/* ===== Theme Variables for Login Page ===== */
:root, [data-theme="ember"] {
    --login-panel-bg: linear-gradient(160deg, #9a3412 0%, #c2410c 30%, #F37021 65%, #f59343 100%);
    --login-page-bg: linear-gradient(180deg, #fffaf6 0%, #fff3e8 100%);
    --login-body-bg: #fffaf6;
    --login-accent: #F37021;
    --login-accent-dark: #c2410c;
    --login-accent-light: #f59343;
    --login-heading: #7c2d12;
    --login-btn-gradient: linear-gradient(135deg, #F37021 0%, #f59343 40%, #f9b070 70%, #2d2d2d 100%);
    --login-btn-shadow: rgba(243, 112, 33, 0.25);
    --login-focus-ring: rgba(243, 112, 33, 0.12);
    --login-mobile-brand: #F37021;
    --login-feature-icon: #2d2d2d;
    --login-subtitle: #525252;
    --login-divider: linear-gradient(90deg, #F37021, #f59343);
    --login-checkbox-bg: #F37021;
}
[data-theme="sand"] {
    --login-panel-bg: linear-gradient(160deg, #57534e 0%, #78716c 30%, #92400e 65%, #d97706 100%);
    --login-page-bg: linear-gradient(180deg, #fafaf9 0%, #f5f5f4 100%);
    --login-body-bg: #fafaf9;
    --login-accent: #d97706;
    --login-accent-dark: #b45309;
    --login-accent-light: #f59e0b;
    --login-heading: #44403c;
    --login-btn-gradient: linear-gradient(135deg, #d97706 0%, #f59e0b 40%, #fbbf24 70%, #78716c 100%);
    --login-btn-shadow: rgba(217, 119, 6, 0.25);
    --login-focus-ring: rgba(217, 119, 6, 0.12);
    --login-mobile-brand: #d97706;
    --login-feature-icon: #78716c;
    --login-subtitle: #a8a29e;
    --login-divider: linear-gradient(90deg, #d97706, #fbbf24);
    --login-checkbox-bg: #f59e0b;
}
[data-theme="cloud"] {
    --login-panel-bg: linear-gradient(160deg, #1e3a5f 0%, #1e4d8c 30%, #2563eb 65%, #3b82f6 100%);
    --login-page-bg: linear-gradient(180deg, #f8fafe 0%, #eff6ff 100%);
    --login-body-bg: #f8fafe;
    --login-accent: #3b82f6;
    --login-accent-dark: #2563eb;
    --login-accent-light: #60a5fa;
    --login-heading: #1e3a5f;
    --login-btn-gradient: linear-gradient(135deg, #3b82f6 0%, #60a5fa 40%, #93c5fd 70%, #14b8a6 100%);
    --login-btn-shadow: rgba(59, 130, 246, 0.30);
    --login-focus-ring: rgba(59, 130, 246, 0.12);
    --login-mobile-brand: #3b82f6;
    --login-feature-icon: #14b8a6;
    --login-subtitle: #14b8a6;
    --login-divider: linear-gradient(90deg, #14b8a6, #2dd4bf);
    --login-checkbox-bg: #60a5fa;
}
[data-theme="dusk"] {
    --login-panel-bg: linear-gradient(160deg, #1e1b4b 0%, #312e81 30%, #3730a3 65%, #4f46e5 100%);
    --login-page-bg: linear-gradient(180deg, #f8f9fb 0%, #eef2ff 100%);
    --login-body-bg: #f8f9fb;
    --login-accent: #4f46e5;
    --login-accent-dark: #3730a3;
    --login-accent-light: #6366f1;
    --login-heading: #1e1b4b;
    --login-btn-gradient: linear-gradient(135deg, #4f46e5 0%, #6366f1 40%, #818cf8 70%, #8b5cf6 100%);
    --login-btn-shadow: rgba(79, 70, 229, 0.30);
    --login-focus-ring: rgba(79, 70, 229, 0.12);
    --login-mobile-brand: #4f46e5;
    --login-feature-icon: #8b5cf6;
    --login-subtitle: #8b5cf6;
    --login-divider: linear-gradient(90deg, #8b5cf6, #a78bfa);
    --login-checkbox-bg: #6366f1;
}
[data-theme="violet"] {
    --login-panel-bg: linear-gradient(160deg, #4c1d95 0%, #5b21b6 30%, #7c3aed 65%, #8b5cf6 100%);
    --login-page-bg: linear-gradient(180deg, #faf5ff 0%, #f3e8ff 100%);
    --login-body-bg: #faf5ff;
    --login-accent: #7C3AED;
    --login-accent-dark: #6D28D9;
    --login-accent-light: #8B5CF6;
    --login-heading: #4c1d95;
    --login-btn-gradient: linear-gradient(135deg, #7C3AED 0%, #8B5CF6 40%, #A78BFA 70%, #E879F9 100%);
    --login-btn-shadow: rgba(139, 92, 246, 0.35);
    --login-focus-ring: rgba(139, 92, 246, 0.12);
    --login-mobile-brand: #7C3AED;
    --login-feature-icon: #E879F9;
    --login-subtitle: #E879F9;
    --login-divider: linear-gradient(90deg, #E879F9, #F0ABFC);
    --login-checkbox-bg: #8B5CF6;
}
[data-theme="ocean"] {
    --login-panel-bg: linear-gradient(160deg, #0c4a6e 0%, #075985 30%, #0284c7 65%, #0ea5e9 100%);
    --login-page-bg: linear-gradient(180deg, #f0f9ff 0%, #e0f2fe 100%);
    --login-body-bg: #f0f9ff;
    --login-accent: #0284c7;
    --login-accent-dark: #0369a1;
    --login-accent-light: #0ea5e9;
    --login-heading: #0c4a6e;
    --login-btn-gradient: linear-gradient(135deg, #0284c7 0%, #0ea5e9 40%, #38bdf8 70%, #06b6d4 100%);
    --login-btn-shadow: rgba(2, 132, 199, 0.35);
    --login-focus-ring: rgba(2, 132, 199, 0.12);
    --login-mobile-brand: #0284c7;
    --login-feature-icon: #06b6d4;
    --login-subtitle: #06b6d4;
    --login-divider: linear-gradient(90deg, #06b6d4, #22d3ee);
    --login-checkbox-bg: #0ea5e9;
}
[data-theme="forest"] {
    --login-panel-bg: linear-gradient(160deg, #14532d 0%, #166534 30%, #16a34a 65%, #22c55e 100%);
    --login-page-bg: linear-gradient(180deg, #f0fdf4 0%, #dcfce7 100%);
    --login-body-bg: #f0fdf4;
    --login-accent: #16a34a;
    --login-accent-dark: #15803d;
    --login-accent-light: #22c55e;
    --login-heading: #14532d;
    --login-btn-gradient: linear-gradient(135deg, #16a34a 0%, #22c55e 40%, #4ade80 70%, #10b981 100%);
    --login-btn-shadow: rgba(22, 163, 74, 0.35);
    --login-focus-ring: rgba(22, 163, 74, 0.12);
    --login-mobile-brand: #16a34a;
    --login-feature-icon: #10b981;
    --login-subtitle: #10b981;
    --login-divider: linear-gradient(90deg, #10b981, #34d399);
    --login-checkbox-bg: #22c55e;
}
[data-theme="slate"] {
    --login-panel-bg: linear-gradient(160deg, #1e293b 0%, #334155 30%, #475569 65%, #64748b 100%);
    --login-page-bg: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    --login-body-bg: #f8fafc;
    --login-accent: #475569;
    --login-accent-dark: #334155;
    --login-accent-light: #64748b;
    --login-heading: #1e293b;
    --login-btn-gradient: linear-gradient(135deg, #475569 0%, #64748b 40%, #94a3b8 70%, #6366f1 100%);
    --login-btn-shadow: rgba(71, 85, 105, 0.35);
    --login-focus-ring: rgba(71, 85, 105, 0.12);
    --login-mobile-brand: #475569;
    --login-feature-icon: #6366f1;
    --login-subtitle: #6366f1;
    --login-divider: linear-gradient(90deg, #6366f1, #818cf8);
    --login-checkbox-bg: #64748b;
}
[data-theme="rose"] {
    --login-panel-bg: linear-gradient(160deg, #881337 0%, #9f1239 30%, #e11d48 65%, #f43f5e 100%);
    --login-page-bg: linear-gradient(180deg, #fff1f2 0%, #ffe4e6 100%);
    --login-body-bg: #fff1f2;
    --login-accent: #e11d48;
    --login-accent-dark: #be123c;
    --login-accent-light: #f43f5e;
    --login-heading: #881337;
    --login-btn-gradient: linear-gradient(135deg, #e11d48 0%, #f43f5e 40%, #fb7185 70%, #ec4899 100%);
    --login-btn-shadow: rgba(225, 29, 72, 0.35);
    --login-focus-ring: rgba(225, 29, 72, 0.12);
    --login-mobile-brand: #e11d48;
    --login-feature-icon: #ec4899;
    --login-subtitle: #ec4899;
    --login-divider: linear-gradient(90deg, #ec4899, #f472b6);
    --login-checkbox-bg: #f43f5e;
}
[data-theme="midnight"] {
    --login-panel-bg: linear-gradient(160deg, #0f0e1a 0%, #1a1830 30%, #1e1b4b 65%, #312e81 100%);
    --login-page-bg: linear-gradient(180deg, #111019 0%, #1a1825 100%);
    --login-body-bg: #111019;
    --login-accent: #6366f1;
    --login-accent-dark: #4f46e5;
    --login-accent-light: #818cf8;
    --login-heading: #f1f5f9;
    --login-btn-gradient: linear-gradient(135deg, #6366f1 0%, #818cf8 40%, #a5b4fc 70%, #a78bfa 100%);
    --login-btn-shadow: rgba(99, 102, 241, 0.35);
    --login-focus-ring: rgba(99, 102, 241, 0.20);
    --login-mobile-brand: #818cf8;
    --login-feature-icon: #a78bfa;
    --login-subtitle: #a78bfa;
    --login-divider: linear-gradient(90deg, #a78bfa, #c4b5fd);
    --login-checkbox-bg: #6366f1;
}
[data-theme="frost"] {
    --login-panel-bg: linear-gradient(160deg, #4f46e5 0%, #6366f1 30%, #818cf8 65%, #a5b4fc 100%);
    --login-page-bg: linear-gradient(180deg, #fcfcff 0%, #f5f7ff 100%);
    --login-body-bg: #fcfcff;
    --login-accent: #818cf8;
    --login-accent-dark: #6366f1;
    --login-accent-light: #a5b4fc;
    --login-heading: #334155;
    --login-btn-gradient: linear-gradient(135deg, #818cf8 0%, #a5b4fc 40%, #c7d2fe 70%, #a78bfa 100%);
    --login-btn-shadow: rgba(129, 140, 248, 0.25);
    --login-focus-ring: rgba(129, 140, 248, 0.10);
    --login-mobile-brand: #818cf8;
    --login-feature-icon: #a78bfa;
    --login-subtitle: #a78bfa;
    --login-divider: linear-gradient(90deg, #a78bfa, #c4b5fd);
    --login-checkbox-bg: #a5b4fc;
}
[data-theme="pearl"] {
    --login-panel-bg: linear-gradient(160deg, #1b4332 0%, #2d6a4f 30%, #40916c 65%, #52b788 100%);
    --login-page-bg: linear-gradient(180deg, #fafcfb 0%, #f4faf6 100%);
    --login-body-bg: #fafcfb;
    --login-accent: #52b788;
    --login-accent-dark: #40916c;
    --login-accent-light: #74c69d;
    --login-heading: #1b4332;
    --login-btn-gradient: linear-gradient(135deg, #52b788 0%, #74c69d 40%, #95d5b2 70%, #40916c 100%);
    --login-btn-shadow: rgba(82, 183, 136, 0.25);
    --login-focus-ring: rgba(82, 183, 136, 0.10);
    --login-mobile-brand: #52b788;
    --login-feature-icon: #40916c;
    --login-subtitle: #40916c;
    --login-divider: linear-gradient(90deg, #40916c, #74c69d);
    --login-checkbox-bg: #74c69d;
}

/* ===== Reset & Base ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--login-body-bg);
    color: #1e1b4b;
    -webkit-font-smoothing: antialiased;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh; /* accounts for mobile browser chrome (address bar) */
}

/* ===== Layout ===== */
.login-container {
    display: flex;
    flex: 1;               /* stretch to fill body */
    min-height: 100vh;
    min-height: 100dvh;
}

/* ===== Left Panel - Branding ===== */
.left-panel {
    flex: 0 0 480px;
    background: var(--login-panel-bg);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 60px 50px;
    position: relative;
    overflow: hidden;
}


/* Decorative circles */
.left-panel::before {
    content: '';
    position: absolute;
    top: -100px;
    right: -80px;
    width: 360px;
    height: 360px;
    background: radial-gradient(circle, rgba(232,121,249,0.18) 0%, transparent 70%);
    border-radius: 50%;
}

.left-panel::after {
    content: '';
    position: absolute;
    bottom: -60px;
    left: -60px;
    width: 280px;
    height: 280px;
    background: radial-gradient(circle, rgba(167,139,250,0.15) 0%, transparent 70%);
    border-radius: 50%;
}

.brand-content {
    position: relative;
    z-index: 1;
    text-align: center;
}

/* Logo */
.logo-wrapper {
    margin-bottom: 24px;
    display: flex;
    justify-content: center;
    width: 260px;
    height: 110px;
    margin-left: auto;
    margin-right: auto;
    animation: logoFloat 4s ease-in-out infinite;
}

.logo-card {
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px 20px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.18);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.company-logo {
    width: 75px;
    height: 75px;
    object-fit: contain;
    display: block;
}

.fallback-logo {
    width: 80px;
    height: 80px;
    display: none;
    align-items: center;
    justify-content: center;
}

@keyframes logoFloat {
    0%, 150% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
}

.brand-title {
    font-size: 27px;
    font-weight: 800;
    color: #fff;
    letter-spacing: 1px;
    margin-bottom: 4px;
}

.brand-subtitle {
    font-size: 15px;
    font-weight: 600;
    color: var(--login-subtitle);
    letter-spacing: 3px;
    text-transform: uppercase;
    margin-bottom: 28px;
}

.brand-divider {
    width: 50px;
    height: 3px;
    background: var(--login-divider);
    border-radius: 2px;
    margin: 0 auto 24px;
}

.brand-description {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.65);
    line-height: 1.75;
    max-width: 340px;
    margin: 0 auto 40px;
}

/* Feature Items */
.brand-features {
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: flex-start;
    max-width: 280px;
    margin: 0 auto;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 14px;
    color: rgba(255, 255, 255, 0.85);
    font-size: 14px;
    font-weight: 500;
    padding: 8px 12px;
    border-radius: 10px;
    width: 100%;
    transition: all 0.25s ease;
}

.feature-item:hover {
    background: rgba(255, 255, 255, 0.07);
    transform: translateX(4px);
}

.feature-icon {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    color: var(--login-subtitle);
}

.left-panel-footer {
    position: absolute;
    bottom: 28px;
    left: 0;
    right: 0;
    text-align: center;
    color: rgba(255, 255, 255, 0.3);
    font-size: 12px;
    z-index: 1;
}

.left-panel-footer .login-copyright {
    color: #ffffff !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    text-align: center;
    letter-spacing: 0.5px;
    margin: 0 !important;
    text-shadow: 0 2px 12px rgba(232, 121, 249, 0.35), 0 0 20px rgba(167, 139, 250, 0.25), 0 1px 3px rgba(0, 0, 0, 0.2);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 240, 255, 0.9) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 2px 8px rgba(124, 58, 237, 0.3));
}

/* ===== Right Panel - Form ===== */
.right-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 40px;
    background: var(--login-page-bg);
    min-height: 100vh; /* ensures centering even when left panel is hidden on mobile */
}

.login-form-wrapper {
    width: 100%;
    max-width: 420px;
}

/* Mobile Logo (hidden on desktop) */
.mobile-logo {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 32px;
}

.mobile-logo-img {
    width: 42px;
    height: 42px;
    object-fit: contain;
}

.m-fallback-logo {
    width: 42px;
    height: 42px;
    display: flex;
}

.mobile-brand {
    font-size: 22px;
    font-weight: 700;
    color: var(--login-accent);
    letter-spacing: 1px;
}

/* Form Header */
.form-header {
    margin-bottom: 32px;
}

.form-header h2 {
    font-size: 28px;
    font-weight: 800;
    color: var(--login-heading);
    margin-bottom: 8px;
    letter-spacing: -0.3px;
}

.form-header p {
    font-size: 15px;
    color: #64748b;
}

/* Alert Messages */
.messages {
    margin-bottom: 24px;
}

.alert {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
}

.alert-error {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.alert-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* Form */
.login-form {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

label {
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    letter-spacing: 0.3px;
}

.forgot-link {
    font-size: 13px;
    color: var(--login-accent);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.forgot-link:hover {
    color: var(--login-accent-dark);
}

/* Input Wrapper */
.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 14px;
    width: 18px;
    height: 18px;
    color: #94a3b8;
    pointer-events: none;
    transition: color 0.25s;
}

.input-wrapper input {
    width: 100%;
    padding: 14px 14px 14px 44px;
    font-size: 14px;
    font-family: inherit;
    color: #0f172a;
    background: #fff;
    border: 1.5px solid #cbd5e1;
    border-radius: 12px;
    outline: none;
    transition: all 0.25s ease;
}

.input-wrapper input::placeholder {
    color: #94a3b8;
}

.input-wrapper input:focus {
    border-color: var(--login-accent-light);
    box-shadow: 0 0 0 3px var(--login-focus-ring);
    background: #fff;
}

.input-wrapper:focus-within .input-icon {
    color: var(--login-accent-light);
}

/* Toggle Password */
.toggle-password {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toggle-password svg {
    width: 18px;
    height: 18px;
    color: #94a3b8;
    transition: color 0.2s;
}

.toggle-password:hover svg {
    color: #64748b;
}

.hidden {
    display: none;
}

/* Checkbox */
.remember-group {
    flex-direction: row;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 400;
    color: #64748b;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    display: none;
}

.checkmark {
    width: 20px;
    height: 20px;
    border: 1.5px solid #cbd5e1;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s ease;
    position: relative;
}

.checkmark::after {
    content: '';
    width: 10px;
    height: 6px;
    border-left: 2.5px solid #fff;
    border-bottom: 2.5px solid #fff;
    transform: rotate(-45deg) scale(0);
    transition: transform 0.15s ease;
    position: absolute;
    top: 4px;
}

.checkbox-label input:checked + .checkmark {
    background: var(--login-checkbox-bg);
    border-color: var(--login-accent-light);
}

.checkbox-label input:checked + .checkmark::after {
    transform: rotate(-45deg) scale(1);
}

/* Login Button */
.btn-login {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 15px;
    font-size: 15px;
    font-weight: 700;
    font-family: inherit;
    color: #fff;
    background: var(--login-btn-gradient);
    background-size: 200% 200%;
    animation: btnShimmer 4s ease infinite;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 16px var(--login-btn-shadow);
    letter-spacing: 0.3px;
}

@keyframes btnShimmer {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.btn-login:hover {
    box-shadow: 0 8px 28px var(--login-btn-shadow);
    transform: translateY(-2px);
}

.btn-login:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px var(--login-btn-shadow);
}

.btn-login svg {
    width: 18px;
    height: 18px;
    transition: transform 0.2s;
}

.btn-login:hover svg {
    transform: translateX(4px);
}

/* Footer */
.form-footer {
    text-align: center;
    margin-top: 32px;
    font-size: 14px;
    color: #64748b;
}

.form-footer a {
    color: var(--login-accent);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;
}

.form-footer a:hover {
    color: var(--login-accent-dark);
}

/* ===== Responsive ===== */
@media (max-width: 960px) {
    .left-panel {
        display: none;
    }

    .mobile-logo {
        display: flex;
    }

    .right-panel {
        flex: 1;               /* fill the login-container which fills body */
        width: 100%;
        min-height: 100vh;
        min-height: 100dvh;
        padding: 24px;
        justify-content: center;
        align-items: center;
        box-sizing: border-box;
    }

    .form-header h2 {
        text-align: center;
    }

    .form-header p {
        text-align: center;
    }
}

@media (max-width: 480px) {
    .login-form-wrapper {
        max-width: 100%;
    }

    .form-header h2 {
        font-size: 24px;
    }

    .input-wrapper input {
        padding: 12px 12px 12px 40px;
    }

    .btn-login {
        padding: 13px;
    }
}

/* ===== Dark Theme (Midnight) — Login Overrides ===== */
[data-theme="midnight"] .right-panel {
    background: linear-gradient(180deg, #111019 0%, #1a1825 100%);
}
[data-theme="midnight"] .form-header p {
    color: #94a3b8;
}
[data-theme="midnight"] label {
    color: #cbd5e1;
}
[data-theme="midnight"] .input-wrapper input {
    color: #f1f5f9;
    background: #1a1825;
    border-color: #334155;
}
[data-theme="midnight"] .input-wrapper input::placeholder {
    color: #475569;
}
[data-theme="midnight"] .input-wrapper input:focus {
    background: #1a1825;
    border-color: #818cf8;
}
[data-theme="midnight"] .checkbox-label {
    color: #94a3b8;
}
[data-theme="midnight"] .checkmark {
    border-color: #334155;
}
[data-theme="midnight"] .form-footer {
    color: #64748b;
}
[data-theme="midnight"] .alert-error {
    background: rgba(220, 38, 38, 0.1);
    color: #f87171;
    border-color: rgba(248, 113, 113, 0.2);
}

/* ============================================================
   LOGIN RESPONSIVE — Add this block at the END of login.css
   Existing file already covers ≤960px and ≤480px.
   This extends to all breakpoints and fixes edge cases.
   ============================================================ */

/* ---- Fluid base ---- */
.login-container {
    min-height: 100dvh; /* dynamic viewport on mobile browsers */
}
.right-panel {
    flex: 1;
    min-width: 0;
    overflow-y: auto;
}

/* ============================================================
   ≤ 1100px  —  Small laptop / tablet landscape
   ============================================================ */
@media (max-width: 1100px) {
    .left-panel {
        flex: 0 0 380px;
        padding: 50px 36px;
    }
    .brand-title {
        font-size: 24px;
    }
    .brand-description {
        font-size: 13px;
    }
    .brand-features {
        max-width: 260px;
    }
}

/* ============================================================
   ≤ 960px  —  Tablet portrait  (existing rule preserved + extended)
   ============================================================ */
@media (max-width: 960px) {
    .left-panel {
        display: none;
    }
    .mobile-logo {
        display: flex;
    }
    .login-container {
        justify-content: center;
    }
    .right-panel {
        padding: 32px 28px;
        background: var(--login-page-bg);
    }
    .login-form-wrapper {
        max-width: 460px;
        margin: 0 auto;
    }
    .form-header {
        text-align: center;
    }
    .form-header h2 {
        text-align: center;
        font-size: 26px;
    }
    .form-header p {
        text-align: center;
    }
}

/* ============================================================
   ≤ 768px  —  Large phone / small tablet
   ============================================================ */
@media (max-width: 768px) {
    .right-panel {
        padding: 24px 20px;
        align-items: flex-start;
        padding-top: 40px;
    }
    .login-form-wrapper {
        max-width: 100%;
        width: 100%;
    }
    .form-header {
        margin-bottom: 24px;
    }
    .form-header h2 {
        font-size: 24px;
    }
    .mobile-logo {
        margin-bottom: 24px;
    }
    .mobile-brand {
        font-size: 20px;
    }
    .mobile-logo-img,
    .m-fallback-logo {
        width: 36px;
        height: 36px;
    }
    .login-form {
        gap: 18px;
    }
    .input-wrapper input {
        padding: 13px 13px 13px 42px;
        font-size: 15px; /* prevent iOS zoom on focus */
    }
    .btn-login {
        padding: 14px;
        font-size: 15px;
    }
}

/* ============================================================
   ≤ 480px  —  Mobile standard  (existing rule preserved + extended)
   ============================================================ */
@media (max-width: 480px) {
    .right-panel {
        padding: 20px 16px;
        padding-top: 220px;
        justify-content: flex-start;
        align-items: stretch;
    }
    .login-form-wrapper {
        max-width: 100%;
        width: 100%;
    }
    .form-header h2 {
        font-size: 22px;
    }
    .form-header p {
        font-size: 14px;
    }
    .input-wrapper input {
        padding: 12px 12px 12px 40px;
        font-size: 16px; /* ≥16px prevents iOS auto-zoom */
        border-radius: 10px;
    }
    .input-icon {
        left: 12px;
        width: 16px;
        height: 16px;
    }
    .toggle-password {
        right: 10px;
    }
    .btn-login {
        padding: 13px;
        font-size: 14px;
        border-radius: 10px;
    }
    .login-form {
        gap: 16px;
    }
    .form-footer {
        margin-top: 24px;
        font-size: 13px;
    }
    /* Alert */
    .alert {
        padding: 12px 14px;
        font-size: 13px;
        border-radius: 10px;
    }
    /* Checkbox label */
    .checkbox-label {
        font-size: 13px;
    }
    .checkmark {
        width: 18px;
        height: 18px;
        border-radius: 5px;
    }
    .checkmark::after {
        width: 9px;
        height: 5px;
        top: 3px;
    }
}

/* ============================================================
   ≤ 360px  —  Very small phones
   ============================================================ */
@media (max-width: 360px) {
    .right-panel {
        padding: 16px 12px;
        padding-top: 24px;
    }
    .form-header h2 {
        font-size: 20px;
    }
    .mobile-brand {
        font-size: 18px;
    }
    .input-wrapper input {
        font-size: 16px;
        padding: 11px 11px 11px 38px;
    }
    .btn-login {
        padding: 12px;
        font-size: 14px;
    }
    .label-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }
    .forgot-link {
        font-size: 12px;
    }
}

/* ============================================================
   Landscape phone (short viewport, wide)
   ============================================================ */
@media (max-height: 600px) and (orientation: landscape) {
    .right-panel {
        padding: 16px 24px;
        align-items: flex-start;
        overflow-y: auto;
    }
    .mobile-logo {
        margin-bottom: 16px;
    }
    .form-header {
        margin-bottom: 16px;
    }
    .login-form {
        gap: 12px;
    }
    .form-footer {
        margin-top: 16px;
    }
    /* Show a compact logo row instead of full mobile logo */
    .mobile-logo-img,
    .m-fallback-logo {
        width: 28px;
        height: 28px;
    }
    .mobile-brand {
        font-size: 16px;
    }
}

/* ============================================================
   Midnight dark theme — mobile overrides
   ============================================================ */
@media (max-width: 960px) {
    [data-theme="midnight"] .right-panel {
        background: linear-gradient(180deg, #111019 0%, #1a1825 100%);
    }
    [data-theme="midnight"] .login-container {
        background: #111019;
    }
}

/* ============================================================
   Accessibility: reduced motion
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    .btn-login {
        animation: none;
    }
    .logo-wrapper {
        animation: none;
    }
    .btn-login:hover {
        transform: none;
    }
    .feature-item:hover {
        transform: none;
    }
}

/* ============================================================
   Print
   ============================================================ */
@media print {
    .left-panel {
        display: none;
    }
    .login-container {
        display: block;
    }
    .right-panel {
        padding: 20px;
    }
}

/* ============================================================
   LOGIN — ADDITIONAL FIXES (appended)
   ============================================================ */

/* Ensure left panel never bleeds on very wide monitors */
@media (min-width: 1600px) {
    .left-panel {
        flex: 0 0 520px;
    }
}

/* 1024px — left panel gets tighter */
@media (max-width: 1024px) {
    .left-panel {
        flex: 0 0 340px;
        padding: 44px 28px;
    }
    .brand-title {
        font-size: 22px;
    }
    .brand-features {
        max-width: 240px;
    }
    .feature-item {
        font-size: 13px;
        gap: 10px;
    }
    .logo-wrapper {
        width: 200px;
        height: 90px;
    }
    .logo-card {
        width: 68px;
        height: 68px;
    }
    .company-logo {
        width: 60px;
        height: 60px;
    }
}

/* Input font ≥16px on every phone — prevents iOS safari auto-zoom */
@media (max-width: 768px) {
    .input-wrapper input {
        font-size: 16px !important;
    }
}

/* Right panel: vertically centered & min-height on tablets */
@media (min-width: 481px) and (max-width: 960px) {
    .right-panel {
        justify-content: center;
        align-items: center;
        min-height: 100dvh;
    }
}

/* Very wide: center form nicely */
@media (min-width: 1400px) {
    .login-form-wrapper {
        max-width: 440px;
    }
}

/* Midnight login — extra polish for tablet */
@media (max-width: 768px) {
    [data-theme="midnight"] .input-wrapper input {
        background: #1a1825;
        border-color: #334155;
        color: #f1f5f9;
    }
    [data-theme="midnight"] .alert-error {
        background: rgba(220,38,38,0.1);
        border-color: rgba(248,113,113,0.2);
        color: #f87171;
    }
}