body {
    --brand-primary: #3b1450; /* PROMIS Time Deep Plum Purple */
    --brand-primary-light: #5a2575;
    --brand-secondary: #7b2cbf; /* Vibrant Violet */
    --brand-accent: #e6006f; /* Vibrant Magenta for light mode */
    --brand-accent-glow: rgba(230, 0, 111, 0.08);
    --bg-dark: #f8f7fc; /* Off-White Body Background */
    --bg-dark-card: rgba(255, 255, 255, 0.65); /* Frosted white glass card */
    --border-color: rgba(123, 44, 191, 0.12); /* Soft purple-tinted borders */
    --border-focus: #7b2cbf;
    --text-primary: #201530; /* High contrast slate-plum */
    --text-secondary: #6a5f7a; /* Muted slate */
    --text-muted: #a098b0; /* Light gray-purple */
    --ambient-orb-opacity: 0.15;
    --loading-overlay-bg: rgba(248, 247, 252, 0.7);
    --loading-card-bg: rgba(255, 255, 255, 0.85);
    --loading-card-border: rgba(255, 255, 255, 0.6);
    --font-outfit: 'Outfit', sans-serif;
    --transition-smooth: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

body.theme-dark {
    --bg-dark: #0b0712; /* Cosmic Deep Dark */
    --bg-dark-card: rgba(25, 17, 38, 0.45); /* Frosted dark glass card */
    --border-color: rgba(255, 255, 255, 0.08);
    --text-primary: #f3f0f7; /* Crisp white */
    --text-secondary: #a39bb4; /* Muted slate */
    --text-muted: #6e6580; /* Light gray-purple */
    --ambient-orb-opacity: 0.25;
    --loading-overlay-bg: rgba(11, 7, 18, 0.7);
    --loading-card-bg: rgba(25, 17, 38, 0.5);
    --loading-card-border: rgba(255, 255, 255, 0.08);
    --border-focus: #7b2cbf;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-outfit);
    background-color: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.5s ease, color 0.5s ease;
}

/* Background animated glow spots */
.ambient-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.ambient-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(130px);
    opacity: var(--ambient-orb-opacity);
    animation: floatOrb 25s infinite alternate ease-in-out;
    transition: opacity 0.5s ease;
}

.orb-1 {
    top: -10%;
    left: 10%;
    width: 45vw;
    height: 45vw;
    background: radial-gradient(circle, var(--brand-secondary) 0%, rgba(255,255,255,0) 70%);
}

.orb-2 {
    bottom: -15%;
    right: 5%;
    width: 50vw;
    height: 50vw;
    background: radial-gradient(circle, var(--brand-primary) 0%, rgba(255,255,255,0) 70%);
    animation-delay: -5s;
}

.orb-3 {
    top: 40%;
    left: 50%;
    width: 30vw;
    height: 30vw;
    background: radial-gradient(circle, var(--brand-accent) 0%, rgba(255,255,255,0) 70%);
    opacity: calc(var(--ambient-orb-opacity) - 0.05);
    animation-delay: -12s;
}

@keyframes floatOrb {
    0% {
        transform: translate(0, 0) scale(1);
    }
    50% {
        transform: translate(4vw, -6vw) scale(1.1);
    }
    100% {
        transform: translate(-3vw, 5vw) scale(0.9);
    }
}

/* Split screen container */
.auth-container {
    position: relative;
    z-index: 1;
    display: flex;
    width: 100%;
    max-width: 1200px;
    height: 750px;
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--loading-card-border);
    border-radius: 24px;
    box-shadow: 0 24px 80px rgba(31, 38, 135, 0.05),
                0 0 40px rgba(123, 44, 191, 0.04);
    overflow: hidden;
    margin: 20px;
    animation: fadeInContainer 1s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    transition: background-color 0.5s ease, border-color 0.5s ease;
}

body.theme-dark .auth-container {
    background: rgba(18, 11, 28, 0.45);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6), 0 0 40px rgba(123, 44, 191, 0.1);
}

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

/* Left panel visual side */
.auth-visual-panel {
    flex: 1.1;
    position: relative;
    background-color: var(--brand-primary);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 60px;
}

.auth-visual-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.75;
    mix-blend-mode: lighten;
    z-index: 1;
}

.auth-visual-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, 
                                rgba(59, 20, 80, 0.92) 0%, 
                                rgba(15, 8, 24, 0.78) 100%);
    z-index: 2;
}

.visual-content-header {
    position: relative;
    z-index: 3;
}

.visual-logo {
    font-size: 2.2rem;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
    letter-spacing: -0.5px;
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

.visual-logo span {
    font-weight: 300;
    color: #ff3399; /* Accent */
}

.visual-content-footer {
    position: relative;
    z-index: 3;
    max-width: 440px;
}

.visual-tagline {
    font-size: 2rem;
    font-weight: 600;
    line-height: 1.25;
    color: #ffffff;
    margin-bottom: 16px;
    text-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.visual-desc {
    font-size: 1.05rem;
    font-weight: 300;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.6;
}

/* Right panel form side */
.auth-form-panel {
    flex: 0.9;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 60px 80px;
    background: var(--bg-dark-card);
    z-index: 3;
    transition: background-color 0.5s ease;
}

.form-header {
    margin-bottom: 40px;
}

.form-title {
    font-size: 2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    letter-spacing: -0.3px;
}

.form-subtitle {
    font-size: 0.95rem;
    color: var(--text-secondary);
}

/* Modern inputs and labels */
.form-group {
    position: relative;
    margin-bottom: 24px;
}

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

.form-input {
    width: 100%;
    padding: 16px 20px;
    padding-left: 50px;
    padding-right: 50px;
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    font-family: var(--font-outfit);
    font-size: 1rem;
    color: var(--text-primary);
    transition: var(--transition-smooth);
}

body.theme-dark .form-input {
    background: rgba(255, 255, 255, 0.04);
}

.form-input:focus {
    outline: none;
    border-color: var(--border-focus);
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 0 0 4px rgba(123, 44, 191, 0.12);
}

body.theme-dark .form-input:focus {
    background: rgba(123, 44, 191, 0.04);
    box-shadow: 0 0 0 4px rgba(123, 44, 191, 0.15);
}

.input-icon {
    position: absolute;
    left: 20px;
    color: var(--text-muted);
    font-size: 1.1rem;
    transition: var(--transition-smooth);
    pointer-events: none;
}

.form-input:focus ~ .input-icon {
    color: var(--brand-secondary);
}

.password-toggle {
    position: absolute;
    right: 20px;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    transition: var(--transition-smooth);
    padding: 4px;
}

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

/* Remember me and Forgot password */
.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.remember-me {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.custom-checkbox {
    position: relative;
    width: 20px;
    height: 20px;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    transition: var(--transition-smooth);
    display: flex;
    align-items: center;
    justify-content: center;
}

.custom-checkbox i {
    font-size: 0.75rem;
    color: #fff;
    opacity: 0;
    transform: scale(0.5);
    transition: var(--transition-smooth);
}

.remember-me input {
    display: none;
}

.remember-me input:checked + .custom-checkbox {
    background: var(--brand-secondary);
    border-color: var(--brand-secondary);
}

.remember-me input:checked + .custom-checkbox i {
    opacity: 1;
    transform: scale(1);
}

.forgot-link {
    font-size: 0.9rem;
    color: var(--brand-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition-smooth);
}

.forgot-link:hover {
    color: var(--brand-accent);
    text-shadow: 0 0 10px var(--brand-accent-glow);
}

/* Premium Button */
.btn-modern {
    width: 100%;
    padding: 16px 30px;
    background: linear-gradient(135deg, var(--brand-primary-light) 0%, var(--brand-secondary) 100%);
    border: none;
    border-radius: 12px;
    color: #ffffff;
    font-family: var(--font-outfit);
    font-weight: 600;
    font-size: 1.05rem;
    cursor: pointer;
    transition: var(--transition-smooth);
    box-shadow: 0 8px 24px rgba(123, 44, 191, 0.25);
    position: relative;
    overflow: hidden;
}

.btn-modern::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
                                transparent, 
                                rgba(255, 255, 255, 0.25), 
                                transparent);
    transition: 0.6s;
}

.btn-modern:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(123, 44, 191, 0.35);
    background: linear-gradient(135deg, var(--brand-secondary) 0%, var(--brand-primary-light) 100%);
}

.btn-modern:hover::before {
    left: 100%;
}

.btn-modern:active {
    transform: translateY(0);
    box-shadow: 0 4px 12px rgba(123, 44, 191, 0.15);
}

/* Error message label */
.error-msg {
    color: #d92635;
    font-size: 0.9rem;
    margin-top: 16px;
    display: block;
    font-weight: 500;
    animation: shakeError 0.4s ease-in-out;
}

@keyframes shakeError {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}

/* Floating Theme Switcher on Login Page */
.theme-switch-floating {
    position: absolute;
    top: 30px;
    right: 30px;
    z-index: 10;
}

.theme-switch-floating button {
    background: var(--bg-dark-card);
    border: 1px solid var(--border-color);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    transition: var(--transition-smooth);
}

.theme-switch-floating button:hover {
    transform: scale(1.08);
    background: #ffffff;
    box-shadow: 0 6px 16px rgba(123, 44, 191, 0.12);
}

body.theme-dark .theme-switch-floating button:hover {
    background: rgba(123, 44, 191, 0.1);
}

/* Loading Overlay Styles */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--loading-overlay-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1),
                visibility 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.loading-overlay.active {
    opacity: 1;
    visibility: visible;
}

.loading-card {
    text-align: center;
    padding: 40px;
    border-radius: 24px;
    background: var(--loading-card-bg);
    border: 1px solid var(--loading-card-border);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.08);
    max-width: 360px;
    width: 90%;
    transform: scale(0.9);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

body.theme-dark .loading-card {
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
}

.loading-overlay.active .loading-card {
    transform: scale(1);
}

.spinner-wrapper {
    position: relative;
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
}

.spinner-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 3px solid transparent;
    border-top-color: var(--brand-accent);
    border-radius: 50%;
    animation: spin 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}

.spinner-ring-inner {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    bottom: 10px;
    border: 3px solid transparent;
    border-top-color: var(--brand-secondary);
    border-radius: 50%;
    animation: spin-reverse 1.5s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes spin-reverse {
    0% { transform: rotate(360deg); }
    100% { transform: rotate(0deg); }
}

.loading-label {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    height: 24px;
    transition: opacity 0.3s ease;
}

.loading-sublabel {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Responsiveness */
@media (max-width: 992px) {
    .auth-container {
        height: auto;
        max-width: 500px;
    }
    
    .auth-visual-panel {
        display: none;
    }
    
    .auth-form-panel {
        flex: 1;
        padding: 50px 40px;
    }
}

@media (max-width: 480px) {
    .auth-container {
        margin: 15px;
    }
    
    .auth-form-panel {
        padding: 40px 24px;
    }
    
    .form-title {
        font-size: 1.7rem;
    }
}
