:root {
    color-scheme: dark;

    /* Token Dark mode colors (default) */
    --bg-gradient-start: rgb(0, 51, 156);
    --bg-gradient-middle: #1a1f2b;
    --bg-gradient-end: rgb(45, 85, 190);
    --text-color: white;
    --primary-color: rgb(59, 130, 246);
    --primary-color-hover: rgb(37, 99, 235);
    --card-bg: rgba(255, 255, 255, 0.1);
    --card-bg-hover: rgba(255, 255, 255, 0.15);
    --card-border: rgba(255, 255, 255, 0.2);
    --input-bg: rgba(255, 255, 255, 0.1);
    --input-border: rgba(255, 255, 255, 0.3);
    --input-focus-border: rgb(59, 130, 246);
    --input-placeholder-color: transparent;
    --input-label-color: rgba(255, 255, 255, 0.7);
    --button-bg: rgb(59, 130, 246);
    --button-bg-hover: rgb(37, 99, 235);
    --logo-opacity: 0.6;
    --logo-hover-opacity: 0.8;
    --pattern-opacity: 0.3;
}

/* Token Light mode */
@media (prefers-color-scheme: light) {
    :root {
        color-scheme: light;
        --bg-gradient-start: rgb(65, 105, 225);
        --bg-gradient-middle: #f0f2f8;
        --bg-gradient-end: rgb(30, 144, 255);
        --text-color: #2c3e50;
        --primary-color: rgb(29, 78, 216);
        --primary-color-hover: rgb(30, 58, 138);
        --card-bg: rgba(255, 255, 255, 0.95);
        --card-bg-hover: rgba(255, 255, 255, 1);
        --card-border: rgba(0, 0, 0, 0.1);
        --input-bg: rgba(255, 255, 255, 0.9);
        --input-border: rgba(0, 0, 0, 0.2);
        --input-focus-border: rgb(29, 78, 216);
        --input-placeholder-color: transparent;
        --input-label-color: rgba(0, 0, 0, 0.7);
        --button-bg: rgb(29, 78, 216);
        --button-bg-hover: rgb(30, 58, 138);
        --logo-opacity: 1;
        --logo-hover-opacity: 0.8;
        --pattern-opacity: 0.15;
    }
}

body {
    background: linear-gradient(135deg, var(--bg-gradient-start), var(--bg-gradient-middle), var(--bg-gradient-end));
    background-size: 200% 200%;
    background-position: 70% 50%;
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-family: 'Segoe UI', sans-serif;
    transition: background-position 0.8s ease;
    padding: 2rem 0;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('/img/bg-t.svg');
    background-repeat: repeat;
    background-position: center;
    background-size: 8%;
    opacity: var(--pattern-opacity);
    pointer-events: none;
    z-index: 1;
}

body > * {
    position: relative;
    z-index: 2;
}

.login-container {
    background: var(--card-bg);
    -webkit-backdrop-filter: blur(15px);
    backdrop-filter: blur(15px);
    border: 1px solid var(--card-border);
    border-radius: 1.5rem;
    padding: 3rem;
    width: 100%;
    max-width: 450px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, background 0.3s ease;
}

.login-container:hover {
    transform: translateY(-5px);
    background: var(--card-bg-hover);
}

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

.brand-header h1 {
    font-size: 2.5rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.brand-header p {
    font-size: 1rem;
    opacity: 0.8;
    margin-bottom: 0;
}

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

.form-control {
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 0.75rem;
    color: var(--text-color);
    -webkit-text-fill-color: var(--text-color);
    caret-color: var(--text-color);
    font-size: 1rem;
    padding: 1rem 0.75rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-control:focus {
    background: var(--input-bg);
    border-color: var(--input-focus-border);
    box-shadow: 0 0 0 0.2rem rgba(59, 130, 246, 0.25);
    color: var(--text-color);
    -webkit-text-fill-color: var(--text-color);
}

.form-control::placeholder {
    color: var(--input-placeholder-color);
    -webkit-text-fill-color: var(--input-placeholder-color);
}

.form-floating > label,
.form-floating > .form-control:placeholder-shown ~ label,
.form-floating > .form-control:focus ~ label,
.form-floating > .form-control:not(:placeholder-shown) ~ label {
    color: var(--input-label-color) !important;
    -webkit-text-fill-color: var(--input-label-color) !important;
    font-size: 0.9rem;
    opacity: 1 !important;
}

.form-floating > label::after,
.form-floating > .form-control:focus ~ label::after,
.form-floating > .form-control:not(:placeholder-shown) ~ label::after {
    display: none;
}

.form-control:-webkit-autofill,
.form-control:-webkit-autofill:hover,
.form-control:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 1000px var(--input-bg) inset;
    -webkit-text-fill-color: var(--text-color);
    caret-color: var(--text-color);
}

.btn-login {
    background: var(--button-bg);
    border: none;
    border-radius: 0.75rem;
    color: white;
    font-size: 1.1rem;
    font-weight: 500;
    padding: 0.875rem;
    width: 100%;
    transition: background 0.3s ease, transform 0.2s ease;
    margin-bottom: 1rem;
}

.btn-login:hover {
    background: var(--button-bg-hover);
    color: white;
    transform: translateY(-2px);
}

.btn-login:focus {
    box-shadow: 0 0 0 0.2rem rgba(59, 130, 246, 0.25);
}

.forgot-password {
    text-align: center;
    margin-bottom: 1.5rem;
}

.forgot-password a {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.3s ease;
}

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

.back-link {
    text-align: center;
    margin-top: 1rem;
}

.back-link a {
    color: var(--text-color);
    text-decoration: none;
    font-size: 0.9rem;
    opacity: 0.8;
    transition: opacity 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.back-link a:hover {
    opacity: 1;
    color: var(--text-color);
}

h1 {
    font-weight: 300;
    margin-bottom: 2rem;
    font-size: 4rem;
}

/* Responsive adjustments */
@media (max-width: 991px) {
    h1 {
        font-size: 3rem;
        margin-bottom: 1.5rem;
    }

    body {
        padding: 1rem 0;
    }
}

/* Better mobile experience */
@media (max-width: 768px) {
    .login-option {
        min-height: 280px;
        margin-bottom: 1rem;
        padding: 2rem;
    }

    .info-card {
        padding: 1.5rem;
        min-height: 60px;
    }

    h1 {
        font-size: 2.5rem;
    }

    body {
        font-size: 1.2rem;
    }
}

/* Responsive adjustments */
@media (max-width: 576px) {
    body {
        padding: 1rem;
    }

    .login-container {
        padding: 2rem 1.5rem;
    }

    .brand-header h1 {
        font-size: 2rem;
    }

    .brand-header h2 {
        font-size: 1.5rem;
    }
}

/* Loading state */
.btn-login.loading {
    position: relative;
    color: transparent;
}

.btn-login.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid transparent;
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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