:root {
    /* Theme Light (Default - Corporate Professional Style) */
    --bg-body: #f8fafc; /* Slate-50 */
    --bg-brand: #1e40af; /* Solid Valtera Blue */
    --bg-form: #ffffff;
    --bg-card: #ffffff;
    --border-card: #e2e8f0; /* Slate-200 */
    --shadow-card: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px 0 rgba(0, 0, 0, 0.03), 0 20px 25px -5px rgba(0, 0, 0, 0.05);
    --text-primary: #0f172a; /* Slate-900 */
    --text-secondary: #334155; /* Slate-700 */
    --text-muted: #64748b; /* Slate-500 */
    --label-color: #475569;
    --input-bg: #f8fafc;
    --input-border: #cbd5e1;
    --input-text: #0f172a;
    --input-placeholder: #94a3b8;
    --input-hover-bg: #f1f5f9;
    --input-hover-border: #94a3b8;
    --icon-color: #64748b;
    --footer-color: #64748b;
    --copyright-color: #94a3b8;
    --alert-bg: #fef2f2;
    --alert-border: #fee2e2;
    --alert-text: #ef4444;
    --toggle-btn-bg: #ffffff;
    --toggle-btn-border: #cbd5e1;
    --toggle-btn-color: #475569;

    /* Left Brand Card variables (Light: Clean White Card) */
    --bg-brand-card: #ffffff;
    --border-brand-card: #e2e8f0;
    --text-brand-primary: #0f172a;
    --text-brand-secondary: #475569;
    --icon-brand-bg: rgba(16, 185, 129, 0.1);
    --icon-brand-border: rgba(16, 185, 129, 0.2);
    --icon-brand-color: #10b981;
    --logo-bg: transparent;
    --logo-padding: 0px;
    --logo-radius: 0%;
    --logo-shadow: none;

    /* Colors and Brand Accents */
    --primary: #1e40af; /* Corporate Blue */
    --primary-hover: #1e3a8a;
    --accent: #10b981; /* Emerald Green */
    --accent-hover: #059669;
}

[data-theme="dark"] {
    /* Theme Dark */
    --bg-body: #020617; /* Slate-950 */
    --bg-brand: #090d1f; /* Solid Dark Blue */
    --bg-form: #090d1f;
    --bg-card: #0f172a; /* Slate-900 */
    --border-card: #1e293b; /* Slate-800 */
    --shadow-card: 0 4px 6px -1px rgba(0, 0, 0, 0.2), 0 2px 4px -1px rgba(0, 0, 0, 0.1), 0 25px 50px -12px rgba(0, 0, 0, 0.4);
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    --label-color: #94a3b8;
    --input-bg: #090d1f;
    --input-border: #1e293b;
    --input-text: #f8fafc;
    --input-placeholder: #475569;
    --input-hover-bg: #0f172a;
    --input-hover-border: #334155;
    --icon-color: #94a3b8;
    --footer-color: #94a3b8;
    --copyright-color: #475569;
    --alert-bg: rgba(239, 68, 68, 0.1);
    --border-brand-card: #1e293b;
    --alert-text: #fca5a5;
    --toggle-btn-bg: #0f172a;
    --toggle-btn-border: #1e293b;
    --toggle-btn-color: #94a3b8;

    /* Left Brand Card variables (Dark: Slate Card + White Circular Logo background) */
    --bg-brand-card: #0f172a;
    --text-brand-primary: #f8fafc;
    --text-brand-secondary: #cbd5e1;
    --icon-brand-bg: rgba(16, 185, 129, 0.15);
    --icon-brand-border: rgba(16, 185, 129, 0.25);
    --icon-brand-color: #34d399;
    --logo-bg: #ffffff;
    --logo-padding: 10px;
    --logo-radius: 50%;
    --logo-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);

    /* Contrast enhancements for Dark Mode */
    --primary: #3b82f6;
    --primary-hover: #60a5fa;
    --accent: #10b981;
    --accent-hover: #34d399;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    /* Strict Performance optimization: NO animations or transitions permitted on the login page */
    transition: none !important;
}

body {
    font-family: 'Outfit', 'Source Sans Pro', sans-serif;
    min-height: 100vh;
    display: flex;
    background: var(--bg-body);
    color: var(--text-primary);
}

.split-wrapper {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

/* Theme toggle button styling */
.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 100;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    border: 1px solid var(--toggle-btn-border);
    background: var(--toggle-btn-bg);
    color: var(--toggle-btn-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.theme-toggle:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.theme-toggle:focus {
    outline: none;
}

.theme-toggle .light-icon {
    display: block;
}

.theme-toggle .dark-icon {
    display: none;
}

[data-theme="dark"] .theme-toggle .light-icon {
    display: none;
}

[data-theme="dark"] .theme-toggle .dark-icon {
    display: block;
}

/* === LEFT BRANDING PANEL === */
.brand-panel {
    flex: 1.15;
    background: var(--bg-brand);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px;
    position: relative;
    overflow: hidden;
    border-right: 1px solid var(--border-card);
}

/* Subtle, static, flat tech grid pattern to look modern without using heavy images or processing power */
.brand-panel .grid-overlay {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none;
}

.brand-content {
    position: relative;
    z-index: 1;
    text-align: center;
    width: 100%;
    max-width: 440px;
}

.brand-glass-card {
    position: relative;
    background: var(--bg-brand-card);
    border-radius: 24px;
    padding: 48px 40px 32px;
    border: 1px solid var(--border-brand-card);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.brand-logo {
    width: 90px;
    height: 90px;
    object-fit: contain;
    margin-bottom: 24px;
    background: var(--logo-bg);
    padding: var(--logo-padding);
    border-radius: var(--logo-radius);
    box-shadow: var(--logo-shadow);
}

.brand-title {
    color: var(--text-brand-primary);
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 6px;
    letter-spacing: -0.5px;
}

.brand-divider {
    width: 50px;
    height: 3px;
    background: var(--accent);
    border-radius: 2px;
    margin: 16px auto;
}

.brand-desc {
    color: var(--text-brand-secondary);
    font-size: 14.5px;
    line-height: 1.6;
    font-weight: 400;
    margin-bottom: 0;
}

.brand-features {
    margin-top: 32px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    text-align: left;
}

.brand-feature-item {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-brand-secondary);
    font-size: 13.5px;
    font-weight: 500;
}

.brand-feature-item .feature-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--icon-brand-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1px solid var(--icon-brand-border);
}

.brand-feature-item .feature-icon i {
    color: var(--icon-brand-color);
    font-size: 13px;
}

/* === RIGHT FORM PANEL === */
.form-panel {
    flex: 0.85;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px;
    background: var(--bg-form);
    position: relative;
}

.form-container {
    width: 100%;
    max-width: 380px;
}

.form-header {
    margin-bottom: 28px;
    text-align: center;
}

.form-header h2 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
    letter-spacing: -0.5px;
}

.form-header p {
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 400;
}

.form-card {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: 20px;
    padding: 32px 28px;
    box-shadow: var(--shadow-card);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: var(--label-color);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 8px;
}

.form-group:focus-within label {
    color: var(--primary);
}

.input-wrapper {
    position: relative;
}

.input-wrapper .input-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--icon-color);
    font-size: 14px;
    pointer-events: none;
}

.input-wrapper .form-control {
    width: 100%;
    padding: 12px 16px 12px 46px;
    font-size: 14px;
    color: var(--input-text);
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 10px;
    height: auto;
}

.input-wrapper .form-control::placeholder {
    color: var(--input-placeholder);
    font-weight: 400;
    font-size: 13px;
}

.input-wrapper .form-control:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--bg-card);
    box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.08);
}

.input-wrapper .form-control:focus ~ .input-icon {
    color: var(--primary);
}

.input-wrapper .form-control:focus::placeholder {
    color: transparent;
}

.input-wrapper .toggle-password {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--icon-color);
    font-size: 14px;
    cursor: pointer;
    z-index: 2;
    background: none;
    border: none;
    padding: 6px;
    line-height: 1;
    border-radius: 6px;
}

.input-wrapper .toggle-password:hover {
    color: var(--primary);
}

.input-wrapper .toggle-password:focus {
    outline: none;
}

.input-wrapper.password-field .form-control {
    padding-right: 46px;
}

.btn-login {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    color: #ffffff;
    background: var(--primary);
    cursor: pointer;
    margin-top: 8px;
    position: relative;
    overflow: hidden;
}

.btn-login:hover {
    background: var(--primary-hover);
    box-shadow: 0 4px 12px rgba(30, 64, 175, 0.15);
}

.btn-login:active {
    opacity: 0.95;
}

.btn-login .spinner {
    display: none;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    margin: 0 auto;
    /* Loading spinner animation is kept, but only triggers dynamically during submission */
    animation: spin 0.8s linear infinite !important;
}

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

.btn-login.loading .btn-text {
    visibility: hidden;
}

.btn-login.loading .spinner {
    display: block;
    position: absolute;
    top: 50%;
    left: 50%;
    margin-top: -10px;
    margin-left: -10px;
}

.alert-custom {
    background: var(--alert-bg);
    border: 1px solid var(--alert-border);
    border-radius: 10px;
    color: var(--alert-text);
    font-size: 13.5px;
    padding: 12px 16px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.alert-custom i {
    flex-shrink: 0;
}

.form-footer {
    text-align: center;
    margin-top: 20px;
}

.form-footer a {
    color: var(--footer-color);
    font-size: 13.5px;
    font-weight: 500;
    text-decoration: none;
}

.form-footer a:hover {
    color: var(--primary);
}

.copyright {
    text-align: center;
    color: var(--copyright-color);
    font-size: 11px;
    margin-top: 28px;
    font-weight: 400;
    line-height: 1.5;
}

.copyright a:hover {
    color: var(--primary) !important;
}

/* === RESPONSIVE === */
@media (max-width: 991px) {
    .theme-toggle {
        top: 16px;
        right: 16px;
        width: 38px;
        height: 38px;
        font-size: 16px;
        border-radius: 10px;
    }

    .brand-panel {
        display: none;
    }

    .form-panel {
        flex: 1;
        padding: 40px 20px;
        background: var(--bg-body);
        min-height: 100vh;
        align-items: center;
    }

    .form-container {
        max-width: 400px;
    }

    .form-header h2 {
        font-size: 24px;
    }

    .form-card {
        padding: 32px 24px;
        background: var(--bg-card);
        border: 1px solid var(--border-card);
        box-shadow: var(--shadow-card);
    }

    .mobile-brand {
        display: flex !important;
        flex-direction: column;
        align-items: center;
        margin-bottom: 24px;
        gap: 8px;
    }

    .mobile-brand img {
        width: 64px;
        height: 64px;
        object-fit: contain;
    }

    .mobile-brand h1 {
        font-size: 20px;
        font-weight: 700;
        color: var(--text-primary);
        letter-spacing: -0.3px;
    }
}

@media (min-width: 992px) {
    .mobile-brand {
        display: none !important;
    }
}

@media (max-width: 576px) {
    .form-panel {
        padding: 24px 16px;
        padding-top: 60px;
    }

    .form-card {
        padding: 28px 20px;
        border-radius: 16px;
    }

    .mobile-brand img {
        width: 56px;
        height: 56px;
    }

    .mobile-brand h1 {
        font-size: 18px;
    }

    .form-group {
        margin-bottom: 18px;
    }

    .input-wrapper .form-control {
        padding: 12px 14px 12px 42px;
        font-size: 13.5px;
    }

    .btn-login {
        padding: 12px;
        font-size: 14px;
    }
}

@media (max-width: 380px) {
    .form-card {
        padding: 24px 14px;
        border-radius: 14px;
    }
}
