/* Reset and Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #f4f7f6;
}

/* Split Layout Container */
.auth-container {
    display: flex;
    height: 100vh;
    width: 100%;
}

/* Left Side: Blue Banner */
.auth-banner {
    flex: 1;
    /* Uses a blue gradient overlay. You can add a background-image URL here later! */
    background: linear-gradient(135deg, rgba(13, 110, 253, 0.9) 0%, rgba(11, 85, 204, 0.618) 100%), 
                url('https://images.unsplash.com/photo-1576091160399-112ba8d25d1d?auto=format&fit=crop&q=80');
    background-size: cover;
    background-position: center;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.banner-content {
    max-width: 500px;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 60px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.banner-content h1 {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 20px;
    line-height: 1.2;
}

.banner-content p {
    font-size: 1.1rem;
    line-height: 1.6;
    opacity: 0.9;
}

/* Right Side: Form Section */
.auth-form-section {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: white;
    padding: 40px;
}

.form-wrapper {
    width: 100%;
    max-width: 420px;
}

.form-wrapper h2 {
    font-size: 2rem;
    color: #1a1a1a;
    margin-bottom: 8px;
}

.subtitle {
    color: #666;
    margin-bottom: 30px;
    font-size: 0.95rem;
}

/* Form Controls */
.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
    font-size: 0.9rem;
}

.password-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.password-hint {
    font-size: 0.75rem;
    color: #888;
}

.input-with-icon {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-icon i {
    position: absolute;
    left: 15px;
    color: #888;
}

.input-with-icon i.toggle-password {
    left: auto;
    right: 15px;
    cursor: pointer;
}

.input-with-icon input {
    width: 100%;
    padding: 12px 15px 12px 40px;
    border: 1px solid #dcdcdc;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
    background-color: #fcfcfc;
}

.input-with-icon input:focus {
    outline: none;
    border-color: #0d6efd;
    background-color: #fff;
}

/* Checkbox */
.checkbox-group {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 10px;
}

.checkbox-group input {
    margin-top: 3px;
    cursor: pointer;
}

.checkbox-group label {
    font-weight: normal;
    color: #555;
    font-size: 0.85rem;
    line-height: 1.4;
}

.checkbox-group a {
    color: #0d6efd;
    text-decoration: none;
}

/* Button */
.btn-primary {
    width: 100%;
    padding: 14px;
    background-color: #0d6efd;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s;
    margin-top: 10px;
}

.btn-primary:hover {
    background-color: #0b5ed7;
}

/* Footer */
.auth-footer {
    text-align: center;
    margin-top: 30px;
    font-size: 0.9rem;
    color: #666;
}

.auth-footer a {
    color: #0d6efd;
    text-decoration: none;
    font-weight: 600;
}

/* Responsive: Stack on smaller screens */
@media (max-width: 768px) {
    .auth-container {
        flex-direction: column;
    }
    .auth-banner {
        flex: 0.4;
        padding: 30px 20px;
    }
    .banner-content h1 {
        font-size: 2rem;
    }
    .logo {
        margin-bottom: 20px;
    }
    .auth-form-section {
        flex: 0.6;
        padding: 30px 20px;
        align-items: flex-start;
    }
}

/* Auth header: prevent <- Home from overlapping <h1> on mobile (<992px and <576px) */
@media (max-width: 991.98px) {
    .back-home-btn {
        position: static;
        display: inline-flex;
        margin-bottom: 16px;
        align-self: flex-start;
    }
    .auth-form-section {
        flex-direction: column;
        align-items: flex-start;
        gap: 0;
    }
    .form-wrapper {
        width: 100%;
    }
    .form-wrapper h2 {
        margin-top: 4px;
    }
}

@media (max-width: 575.98px) {
    .back-home-btn {
        margin-bottom: 12px;
        font-size: 0.85rem;
    }
    .auth-form-section {
        padding: 24px 16px;
    }
}

/* Custom Error Alert Box — solid side-notification style (no border-left accent) */
.error-alert {
    display: flex;
    align-items: center;
    background-color: #991b1b; /* Solid red for errors */
    border: 1px solid #991b1b;
    color: #ffffff;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: 0 2px 4px rgba(153, 27, 27, 0.25);
}

.error-alert i {
    font-size: 1.1rem;
    margin-right: 12px;
    color: #ffffff;
}

/* Success Alert Box — solid side-notification style (no border-left accent) */
.success-alert {
    display: flex;
    align-items: center;
    background-color: #065f46; 
    border: 1px solid #065f46;
    color: #ffffff;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: 0 2px 4px rgba(6, 95, 70, 0.25);
}

.success-alert i {
    font-size: 1.1rem;
    margin-right: 12px;
    color: #ffffff;
}

/* Secondary Button (Disabled State by default) */
.btn-secondary {
    width: 100%;
    padding: 14px;
    background-color: #f3f4f6;
    color: #9ca3af; /* Grayed out text */
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: not-allowed; /* Shows a 'no' circle cursor when hovered */
    transition: all 0.3s;
}

/* Secondary Button (Active State when timer hits 0) */
.btn-secondary.active {
    background-color: white;
    color: #0d6efd;
    border: 1px solid #0d6efd;
    cursor: pointer;
}

.btn-secondary.active:hover {
    background-color: #f8faff;
}

/* Forgot Password Link */
.forgot-password {
    text-align: left; /* Change to 'right' if you want it aligned to the other side */
    margin-top: -10px;
    margin-bottom: 25px;
}

.forgot-password a {
    color: #666;
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    transition: color 0.3s;
}

.forgot-password a:hover {
    color: #0d6efd;
    text-decoration: underline;
}

/* --- PAGE TRANSITION ANIMATIONS --- */

/* 1. Define the fade-in from slightly below */
@keyframes fadeIn {
    from { 
        opacity: 0; 
        transform: translateY(15px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

/* 2. Define the fade-out moving slightly up */
@keyframes fadeOut {
    from { 
        opacity: 1; 
        transform: translateY(0); 
    }
    to { 
        opacity: 0; 
        transform: translateY(-15px); 
    }
}

/* 3. Apply the fade-in automatically to the main container */
.auth-container {
    display: flex;
    height: 100vh;
    width: 100%;
    /* This makes it fade in whenever ANY auth page is accessed */
    animation: fadeIn 0.4s ease-out forwards; 
}

/* 4. This class will be added by JavaScript right before leaving the page */
.auth-container.page-exit {
    animation: fadeOut 0.3s ease-in forwards;
}

/* --- GLOBAL FULL-SCREEN LOADER --- */
.global-loader {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(255, 255, 255, 0.95);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.global-loader.active {
    opacity: 1;
    pointer-events: all;
}

.global-loader {
    position: fixed;
    inset: 0;
    background: rgba(255,255,255,0.95);
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    z-index: 9999;
}

.global-loader.active {
    display: flex;
}

/* Custom smooth spinning animation */
@keyframes customSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loader-spinner {
    font-size: 3rem;
    color: #0d6efd;
    margin-bottom: 15px;
    display: inline-block; /* REQUIRED: You cannot spin a standard inline text element! */
    animation: customSpin 1s linear infinite !important; /* Force the spin */
}

.loader-text {
    font-size: 1.2rem;
    font-weight: 600;
    color: #333;
}

/* --- POPUP MODAL (For Redirect Notices) --- */
.popup-overlay {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    backdrop-filter: blur(3px);
}

.popup-overlay.active { 
    opacity: 1; 
    pointer-events: all; 
}

.popup-box {
    background: white; 
    padding: 30px; 
    border-radius: 12px;
    text-align: center; 
    max-width: 400px;
    width: 90%;
    transform: translateY(20px) scale(0.95); 
    transition: all 0.3s ease-out;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

.popup-overlay.active .popup-box { 
    transform: translateY(0) scale(1); 
}

/* --- BACK TO HOME BUTTON & LOGO LINK --- */

/* 1. Make sure the form section can hold absolute positioned items */
.auth-form-section {
    position: relative; 
}

/* 2. Floating Back Button Styling */
.back-home-btn {
    position: absolute;
    top: 30px;
    left: 40px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #6b7280;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.3s ease;
    z-index: 10;
}

.back-home-btn:hover {
    color: #0d6efd; /* GabayRN Blue */
}

/* 3. Make the Logo a clickable link without changing its look */
a.logo {
    text-decoration: none;
    color: white; /* Assuming it's on the blue banner */
    transition: opacity 0.3s ease;
    cursor: pointer;
}

a.logo:hover {
    opacity: 0.85;
}