/* ============================================================
   styles.css — Design System + HUD + Modales base
   Growth City Serious Game
   ============================================================ */

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

/* ══════════════════════════════════════════════════════════
   DESIGN TOKENS
══════════════════════════════════════════════════════════ */
:root {
    /* Paleta base */
    --bg-deep:        #04060e;
    --bg-surface:     #080d12;
    --bg-raise:       rgba(255,255,255,.045);
    --bg-hover:       rgba(255,255,255,.08);

    --border:         rgba(255,255,255,.08);
    --border-strong:  rgba(255,255,255,.16);

    /* Colores de acento */
    --accent:         #2563eb;
    --accent-light:   #60a5fa;
    --gold:           #ffd93d;
    --gold-dim:       rgba(255,217,61,.14);
    --cyan:           #74c8ff;
    --violet:         #a78bfa;
    --green:          #4ade80;
    --green-dark:     #22c55e;
    --red:            #f87171;

    /* Texto */
    --text-primary:   #e8f0f8;
    --text-secondary: #7a9ab8;
    --text-muted:     rgba(255,255,255,.28);

    /* Tipografía */
    --font:     'Inter', system-ui, -apple-system, sans-serif;
    --fs-xs:    11px;
    --fs-sm:    13px;
    --fs-base:  15px;
    --fs-md:    17px;
    --fs-lg:    20px;
    --fs-xl:    26px;

    /* Radios */
    --radius-sm:  8px;
    --radius-md:  12px;
    --radius-lg:  16px;
    --radius-xl:  20px;

    /* Sombras */
    --shadow-panel: 0 8px 28px rgba(0,0,0,.55);
    --shadow-modal: 0 24px 64px rgba(0,0,0,.72);
    --blur:         blur(14px);
}

/* ══════════════════════════════════════════════════════════
   RESET
══════════════════════════════════════════════════════════ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0; padding: 0;
}
body {
    font-family: var(--font);
    background: var(--bg-deep);
    overflow: hidden;
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
}

/* ══════════════════════════════════════════════════════════
   CANVAS
══════════════════════════════════════════════════════════ */
#game-container {
    width: 100vw; height: 100vh;
    position: relative;
}
#gameCanvas {
    display: block; width: 100%; height: 100%;
}

/* ══════════════════════════════════════════════════════════
   HUD — PANELES FLOTANTES
══════════════════════════════════════════════════════════ */

/* Base compartida para todos los paneles */
.hud-panel-base {
    background: rgba(6,9,18,.86);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    box-shadow: var(--shadow-panel);
}

/* ── Info (top-left) ─────────────────────────────────────── */
#hud-container {
    position: fixed;
    top: 14px; left: 14px;
    z-index: 10;
    pointer-events: none;
}
#info-panel {
    background: rgba(6,9,18,.86);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    box-shadow: var(--shadow-panel);
    padding: 13px 15px;
    max-width: 250px;
}
#info-panel h3 {
    font-size: var(--fs-sm);
    font-weight: 700;
    color: var(--cyan);
    margin-bottom: 9px;
    letter-spacing: .2px;
}
#info-panel p {
    font-size: var(--fs-xs);
    color: var(--text-secondary);
    margin: 4px 0;
    line-height: 1.5;
}
#info-panel strong { color: var(--text-primary); font-weight: 600; }
#player-position,
#current-zone      { font-variant-numeric: tabular-nums; }
#artifacts-collected { font-weight: 700; margin-top: 10px !important; }

/* ── Score (top-right) ───────────────────────────────────── */
#score-container {
    position: fixed;
    top: 14px; right: 14px;
    z-index: 10;
    pointer-events: none;
}
#score-panel {
    background: rgba(6,9,18,.86);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    box-shadow: var(--shadow-panel);
    padding: 11px 15px;
    min-width: 138px;
    text-align: center;
    pointer-events: all;
}
#score-panel h3 {
    font-size: var(--fs-xs);
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 7px;
}
#score-value {
    font-size: var(--fs-md);
    font-weight: 800;
    color: var(--gold);
    display: block;
    margin-bottom: 3px;
}
#coins-value {
    font-size: var(--fs-sm);
    font-weight: 600;
    color: var(--gold);
    display: block;
    margin-bottom: 2px;
}

/* ── Inventory (right, justo a la izquierda del score) ───── */
#inventory-container {
    position: fixed;
    top: 14px; right: 163px;
    z-index: 10;
    pointer-events: none;
    max-height: calc(100vh - 28px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
#inventory-panel {
    background: rgba(6,9,18,.86);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    box-shadow: var(--shadow-panel);
    padding: 12px 12px;
    width: 132px;
    pointer-events: all;
}
#inventory-panel h3 {
    font-size: var(--fs-xs);
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 1px;
    text-transform: uppercase;
    text-align: center;
    margin-bottom: 9px;
}
#inventory-items {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 5px;
    margin-bottom: 4px;
}
.inventory-item {
    background: var(--bg-raise);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px 3px;
    text-align: center;
    font-size: 16px;
    cursor: pointer;
    transition: background .18s, transform .14s, border-color .18s;
    animation: slideIn .32s ease both;
    pointer-events: all;
    line-height: 1;
}
.inventory-item:hover {
    background: rgba(116,200,255,.14);
    transform: scale(1.1);
    border-color: rgba(116,200,255,.35);
}

/* ══════════════════════════════════════════════════════════
   ANIMACIONES BASE
══════════════════════════════════════════════════════════ */
@keyframes slideIn {
    from { opacity: 0; transform: translateY(-5px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes popIn {
    from { transform: scale(.86) translateY(14px); opacity: 0; }
    to   { transform: scale(1)   translateY(0);    opacity: 1; }
}

/* ══════════════════════════════════════════════════════════
   BOTÓN PRIMARIO COMPARTIDO
══════════════════════════════════════════════════════════ */
.modal-btn {
    background: linear-gradient(135deg, #1a4a8a, #2563eb);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    padding: 10px 24px;
    font-family: var(--font);
    font-size: var(--fs-sm);
    font-weight: 700;
    cursor: pointer;
    transition: filter .15s, transform .12s;
    letter-spacing: .3px;
    min-height: 40px;
    pointer-events: all;
}
.modal-btn:hover  { filter: brightness(1.16); }
.modal-btn:active { transform: scale(.96); }

.modal-btn-ghost {
    background: rgba(255,255,255,.05);
    color: rgba(255,255,255,.35);
    border: 1px solid rgba(255,255,255,.08);
}
.modal-btn-ghost:hover { filter: brightness(1.3); }

/* ══════════════════════════════════════════════════════════
   MODAL — ARTEFACTO RECOGIDO
══════════════════════════════════════════════════════════ */
#artifact-modal {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.74);
    display: flex; align-items: center; justify-content: center;
    z-index: 100; padding: 20px;
}
#artifact-modal.hidden { display: none; }

.modal-content {
    background: var(--bg-surface);
    border: 1px solid rgba(116,200,255,.2);
    border-radius: var(--radius-xl);
    padding: 34px 30px;
    max-width: 420px; width: 100%;
    text-align: center;
    box-shadow: var(--shadow-modal), 0 0 50px rgba(116,200,255,.1);
    animation: popIn .34s cubic-bezier(.34,1.56,.64,1) both;
    max-height: 88vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.modal-icon {
    font-size: 58px; margin-bottom: 14px;
    line-height: 1; display: block;
    animation: popIn .48s cubic-bezier(.34,1.56,.64,1) .08s both;
}
.modal-content h2 {
    font-size: var(--fs-lg);
    font-weight: 800;
    color: var(--cyan);
    margin-bottom: 10px;
    line-height: 1.2;
}
.modal-content p {
    font-size: var(--fs-sm);
    color: var(--text-secondary);
    line-height: 1.72;
    margin-bottom: 22px;
    text-align: left;
}

/* ══════════════════════════════════════════════════════════
   MODAL — CAJA MISTERIOSA
══════════════════════════════════════════════════════════ */
#mystery-box-modal {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.74);
    display: flex; align-items: center; justify-content: center;
    z-index: 100; padding: 20px;
}
#mystery-box-modal.hidden { display: none; }

.quiz-modal-content {
    background: var(--bg-surface);
    border: 1px solid rgba(167,139,250,.22);
    border-radius: var(--radius-xl);
    padding: 30px 26px;
    max-width: 460px; width: 100%;
    text-align: center;
    box-shadow: var(--shadow-modal), 0 0 44px rgba(167,139,250,.1);
    animation: popIn .34s cubic-bezier(.34,1.56,.64,1) both;
    max-height: 90vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Tag de tipo de caja */
.quiz-box-type {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: var(--fs-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .8px;
    padding: 3px 11px;
    border-radius: 12px;
    margin-bottom: 10px;
    background: rgba(167,139,250,.1);
    color: var(--violet);
    border: 1px solid rgba(167,139,250,.25);
}

.quiz-modal-content h2 {
    font-size: var(--fs-lg);
    font-weight: 800;
    color: var(--violet);
    margin-bottom: 8px;
}
.quiz-modal-content p {
    font-size: var(--fs-sm);
    color: var(--text-secondary);
    line-height: 1.72;
    margin-bottom: 20px;
    font-style: italic;
    text-align: left;
}

/* Grid de opciones — 3 opciones en columna para mayor claridad */
.quiz-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}
.quiz-btn {
    background: rgba(167,139,250,.07);
    border: 1px solid rgba(167,139,250,.22);
    color: var(--text-primary);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: var(--fs-sm);
    font-weight: 600;
    font-family: var(--font);
    pointer-events: all;
    transition: background .18s, transform .12s, border-color .18s;
    line-height: 1.45;
    text-align: left;
}
.quiz-btn:hover {
    background: rgba(167,139,250,.18);
    border-color: rgba(167,139,250,.5);
    transform: translateX(3px);
}
.quiz-btn:active { transform: scale(.97); }

/* Área de pista (shop inline) */
#box-shop-hint-area {
    margin-top: 8px;
    text-align: center;
}

/* ══════════════════════════════════════════════════════════
   ETIQUETA DE PROXIMIDAD DE ARTEFACTO
══════════════════════════════════════════════════════════ */
.drive-proximity-label {
    position: fixed;
    z-index: 20;
    pointer-events: none;
    transform: translate(-50%, -100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    transition: opacity .24s ease;
    will-change: transform, opacity;
}
.dpl-inner {
    background: rgba(6,9,18,.92);
    border: 1px solid rgba(255,255,255,.16);
    border-radius: 18px;
    padding: 5px 12px;
    display: flex; align-items: center; gap: 6px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 4px 14px rgba(0,0,0,.55);
    white-space: nowrap;
}
.dpl-emoji { font-size: 16px; line-height: 1; }
.dpl-name  {
    font-family: var(--font);
    font-size: var(--fs-sm);
    font-weight: 700;
    color: #fff;
    letter-spacing: .2px;
}
.dpl-hint  {
    font-family: var(--font);
    font-size: var(--fs-xs);
    color: rgba(255,255,255,.4);
    text-align: center;
    animation: dpl-pulse 1.3s ease-in-out infinite;
}
.dpl-arrow {
    width: 0; height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid rgba(255,255,255,.15);
    margin-top: -2px;
}
@keyframes dpl-pulse {
    0%,100% { opacity: .4; }
    50%      { opacity: .9; }
}

/* ── Flash de recolección ────────────────────────────────── */
#drive-collect-flash {
    position: fixed; inset: -18px;
    z-index: 19;
    pointer-events: none;
    opacity: 0;
    transition: opacity .18s ease;
    mix-blend-mode: screen;
}
#drive-collect-flash.active {
    opacity: 1;
    transition: opacity .04s ease;
}

/* ══════════════════════════════════════════════════════════
   SALUD DE LA STARTUP — HUD central superior
   (construido dinámicamente en game.js)
══════════════════════════════════════════════════════════ */
#company-health-hud {
    /* Posicionamiento manejado por game.js inline */
    font-family: var(--font);
}

/* ══════════════════════════════════════════════════════════
   TOAST DE MONEDA
══════════════════════════════════════════════════════════ */
#coin-toast {
    font-family: var(--font);
}

/* ══════════════════════════════════════════════════════════
   SCROLLBAR GLOBAL
══════════════════════════════════════════════════════════ */
::-webkit-scrollbar       { width: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,.14);
    border-radius: 3px;
}

/* ══════════════════════════════════════════════════════════
   UTILIDADES
══════════════════════════════════════════════════════════ */
.hidden { display: none !important; }

/* ══════════════════════════════════════════════════════════
   RESPONSIVE — Ajustes básicos desktop/tablet
══════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
    #info-panel        { max-width: 220px; }
    #inventory-panel   { width: 122px; }
    #inventory-container { right: 155px; }
}
@media (max-width: 768px) {
    #info-panel        { padding: 10px 12px; max-width: 200px; }
    #info-panel h3     { font-size: 11px; }
    #info-panel p      { font-size: 10px; }
    #player-position,
    #current-zone      { display: none; }
    #score-container   { top: auto; bottom: 58px; right: 8px; }
    #inventory-container { right: 8px; top: auto; bottom: 130px; }
    #inventory-panel   { width: 116px; }
    #inventory-items   { grid-template-columns: repeat(4,1fr); }
}
