@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    --color-bg: #F3F5FA;
    --color-surface: #FFFFFF;
    --color-surface-alt: #F8FAFC;
    --color-border: #E3E8EF;
    --color-border-strong: #CBD3E1;
    --color-text: #10162B;
    --color-text-secondary: #47516B;
    --color-text-muted: #8891A5;
    --color-primary: #2A4CDB;
    --color-primary-dark: #1A34A8;
    --color-primary-light: #EEF1FE;
    --color-primary-soft: #DCE3FC;
    --color-success: #0F8A5F;
    --color-success-bg: #E4F6EE;
    --color-danger: #D6304A;
    --color-danger-bg: #FCEAEC;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --shadow-lg: 0 24px 60px rgba(16, 22, 43, 0.16);
}

/* Cỡ chữ gốc co giãn theo bề rộng màn hình (đồng bộ style.css) */
html {
    font-size: clamp(13.5px, 12.2px + 0.35vw, 16.5px);
}

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

body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: radial-gradient(circle at 15% 15%, #33509E 0%, #10162B 55%, #0B0E1D 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.login-container {
    background: var(--color-surface);
    padding: 2.75rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 440px;
}

.logo {
    text-align: center;
    margin-bottom: 1.75rem;
}

.logo-img {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.logo h1 {
    color: var(--color-text);
    font-size: clamp(1.05rem, 3.8vw, 1.35rem);
    font-weight: 800;
    margin: 0;
    letter-spacing: -0.01em;
    line-height: 1.25;
    text-align: left;
}

.logo-icon {
    width: 46px;
    height: 46px;
    background: var(--color-primary);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.6rem;
    font-weight: 800;
    flex-shrink: 0;
}

.logo h1 .highlight {
    color: var(--color-primary);
}

.section-title {
    text-align: center;
    margin-bottom: 1.75rem;
}

.section-title h2 {
    color: var(--color-text);
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    margin-bottom: 0.3rem;
}

.section-title p {
    color: var(--color-text-muted);
    font-size: 0.88rem;
    margin: 0;
}

.form-group {
    margin-bottom: 1.1rem;
}

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

.input-icon {
    display: none;
}

input[type="text"],
input[type="password"] {
    width: 100%;
    padding: 13px 16px;
    border: 1.5px solid var(--color-border-strong);
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-family: inherit;
    color: var(--color-text);
    background: var(--color-surface);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

@media (max-width: 768px) {
    input[type="text"],
    input[type="password"] {
        padding: 6px 10px;
        min-height: 30px;
        font-size: 14px;
        line-height: 1.35;
        border-radius: 6px;
        -webkit-text-size-adjust: 100%;
    }
}

input::placeholder {
    color: var(--color-text-muted);
}

input:focus,
input:focus-visible {
    outline: none !important;
    border-color: var(--color-border-strong) !important;
    box-shadow: none !important;
}

.btn-login {
    width: 100%;
    padding: 14px;
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.98rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
    letter-spacing: 0.02em;
    margin-top: 0.4rem;
}

.btn-login:hover:not(:disabled) {
    background: var(--color-primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(42, 76, 219, 0.28);
}

.btn-login:disabled {
    background: var(--color-border-strong);
    cursor: not-allowed;
}

.alert {
    display: none;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    margin-bottom: 1.25rem;
    font-size: 0.88rem;
    line-height: 1.55;
    border: 1px solid transparent;
}

.alert.show {
    display: flex;
}

.alert-body {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.alert-icon {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1;
    margin-top: 1px;
}

.alert-message {
    margin: 0;
    flex: 1;
    min-width: 0;
}

.alert-close {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: inherit;
    opacity: 0.55;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 1.25rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: -4px -6px 0 0;
    transition: opacity 0.15s ease, background 0.15s ease;
}

.alert-close:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.06);
}

.alert-error {
    background: var(--color-danger-bg);
    color: #9B1B32;
    border-color: rgba(214, 48, 74, 0.22);
}

.alert-error .alert-icon {
    background: rgba(214, 48, 74, 0.14);
    color: var(--color-danger);
}

.alert-success {
    background: var(--color-success-bg);
    color: #0A6B49;
    border-color: rgba(15, 138, 95, 0.22);
}

.alert-success .alert-icon {
    background: rgba(15, 138, 95, 0.14);
    color: var(--color-success);
}

.loading {
    display: none;
    text-align: center;
    margin-top: 1rem;
}

.loading.show {
    display: block;
}

.spinner {
    border: 3px solid var(--color-border);
    border-top: 3px solid var(--color-primary);
    border-radius: 50%;
    width: 28px;
    height: 28px;
    animation: spin 0.9s linear infinite;
    margin: 0 auto;
}

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

.auth-link {
    text-align: center;
    margin-top: 1rem;
    color: var(--color-text-muted);
    font-size: 0.88rem;
}

.auth-link a {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 600;
}

.auth-link a:hover {
    text-decoration: underline;
}

.support-info {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--color-border);
}

.support-info .disclaimer {
    color: var(--color-text-muted);
    font-size: 0.72rem;
    font-style: italic;
    line-height: 1.5;
}

.footer {
    text-align: center;
    margin-top: 1rem;
    color: var(--color-text-muted);
    font-size: 0.78rem;
}

@media (max-width: 500px) {
    .login-container {
        padding: 2rem 1.5rem;
    }

    .logo h1 {
        font-size: 1.2rem;
    }
}

/* Theme toggle */
.auth-theme-toggle {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 100;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(6px);
}

.auth-theme-toggle:hover {
    background: rgba(255, 255, 255, 0.22);
}

/* Dark mode — đăng nhập / đăng ký */
html[data-theme="dark"] {
    --color-bg: #0B0E1D;
    --color-surface: #161E30;
    --color-surface-alt: #1E2840;
    --color-border: #2B3654;
    --color-border-strong: #445379;
    --color-text: #E9EDF8;
    --color-text-secondary: #C2CCE1;
    --color-text-muted: #93A0BD;
    --color-primary: #6B87FF;
    --color-primary-dark: #4D6BF5;
    --color-primary-light: #1F2A4C;
    --color-primary-soft: #2A3A6B;
    --color-success-bg: #143327;
    --color-danger-bg: #3A1B23;
}

html[data-theme="dark"] body {
    background: radial-gradient(circle at 15% 15%, #1a2a5e 0%, #0B0E1D 55%, #060810 100%);
}

html[data-theme="dark"] .login-container,
html[data-theme="dark"] .signup-container {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

html[data-theme="dark"] .logo h1 {
    color: var(--color-text);
}

html[data-theme="dark"] .section-title h2 {
    color: var(--color-text-secondary);
}

html[data-theme="dark"] input[type="text"],
html[data-theme="dark"] input[type="password"],
html[data-theme="dark"] input[type="email"],
html[data-theme="dark"] input[type="tel"] {
    background: var(--color-surface-alt);
    color: var(--color-text);
    border-color: var(--color-border-strong);
}

html[data-theme="dark"] input::placeholder {
    color: var(--color-text-muted);
}

html[data-theme="dark"] .signup-link,
html[data-theme="dark"] .login-link {
    color: var(--color-text-secondary);
}

html[data-theme="dark"] .signup-link a,
html[data-theme="dark"] .login-link a {
    color: var(--color-primary);
}

html[data-theme="dark"] .alert-error {
    background: rgba(214, 48, 74, 0.14);
    color: #FF8FA0;
    border-color: rgba(214, 48, 74, 0.35);
}

html[data-theme="dark"] .alert-error .alert-icon {
    background: rgba(214, 48, 74, 0.22);
    color: #FF8FA0;
}

html[data-theme="dark"] .alert-success {
    background: rgba(15, 138, 95, 0.14);
    color: #6FE0B3;
    border-color: rgba(15, 138, 95, 0.35);
}

html[data-theme="dark"] .alert-success .alert-icon {
    background: rgba(15, 138, 95, 0.22);
    color: #6FE0B3;
}

html[data-theme="dark"] .alert-close:hover {
    background: rgba(255, 255, 255, 0.08);
}
