/* ============================================================
   OpenQuiz — Design System v2
   Elegante, divertido, responsivo
   ============================================================ */

/* ── Tokens ─────────────────────────────────────────────────── */
:root {
    --bg:        #0b1120;
    --bg-subtle: #111827;
    --panel:     #151d30;
    --panel-alt: rgba(23, 32, 54, 0.72);
    --border:    rgba(255, 255, 255, 0.10);
    --border-hi: rgba(167, 139, 250, 0.40);
    --text:      #f1f5f9;
    --text-soft: #94a3b8;
    --muted:     #64748b;
    --primary:   #7c3aed;
    --primary-l: #a78bfa;
    --primary-d: #5b21b6;
    --accent:    #06b6d4;
    --danger:    #ef4444;
    --success:   #22c55e;
    --warning:   #f59e0b;
    --radius:    14px;
    --radius-sm: 10px;
    --radius-xs: 6px;
    --shadow:    0 8px 32px rgba(0,0,0,.28);
    --shadow-sm: 0 4px 14px rgba(0,0,0,.18);
    --transition: .22s cubic-bezier(.4,0,.2,1);
    --navbar-h:  64px;
    --font:      'Inter', system-ui, -apple-system, sans-serif;
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
body {
    margin: 0; padding: 0;
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    background-image:
        radial-gradient(ellipse 80% 60% at 10% 0%, rgba(124,58,237,.35), transparent),
        radial-gradient(ellipse 60% 50% at 95% 5%, rgba(6,182,212,.22), transparent),
        radial-gradient(ellipse 50% 40% at 50% 100%, rgba(124,58,237,.12), transparent);
    background-attachment: fixed;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary-l); text-decoration: none; transition: color var(--transition); }
a:hover { color: #c4b5fd; }
img { max-width: 100%; height: auto; }
h1,h2,h3,h4 { margin-top: 0; font-weight: 800; line-height: 1.2; }
h1 { font-size: clamp(1.5rem, 4vw, 2.2rem); }
h2 { font-size: clamp(1.15rem, 3vw, 1.55rem); }
h3 { font-size: 1.1rem; }
p { margin: 0 0 .75rem; }
ul,ol { padding-left: 1.25rem; }

/* ── Navbar ─────────────────────────────────────────────────── */
.navbar {
    position: fixed; top: 0; left: 0; right: 0;
    z-index: 1000;
    height: var(--navbar-h);
    background: rgba(11,17,32,.72);
    backdrop-filter: blur(14px) saturate(1.4);
    -webkit-backdrop-filter: blur(14px) saturate(1.4);
    border-bottom: 1px solid var(--border);
    transition: background var(--transition), box-shadow var(--transition);
}
.navbar.scrolled {
    background: rgba(11,17,32,.92);
    box-shadow: 0 2px 20px rgba(0,0,0,.35);
}
.navbar-inner {
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 20px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.navbar-brand {
    display: flex; align-items: center; gap: 8px;
    font-weight: 900; font-size: 1.25rem;
    color: var(--text); text-decoration: none;
}
.navbar-brand:hover { color: var(--text); }
.brand-icon {
    font-size: 1.4rem;
    filter: drop-shadow(0 0 6px rgba(124,58,237,.6));
}
.navbar-links {
    display: flex; align-items: center; gap: 6px;
}
.navbar-links a {
    padding: 7px 14px;
    border-radius: var(--radius-sm);
    font-weight: 600; font-size: .875rem;
    color: var(--text-soft);
    transition: color var(--transition), background var(--transition);
}
.navbar-links a:hover {
    color: var(--text);
    background: rgba(255,255,255,.06);
}
.nav-btn {
    border: 1.5px solid transparent !important;
}
.nav-btn--outline {
    border-color: var(--border-hi) !important;
    color: var(--primary-l) !important;
}
.nav-btn--outline:hover {
    background: rgba(124,58,237,.12) !important;
    color: #c4b5fd !important;
}
.nav-btn--primary {
    background: var(--primary) !important;
    color: #fff !important;
}
.nav-btn--primary:hover {
    background: var(--primary-d) !important;
}

/* Hamburger toggle */
.navbar-toggle {
    display: none;
    background: none; border: none; cursor: pointer;
    padding: 6px; flex-direction: column; gap: 5px;
}
.navbar-toggle span {
    display: block; width: 22px; height: 2px;
    background: var(--text); border-radius: 2px;
    transition: transform var(--transition), opacity var(--transition);
}
.navbar-toggle.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.navbar-toggle.active span:nth-child(2) { opacity: 0; }
.navbar-toggle.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── Page Content ───────────────────────────────────────────── */
.page-content {
    padding-top: calc(var(--navbar-h) + 24px);
    padding-bottom: 48px;
    min-height: calc(100vh - 200px);
}
.page-content.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
}
.page-content.narrow .container { max-width: 520px; }

.container {
    max-width: 1040px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

/* ── Cards ──────────────────────────────────────────────────── */
.card {
    background: var(--panel-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: var(--shadow-sm);
    transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}
.card:hover {
    border-color: var(--border-hi);
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
}

.action { text-decoration: none; color: var(--text); display: block; }
.action:hover { color: var(--text); transform: translateY(-4px); box-shadow: var(--shadow); }

/* Card with icon */
.card-icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 1.4rem;
    margin-bottom: 12px;
}
.card-icon.purple { background: rgba(124,58,237,.2); }
.card-icon.cyan   { background: rgba(6,182,212,.2); }
.card-icon.green  { background: rgba(34,197,94,.2); }

/* ── Hero Section ───────────────────────────────────────────── */
.hero-headline {
    font-size: clamp(2rem, 5vw, 3.2rem);
    font-weight: 900;
    line-height: 1.1;
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--text) 40%, var(--primary-l) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.hero-sub {
    font-size: clamp(1rem, 2.5vw, 1.25rem);
    color: var(--text-soft);
    max-width: 540px;
    margin-bottom: 32px;
}
.hero-actions {
    display: flex; gap: 12px; flex-wrap: wrap;
    margin-bottom: 48px;
}

/* ── Slogan / Subtitle ──────────────────────────────────────── */
.slogan {
    font-size: 1.1rem;
    color: var(--primary-l);
    font-weight: 600;
    letter-spacing: .02em;
}
.subtitle {
    color: var(--text-soft);
    margin-bottom: 24px;
}

/* ── Forms ───────────────────────────────────────────────────── */
.form-card label {
    display: block;
    margin-bottom: 16px;
    font-weight: 700;
    font-size: .9rem;
    color: var(--text-soft);
}
input, textarea, select {
    width: 100%;
    margin-top: 6px;
    border-radius: var(--radius-sm);
    border: 1.5px solid rgba(255,255,255,.1);
    background: rgba(17,24,39,.7);
    color: var(--text);
    padding: 11px 14px;
    font-family: var(--font);
    font-size: .9rem;
    transition: border-color var(--transition), box-shadow var(--transition);
}
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(124,58,237,.18);
}
textarea { resize: vertical; }
select { cursor: pointer; }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    background: rgba(255,255,255,.08);
    color: var(--text);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 18px;
    font-family: var(--font);
    font-weight: 700;
    font-size: .875rem;
    cursor: pointer;
    transition: transform var(--transition), background var(--transition), border-color var(--transition), box-shadow var(--transition);
    text-decoration: none;
    white-space: nowrap;
}
.btn:hover {
    transform: translateY(-1px);
    background: rgba(255,255,255,.12);
    border-color: rgba(255,255,255,.18);
}
.btn.primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    box-shadow: 0 4px 14px rgba(124,58,237,.35);
}
.btn.primary:hover {
    background: var(--primary-d);
    box-shadow: 0 6px 20px rgba(124,58,237,.45);
}
.btn.danger {
    background: var(--danger);
    border-color: var(--danger);
    color: #fff;
}
.btn.danger:hover { filter: brightness(1.1); }
.btn.mini {
    padding: 5px 10px;
    font-size: 12px;
    border-radius: var(--radius-xs);
}
.btn.large {
    padding: 14px 28px;
    font-size: 1rem;
    border-radius: var(--radius);
}

/* ── Pill / Badge ────────────────────────────────────────────── */
.pill {
    background: rgba(124,58,237,.2);
    border: 1px solid rgba(124,58,237,.3);
    border-radius: 999px;
    padding: 6px 14px;
    font-size: .8rem;
    font-weight: 700;
    color: var(--primary-l);
}

/* ── Status message ──────────────────────────────────────────── */
.status {
    color: var(--warning);
    min-height: 20px;
    font-size: .875rem;
    margin-top: 8px;
}

/* ── Link ────────────────────────────────────────────────────── */
.link { color: var(--primary-l); font-weight: 600; }
.link:hover { color: #c4b5fd; text-decoration: underline; }

.hidden { display: none !important; }

/* ── Topbar (legacy support for pages not yet using layout) ─── */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}
.topbar > div {
    display: flex;
    gap: 12px;
    align-items: center;
}

/* ── Page Title ──────────────────────────────────────────────── */
.page-title {
    margin-bottom: 8px;
}
.page-description {
    color: var(--text-soft);
    margin-bottom: 28px;
    font-size: .95rem;
}

/* ── Question / Game UI ──────────────────────────────────────── */
.question-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}
.timer {
    font-size: 2rem;
    font-weight: 900;
    color: #fde047;
    min-width: 64px;
    text-align: right;
    line-height: 1;
    text-shadow: 0 0 12px rgba(253,224,71,.3);
}

.countdown-wrap { margin-top: 12px; }
.countdown-progress { height: 10px; }
.countdown-note {
    margin: 6px 0 0;
    font-size: .75rem;
    color: var(--muted);
}

.question-image {
    width: 100%;
    max-height: 280px;
    object-fit: contain;
    margin-top: 14px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: rgba(17,24,39,.5);
}

.answer-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(130px, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.btn-answer {
    border: none;
    border-radius: var(--radius);
    padding: 20px 16px;
    color: #fff;
    font-weight: 800;
    font-size: 1rem;
    cursor: pointer;
    transition: transform var(--transition), box-shadow var(--transition), filter var(--transition);
    position: relative;
    overflow: hidden;
}
.btn-answer::after {
    content: '';
    position: absolute; inset: 0;
    background: linear-gradient(180deg, rgba(255,255,255,.12) 0%, transparent 60%);
    pointer-events: none;
}
.btn-answer:hover:not(:disabled) {
    transform: scale(1.03);
    box-shadow: 0 6px 20px rgba(0,0,0,.3);
}
.btn-answer:disabled { opacity: .55; cursor: not-allowed; }

.red    { background: #ef4444; }
.blue   { background: #3b82f6; }
.yellow { background: #eab308; color: #111; }
.green  { background: #22c55e; }
.purple { background: #a855f7; }
.orange { background: #f97316; }

/* QR Code */
.qr {
    width: 140px; height: 140px;
    border-radius: var(--radius-sm);
    background: #fff;
    padding: 8px;
}

/* Host actions */
.host-actions {
    display: flex; gap: 10px; flex-wrap: wrap;
    margin: 14px 0 20px;
}

/* ── Question Builder (Create Quiz) ──────────────────────────── */
.question-item { margin-top: 16px; }

.question-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(200px, 1fr));
    gap: 14px;
}
.question-fields label:first-child {
    grid-column: 1 / -1;
}

.answers {
    margin: 14px 0;
    display: grid;
    gap: 10px;
}
.answer-row {
    display: grid;
    grid-template-columns: 36px 1fr auto;
    gap: 10px;
    align-items: center;
}
.answer-tag {
    width: 36px; height: 36px;
    border-radius: 8px;
    display: inline-flex; align-items: center; justify-content: center;
    background: rgba(124,58,237,.2);
    font-weight: 800;
    font-size: .85rem;
    color: var(--primary-l);
}
.check-inline {
    margin: 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    white-space: nowrap;
    color: var(--text);
}
.check-inline input { width: auto; margin: 0; }

.question-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    flex-wrap: wrap;
}

/* ── Podium ──────────────────────────────────────────────────── */
.podium-item {
    font-size: 1.15rem;
    margin: 10px 0;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    background: rgba(124,58,237,.08);
    border-left: 4px solid var(--primary);
    animation: rise .5s ease;
}
@keyframes rise {
    from { transform: translateY(12px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}

/* ── Progress bar ────────────────────────────────────────────── */
.progress {
    width: 100%;
    height: 8px;
    background: rgba(255,255,255,.08);
    border-radius: 999px;
    overflow: hidden;
}
.progress > span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: 999px;
    transition: width .3s ease;
}

/* ── Data Table ──────────────────────────────────────────────── */
.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    margin-top: 8px;
}
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .85rem;
}
.data-table th,
.data-table td {
    padding: 12px 14px;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid var(--border);
}
.data-table th {
    color: var(--primary-l);
    font-weight: 700;
    background: rgba(124,58,237,.06);
    position: sticky;
    top: 0;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td {
    background: rgba(255,255,255,.03);
}

/* ── Footer ──────────────────────────────────────────────────── */
.site-footer {
    background: rgba(11,17,32,.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid var(--border);
    padding: 40px 20px 28px;
    text-align: center;
}
.footer-inner {
    max-width: 1040px;
    margin: 0 auto;
}
.footer-brand {
    font-weight: 900;
    font-size: 1.2rem;
    margin-bottom: 6px;
}
.footer-tagline {
    color: var(--text-soft);
    font-size: .9rem;
    margin-bottom: 16px;
}
.footer-links {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}
.footer-links a {
    color: var(--muted);
    font-size: .85rem;
    font-weight: 600;
    transition: color var(--transition);
}
.footer-links a:hover { color: var(--primary-l); }
.footer-copy {
    color: var(--muted);
    font-size: .75rem;
    margin-bottom: 0;
}

/* ── Stat Cards / Info Grid ──────────────────────────────────── */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}
.stat-card {
    background: rgba(255,255,255,.04);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px;
    text-align: center;
}
.stat-value {
    font-size: 1.6rem;
    font-weight: 900;
    color: var(--primary-l);
}
.stat-label {
    font-size: .75rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-top: 4px;
}

/* ── Steps / How it works ────────────────────────────────────── */
.steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    counter-reset: step;
    margin-top: 12px;
}
.step {
    counter-increment: step;
    position: relative;
    padding: 20px 18px 18px;
    background: rgba(255,255,255,.03);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-align: center;
}
.step::before {
    content: counter(step);
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-weight: 800;
    font-size: .85rem;
    margin-bottom: 10px;
}
.step-text {
    font-size: .9rem;
    color: var(--text-soft);
}

/* ── Section ─────────────────────────────────────────────────── */
.section-title {
    font-size: 1rem;
    color: var(--primary-l);
    font-weight: 700;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 768px) {
    .navbar-toggle { display: flex; }
    .navbar-links {
        display: none;
        position: absolute;
        top: var(--navbar-h);
        left: 0; right: 0;
        background: rgba(11,17,32,.96);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        border-bottom: 1px solid var(--border);
        flex-direction: column;
        padding: 12px 20px 20px;
        gap: 4px;
    }
    .navbar-links.open { display: flex; }
    .navbar-links a {
        padding: 12px 16px;
        border-radius: var(--radius-sm);
        font-size: 1rem;
        width: 100%;
    }

    .page-content { padding-top: calc(var(--navbar-h) + 16px); }
    .card { padding: 18px 16px; }

    .answer-grid { grid-template-columns: 1fr; }
    .question-fields { grid-template-columns: 1fr; }
    .answer-row { grid-template-columns: 1fr; }

    .hero-headline { font-size: clamp(1.6rem, 7vw, 2.4rem); }
    .hero-actions { flex-direction: column; }
    .hero-actions .btn { width: 100%; justify-content: center; }

    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .steps { grid-template-columns: 1fr; }
    .card-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    :root { --navbar-h: 56px; }
    body { font-size: 14px; }
    .container { padding: 0 14px; }
    .card { padding: 16px 14px; margin-bottom: 14px; }
    .btn { padding: 9px 14px; font-size: .8rem; }
    .btn.large { padding: 12px 20px; font-size: .9rem; }
    .stat-grid { grid-template-columns: 1fr; }
    .host-actions { flex-direction: column; }
    .host-actions .btn { width: 100%; justify-content: center; }
}

/* ── Animations ──────────────────────────────────────────────── */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}
.fade-in-up {
    animation: fadeInUp .5s ease both;
}
.fade-in-up-d1 { animation-delay: .1s; }
.fade-in-up-d2 { animation-delay: .2s; }
.fade-in-up-d3 { animation-delay: .3s; }
.fade-in-up-d4 { animation-delay: .4s; }

/* ── Scrollbar ───────────────────────────────────────────────── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,.12);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.22); }

/* ── Selection ───────────────────────────────────────────────── */
::selection {
    background: rgba(124,58,237,.3);
    color: #fff;
}
