/* ═══════════════════════════════════════════════
   JUICE WORLD — Auth Styles
   Clean solid dark UI. No glass. No blur.
═══════════════════════════════════════════════ */

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

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

:root {
    --bg-base:    #0a0a0a;
    --bg-card:    #111111;
    --bg-input:   #181818;
    --bg-hover:   #1e1e1e;
    --border:     #2a2a2a;
    --border-focus:#7c3aed;
    --accent:     #a855f7;
    --accent-dim: #7c3aed;
    --accent-glow:rgba(168,85,247,0.15);
    --text:       #fafafa;
    --text-muted: #71717a;
    --text-dim:   #3f3f46;
    --danger:     #ef4444;
    --danger-bg:  #1a0a0a;
    --danger-bd:  #3f1010;
    --taken-clr:  #ef4444;
    --success:    #22c55e;
    --radius:     10px;
    --radius-sm:  6px;
    --radius-lg:  14px;
}

html, body {
    width: 100%; min-height: 100vh;
    background: var(--bg-base);
    font-family: 'Inter', sans-serif;
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

/* ── Page layout ─────────────────────────────── */
.auth-page {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr 1fr;
}

/* Left branding panel */
.auth-brand {
    background: #0d0d0d;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 48px;
    position: relative;
    overflow: hidden;
}

.auth-brand::before {
    content: '';
    position: absolute;
    top: -120px; left: -120px;
    width: 400px; height: 400px;
    background: radial-gradient(circle, rgba(168,85,247,0.08) 0%, transparent 70%);
    pointer-events: none;
}

.brand-top { position: relative; z-index: 1; }

.brand-wordmark {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.brand-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--accent);
}

.brand-name {
    font-family: 'Syne', sans-serif;
    font-size: 52px;
    font-weight: 800;
    color: var(--text);
    line-height: 1;
    letter-spacing: -2px;
}

.brand-name span { color: var(--accent); }

.brand-tagline {
    margin-top: 20px;
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.6;
    max-width: 280px;
}

/* Feature list */
.brand-features {
    position: relative; z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.brand-feature {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: var(--text-muted);
}

.feature-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--accent);
    flex-shrink: 0;
}

.brand-bottom {
    position: relative; z-index: 1;
    font-size: 11px;
    color: var(--text-dim);
}

/* Right form panel */
.auth-form-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 40px;
    background: var(--bg-base);
}

.auth-form-box {
    width: 100%;
    max-width: 400px;
}

/* Register form panel is wider */
.auth-page.register-page .auth-form-panel {
    padding: 40px 32px;
    overflow-y: auto;
}

.auth-page.register-page .auth-form-box {
    max-width: 520px;
}

/* ── Form header ─────────────────────────────── */
.form-header { margin-bottom: 36px; }

.form-title {
    font-family: 'Syne', sans-serif;
    font-size: 28px;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.5px;
}

.form-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 6px;
    line-height: 1.5;
}

/* ── Error banner ─────────────────────────────── */
.auth-error {
    background: var(--danger-bg);
    border: 1px solid var(--danger-bd);
    border-radius: var(--radius);
    padding: 12px 14px;
    margin-bottom: 24px;
    color: #f87171;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ── Fields ─────────────────────────────────── */
.auth-form { display: flex; flex-direction: column; gap: 16px; }

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.field-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field-group label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: 0.3px;
}

.field-group label .note {
    color: var(--taken-clr);
    font-weight: 400;
    font-size: 11px;
}

/* Input */
.input-wrap { position: relative; }

.input-wrap input {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    padding: 11px 40px 11px 14px;
    outline: none;
    transition: border-color 0.15s, background 0.15s;
    -webkit-appearance: none;
}

.input-wrap input:focus {
    border-color: var(--border-focus);
    background: #141414;
}

.input-wrap input::placeholder { color: var(--text-dim); }

.toggle-pw {
    position: absolute;
    right: 12px; top: 50%;
    transform: translateY(-50%);
    background: none; border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
    padding: 0;
    line-height: 1;
    transition: color 0.15s;
}
.toggle-pw:hover { color: var(--text); }

/* ── Country section ─────────────────────────── */
.country-section-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.country-section-label .note {
    color: var(--taken-clr);
    font-size: 11px;
    font-weight: 400;
}

.country-picker-grid {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 14px;
    align-items: start;
}

/* Flag card */
.flag-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px 14px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    min-height: 150px;
    justify-content: center;
    transition: border-color 0.2s;
}

.flag-card.active { border-color: var(--accent); }

.flag-card img {
    width: 100px;
    height: auto;
    border-radius: 4px;
    display: block;
}

.flag-empty {
    font-size: 36px;
    opacity: 0.2;
    line-height: 1;
}

.flag-country-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.3;
}

.flag-country-code {
    font-size: 10px;
    color: var(--accent);
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
}

/* Country list panel */
.country-panel {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.country-search-wrap { position: relative; }

.country-search-wrap input {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    padding: 10px 14px 10px 36px;
    outline: none;
    transition: border-color 0.15s;
}

.country-search-wrap input:focus { border-color: var(--border-focus); }
.country-search-wrap input::placeholder { color: var(--text-dim); }

.search-icon {
    position: absolute;
    left: 12px; top: 50%;
    transform: translateY(-50%);
    font-size: 13px;
    pointer-events: none;
    color: var(--text-dim);
}

.country-list {
    max-height: 220px;
    overflow-y: auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
}

.country-list::-webkit-scrollbar { width: 3px; }
.country-list::-webkit-scrollbar-track { background: transparent; }
.country-list::-webkit-scrollbar-thumb { background: #2a2a2a; border-radius: 3px; }

.country-opt {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    cursor: pointer;
    transition: background 0.1s;
    border-bottom: 1px solid transparent;
}

.country-opt:last-child { border-bottom: none; }

.country-opt:not(.is-taken):hover {
    background: var(--bg-hover);
}

.country-opt.is-selected {
    background: rgba(168,85,247,0.1);
}

.country-opt.is-taken {
    opacity: 0.38;
    cursor: not-allowed;
}

.country-opt img {
    width: 26px; height: auto;
    border-radius: 3px;
    flex-shrink: 0;
}

.opt-name {
    flex: 1;
    font-size: 13px;
    color: var(--text);
}

.taken-tag {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--taken-clr);
    background: rgba(239,68,68,0.1);
    border: 1px solid rgba(239,68,68,0.2);
    border-radius: 4px;
    padding: 2px 5px;
}

/* ── Divider ─────────────────────────────────── */
.form-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
}

/* ── Submit button ──────────────────────────── */
.btn-submit {
    width: 100%;
    padding: 13px 24px;
    background: var(--accent);
    border: none;
    border-radius: var(--radius);
    color: #fff;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
    margin-top: 4px;
}

.btn-submit:hover { background: #9333ea; }
.btn-submit:active { transform: scale(0.99); }

/* ── Switch link ─────────────────────────────── */
.auth-switch {
    margin-top: 24px;
    font-size: 13px;
    color: var(--text-muted);
    text-align: center;
}

.auth-switch a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

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

/* ── Responsive ─────────────────────────────── */
@media (max-width: 820px) {
    .auth-page { grid-template-columns: 1fr; }
    .auth-brand { display: none; }
    .auth-form-panel { padding: 40px 24px; }
    .auth-page.register-page .auth-form-box { max-width: 100%; }
}

@media (max-width: 560px) {
    .form-row { grid-template-columns: 1fr; }
    .country-picker-grid { grid-template-columns: 1fr; }
    .flag-card { min-height: auto; flex-direction: row; padding: 14px; }
}
