/* ============================================================
 * Pattaya Bar Simulator — Dark theme design tokens
 *
 * Drop this into base.html as a <style> block, or import it
 * before mobile.css / your existing stylesheet. These tokens
 * are additive — they don't redefine the existing --mc-*
 * mobile tokens, they sit alongside them.
 *
 * Token prefix: --pbs- (Pattaya Bar Sim)
 * Surfaces are dark-first; the existing light mobile theme
 * remains untouched on /mobile-*.
 * ============================================================ */

:root {
    /* Surfaces */
    --pbs-bg:           #0b0f17;
    --pbs-bg-2:         #10151f;
    --pbs-card:         #161c28;
    --pbs-inset:        #1c2331;
    --pbs-border:       #232b3b;
    --pbs-border-soft:  #1c2331;

    /* Text */
    --pbs-text:         #f1f4f9;
    --pbs-text-2:       #a3afc2;
    --pbs-muted:        #6b7689;

    /* Brand */
    --pbs-accent:       #4f9dff;
    --pbs-accent-2:     #7ab8ff;
    --pbs-accent-grad:  linear-gradient(135deg, #4f9dff, #7ab8ff);

    /* Semantic */
    --pbs-gold:         #f0c75a;   /* money — bold, tabular, ฿ prefix */
    --pbs-green:        #34d671;   /* present, live */
    --pbs-green-deep:   #6ee7a8;   /* trend up */
    --pbs-red:          #ff5c5c;   /* not present, hostile */
    --pbs-purple:       #a279ff;   /* prestige */
    --pbs-orange:       #ffa54a;   /* warning, notoriety */

    /* Radii */
    --pbs-r-sm: 8px;
    --pbs-r-md: 12px;
    --pbs-r-lg: 16px;
    --pbs-r-xl: 22px;
    --pbs-r-pill: 999px;

    /* Shadows */
    --pbs-shadow-sm: 0 1px 2px rgba(0, 0, 0, .25);
    --pbs-shadow-md: 0 8px 24px rgba(0, 0, 0, .35);
    --pbs-shadow-lg: 0 18px 50px rgba(0, 0, 0, .50);
    --pbs-shadow-glow: 0 8px 22px rgba(79, 157, 255, .35);

    /* Type. Noto Sans Thai listed as fallback so ฿ (U+0E3F) renders
       as the proper baht glyph instead of a Latin "B" on systems where
       Inter doesn't ship the Thai range. Per-character fallback means
       Latin chars still use Inter. Mono needs the same fallback for
       any baht-bearing tabular number. */
    --pbs-font: "Inter", "Noto Sans Thai", -apple-system, system-ui, sans-serif;
    --pbs-mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, "Noto Sans Thai", monospace;
}

/* ============================================================
 * Avatar palette — gradient backgrounds keyed by initial.
 * Use .pbs-av plus a tint class. Initial-tinted only, never photo.
 * ============================================================ */
.pbs-av {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; border-radius: 50%;
    color: #fff; font-weight: 800; font-size: 12px; flex-shrink: 0;
    background: linear-gradient(135deg, #5aa9e3, #2a7fd1);
}
.pbs-av-xs { width: 22px; height: 22px; font-size: 9px; }
.pbs-av-sm { width: 26px; height: 26px; font-size: 10px; }
.pbs-av-md { width: 36px; height: 36px; font-size: 13px; }
.pbs-av-lg { width: 56px; height: 56px; font-size: 18px; }

.pbs-av-pink   { background: linear-gradient(135deg, #ff7eb6, #d63384); }
.pbs-av-amber  { background: linear-gradient(135deg, #f3a83a, #d97706); }
.pbs-av-violet { background: linear-gradient(135deg, #a06cd5, #7e3ac9); }
.pbs-av-teal   { background: linear-gradient(135deg, #4dd0c0, #14b8a6); }
.pbs-av-coral  { background: linear-gradient(135deg, #ff9176, #ef5b3b); }
.pbs-av-mint   { background: linear-gradient(135deg, #6ee7a8, #15803d); }
.pbs-av-rose   { background: linear-gradient(135deg, #ff8aa8, #be185d); }
.pbs-av-blue   { background: linear-gradient(135deg, #5aa9e3, #2a7fd1); }
.pbs-av-sun    { background: linear-gradient(135deg, #ffd54a, #b88a00); }

/* Presence — strictly binary. Green = present, Red = not. */
.pbs-presence-wrap { position: relative; display: inline-block; }
.pbs-presence-wrap .pbs-pdot {
    position: absolute; bottom: -1px; right: -1px;
    width: 11px; height: 11px; border-radius: 50%;
    background: var(--pbs-red);
    border: 2px solid var(--pbs-card);
}
.pbs-presence-wrap.present .pbs-pdot { background: var(--pbs-green); }

/* ============================================================
 * Money / numerals
 * ============================================================ */
.pbs-money {
    color: var(--pbs-gold);
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}
.pbs-tnum { font-variant-numeric: tabular-nums; }

/* ============================================================
 * Buttons
 * ============================================================ */
.pbs-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 44px; padding: 0 18px; border-radius: var(--pbs-r-pill);
    font-size: 14px; font-weight: 700; font-family: inherit;
    border: 0; cursor: pointer; text-decoration: none; white-space: nowrap;
    transition: transform .12s, box-shadow .15s;
}
.pbs-btn-primary {
    background: var(--pbs-accent-grad); color: #fff;
    box-shadow: var(--pbs-shadow-glow);
}
.pbs-btn-primary:hover { transform: translateY(-1px); }
.pbs-btn-outline {
    background: var(--pbs-card); color: var(--pbs-text);
    border: 1px solid var(--pbs-border);
}
.pbs-btn-outline:hover { border-color: var(--pbs-accent); color: var(--pbs-accent); }
.pbs-btn-ghost { background: transparent; color: var(--pbs-text); }
.pbs-btn-ghost:hover { background: rgba(255, 255, 255, .05); }
.pbs-btn-danger { background: linear-gradient(135deg, #ff5c5c, #c03030); color: #fff; }
.pbs-btn-discord { background: #5865F2; color: #fff; box-shadow: 0 8px 22px rgba(88, 101, 242, .4); }
.pbs-btn-lg { min-height: 52px; padding: 0 24px; font-size: 15px; }
.pbs-btn-sm { min-height: 32px; padding: 0 12px; font-size: 12px; }

.pbs-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(79, 157, 255, .35);
}

/* ============================================================
 * Pills / status chips
 * ============================================================ */
.pbs-pill {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px; border-radius: var(--pbs-r-pill);
    background: var(--pbs-inset); border: 1px solid var(--pbs-border);
    font-size: 12px; font-weight: 700; color: var(--pbs-text-2);
}
.pbs-pill-live   { background: rgba(52, 214, 113, .12); border-color: rgba(52, 214, 113, .35); color: var(--pbs-green-deep); }
.pbs-pill-gold   { background: rgba(240, 199, 90, .12); border-color: rgba(240, 199, 90, .35); color: var(--pbs-gold); }
.pbs-pill-red    { background: rgba(255, 92, 92, .12);  border-color: rgba(255, 92, 92, .35);  color: var(--pbs-red); }
.pbs-pill-purple { background: rgba(162, 121, 255, .12); border-color: rgba(162, 121, 255, .35); color: var(--pbs-purple); }
.pbs-pill-blue   { background: rgba(79, 157, 255, .12); border-color: rgba(79, 157, 255, .35); color: var(--pbs-accent); }
.pbs-pill-orange { background: rgba(255, 165, 74, .12); border-color: rgba(255, 165, 74, .35); color: var(--pbs-orange); }

.pbs-pulse-dot {
    width: 8px; height: 8px; border-radius: 50%; background: var(--pbs-green);
    box-shadow: 0 0 0 0 rgba(52, 214, 113, .65);
    animation: pbs-pulse 1.6s infinite ease-out; flex-shrink: 0;
}
@keyframes pbs-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(52, 214, 113, .65); }
    70%  { box-shadow: 0 0 0 8px rgba(52, 214, 113, 0); }
    100% { box-shadow: 0 0 0 0 rgba(52, 214, 113, 0); }
}

/* ============================================================
 * Form controls (dark)
 * ============================================================ */
.pbs-input, .pbs-select, .pbs-textarea {
    width: 100%; padding: 10px 12px;
    background: var(--pbs-inset); border: 1px solid var(--pbs-border);
    border-radius: var(--pbs-r-sm); color: var(--pbs-text);
    font-family: inherit; font-size: 14px; outline: none;
    transition: border-color .15s, box-shadow .15s;
}
.pbs-input:focus, .pbs-select:focus, .pbs-textarea:focus {
    border-color: var(--pbs-accent);
    box-shadow: 0 0 0 3px rgba(79, 157, 255, .18);
}
.pbs-input::placeholder { color: var(--pbs-muted); }

/* iOS no-zoom trick — only use on viewports < 768px */
@media (max-width: 767px) {
    .pbs-input, .pbs-select, .pbs-textarea { font-size: 16px !important; }
}

/* Segmented control */
.pbs-segmented {
    display: inline-flex; padding: 3px;
    background: var(--pbs-inset); border: 1px solid var(--pbs-border);
    border-radius: var(--pbs-r-sm); gap: 2px;
}
.pbs-segmented button {
    border: 0; background: transparent; color: var(--pbs-text-2);
    font-family: inherit; font-size: 12px; font-weight: 700;
    padding: 6px 12px; border-radius: 6px; cursor: pointer;
}
.pbs-segmented button.active {
    background: var(--pbs-card); color: var(--pbs-text);
    box-shadow: 0 1px 3px rgba(0, 0, 0, .4);
}

/* ============================================================
 * Cards
 * ============================================================ */
.pbs-card {
    background: var(--pbs-card); border: 1px solid var(--pbs-border);
    border-radius: var(--pbs-r-md); padding: 16px;
}
.pbs-stat-card {
    background: var(--pbs-card); border: 1px solid var(--pbs-border);
    border-radius: var(--pbs-r-md); padding: 14px 16px;
}
.pbs-stat-card .pbs-stat-label {
    font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase;
    font-weight: 800; color: var(--pbs-muted);
}
.pbs-stat-card .pbs-stat-value {
    font-size: 22px; font-weight: 800; letter-spacing: -0.01em;
    line-height: 1.1; margin-top: 6px; font-variant-numeric: tabular-nums;
}
.pbs-stat-card .pbs-stat-trend { font-size: 11px; font-weight: 700; margin-top: 4px; }
.pbs-trend-up { color: var(--pbs-green-deep); }
.pbs-trend-down { color: var(--pbs-red); }

/* Hero card — gradient. Reserve for one-per-screen feature panels. */
.pbs-hero {
    border-radius: var(--pbs-r-lg); padding: 18px;
    background: linear-gradient(135deg, rgba(79, 157, 255, .18), rgba(122, 184, 255, .05));
    border: 1px solid rgba(79, 157, 255, .3);
}
.pbs-hero-gold {
    background: linear-gradient(135deg, rgba(240, 199, 90, .16), rgba(240, 199, 90, .03));
    border-color: rgba(240, 199, 90, .35);
}

/* ============================================================
 * Type — display sizes
 * ============================================================ */
.pbs-h1 { font-size: clamp(2rem, 4vw, 3.5rem); font-weight: 800; letter-spacing: -0.025em; line-height: 1.02; }
.pbs-h2 { font-size: clamp(1.6rem, 3vw, 2.25rem); font-weight: 800; letter-spacing: -0.02em; line-height: 1.05; }
.pbs-h3 { font-size: 22px; font-weight: 800; letter-spacing: -0.015em; }
.pbs-lede { font-size: 18px; line-height: 1.55; color: var(--pbs-text-2); }
.pbs-eyebrow {
    font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase;
    font-weight: 800; color: var(--pbs-text-2);
}
.pbs-gradient-text {
    background: var(--pbs-accent-grad);
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent;
}
