/* Authentication Pages Styles - Fresh Modern Design */

body {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    height: 100vh;
    width: 100vw;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    position: relative;
    overflow: hidden;
    margin: 0;
    padding: 0;
}

/* Main auth container - Full screen two column layout */
.auth-container {
    display: flex;
    width: 100vw;
    height: 100vh;
    background: white;
    overflow: hidden;
}

/* Image section - 55-60% width */
.auth-image-section {
    flex: 0 0 58%;
    position: relative;
    overflow: hidden;
}

.auth-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Form section - 40-45% width */
.auth-form-section {
    flex: 0 0 42%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem 3rem;
    background: white;
}

/* Hide old layout elements */
.auth-hero-bleed,
.auth-panel {
    display: none !important;
}

.auth-card {
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
    animation: slideUp 0.6s ease-out;
    border: none;
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 480px;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.auth-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 2rem;
}

.auth-logo img {
    width: 40px;
    height: 40px;
}

.auth-logo h1 {
    color: #667eea;
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
}

.logo-text {
    width: 48px;
    height: 48px;
    background: #667eea;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 1.25rem;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    flex-shrink: 0;
}

.auth-header h2 {
    color: #1a202c;
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.auth-header p {
    color: #6b7280;
    font-size: 1rem;
    margin: 0;
    font-weight: 400;
}

/* Form Styles */
.auth-form {
    margin-bottom: 2rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

.form-group {
    margin-bottom: 2rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #1a202c;
    font-weight: 600;
    font-size: 0.9rem;
}

.form-group input {
    width: 100%;
    padding: 16px 20px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 1rem;
    line-height: 1.5;
    transition: all 0.3s ease;
    background: white;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
    background: #fafbff;
}

.form-group input:invalid:not(:focus):not([data-pristine]) {
    border-color: #e53e3e;
}

.form-group input:valid:not(:focus):not(:placeholder-shown) {
    border-color: #38a169;
}

/* Password Strength Indicator */
.password-strength {
    margin-top: 0.5rem;
}

.strength-bar {
    height: 4px;
    background: #e2e8f0;
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 0.25rem;
}

.strength-fill {
    height: 100%;
    width: 0%;
    transition: all 0.3s ease;
    border-radius: 2px;
}

.strength-fill.weak {
    width: 25%;
    background: #e53e3e;
}

.strength-fill.medium {
    width: 50%;
    background: #ed8936;
}

.strength-fill.strong {
    width: 75%;
    background: #38a169;
}

.strength-fill.very-strong {
    width: 100%;
    background: #2d3748;
}

.strength-text {
    font-size: 0.8rem;
    color: #666;
}

/* Form Options */
.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 0.9rem;
    color: #666;
}

.checkbox-label input[type="checkbox"] {
    opacity: 0;
    position: absolute;
    width: 0;
    height: 0;
}

.checkmark {
    width: 18px;
    height: 18px;
    border: 2px solid #e2e8f0;
    border-radius: 4px;
    margin-right: 0.5rem;
    position: relative;
    transition: all 0.3s ease;
}

.checkbox-label:hover .checkmark {
    border-color: #667eea;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark {
    background: #667eea;
    border-color: #667eea;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 2px;
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox-group {
    margin-bottom: 1rem;
}

.checkbox-group .checkbox-label {
    align-items: flex-start;
    line-height: 1.4;
}

.checkbox-group .checkmark {
    margin-top: 2px;
    flex-shrink: 0;
}

.forgot-link {
    color: #667eea;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.3s ease;
}

.forgot-link:hover {
    color: #5a67d8;
    text-decoration: underline;
}

/* Button Styles */
.btn {
    display: inline-block;
    padding: 16px 32px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.3s ease;
    text-decoration: none;
    cursor: pointer;
    border: none;
    text-align: center;
    line-height: 1.5;
}

.btn-primary {
    background: #667eea;
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover {
    background: #5a67d8;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-full {
    width: 100%;
    margin-bottom: 1.5rem;
}

.btn-google {
    background: white;
    border: 2px solid #e2e8f0;
    color: #1a202c;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 600;
    transition: all 0.3s ease;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.btn-google:hover {
    border-color: #667eea;
    background: #fafbff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.btn-google img {
    width: 20px;
    height: 20px;
}

/* Divider */
.divider {
    text-align: center;
    margin: 2rem 0;
    position: relative;
}

.divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #e2e8f0;
}

.divider span {
    background: white;
    color: #6b7280;
    padding: 0 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    position: relative;
}

/* Footer */
.auth-footer {
    text-align: center;
    margin-top: 2rem;
}

.auth-footer p {
    color: #6b7280;
    margin-bottom: 1rem;
    font-weight: 400;
}

.auth-footer a {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

.auth-footer a:hover {
    color: #5a67d8;
    text-decoration: underline;
}

.back-home {
    color: #6b7280 !important;
    font-size: 0.9rem;
    text-decoration: none;
    transition: color 0.3s ease;
    font-weight: 500;
    display: inline-block;
    margin-top: 0.5rem;
}

.back-home:hover {
    color: #667eea !important;
}

/* Loading State */
.btn.loading {
    position: relative;
    color: transparent;
}

.btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Error Messages */
.error-message {
    background: #fed7d7;
    color: #c53030;
    padding: 0.75rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    border: 1px solid #feb2b2;
}

.success-message {
    background: #c6f6d5;
    color: #2f855a;
    padding: 0.75rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    border: 1px solid #9ae6b4;
}

/* Responsive Design */
@media (max-width: 768px) {
    /* Mobile: Stack vertically with full viewport */
    .auth-container {
        flex-direction: column;
        width: 100vw;
        height: 100vh;
    }

    .auth-image-section {
        flex: 0 0 38%;
        min-height: 38vh;
    }

    .auth-form-section {
        flex: 1;
        padding: 2.5rem 2rem;
        min-height: 62vh;
    }
    
    /* Make card spacious and immersive */
    .auth-card {
        width: 100%;
        max-width: 100%;
        margin: 0 auto;
    }

    .auth-form-section {
        padding: 3rem 2rem;
    }

    /* Stack form rows into single column */
    .form-row {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .form-options {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .auth-header h2 {
        font-size: 1.5rem;
        margin-bottom: 0.5rem;
    }
    
    /* Hide decorative background stripe / gradient on small screens */
    body::before {
        display: none;
    }

    /* Reduce logo size */
    .auth-logo h1 {
        font-size: 1.25rem;
    }
    .auth-logo .logo-text {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }

    /* Tighter form spacing for mobile */
    .form-group {
        margin-bottom: 0.9rem;
    }

    .form-group input {
        padding: 12px 14px;
        font-size: 1rem;
        border-radius: 10px;
    }

    .btn {
        padding: 12px 16px;
        border-radius: 10px;
        font-size: 1rem;
    }

    .btn-full {
        padding: 12px 14px;
    }

    /* Stack secondary actions under primary on very small screens */
    .auth-footer, .form-options {
        width: 100%;
    }

    /* Ensure body background is simple */
    body {
        background: #f8fafc;
    }
    
    /* Mobile-only auth - Reference design (loginpage.mobile.html) */
    .auth-layout { display: none !important; }
    /* Prevent body from centering - align auth-mobile to top so Welcome Back is visible */
    body {
        align-items: flex-start !important;
        justify-content: flex-start !important;
    }
    .auth-mobile {
        display: flex !important;
        flex-direction: column;
        width: 100vw;
        min-height: 100vh;
        max-height: 100vh;
        overflow: hidden;
        background: #F8FAFC;
        font-family: system-ui, -apple-system, sans-serif;
    }
    /* Hide header and footer on mobile login */
    .auth-mobile-header,
    .auth-mobile-footer {
        display: none !important;
    }
    /* Header */
    .auth-mobile-header {
        width: 100%;
        background: #fff;
        border-bottom: 1px solid #e2e8f0;
        position: sticky;
        top: 0;
        z-index: 50;
        padding: 0 1rem;
        height: 64px;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }
    .auth-mobile-logo {
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }
    .auth-mobile-logo-icon {
        width: 32px;
        height: 32px;
        background: #2563EB;
        border-radius: 8px;
        display: flex;
        align-items: center;
        justify-content: center;
        color: #fff;
        font-size: 0.875rem;
    }
    .auth-mobile-logo-text {
        font-size: 1.25rem;
        font-weight: 700;
        color: #1E293B;
        letter-spacing: -0.02em;
    }
    .auth-mobile-help {
        font-size: 0.875rem;
        font-weight: 500;
        color: #2563EB;
        text-decoration: none;
    }
    .auth-mobile-help:hover { text-decoration: underline; }
    /* Main - scrollable when content overflows */
    .auth-mobile-main {
        flex: 1 1 0;
        min-height: 0;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: flex-start;
        padding: 1.5rem 1rem 2rem;
        overflow-y: auto !important;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-y: contain;
    }
    .auth-mobile-card {
        width: 100%;
        max-width: 28rem;
        background: #fff;
        border-radius: 1rem;
        box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.08);
        padding: 2rem;
        border: 1px solid #f1f5f9;
        flex-shrink: 0;
    }
    .auth-mobile .mobile-header {
        text-align: center;
        margin-bottom: 2rem;
    }
    .auth-mobile .auth-mobile-logo-img {
        display: block;
        margin: 0 auto 1rem auto;
        max-width: 200px;
        width: 200px;
        height: auto;
    }
    .auth-mobile .mobile-header h1 {
        font-size: 1.5rem;
        font-weight: 800;
        color: #1E293B;
        margin: 0 0 0.5rem 0;
        letter-spacing: -0.02em;
    }
    .auth-mobile .mobile-header p {
        color: #475569;
        font-size: 1rem;
        margin: 0;
    }
    .auth-mobile .mobile-form .form-group {
        margin-bottom: 1.25rem;
    }
    .auth-mobile .mobile-form .form-group label {
        display: block;
        font-size: 0.875rem;
        font-weight: 600;
        color: #1E293B;
        margin-bottom: 0.375rem;
    }
    .form-group-label-row {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 0.375rem;
    }
    .form-group-label-row label { margin-bottom: 0; }
    .form-group-label-row .forgot-link {
        font-size: 0.75rem;
        font-weight: 600;
        color: #2563EB;
    }
    .input-with-icon {
        position: relative;
    }
    .input-with-icon .input-icon {
        position: absolute;
        left: 0.75rem;
        top: 50%;
        transform: translateY(-50%);
        color: #94a3b8;
        font-size: 0.875rem;
        pointer-events: none;
    }
    .input-with-icon .password-toggle {
        position: absolute;
        right: 0.75rem;
        top: 50%;
        transform: translateY(-50%);
        background: none;
        border: none;
        color: #94a3b8;
        cursor: pointer;
        padding: 0.25rem;
    }
    .input-with-icon .password-toggle:hover { color: #2563EB; }
    .auth-mobile .mobile-form .form-group input {
        width: 100%;
        padding: 0.75rem 1rem 0.75rem 2.5rem;
        border: 1px solid #e2e8f0;
        border-radius: 0.75rem;
        font-size: 1rem;
        background: #f8fafc;
        transition: all 0.2s;
    }
    .auth-mobile .mobile-form .form-group input[type="password"] {
        padding-right: 2.75rem;
    }
    .auth-mobile .mobile-form .form-group input:focus {
        outline: 2px solid #2563EB;
        outline-offset: 2px;
        border-color: transparent;
        background: #fff;
    }
    .auth-mobile .checkbox-row { margin-bottom: 1.25rem; }
    .auth-mobile .checkbox-row .checkbox-label {
        display: flex;
        align-items: center;
        font-size: 0.875rem;
        color: #475569;
        cursor: pointer;
    }
    .auth-mobile .checkbox-row .checkmark {
        width: 16px;
        height: 16px;
        border: 1px solid #cbd5e1;
        border-radius: 4px;
        margin-right: 0.5rem;
    }
    .auth-mobile .checkbox-row input:checked + .checkmark {
        background: #2563EB;
        border-color: #2563EB;
    }
    .auth-mobile .mobile-form .btn-primary {
        width: 100%;
        padding: 0.875rem 1rem;
        background: #2563EB;
        color: #fff;
        font-weight: 700;
        border-radius: 0.75rem;
        border: none;
        font-size: 1rem;
        margin-bottom: 0;
        box-shadow: 0 10px 15px -3px rgba(37, 99, 235, 0.2);
    }
    .auth-mobile .mobile-form .btn-primary:hover {
        background: #1d4ed8;
    }
    .auth-mobile .mobile-divider {
        margin: 2rem 0;
        position: relative;
        text-align: center;
    }
    .auth-mobile .mobile-divider::before {
        content: '';
        position: absolute;
        top: 50%;
        left: 0;
        right: 0;
        height: 1px;
        background: #e2e8f0;
    }
    .auth-mobile .mobile-divider span {
        position: relative;
        background: #fff;
        padding: 0 0.75rem;
        font-size: 0.75rem;
        font-weight: 500;
        color: #94a3b8;
        text-transform: uppercase;
    }
    .auth-mobile .social-buttons {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
    }
    .auth-mobile .btn-google,
    .auth-mobile .btn-social {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
        padding: 0.625rem 1rem;
        border: 1px solid #e2e8f0;
        border-radius: 0.75rem;
        background: #fff;
        color: #1E293B;
        font-weight: 600;
        font-size: 0.875rem;
        cursor: pointer;
    }
    .auth-mobile .btn-google:hover,
    .auth-mobile .btn-social:hover {
        background: #f8fafc;
    }
    .auth-mobile .btn-google .google-icon {
        width: 16px;
        height: 16px;
    }
    .auth-mobile .auth-footer {
        text-align: center;
        margin-top: 2rem;
    }
    .auth-mobile .auth-footer p {
        color: #475569;
        font-size: 0.875rem;
        margin: 0;
    }
    .auth-mobile .auth-footer a {
        color: #2563EB;
        font-weight: 700;
        text-decoration: none;
    }
    .auth-mobile .auth-footer a:hover { text-decoration: underline; }
    /* Trust badges */
    .auth-mobile-trust {
        margin-top: 3rem;
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 2rem;
        opacity: 0.6;
    }
    .auth-mobile-trust .trust-badge {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        font-size: 0.75rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.1em;
        color: #475569;
    }
    .auth-mobile-trust .trust-badge i {
        color: #10B981;
    }
    .auth-mobile-trust .trust-badge:nth-child(2) i { color: #2563EB; }
    .auth-mobile-trust .trust-badge:nth-child(3) i { color: #6366F1; }
    /* Footer */
    .auth-mobile-footer {
        width: 100%;
        border-top: 1px solid #e2e8f0;
        background: #fff;
        padding: 2rem 1rem;
    }
    .auth-mobile-footer-logo {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        margin-bottom: 1rem;
    }
    .auth-mobile-logo-icon-sm {
        width: 24px;
        height: 24px;
        background: #2563EB;
        border-radius: 4px;
        display: flex;
        align-items: center;
        justify-content: center;
        color: #fff;
        font-size: 0.625rem;
    }
    .auth-mobile-footer-logo span {
        font-size: 0.875rem;
        font-weight: 700;
        color: #1E293B;
    }
    .auth-mobile-footer-logo .footer-copy {
        font-weight: 400;
        color: #475569;
        margin-left: 0.5rem;
    }
    .auth-mobile-footer-links {
        display: flex;
        gap: 1.5rem;
        font-size: 0.75rem;
        font-weight: 600;
    }
    .auth-mobile-footer-links a {
        color: #475569;
        text-decoration: none;
    }
    .auth-mobile-footer-links a:hover { color: #2563EB; }

    /* Ensure original desktop auth-page hidden */
    .auth-page.auth-layout { display: none !important; }
}

/* Hide mobile auth form on desktop */
@media (min-width: 769px) {
    .auth-mobile {
        display: none !important;
    }
}
