/* ============================================================
   WTT-ALI — Auth (Login / Register)
   Design language matching Sala module
   ============================================================ */

/* ── Reset & Globals ── */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --bg: #f2f2f7;
    --bg-card: #ffffff;
    --bg-input: #ffffff;
    --surface: #e5e5ea;
    --surface-2: #d1d1d6;
    --border: rgba(0,0,0,.08);
    --text: #1c1c1e;
    --text-secondary: #636366;
    --text-tertiary: #8e8e93;
    --accent: #007aff;
    --accent-hover: #0066d6;
    --accent-dim: rgba(0,122,255,.12);
    --danger: #ff3b30;
    --danger-dim: rgba(255,59,48,.10);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --radius: 14px;
    --radius-sm: 10px;
    --radius-xs: 8px;
}

[data-theme="dark"] {
    --bg: #0a0a0a;
    --bg-card: #1c1c1e;
    --bg-input: #1c1c1e;
    --surface: #2c2c2e;
    --surface-2: #3a3a3c;
    --border: rgba(255,255,255,.08);
    --text: #f5f5f7;
    --text-secondary: #8e8e93;
    --text-tertiary: #636366;
    --accent: #0a84ff;
    --accent-hover: #409cff;
    --accent-dim: rgba(10,132,255,.15);
    --danger: #ff453a;
    --danger-dim: rgba(255,69,58,.12);
}

html, body {
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    height: 100%;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}


/* ── Login Container ── */
.login-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 40px 24px;
    animation: fadeSlideIn .3s ease;
}

@keyframes fadeSlideIn {
    from { opacity: 0; transform: translateX(30px); }
    to   { opacity: 1; transform: translateX(0); }
}

.login-brand {
    text-align: center;
    margin-bottom: 18px;
}

.brand-icon {
    height: 140px;
    margin: 0 auto 16px;
}

.brand-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.login-brand h1 {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.login-brand .subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 4px;
}


/* ── Forms ── */
#login-form, #register-form {
    width: 100%;
    max-width: 360px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.input-group input {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 16px;
    font-family: var(--font);
    transition: border-color .2s, box-shadow .2s;
    outline: none;
}

.input-group input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

.input-group input::placeholder {
    color: var(--text-tertiary);
}

.input-row {
    display: flex;
    gap: 10px;
}

.input-row .input-group { flex: 1; }


/* ── Error ── */
.form-error {
    display: none;
    background: var(--danger-dim);
    color: var(--danger);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.45;
    padding: 10px 14px;
    border-radius: var(--radius-xs);
    animation: error-in .25s ease;
}

.form-error.visible { display: block; }

@keyframes error-in {
    from { opacity: 0; transform: translateY(-4px); }
}


/* ── Primary Button ── */
.btn-primary {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px 24px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: background .2s, transform .1s;
    overflow: hidden;
}

.btn-primary:active {
    transform: scale(.97);
    background: var(--accent-hover);
}

.btn-primary:disabled {
    opacity: .55;
    cursor: default;
    transform: none;
}

.btn-primary .btn-spinner {
    display: none;
    width: 18px;
    height: 18px;
    border: 2.5px solid rgba(255,255,255,.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .65s linear infinite;
    position: absolute;
    right: 18px;
    top: 50%;
    margin-top: -9px;
}

.btn-primary.loading .btn-spinner { display: block; }
.btn-primary.loading .btn-label { opacity: .7; }

@keyframes spin {
    to { transform: rotate(360deg); }
}


/* ── Links ── */
.login-link {
    text-align: center;
    margin-top: 14px;
    font-size: 14px;
    color: var(--text-secondary);
}

.login-link a {
    color: var(--accent);
    text-decoration: none;
}

.login-links {
    display: flex;
    flex-direction: column;
}


/* ── Legal ── */
.auth-legal {
    margin-top: 32px;
    font-size: 12px;
    color: var(--text-tertiary);
    text-align: center;
}


/* ── WTT Brand Footer ── */
.auth-brand-footer {
    margin-top: 20px;
    display: flex;
    justify-content: center;
}

.auth-brand-logo {
    height: 40px;
    width: auto;
    object-fit: contain;
    opacity: .7;
    transition: opacity .2s;
}

.auth-brand-logo.logo-light { display: none; }

[data-theme="dark"] .auth-brand-logo.logo-dark  { display: none; }
[data-theme="dark"] .auth-brand-logo.logo-light { display: block; opacity: .7; }


/* ── Theme Toggle ── */
.btn-theme {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 50%;
    transition: background .2s, color .2s;
}

.btn-theme:active { background: var(--surface); }
.btn-theme svg { width: 20px; height: 20px; }

.theme-toggle-login {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 10;
}


/* ── Responsive ── */
@media (max-width: 480px) {
    .input-row { flex-direction: column; gap: 12px; }
    .login-brand h1 { font-size: 24px; }
}


/* ── Hidden ── */
.hidden { display: none !important; }
