:root {
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --primary-glow: rgba(59, 130, 246, 0.4);
    --bg-gradient: radial-gradient(circle at 10% 20%, #1e1b4b 0%, #0f172a 100%);
    --glass-bg: rgba(15, 23, 42, 0.65);
    --glass-border: rgba(255, 255, 255, 0.08);
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --success: #10b981;
    --danger: #ef4444;
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg-gradient);
    color: var(--text-main);
    min-height: 100vh;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
}

.login-page-wrapper {
    width: 100%;
    padding: 40px 20px;
    display: flex;
    flex: 1;
    justify-content: center;
    align-items: center;
}

.login-split-card {
    display: flex;
    width: 100%;
    max-width: 1100px;
    min-height: 550px;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 32px;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.4);
    overflow: hidden;
}

.login-hero {
    flex: 0 0 60%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 60px;
    overflow: hidden;
}

.hero-content {
    text-align: center;
    z-index: 2;
}

.hero-image-wrapper {
    margin-bottom: 40px;
}

.floating-img {
    width: 100%;
    max-width: 500px;
    height: auto;
    animation: float 6s ease-in-out infinite;
    filter: drop-shadow(0 20px 40px rgba(0, 0, 0, 0.4));
}

@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-20px); }
    100% { transform: translateY(0px); }
}

.hero-title {
    font-size: 42px;
    font-weight: 700;
    margin-bottom: 16px;
    background: linear-gradient(135deg, #60a5fa 0%, #c084fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-subtitle {
    font-size: 18px;
    color: rgba(255, 255, 255, 0.7);
}

.login-form-side {
    flex: 0 0 40%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 40px;
    background: rgba(0, 0, 0, 0.15);
    border-left: 1px solid rgba(255, 255, 255, 0.05);
    z-index: 10;
}

/* Ambient Glow Blobs in Background */
body::before, body::after {
    content: '';
    position: absolute;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: rgba(99, 102, 241, 0.15);
    filter: blur(100px);
    z-index: -1;
}
body::before {
    top: 10%;
    left: 15%;
}
body::after {
    bottom: 15%;
    right: 15%;
    background: rgba(59, 130, 246, 0.15);
}

.login-container {
    width: 100%;
    max-width: 440px;
    perspective: 1000px;
}

.login-card {
    background: transparent;
    border: none;
    padding: 0;
    box-shadow: none;
    width: 100%;
}

.login-card .brand-subtitle,
.login-card .form-label {
    color: #cbd5e1;
}

.login-card .form-input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

.login-card .form-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.login-card .form-input:focus {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.25);
}

.login-card .password-toggle-btn {
    color: #cbd5e1;
}

.login-card .password-toggle-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
}

.login-card .captcha-image-wrapper {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.login-card .captcha-refresh-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #cbd5e1;
}

.login-card .captcha-refresh-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
    color: #ffffff;
}

.login-card .btn-submit:disabled {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.3);
}

.brand-section {
    text-align: center;
    margin-bottom: 32px;
}

/* Logo Swap Logic */
.brand-logo {
    height: 60px;
    width: auto;
    margin-bottom: 15px;
}

.brand-section .light-logo {
    display: none;
}
.brand-section .dark-logo {
    display: inline-block;
}

:root.light-mode .brand-section .dark-logo {
    display: none;
}
:root.light-mode .brand-section .light-logo {
    display: inline-block;
}

.brand-title {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #60a5fa 0%, #c084fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 6px;
}

.brand-subtitle {
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 400;
}

/* Form Controls */
.form-group {
    margin-bottom: 22px;
    position: relative;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-main);
    margin-bottom: 8px;
    letter-spacing: 0.2px;
}

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

.form-input {
    width: 100%;
    background: rgba(15, 23, 42, 0.4);
    border: 1.5px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 14px;
    color: var(--text-main);
    outline: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-glow);
    background: rgba(15, 23, 42, 0.8);
}

/* Password visibility toggle */
.form-input-password {
    padding-right: 48px;
}

.password-toggle-btn {
    position: absolute;
    right: 14px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    border-radius: 6px;
    transition: color 0.2s, background-color 0.2s;
}

.password-toggle-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

/* Captcha styling */
.captcha-container {
    display: flex;
    align-items: stretch;
    gap: 12px;
    margin-top: 8px;
}

.captcha-image-wrapper {
    background: rgba(15, 23, 42, 0.8);
    border: 1.5px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 48px;
    min-width: 160px;
}

.captcha-image-wrapper img {
    display: block;
    height: 100%;
    width: auto;
}

.captcha-refresh-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1.5px solid rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    border-radius: 12px;
    padding: 0 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.captcha-refresh-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.2);
}

.captcha-refresh-btn:active {
    transform: scale(0.95);
}

/* Spin Animation for Captcha Refresh Icon */
.spin {
    animation: spin-animation 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes spin-animation {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 22px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from { transform: translateY(-10px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.alert-danger {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: #fca5a5;
}

.alert-success {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.25);
    color: #a7f3d0;
}

/* Submit Button */
.btn-submit {
    width: 100%;
    background: linear-gradient(135deg, var(--primary) 0%, #4f46e5 100%);
    border: none;
    border-radius: 12px;
    padding: 14px 20px;
    font-size: 15px;
    font-weight: 600;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
    margin-top: 8px;
}

.btn-submit:hover {
    opacity: 0.95;
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.35);
    transform: translateY(-1px);
}

.btn-submit:active {
    transform: translateY(1px);
}

.btn-submit:disabled {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

/* Loading Spinner */
.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
    display: none;
}

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

/* SVG Sizing */
.icon {
    width: 20px;
    height: 20px;
}

/* Site Footer */
.site-footer {
    width: 100%;
    padding: 20px;
    border-top: 1px solid var(--glass-border);
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
    margin-top: auto;
    background: rgba(0, 0, 0, 0.1);
}

/* Responsive Layout */
@media (max-width: 992px) {
    .login-split-card {
        flex-direction: column;
        max-width: 500px;
    }
    .login-hero {
        flex: 1 1 auto;
        padding: 40px 20px;
    }
    .login-form-side {
        flex: 1 1 auto;
        padding: 40px 20px;
        border-left: none;
        border-top: 1px solid rgba(255, 255, 255, 0.08);
    }
}

/* Theme Toggle Button */
.theme-toggle-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1000;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.theme-toggle-btn:hover {
    transform: scale(1.1);
    background: rgba(15, 23, 42, 0.8);
}

.theme-toggle-btn svg {
    width: 24px;
    height: 24px;
}

.theme-toggle-btn .icon-moon {
    display: none;
}

:root.light-mode .theme-toggle-btn {
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: #0f172a;
}

:root.light-mode .theme-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.9);
}

:root.light-mode .theme-toggle-btn .icon-sun {
    display: none;
}

:root.light-mode .theme-toggle-btn .icon-moon {
    display: block;
}

/* Light Mode Overrides for Auth Page */
:root.light-mode {
    --bg-gradient: radial-gradient(circle at 10% 20%, #e2e8f0 0%, #f1f5f9 100%);
    --text-main: #0f172a;
    --text-muted: #64748b;
}

:root.light-mode body::before {
    background: rgba(99, 102, 241, 0.3);
}

:root.light-mode body::after {
    background: rgba(59, 130, 246, 0.3);
}

:root.light-mode .hero-title {
    background: linear-gradient(135deg, #2563eb 0%, #7e22ce 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

:root.light-mode .hero-subtitle {
    color: rgba(15, 23, 42, 0.7);
}

:root.light-mode .login-split-card {
    background: rgba(255, 255, 255, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.7);
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.1);
}

:root.light-mode .login-form-side {
    background: rgba(255, 255, 255, 0.45);
    border-left: 1px solid rgba(255, 255, 255, 0.6);
}

:root.light-mode .login-card {
    background: transparent;
    border: none;
    box-shadow: none;
}

:root.light-mode .login-card .brand-subtitle,
:root.light-mode .login-card .form-label,
:root.light-mode .login-card .password-toggle-btn {
    color: #475569;
}

:root.light-mode .login-card .form-input,
:root.light-mode .login-card .captcha-image-wrapper,
:root.light-mode .login-card .captcha-refresh-btn,
:root.light-mode .login-card .btn-submit:disabled {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.12);
    color: #0f172a;
}

:root.light-mode .login-card .form-input::placeholder {
    color: rgba(0, 0, 0, 0.4);
}

:root.light-mode .login-card .form-input:focus {
    background: #ffffff;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
}

/* Success Animation Overlay */
.success-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.5s ease;
}
.success-overlay.active {
    opacity: 1;
}
:root.light-mode .success-overlay {
    background: rgba(255, 255, 255, 0.95);
}
:root.light-mode .success-overlay h3 {
    color: #0f172a !important;
}
