/* ============================================================
   TriviaForge — Global Styles
   Theme: Deep charcoal + orange/amber forge aesthetic
   ============================================================ */

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

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
img, svg { display: block; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }

/* ── Design Tokens ─────────────────────────────────────────── */
:root {
    --bg:          #0a0a0a;
    --bg-2:        #111111;
    --bg-3:        #191919;
    --bg-4:        #222222;
    --bg-5:        #2a2a2a;

    --orange:      #f97316;
    --orange-dark: #ea580c;
    --amber:       #fbbf24;
    --orange-glow: rgba(249, 115, 22, 0.18);
    --orange-dim:  rgba(249, 115, 22, 0.08);
    --orange-border: rgba(249, 115, 22, 0.35);

    --text:        #f0f0f0;
    --text-2:      #9a9a9a;
    --text-3:      #555555;

    --border:      #242424;
    --border-2:    #2e2e2e;

    --radius:      8px;
    --radius-lg:   14px;
    --radius-xl:   20px;

    --shadow-orange: 0 0 40px rgba(249, 115, 22, 0.25);
    --shadow-card:   0 4px 24px rgba(0, 0, 0, 0.4);
}

/* ── Base ───────────────────────────────────────────────────── */
body {
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    padding-top: 64px;
}

h1, h2, h3, h4, h5 {
    font-family: 'Rajdhani', system-ui, sans-serif;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.01em;
}

/* ── Layout Helpers ─────────────────────────────────────────── */
.container {
    max-width: 1160px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.section {
    padding: 6rem 1.5rem;
    max-width: 1160px;
    margin: 0 auto;
}

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.65rem 1.5rem;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 600;
    border: none;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-primary,
a.btn-primary {
    background: var(--orange);
    color: #0f0f0f;
    font-weight: 700;
    box-shadow: 0 0 24px rgba(249, 115, 22, 0.35);
}
.btn-primary:hover {
    background: var(--orange-dark);
    box-shadow: 0 0 36px rgba(249, 115, 22, 0.55);
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    color: var(--text-2);
    border: 1px solid var(--border-2);
}
.btn-outline:hover {
    border-color: var(--orange-border);
    color: var(--text);
}

.btn-lg {
    padding: 0.85rem 2rem;
    font-size: 1rem;
    border-radius: var(--radius-lg);
}

/* ── Navbar ─────────────────────────────────────────────────── */
.nav {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 200;
    height: 64px;
    background: rgba(10, 10, 10, 0.88);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
}

.nav-inner {
    max-width: 1160px;
    margin: 0 auto;
    padding: 0 1.5rem;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-family: 'Rajdhani', sans-serif;
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}
.nav-logo:hover { opacity: 0.85; }
.nav-logo svg { width: 30px; height: 30px; flex-shrink: 0; }
.nav-logo-img { width: 44px; height: 44px; object-fit: contain; flex-shrink: 0; border-radius: 50%; }

.nav-links {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    list-style: none;
}
.nav-links a {
    padding: 0.4rem 0.85rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    color: var(--text-2);
    transition: color 0.15s, background 0.15s;
}
.nav-links a:hover {
    color: var(--text);
    background: var(--bg-4);
}
.nav-links .nav-cta { margin-left: 0.5rem; }
.nav-links a.btn-primary { color: #0f0f0f; font-weight: 700; }

/* ── Hero ───────────────────────────────────────────────────── */
.hero {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 7rem 1.5rem 5rem;
    position: relative;
    overflow: hidden;
    background-image: url('/static/img/banner-web.jpg');
    background-size: cover;
    background-position: center top;
    background-repeat: no-repeat;
}
.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(10, 10, 10, 0.72);
    z-index: 0;
}

.hero-glow {
    position: absolute;
    top: 15%;
    left: 50%;
    transform: translateX(-50%);
    width: 700px;
    height: 700px;
    background: radial-gradient(ellipse, rgba(249,115,22,0.10) 0%, transparent 68%);
    pointer-events: none;
    z-index: 0;
}

.hero-content { position: relative; z-index: 1; }

.hero-logo-mark {
    width: 88px;
    height: 88px;
    margin: 0 auto 1.75rem;
    filter: drop-shadow(0 0 20px rgba(249,115,22,0.5));
}

.hero-tagline {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--orange);
    background: var(--orange-dim);
    border: 1px solid var(--orange-border);
    padding: 0.3rem 0.9rem;
    border-radius: 999px;
    margin-bottom: 1.5rem;
}

.hero h1 {
    font-size: clamp(3.2rem, 9vw, 6.5rem);
    background: linear-gradient(140deg, #ffffff 30%, var(--amber) 70%, var(--orange) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1rem;
}

.hero-sub {
    font-size: 1.1rem;
    color: var(--text-2);
    max-width: 480px;
    margin: 0 auto 2.5rem;
    line-height: 1.7;
}

.hero-btns {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 5rem;
}

.hero-divider {
    width: 100%;
    max-width: 700px;
    margin: 0 auto;
    border: none;
    border-top: 1px solid var(--border);
}

.hero-stats {
    display: flex;
    gap: 3.5rem;
    justify-content: center;
    flex-wrap: wrap;
    padding-top: 3rem;
}

.hero-stat-num {
    font-family: 'Rajdhani', sans-serif;
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--orange);
    line-height: 1;
}
.hero-stat-label {
    font-size: 0.75rem;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-top: 0.25rem;
}

/* ── Section Headers ────────────────────────────────────────── */
.section-label {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--orange);
    margin-bottom: 0.75rem;
}
.section-title {
    font-size: clamp(1.9rem, 4vw, 2.8rem);
    margin-bottom: 0.75rem;
}
.section-sub {
    font-size: 1rem;
    color: var(--text-2);
    max-width: 480px;
    margin: 0 auto;
}

/* ── Feature Cards ──────────────────────────────────────────── */
.features-divider {
    border: none;
    border-top: 1px solid var(--border);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
    gap: 1.25rem;
    margin-top: 3.5rem;
}

.feature-card {
    background: var(--bg-3);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}
.feature-card:hover {
    border-color: var(--orange-border);
    transform: translateY(-3px);
    box-shadow: var(--shadow-card);
}

.feature-icon {
    font-size: 1.75rem;
    margin-bottom: 1rem;
    line-height: 1;
}
.feature-card h3 {
    font-size: 1.15rem;
    margin-bottom: 0.5rem;
}
.feature-card p {
    font-size: 0.875rem;
    color: var(--text-2);
    line-height: 1.65;
}

/* ── Steps ──────────────────────────────────────────────────── */
.steps-section {
    background: var(--bg-2);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.steps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    margin-top: 3.5rem;
}

.step { text-align: center; }

.step-num {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--orange-dim);
    border: 1px solid var(--orange-border);
    color: var(--orange);
    font-family: 'Rajdhani', sans-serif;
    font-size: 1.3rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.1rem;
}
.step h3 { font-size: 1.1rem; margin-bottom: 0.4rem; }
.step p  { font-size: 0.875rem; color: var(--text-2); }

/* ── CTA Band ───────────────────────────────────────────────── */
.cta-band {
    text-align: center;
    padding: 6rem 1.5rem;
    position: relative;
    overflow: hidden;
}
.cta-band::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, rgba(249,115,22,0.07) 0%, transparent 65%);
    pointer-events: none;
}
.cta-band h2 {
    font-size: clamp(2rem, 5vw, 3.2rem);
    margin-bottom: 1rem;
    position: relative;
}
.cta-band p {
    color: var(--text-2);
    margin-bottom: 2.5rem;
    position: relative;
}
.cta-band .btn { position: relative; }

/* ── Footer ─────────────────────────────────────────────────── */
.footer {
    border-top: 1px solid var(--border);
    padding: 2.5rem 1.5rem;
}
.footer-inner {
    max-width: 1160px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1.25rem;
}
.footer-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: 'Rajdhani', sans-serif;
    font-size: 1rem;
    font-weight: 700;
}
.footer-logo svg { width: 22px; height: 22px; }
.footer-links {
    display: flex;
    gap: 1.5rem;
    list-style: none;
}
.footer-links a {
    font-size: 0.82rem;
    color: var(--text-3);
    transition: color 0.15s;
}
.footer-links a:hover { color: var(--text-2); }
.footer-copy {
    font-size: 0.78rem;
    color: var(--text-3);
}

/* ── Page Header (inner pages) ──────────────────────────────── */
.page-header {
    padding: 6.5rem 1.5rem 2.5rem;
    text-align: center;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, rgba(249,115,22,0.04) 0%, transparent 100%);
}
.page-header h1 { font-size: clamp(1.8rem, 4vw, 2.8rem); margin-bottom: 0.4rem; }
.page-header p  { color: var(--text-2); font-size: 0.95rem; }

/* ── Period Tabs ────────────────────────────────────────────── */
.tabs-bar {
    display: flex;
    gap: 0.4rem;
    justify-content: center;
    padding: 1.75rem 1.5rem 0;
    flex-wrap: wrap;
}
.tab {
    padding: 0.45rem 1.1rem;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 600;
    border: 1px solid var(--border-2);
    color: var(--text-2);
    background: transparent;
    transition: all 0.15s;
}
.tab:hover { border-color: var(--orange-border); color: var(--text); }
.tab.active {
    background: var(--orange);
    border-color: var(--orange);
    color: #fff;
}

/* ── Reset Badge ────────────────────────────────────────────── */
.reset-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--orange-dim);
    border: 1px solid var(--orange-border);
    color: var(--orange);
    font-size: 0.78rem;
    font-weight: 500;
    padding: 0.28rem 0.75rem;
    border-radius: 999px;
    margin: 1rem auto 0;
}
.reset-countdown { font-weight: 700; }

/* ── Leaderboard Table ──────────────────────────────────────── */
.leaderboard-wrap {
    max-width: 760px;
    margin: 2.5rem auto 5rem;
    padding: 0 1.5rem;
}

.lb-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-3);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.lb-table thead th {
    text-align: left;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-3);
    padding: 0.9rem 1.25rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg-4);
}

.lb-table tbody td {
    padding: 0.95rem 1.25rem;
    font-size: 0.925rem;
    border-bottom: 1px solid var(--border);
}
.lb-table tbody tr:last-child td { border-bottom: none; }
.lb-table tbody tr:hover td { background: rgba(249,115,22,0.03); }

.rank-cell {
    width: 56px;
    font-family: 'Rajdhani', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-3);
}
.rank-1 { color: #ffd700; font-size: 1.2rem; }
.rank-2 { color: #c0c0c0; font-size: 1.2rem; }
.rank-3 { color: #cd7f32; font-size: 1.2rem; }

.points-cell {
    text-align: right;
    font-family: 'Rajdhani', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--orange);
}

.empty-state {
    text-align: center;
    padding: 5rem 2rem;
    background: var(--bg-3);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 1rem; }
.empty-state h3 { font-size: 1.4rem; margin-bottom: 0.5rem; }
.empty-state p  { font-size: 0.9rem; color: var(--text-2); }

/* ── Pricing ────────────────────────────────────────────────── */
.pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
    max-width: 900px;
    margin: 0 auto;
}

.pricing-card {
    background: var(--bg-3);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 2rem;
    text-align: center;
    position: relative;
    transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.pricing-card:hover {
    transform: translateY(-4px);
    border-color: var(--orange-border);
    box-shadow: var(--shadow-card);
}
.pricing-card.featured {
    border-color: var(--orange);
    background: linear-gradient(160deg, var(--bg-3) 0%, rgba(249,115,22,0.06) 100%);
    box-shadow: 0 0 40px rgba(249,115,22,0.12);
}

.pricing-badge {
    position: absolute;
    top: -13px; left: 50%;
    transform: translateX(-50%);
    background: var(--orange);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 0.2rem 0.85rem;
    border-radius: 999px;
}

.pricing-name {
    font-family: 'Rajdhani', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-2);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 1.25rem;
}

.pricing-price {
    font-family: 'Rajdhani', sans-serif;
    line-height: 1;
    margin-bottom: 0.2rem;
}
.pricing-price .currency { font-size: 1.4rem; vertical-align: top; margin-top: 0.4rem; display: inline-block; }
.pricing-price .amount   { font-size: 3.2rem; font-weight: 700; }
.pricing-period {
    font-size: 0.8rem;
    color: var(--text-3);
    margin-bottom: 2rem;
}

.pricing-features {
    list-style: none;
    text-align: left;
    margin-bottom: 2rem;
}
.pricing-features li {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    font-size: 0.875rem;
    color: var(--text-2);
    padding: 0.55rem 0;
    border-bottom: 1px solid var(--border);
    line-height: 1.5;
}
.pricing-features li:last-child { border-bottom: none; }
.feat-check { color: var(--orange); flex-shrink: 0; margin-top: 1px; }
.feat-x { color: var(--text-3); flex-shrink: 0; margin-top: 1px; }

.pricing-note {
    text-align: center;
    font-size: 0.82rem;
    color: var(--text-3);
    margin-top: 2.5rem;
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
    .nav-links { display: none; }
    .nav-links .nav-user { display: flex; }
    .hero-stats { gap: 2rem; }
    .footer-inner { flex-direction: column; align-items: flex-start; }
    .section { padding: 4rem 1.25rem; }
}

/* ── Stat Card ───────────────────────────────────────────────── */
.stat-card {
  background: var(--surface, #1a1a1a);
  border: 1px solid var(--border, #2a2a2a);
  border-radius: 0.75rem;
  padding: 1.25rem;
  text-align: center;
}
.stat-card .stat-value {
  font-size: 2rem;
  font-weight: 900;
  color: var(--accent, #f97316);
  line-height: 1;
}
.stat-card .stat-label {
  font-size: 0.8rem;
  color: var(--text-muted, #888);
  margin-top: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ── Auth navbar additions ───────────────────────────────── */
.nav-user {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--orange);
}

.nav-avatar-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--orange);
  color: #000;
  font-weight: 700;
  font-size: 0.85rem;
}

.nav-username {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}

.nav-hamburger {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  font-size: 1rem;
  transition: border-color 0.15s;
}
.nav-hamburger:hover { border-color: var(--orange); }

.nav-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  min-width: 180px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  z-index: 200;
  overflow: hidden;
}
.nav-dropdown.open { display: block; }

.nav-dropdown a {
  display: block;
  padding: 0.65rem 1rem;
  font-size: 0.875rem;
  color: var(--text-2);
  text-decoration: none;
  transition: background 0.1s, color 0.1s;
}
.nav-dropdown a:hover { background: var(--bg-3); color: var(--text); }
.nav-dropdown-logout { border-top: 1px solid var(--border); color: #f87171 !important; }
.nav-dropdown-logout:hover { background: rgba(248,113,113,0.1) !important; }

/* ── Stats row highlight ─────────────────────────────────── */
.my-row td { background: rgba(249,115,22,0.12); }
.my-row td:first-child { border-left: 3px solid var(--orange); }
