/**
 * eFit Login Page Styles v3.0.0
 *
 * WCAG 2.2 AAA Compliant | Bootstrap 5.3.8 | Modern Design
 * Matching Dashboard Theme
 */

/* ============================================================================
   CSS Custom Properties - Matching Dashboard Theme
   ============================================================================ */
:root {
    --primary-600: #0066cc;
    --primary-700: #0052a3;
    --primary-800: #003d7a;
    --success-500: #22c55e;
    --warning-500: #f59e0b;
    --danger-500: #ef4444;
    --neutral-50: #f8fafc;
    --neutral-100: #f1f5f9;
    --neutral-200: #e2e8f0;
    --neutral-300: #cbd5e1;
    --neutral-400: #94a3b8;
    --neutral-500: #64748b;
    --neutral-600: #475569;
    --neutral-700: #334155;
    --neutral-800: #1e293b;
    --neutral-900: #0f172a;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1);
    --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
    --radius-full: 9999px;
}

/* ============================================================================
   Override Dashboard Layout for Login Page
   ============================================================================ */

/* Hide sidebar and topbar on login page */
body.login-page-active .topbar,
body.login-page-active #left-menu,
body.login-page-active .admin-sidebar {
    display: none !important;
}

/* Remove wrapper padding and content-page margin - use #wrapper for specificity */
body.login-page-active #wrapper {
    padding-top: 0 !important;
}

body.login-page-active #wrapper .content-page {
    margin-left: 0 !important;
    margin-top: 0 !important;
}

body.login-page-active #wrapper .content-page .content {
    padding: 0 !important;
    min-height: auto !important;
}

/* ============================================================================
   Login Page Layout
   ============================================================================ */
.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--neutral-100) 0%, var(--neutral-50) 50%, #e0e7ff 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    position: relative;
    overflow: hidden;
}

/* Decorative background elements */
.login-page::before {
    content: '';
    position: absolute;
    top: -20%;
    right: -10%;
    width: 50%;
    height: 70%;
    background: radial-gradient(circle, rgba(0, 102, 204, 0.08) 0%, transparent 70%);
    pointer-events: none;
}

.login-page::after {
    content: '';
    position: absolute;
    bottom: -20%;
    left: -10%;
    width: 50%;
    height: 70%;
    background: radial-gradient(circle, rgba(124, 58, 237, 0.06) 0%, transparent 70%);
    pointer-events: none;
}

/* Skip link for keyboard navigation */
.skip-link {
    position: absolute;
    top: -100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary-600);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-lg);
    text-decoration: none;
    font-weight: 600;
    z-index: 1000;
    transition: top 0.3s ease;
}

.skip-link:focus {
    top: 1rem;
    outline: 3px solid var(--warning-500);
    outline-offset: 2px;
}

/* ============================================================================
   Login Container
   ============================================================================ */
.login-container {
    display: grid;
    grid-template-columns: 1fr 1.3fr;
    max-width: 1100px;
    width: 100%;
    background: white;
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-2xl);
    overflow: hidden;
    position: relative;
    z-index: 1;
}

@media (max-width: 991.98px) {
    .login-container {
        grid-template-columns: 1fr;
        max-width: 520px;
    }
}

/* ============================================================================
   Brand Panel (Left Side)
   ============================================================================ */
.login-brand-panel {
    background: linear-gradient(135deg, var(--primary-600) 0%, var(--primary-800) 100%);
    padding: 3rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.login-brand-panel::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -30%;
    width: 100%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 60%);
    pointer-events: none;
}

@media (max-width: 991.98px) {
    .login-brand-panel {
        padding: 2rem 1.5rem;
    }
}

.brand-logo {
    width: 160px;
    height: auto;
    margin-bottom: 2rem;
    filter: drop-shadow(0 4px 12px rgba(0,0,0,0.2));
    position: relative;
    z-index: 1;
}

@media (max-width: 991.98px) {
    .brand-logo {
        width: 100px;
        margin-bottom: 1rem;
    }
}

.brand-title {
    font-size: 2rem;
    font-weight: 800;
    color: white;
    margin: 0 0 0.75rem 0;
    line-height: 1.2;
    position: relative;
    z-index: 1;
}

@media (max-width: 991.98px) {
    .brand-title {
        font-size: 1.5rem;
    }
}

.brand-tagline {
    font-size: 1.0625rem;
    color: rgba(255,255,255,0.9);
    margin: 0 0 2rem 0;
    line-height: 1.5;
    max-width: 280px;
    position: relative;
    z-index: 1;
}

@media (max-width: 991.98px) {
    .brand-tagline {
        font-size: 0.9375rem;
        margin-bottom: 1.5rem;
    }
}

/* Feature Pills */
.feature-pills {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    position: relative;
    z-index: 1;
}

.feature-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.875rem;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: var(--radius-full);
    font-size: 0.8125rem;
    font-weight: 500;
    color: white;
    backdrop-filter: blur(4px);
}

.feature-pill i {
    font-size: 0.875rem;
}

@media (max-width: 991.98px) {
    .feature-pills {
        display: none;
    }
}

/* ============================================================================
   Form Panel (Right Side)
   ============================================================================ */
.login-form-panel {
    padding: 3rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

@media (max-width: 991.98px) {
    .login-form-panel {
        padding: 2rem 1.5rem;
    }
}

.form-header {
    margin-bottom: 2rem;
    text-align: center;
}

.form-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--neutral-900);
    margin: 0 0 0.5rem 0;
}

.form-header p {
    font-size: 0.9375rem;
    color: var(--neutral-600);
    margin: 0;
}

/* ============================================================================
   Form Styles
   ============================================================================ */
.login-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-group {
    position: relative;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--neutral-700);
    margin-bottom: 0.5rem;
}

.input-wrapper {
    position: relative;
}

.input-wrapper .form-control {
    width: 100%;
    padding: 0.875rem 1rem;
    padding-left: 2.75rem;
    font-size: 1rem;
    color: var(--neutral-900);
    background: var(--neutral-50);
    border: 2px solid var(--neutral-200);
    border-radius: var(--radius-lg);
    transition: all 0.2s ease;
    min-height: 52px;
}

.input-wrapper .form-control:hover {
    border-color: var(--neutral-300);
}

.input-wrapper .form-control:focus {
    outline: none;
    border-color: var(--primary-600);
    background: white;
    box-shadow: 0 0 0 4px rgba(0, 102, 204, 0.1);
}

.input-wrapper .form-control::placeholder {
    color: var(--neutral-400);
}

.input-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.125rem;
    color: var(--neutral-400);
    pointer-events: none;
    transition: color 0.2s ease;
}

.input-wrapper:focus-within .input-icon {
    color: var(--primary-600);
}

/* Password Toggle */
.password-toggle {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    color: var(--neutral-400);
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.password-toggle:hover {
    color: var(--primary-600);
    background: var(--neutral-100);
}

.password-toggle:focus {
    outline: 3px solid var(--primary-600);
    outline-offset: 2px;
}

.password-toggle i {
    font-size: 1.25rem;
}

/* Form Actions Row */
.form-actions-row {
    display: flex;
    justify-content: flex-end;
    margin-top: -0.5rem;
}

.forgot-link {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--primary-600);
    text-decoration: none;
    padding: 0.25rem 0;
    transition: color 0.2s ease;
}

.forgot-link:hover {
    color: var(--primary-700);
    text-decoration: underline;
}

.forgot-link:focus {
    outline: 3px solid var(--primary-600);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* Submit Button */
.btn-login {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
    padding: 1rem 1.5rem;
    font-size: 1rem;
    font-weight: 700;
    color: white;
    background: linear-gradient(135deg, var(--primary-600) 0%, var(--primary-700) 100%);
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 56px;
    margin-top: 0.5rem;
    box-shadow: var(--shadow-md), 0 4px 14px rgba(0, 102, 204, 0.25);
}

.btn-login:hover {
    background: linear-gradient(135deg, var(--primary-700) 0%, var(--primary-800) 100%);
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg), 0 6px 20px rgba(0, 102, 204, 0.3);
}

.btn-login:focus {
    outline: 3px solid var(--primary-600);
    outline-offset: 3px;
}

.btn-login:active {
    transform: translateY(0);
}

.btn-login i {
    font-size: 1.125rem;
}

/* Spinner */
.spinner-border {
    display: inline-block;
    width: 1.25rem;
    height: 1.25rem;
    border: 0.2em solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spinner-border 0.75s linear infinite;
}

@keyframes spinner-border {
    to { transform: rotate(360deg); }
}

.spinner-visible {
    display: inline-block !important;
}

/* Error Messages */
.error-message {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--danger-500);
    font-size: 0.8125rem;
    font-weight: 500;
    margin-top: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: #fef2f2;
    border-radius: var(--radius-md);
    border-left: 3px solid var(--danger-500);
}

/* ============================================================================
   Form Footer
   ============================================================================ */
.form-footer {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--neutral-200);
}

.legal-text {
    font-size: 0.75rem;
    color: var(--neutral-500);
    line-height: 1.6;
    text-align: center;
    margin: 0 0 1.5rem 0;
}

.legal-text a {
    color: var(--primary-600);
    text-decoration: none;
    font-weight: 500;
}

.legal-text a:hover {
    text-decoration: underline;
}

.registration-notice {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem;
    background: var(--neutral-50);
    border-radius: var(--radius-lg);
    text-align: center;
}

.registration-notice i {
    font-size: 1.125rem;
    color: var(--primary-600);
}

.registration-notice p {
    font-size: 0.875rem;
    color: var(--neutral-700);
    margin: 0;
}

/* ============================================================================
   WCAG 2.2 AAA Focus Styles
   ============================================================================ */
:focus-visible {
    outline: 3px solid var(--primary-600);
    outline-offset: 2px;
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .login-container {
        border: 2px solid var(--neutral-900);
    }

    .input-wrapper .form-control {
        border-width: 3px;
    }

    .btn-login {
        border: 2px solid white;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================================================
   Mobile Responsive
   ============================================================================ */
@media (max-width: 991.98px) {
    /* Override dashboard layout for mobile */
    body.login-page-active #wrapper .content-page {
        margin-left: 0 !important;
        margin-top: 0 !important;
    }

    /* Ensure footer is visible */
    body.login-page-active #wrapper .content-page .content {
        display: block !important;
    }

    body.login-page-active .footer {
        position: relative !important;
        padding: 1rem !important;
    }

    .login-page {
        min-height: auto;
        padding: 0;
        padding-bottom: 1rem;
        background: var(--neutral-100);
    }

    .login-container {
        max-width: 100%;
        border-radius: 0;
        box-shadow: none;
    }

    .login-brand-panel {
        padding: 1.5rem 1rem;
    }

    .brand-logo {
        width: 80px;
        margin-bottom: 0.75rem;
    }

    .brand-title {
        font-size: 1.25rem;
        margin-bottom: 0.5rem;
    }

    .brand-tagline {
        font-size: 0.875rem;
        margin-bottom: 0;
        max-width: 100%;
    }

    .login-form-panel {
        padding: 1.5rem;
    }

    .form-header {
        margin-bottom: 1.5rem;
    }

    .form-header h1 {
        font-size: 1.5rem;
    }

    .form-header p {
        font-size: 0.875rem;
    }

    .login-form {
        gap: 1rem;
    }

    .form-footer {
        margin-top: 1.5rem;
        padding-top: 1rem;
    }

    .legal-text {
        font-size: 0.6875rem;
        margin-bottom: 1rem;
    }

    .registration-notice {
        flex-direction: column;
        padding: 0.875rem;
        gap: 0.375rem;
    }

    .registration-notice i {
        font-size: 1rem;
    }

    .registration-notice p {
        font-size: 0.8125rem;
    }
}

@media (max-width: 575.98px) {
    .login-form-panel {
        padding: 1.25rem 1rem;
    }

    .form-header {
        margin-bottom: 1.25rem;
    }

    .form-header h1 {
        font-size: 1.375rem;
    }

    .form-group label {
        font-size: 0.8125rem;
    }

    .input-wrapper .form-control {
        padding: 0.75rem 1rem;
        padding-left: 2.5rem;
        min-height: 48px;
        font-size: 1rem;
    }

    .btn-login {
        min-height: 50px;
        font-size: 0.9375rem;
        padding: 0.875rem 1.25rem;
    }
}
