/* ============================================================
   Challenge Circle — main.css
   Design tokens, reset, glass system, layout, buttons, type
   ============================================================ */

/* ── CSS Variables (Design Tokens) ──────────────────────────── */
:root {
    /* Brand Colours */
    --purple:        #8b5cf6;
    --purple-deep:   #6d28d9;
    --purple-light:  #a78bfa;
    --purple-faint:  #c4b5fd;
    --gold:          #f59e0b;
    --gold-light:    #fbbf24;
    --gold-deep:     #d97706;

    /* Backgrounds */
    --dark-bg:       #05020a;
    --dark-surface:  #0a0612;
    --dark-border:   rgba(255, 255, 255, 0.05);

    /* Glass System */
    --glass-bg:          rgba(139, 92, 246, 0.04);
    --glass-border:      rgba(139, 92, 246, 0.12);
    --glass-gold-bg:     rgba(245, 158, 11, 0.05);
    --glass-gold-border: rgba(245, 158, 11, 0.15);

    /* Typography */
    --font:          'Plus Jakarta Sans', sans-serif;

    /* Spacing */
    --gap-sm:   12px;
    --gap:      24px;
    --gap-lg:   48px;

    /* Radii */
    --radius-sm:  12px;
    --radius:     20px;
    --radius-lg:  32px;
    --radius-xl:  40px;
    --radius-pill: 999px;

    /* Shadows */
    --shadow-purple: 0 0 30px rgba(139, 92, 246, 0.25);
    --shadow-gold:   0 0 30px rgba(245, 158, 11, 0.30);

    /* Sidebar */
    --sidebar-width: 260px;
    --nav-height:    80px;
}

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

html { scroll-behavior: smooth; }

body {
    font-family: var(--font);
    background-color: var(--dark-bg);
    color: #ffffff;
    overflow-x: hidden;
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: var(--font); }
input, select, textarea {
    font-family: var(--font);
    color: #ffffff;
    background: transparent;
    border: none;
    outline: none;
}
ul, ol { list-style: none; }

/* ── Scrollbar ────────────────────────────────────────────────── */
::-webkit-scrollbar              { width: 5px; height: 5px; }
::-webkit-scrollbar-track        { background: transparent; }
::-webkit-scrollbar-thumb        { background: rgba(139,92,246,0.3); border-radius: var(--radius-pill); }
::-webkit-scrollbar-thumb:hover  { background: rgba(139,92,246,0.5); }

/* ── Glass System ─────────────────────────────────────────────── */
.glass {
    background:    var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
}
.glass-gold {
    background:    var(--glass-gold-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-gold-border);
}
.glass-dark {
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--dark-border);
}

/* ── Gradient Text ────────────────────────────────────────────── */
.text-purple-gradient {
    background: linear-gradient(135deg, var(--purple-light), var(--purple), var(--purple-faint));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.text-gold-gradient {
    background: linear-gradient(135deg, var(--gold-light), var(--gold), var(--gold-deep));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ── Glows ────────────────────────────────────────────────────── */
.purple-glow { box-shadow: var(--shadow-purple); }
.gold-glow   { box-shadow: var(--shadow-gold); }

/* ── Layout ───────────────────────────────────────────────────── */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 var(--gap);
}
.container-sm {
    max-width: 768px;
    margin: 0 auto;
    padding: 0 var(--gap);
}
.section { padding: 112px 0; }
.section-sm { padding: 64px 0; }

/* Grid helpers */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--gap); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gap); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--gap); }
@media (max-width: 1024px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* Flex helpers */
.flex          { display: flex; }
.flex-col      { flex-direction: column; }
.items-center  { align-items: center; }
.items-start   { align-items: flex-start; }
.items-end     { align-items: flex-end; }
.justify-center    { justify-content: center; }
.justify-between   { justify-content: space-between; }
.justify-end       { justify-content: flex-end; }
.flex-1        { flex: 1; }
.flex-wrap     { flex-wrap: wrap; }
.gap-sm        { gap: var(--gap-sm); }
.gap           { gap: var(--gap); }
.gap-lg        { gap: var(--gap-lg); }

/* ── Typography ───────────────────────────────────────────────── */
.text-xs    { font-size: 11px; }
.text-sm    { font-size: 13px; }
.text-base  { font-size: 15px; }
.text-lg    { font-size: 18px; }
.text-xl    { font-size: 22px; }
.text-2xl   { font-size: 28px; }
.text-3xl   { font-size: 36px; }
.text-4xl   { font-size: 48px; }
.text-5xl   { font-size: 60px; }
.text-hero  { font-size: clamp(42px, 8vw, 96px); }

.font-medium  { font-weight: 500; }
.font-bold    { font-weight: 700; }
.font-black   { font-weight: 800; }
.font-heavy   { font-weight: 900; }

.uppercase       { text-transform: uppercase; }
.tracking-wide   { letter-spacing: 0.05em; }
.tracking-wider  { letter-spacing: 0.1em; }
.tracking-widest { letter-spacing: 0.2em; }
.tracking-tight  { letter-spacing: -0.03em; }
.tracking-tighter{ letter-spacing: -0.05em; }

.leading-tight   { line-height: 1.1; }
.leading-relaxed { line-height: 1.7; }

.text-center  { text-align: center; }
.text-left    { text-align: left; }
.text-right   { text-align: right; }
.truncate     { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

/* Colour helpers */
.text-white       { color: #ffffff; }
.text-gray        { color: #9ca3af; }
.text-gray-dark   { color: #6b7280; }
.text-purple      { color: var(--purple); }
.text-purple-light{ color: var(--purple-light); }
.text-gold        { color: var(--gold); }
.text-gold-light  { color: var(--gold-light); }
.text-green       { color: #34d399; }
.text-red         { color: #f87171; }
.text-blue        { color: #60a5fa; }

/* ── Buttons ──────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    border-radius: var(--radius);
    padding: 14px 28px;
    font-family: var(--font);
    font-weight: 800;
    font-size: 15px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    white-space: nowrap;
    text-decoration: none;
}
.btn:active { transform: scale(0.96); }

.btn-primary {
    background: var(--purple);
    color: #ffffff;
    box-shadow: var(--shadow-purple);
}
.btn-primary:hover { background: var(--purple-deep); transform: scale(1.03); }

.btn-gold {
    background: var(--gold);
    color: #000000;
    box-shadow: var(--shadow-gold);
}
.btn-gold:hover { background: var(--gold-light); transform: scale(1.03); }

.btn-ghost {
    background: rgba(255,255,255,0.05);
    color: #ffffff;
    border: 1px solid rgba(255,255,255,0.1);
}
.btn-ghost:hover { background: rgba(255,255,255,0.09); }

.btn-glass {
    background: var(--glass-bg);
    color: var(--purple-light);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(12px);
}
.btn-glass:hover { background: rgba(139,92,246,0.12); }

.btn-sm { padding: 9px 18px; font-size: 12px; border-radius: var(--radius-sm); }
.btn-lg { padding: 18px 40px; font-size: 17px; border-radius: var(--radius-lg); }
.btn-pill { border-radius: var(--radius-pill); }
.btn-block { display: flex; width: 100%; }

.btn-danger {
    background: rgba(239,68,68,0.15);
    color: #f87171;
    border: 1px solid rgba(239,68,68,0.25);
}
.btn-danger:hover { background: rgba(239,68,68,0.25); }

/* ── Form Inputs ──────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label {
    font-size: 12px;
    font-weight: 700;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.form-input {
    width: 100%;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius);
    padding: 13px 18px;
    font-size: 14px;
    color: #ffffff;
    font-family: var(--font);
    transition: border-color 0.2s ease;
}
.form-input:focus {
    border-color: var(--purple);
    background: rgba(139,92,246,0.06);
    outline: none;
}
.form-input::placeholder { color: #6b7280; }
.form-input-gold:focus   { border-color: var(--gold); }

.form-select {
    width: 100%;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius);
    padding: 13px 18px;
    font-size: 14px;
    color: #ffffff;
    font-family: var(--font);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7280' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
}
.form-select:focus { border-color: var(--purple); outline: none; }
.form-select option { background: #0a0612; }

.form-error { font-size: 12px; color: #f87171; margin-top: 4px; }
.form-hint  { font-size: 12px; color: #6b7280; margin-top: 4px; }

/* ── Progress Bars ─────────────────────────────────────────────── */
.progress-track {
    width: 100%;
    height: 6px;
    background: rgba(255,255,255,0.05);
    border-radius: var(--radius-pill);
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    border-radius: var(--radius-pill);
    background: linear-gradient(90deg, var(--purple), var(--purple-light));
    transition: width 1.5s ease;
    width: 0;
}
.progress-fill-gold {
    background: linear-gradient(90deg, var(--gold-deep), var(--gold-light));
}
.progress-fill-green {
    background: linear-gradient(90deg, #065f46, #34d399);
}

/* ── Badges / Pills ────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}
.badge-purple { background: rgba(139,92,246,0.2); color: var(--purple-light); border: 1px solid rgba(139,92,246,0.3); }
.badge-gold   { background: rgba(245,158,11,0.2); color: var(--gold-light);   border: 1px solid rgba(245,158,11,0.3); }
.badge-green  { background: rgba(52,211,153,0.15); color: #34d399; border: 1px solid rgba(52,211,153,0.25); }
.badge-red    { background: rgba(248,113,113,0.15); color: #f87171; border: 1px solid rgba(248,113,113,0.25); }
.badge-gray   { background: rgba(156,163,175,0.15); color: #9ca3af; border: 1px solid rgba(156,163,175,0.2); }
.badge-blue   { background: rgba(96,165,250,0.15);  color: #60a5fa; border: 1px solid rgba(96,165,250,0.25); }

/* Plan badges */
.badge-pico    { background: rgba(156,163,175,0.2); color: #d1d5db; }
.badge-plus    { background: rgba(139,92,246,0.2);  color: var(--purple-light); }
.badge-premium { background: rgba(245,158,11,0.2);  color: var(--gold-light); }

/* ── Cards ─────────────────────────────────────────────────────── */
.card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 32px;
    backdrop-filter: blur(16px);
    transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}
.card:hover {
    transform: translateY(-4px);
    border-color: rgba(139,92,246,0.4);
    box-shadow: 0 20px 60px rgba(139,92,246,0.1);
}
.card-gold {
    background: var(--glass-gold-bg);
    border: 1px solid var(--glass-gold-border);
}
.card-flat { background: rgba(255,255,255,0.03); border: 1px solid var(--dark-border); }

/* ── Section Labels ────────────────────────────────────────────── */
.section-eyebrow {
    font-size: 11px;
    font-weight: 900;
    color: var(--purple-light);
    text-transform: uppercase;
    letter-spacing: 0.3em;
    text-align: center;
    display: block;
    margin-bottom: 16px;
}
.section-eyebrow-gold { color: var(--gold); }

/* ── Stat Numbers ──────────────────────────────────────────────── */
.stat-number {
    font-size: 2.4rem;
    font-weight: 900;
    background: linear-gradient(135deg, #fff, var(--purple-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
}
.stat-number-gold {
    font-size: 2.4rem;
    font-weight: 900;
    background: linear-gradient(135deg, var(--gold-light), var(--gold));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
}

/* ── Dividers ──────────────────────────────────────────────────── */
.divider      { height: 1px; background: var(--dark-border); width: 100%; }
.divider-glow { background: linear-gradient(90deg, transparent, var(--purple), transparent); }

/* ── Avatar Initials ───────────────────────────────────────────── */
.avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 900;
    flex-shrink: 0;
    background: rgba(139,92,246,0.4);
    color: #fff;
}
.avatar-lg { width: 56px; height: 56px; font-size: 18px; }
.avatar-sm { width: 28px; height: 28px; font-size: 10px; }

/* Avatar colour variants */
.av-purple  { background: rgba(139,92,246,0.4); }
.av-indigo  { background: rgba(99,102,241,0.4); }
.av-fuchsia { background: rgba(217,70,239,0.4); }
.av-violet  { background: rgba(167,139,250,0.4); }
.av-blue    { background: rgba(59,130,246,0.4); }
.av-pink    { background: rgba(236,72,153,0.4); }
.av-cyan    { background: rgba(6,182,212,0.4); }
.av-teal    { background: rgba(20,184,166,0.4); }
.av-amber   { background: rgba(245,158,11,0.4); }

/* ── Utility Classes ────────────────────────────────────────────── */
.hidden    { display: none !important; }
.invisible { visibility: hidden; }
.relative  { position: relative; }
.absolute  { position: absolute; }
.fixed     { position: fixed; }
.inset-0   { top: 0; right: 0; bottom: 0; left: 0; }
.w-full    { width: 100%; }
.h-full    { height: 100%; }
.overflow-hidden { overflow: hidden; }
.overflow-y-auto { overflow-y: auto; }
.pointer-events-none { pointer-events: none; }
.z-10  { z-index: 10; }
.z-50  { z-index: 50; }
.z-100 { z-index: 100; }

.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-5 { margin-top: 20px; }
.mt-6 { margin-top: 24px; }
.mt-8 { margin-top: 32px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-5 { margin-bottom: 20px; }
.mb-6 { margin-bottom: 24px; }
.mb-8 { margin-bottom: 32px; }
.ml-auto { margin-left: auto; }
.mr-auto { margin-right: auto; }
.mx-auto { margin-left: auto; margin-right: auto; }

.p-2  { padding: 8px; }
.p-3  { padding: 12px; }
.p-4  { padding: 16px; }
.p-5  { padding: 20px; }
.p-6  { padding: 24px; }
.p-8  { padding: 32px; }
.px-4 { padding-left: 16px; padding-right: 16px; }
.px-6 { padding-left: 24px; padding-right: 24px; }
.py-2 { padding-top: 8px;  padding-bottom: 8px; }
.py-3 { padding-top: 12px; padding-bottom: 12px; }
.py-4 { padding-top: 16px; padding-bottom: 16px; }

/* ── Canvas backgrounds ─────────────────────────────────────────── */
#bg-canvas,
#confetti-canvas {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 0;
}
#confetti-canvas { z-index: 9998; }

/* ── Flash messages ─────────────────────────────────────────────── */
.flash {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 20px;
}
.flash-success { background: rgba(52,211,153,0.1); border: 1px solid rgba(52,211,153,0.25); color: #34d399; }
.flash-error   { background: rgba(248,113,113,0.1); border: 1px solid rgba(248,113,113,0.25); color: #f87171; }
.flash-info    { background: rgba(139,92,246,0.1);  border: 1px solid rgba(139,92,246,0.25);  color: var(--purple-light); }

/* ── Responsive helpers ──────────────────────────────────────────── */
@media (max-width: 768px) {
    .hide-mobile { display: none !important; }
    .section { padding: 64px 0; }
    .text-hero { font-size: 40px; }
}
@media (min-width: 769px) {
    .hide-desktop { display: none !important; }
}
