/* ==========================================================
   NovaStream — tokens
   Paleta: navy profundo + dorado señal + verde "disponible"
   Tipografía: Space Grotesk (display) + Inter (texto)
   Firma: medidor de stock en barras (estilo ecualizador)
   ========================================================== */
:root {
    --bg-deep:      #0f1329;
    --bg-panel:     #161b3a;
    --bg-panel-2:   #1d2348;
    --line:         #2b3163;
    --text:         #e8eaf6;
    --muted:        #939ac2;
    --gold:         #f2b807;
    --gold-dim:     #7a6206;
    --teal:         #2dd4bf;
    --red:          #ef5b5b;
    --radius:       14px;
    --radius-sm:    8px;
    --shadow:       0 20px 50px -20px rgba(0,0,0,.6);
    --font-display: 'Space Grotesk', 'Segoe UI', sans-serif;
    --font-body:    'Inter', 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    background: radial-gradient(ellipse 120% 60% at 50% -10%, #1c2352 0%, var(--bg-deep) 55%);
    color: var(--text);
    font-family: var(--font-body);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { font-family: var(--font-display); margin: 0 0 .4em; letter-spacing: -0.01em; }
p { margin: 0 0 1em; color: var(--muted); }
img { max-width: 100%; display: block; }
.container { width: 92%; max-width: 1180px; margin: 0 auto; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ---------- buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .4em;
    font-family: var(--font-body); font-weight: 600; font-size: .92rem;
    padding: .75em 1.4em; border-radius: 999px; border: 1px solid transparent;
    cursor: pointer; transition: transform .15s ease, background .15s ease, border-color .15s ease;
    white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--gold); color: #14140a; }
.btn-primary:hover { background: #ffcb2b; }
.btn-primary:disabled { background: var(--gold-dim); color: #a5a5a5; cursor: not-allowed; transform: none; }
.btn-outline { background: transparent; border-color: var(--line); color: var(--text); }
.btn-outline:hover { border-color: var(--gold); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); }
.btn-sm { padding: .5em 1em; font-size: .84rem; }
.btn-block { width: 100%; }
.btn-danger { background: transparent; border-color: var(--red); color: var(--red); }
.btn-danger:hover { background: rgba(239,91,91,.1); }

/* ---------- header ---------- */
.site-header { position: sticky; top: 0; z-index: 40; background: rgba(15,19,41,.85); border-bottom: 1px solid var(--line); }
/* El desenfoque va en un pseudo-elemento aparte: si backdrop-filter estuviera
   directamente en .site-header, crearía un "contenedor" nuevo para cualquier
   descendiente con position:fixed (como el menú móvil), rompiendo el overlay. */
.site-header::before {
    content: "";
    position: absolute;
    inset: 0;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: -1;
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; padding: .9rem 0; }
.brand { display: flex; align-items: center; gap: .5rem; font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; }
.brand-mark { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--gold); color: #14140a; font-size: .8rem; flex-shrink: 0; }
.main-nav { display: flex; align-items: center; font-weight: 500; color: var(--muted); }
.main-nav-brand { display: none; }
.main-nav-links { display: flex; align-items: center; gap: 1.4rem; }
.main-nav a:hover { color: var(--text); }
.header-actions { display: flex; align-items: center; gap: .7rem; }
.cart-link { position: relative; font-size: 1.1rem; padding: .3rem .5rem; }
.cart-count { position: absolute; top: -4px; right: -6px; background: var(--gold); color: #14140a; font-size: .65rem; font-weight: 700; border-radius: 999px; padding: 1px 5px; }
.balance-pill { background: var(--bg-panel-2); border: 1px solid var(--line); padding: .4em .9em; border-radius: 999px; font-size: .82rem; font-weight: 600; color: var(--teal); white-space: nowrap; }

/* ---------- botón hamburguesa (tienda) ---------- */
.nav-toggle {
    display: none;
    background: transparent;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    width: 42px; height: 42px;
    align-items: center; justify-content: center;
    color: var(--text); font-size: 1.25rem; line-height: 1; cursor: pointer;
    flex-shrink: 0;
}
.nav-toggle:hover { border-color: var(--gold); }
.nav-extra { display: none; }
.nav-overlay { display: none; }
body.menu-open { overflow: hidden; }

@media (max-width: 860px) {
    .nav-toggle { display: inline-flex; }
    .header-actions > .btn, .header-actions > .balance-pill { display: none; }

    .main-nav {
        position: fixed;
        top: 0; left: 0; bottom: 0;
        width: 260px;
        max-width: 82vw;
        margin: 0;
        padding: 1.5rem 1.2rem;
        background: var(--bg-panel);
        border-right: 1px solid var(--line);
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        transform: translateX(-100%);
        transition: transform .22s ease;
        z-index: 55;
        overflow-y: auto;
        box-shadow: var(--shadow);
    }
    .main-nav.open { transform: translateX(0); }

    .main-nav-brand {
        display: flex; align-items: center; gap: .5rem;
        font-family: var(--font-display); font-weight: 700; font-size: 1rem; color: var(--text);
        margin-bottom: 1.6rem;
    }

    .main-nav-links { display: flex; flex-direction: column; gap: .2rem; }
    .main-nav a {
        display: flex; align-items: center; gap: .6em;
        padding: .7em .9em; border-radius: var(--radius-sm);
        font-size: .88rem; font-weight: 500; color: var(--muted);
    }
    .main-nav a:hover { background: var(--bg-panel-2); color: var(--text); }
    .main-nav a.active { background: var(--gold); color: #14140a; font-weight: 700; }

    .nav-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(6, 8, 20, .6);
        z-index: 50;
        opacity: 0;
        visibility: hidden;
        transition: opacity .2s ease;
    }
    .nav-overlay.open { opacity: 1; visibility: visible; }

    .nav-extra {
        display: flex; flex-direction: column; gap: .6rem;
        margin-top: auto; padding-top: 1.4rem; border-top: 1px solid var(--line);
    }
    .nav-extra .balance-pill { text-align: center; }
}

@media (max-width: 420px) {
    .brand-name { display: none; }
}

/* ---------- flash messages ---------- */
.flash { margin: 1rem 0; padding: .85em 1.1em; border-radius: var(--radius-sm); font-size: .9rem; border: 1px solid; }
.flash-success { background: rgba(45,212,191,.08); border-color: var(--teal); color: var(--teal); }
.flash-error { background: rgba(239,91,91,.08); border-color: var(--red); color: var(--red); }
.flash-info { background: rgba(242,184,7,.08); border-color: var(--gold); color: var(--gold); }

/* ---------- hero ---------- */
.hero { padding: 5.5rem 0 4rem; position: relative; overflow: hidden; }
.hero-inner { display: grid; grid-template-columns: 1.1fr .9fr; gap: 3rem; align-items: center; }
.eyebrow { display: inline-flex; align-items: center; gap: .5em; text-transform: uppercase; letter-spacing: .14em; font-size: .72rem; color: var(--gold); font-weight: 700; margin-bottom: 1.2em; }
.hero h1 { font-size: clamp(2.1rem, 4vw, 3.2rem); line-height: 1.08; }
.hero .lede { font-size: 1.05rem; max-width: 46ch; }
.hero-cta { display: flex; gap: .8rem; margin-top: 1.6rem; flex-wrap: wrap; }
.hero-stats { display: flex; gap: 2rem; margin-top: 2.4rem; }
.hero-stat b { display: block; font-family: var(--font-display); font-size: 1.5rem; color: var(--gold); }
.hero-stat span { font-size: .78rem; color: var(--muted); }

/* signature: equalizer / signal panel illustration in hero */
.eq-panel { background: var(--bg-panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.6rem; box-shadow: var(--shadow); }
.eq-panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.2rem; font-size: .82rem; color: var(--muted); }
.eq-bars { display: flex; align-items: flex-end; gap: 6px; height: 140px; }
.eq-bars span { flex: 1; background: linear-gradient(180deg, var(--gold), var(--teal)); border-radius: 3px; animation: eq 1.8s ease-in-out infinite; }
.eq-bars span:nth-child(2n) { animation-duration: 1.3s; }
.eq-bars span:nth-child(3n) { animation-duration: 2.1s; }
@keyframes eq { 0%,100% { transform: scaleY(.35); } 50% { transform: scaleY(1); } }
.eq-caption { margin-top: 1rem; font-size: .8rem; color: var(--muted); }
@media (prefers-reduced-motion: reduce) { .eq-bars span { animation: none; transform: scaleY(.7); } }

/* ---------- auth panels on landing ---------- */
.auth-band { padding: 3.5rem 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--bg-panel); }
.auth-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; }
.auth-card { background: var(--bg-panel-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 2rem; }
.auth-card h3 { font-size: 1.2rem; }
@media (max-width: 760px) { .auth-grid, .hero-inner { grid-template-columns: 1fr; } }

/* ---------- section heading ---------- */
.section { padding: 4rem 0; }
.section-head { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 2rem; gap: 1rem; flex-wrap: wrap; }
.section-head h2 { font-size: 1.7rem; }

/* ---------- product grid ---------- */
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1.3rem; }
.product-card { background: var(--bg-panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; transition: border-color .15s ease, transform .15s ease; }
.product-card:hover { border-color: var(--gold-dim); transform: translateY(-3px); }
.product-thumb { aspect-ratio: 16/9; background: linear-gradient(135deg, var(--bg-panel-2), var(--bg-deep)); display: grid; place-items: center; font-family: var(--font-display); font-weight: 700; font-size: 1.3rem; color: var(--muted); }
.product-body { padding: 1.1rem 1.2rem 1.3rem; display: flex; flex-direction: column; gap: .6rem; flex: 1; }
.product-cat { font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; color: var(--gold); font-weight: 700; }
.product-card h3 { font-size: 1.05rem; }
.product-desc { font-size: .84rem; flex: 1; }
.product-price { font-family: var(--font-display); font-size: 1.35rem; color: var(--text); }
.product-price small { font-family: var(--font-body); font-size: .7rem; color: var(--muted); font-weight: 400; }

/* stock meter — señal de barras (elemento firma) */
.stock-meter { display: flex; align-items: center; gap: 8px; }
.stock-bars { display: flex; align-items: flex-end; gap: 3px; height: 16px; }
.stock-bars i { display: block; width: 4px; border-radius: 2px; background: var(--line); }
.stock-bars i:nth-child(1) { height: 30%; }
.stock-bars i:nth-child(2) { height: 55%; }
.stock-bars i:nth-child(3) { height: 75%; }
.stock-bars i:nth-child(4) { height: 100%; }
.stock-bars.level-0 i { background: var(--line); }
.stock-bars.level-1 i:nth-child(1) { background: var(--red); }
.stock-bars.level-2 i:nth-child(-n+2) { background: var(--gold); }
.stock-bars.level-3 i:nth-child(-n+3) { background: var(--gold); }
.stock-bars.level-4 i { background: var(--teal); }
.stock-label { font-size: .76rem; color: var(--muted); }
.stock-label.out { color: var(--red); }

.product-foot { padding: 0 1.2rem 1.2rem; }

/* ---------- cart page ---------- */
.cart-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 2rem; align-items: start; }
.cart-item { display: grid; grid-template-columns: 70px 1fr auto; gap: 1rem; align-items: center; padding: 1rem; background: var(--bg-panel); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: .9rem; }
.cart-item-thumb { width: 70px; height: 70px; border-radius: var(--radius-sm); background: var(--bg-panel-2); display: grid; place-items: center; font-family: var(--font-display); font-weight: 700; color: var(--muted); }
.cart-item-name { font-weight: 600; }
.cart-item-price { color: var(--muted); font-size: .85rem; }
.qty-control { display: flex; align-items: center; gap: .5rem; border: 1px solid var(--line); border-radius: 999px; padding: .2rem; }
.qty-control button { width: 28px; height: 28px; border-radius: 999px; border: none; background: var(--bg-panel-2); color: var(--text); font-size: 1rem; cursor: pointer; }
.qty-control button:hover { background: var(--gold); color: #14140a; }
.qty-control span { min-width: 1.4em; text-align: center; font-weight: 600; }
.cart-item-actions { display: flex; flex-direction: column; align-items: flex-end; gap: .5rem; }
.remove-link { font-size: .78rem; color: var(--red); cursor: pointer; background: none; border: none; }

.cart-summary { background: var(--bg-panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; position: sticky; top: 90px; }
.cart-summary h3 { font-size: 1.1rem; }
.summary-row { display: flex; justify-content: space-between; padding: .5rem 0; font-size: .9rem; color: var(--muted); border-bottom: 1px dashed var(--line); }
.summary-row.total { color: var(--text); font-weight: 700; font-size: 1.1rem; border-bottom: none; padding-top: .9rem; }
.summary-actions { display: flex; flex-direction: column; gap: .7rem; margin-top: 1.2rem; }
.balance-note { font-size: .8rem; color: var(--muted); margin-top: .8rem; }
.balance-note.insufficient { color: var(--red); }

.empty-state { text-align: center; padding: 4rem 1rem; color: var(--muted); }
.empty-state .icon { font-size: 2.4rem; margin-bottom: .6rem; }

/* ---------- forms ---------- */
.form-card { max-width: 440px; margin: 3rem auto; background: var(--bg-panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 2.2rem; }
.form-card h2 { font-size: 1.4rem; }
.field { margin-bottom: 1.1rem; }
.field label { display: block; font-size: .82rem; font-weight: 600; margin-bottom: .4em; color: var(--muted); }
.field input, .field select { width: 100%; padding: .75em .9em; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--bg-deep); color: var(--text); font-size: .95rem; font-family: var(--font-body); }
.field input:focus, .field select:focus { border-color: var(--gold); outline: none; }
.form-foot { margin-top: 1.2rem; font-size: .85rem; color: var(--muted); text-align: center; }

/* ---------- dashboard ---------- */
.dash-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 2rem; align-items: start; }
.dash-nav { background: var(--bg-panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem; position: sticky; top: 90px; }
.dash-nav a { display: block; padding: .7em .9em; border-radius: var(--radius-sm); font-size: .88rem; font-weight: 500; color: var(--muted); margin-bottom: .2rem; }
.dash-nav a:hover { background: var(--bg-panel-2); color: var(--text); }
.dash-nav a.active { background: var(--gold); color: #14140a; font-weight: 700; }
.dash-panel { background: var(--bg-panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 2rem; margin-bottom: 1.5rem; min-width: 0; }
.dash-panel h3 { font-size: 1.15rem; }
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px,1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card { background: var(--bg-panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem; }
.stat-card b { display: block; font-family: var(--font-display); font-size: 1.5rem; color: var(--gold); }
.stat-card span { font-size: .78rem; color: var(--muted); }

.order-block { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 1rem 1.2rem; margin-bottom: 1rem; }
.order-block-head { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .2rem .8rem; font-size: .85rem; color: var(--muted); margin-bottom: .6rem; }
.order-block-head span { overflow-wrap: anywhere; }
.license-box { background: var(--bg-deep); border: 1px dashed var(--line); border-radius: var(--radius-sm); padding: .8rem 1rem; margin-top: .6rem; font-size: .84rem; }
.license-box div { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .1rem .8rem; padding: .2em 0; }
.license-box .lk { color: var(--muted); flex-shrink: 0; }
.license-box .lv { font-family: monospace; color: var(--teal); overflow-wrap: anywhere; text-align: right; }

table.simple { width: 100%; border-collapse: collapse; font-size: .88rem; }
table.simple th, table.simple td { text-align: left; padding: .6em .5em; border-bottom: 1px solid var(--line); }
table.simple th { color: var(--muted); font-weight: 600; font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; }

/* ---------- movimientos de saldo ---------- */
.movement-amount { font-weight: 700; white-space: nowrap; }
.movement-in { color: var(--teal); }
.movement-out { color: var(--red); }

/* ---------- checkout success ---------- */
.success-card { max-width: 620px; margin: 3rem auto; text-align: center; }
.success-icon { width: 72px; height: 72px; border-radius: 999px; background: rgba(45,212,191,.12); border: 1px solid var(--teal); color: var(--teal); display: grid; place-items: center; font-size: 2rem; margin: 0 auto 1.2rem; }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 2.4rem 0; margin-top: 3rem; }
.footer-inner { display: flex; flex-direction: column; align-items: center; gap: .3rem; text-align: center; color: var(--muted); font-size: .85rem; }
.muted { color: var(--muted); font-size: .78rem; }

@media (max-width: 860px) {
    .cart-layout, .dash-layout { grid-template-columns: minmax(0, 1fr); }
    .dash-nav { position: static; display: flex; overflow-x: auto; gap: .3rem; }
}

@media (max-width: 600px) {
    .container { width: 94%; }
    .hero { padding: 3.2rem 0 2.6rem; }
    .hero-stats { flex-wrap: wrap; gap: 1.2rem 1.8rem; }
    .section { padding: 2.6rem 0; }
    .section-head h2 { font-size: 1.4rem; }
    .product-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .9rem; }
    .cart-item { grid-template-columns: 56px 1fr; row-gap: .6rem; }
    .cart-item-thumb { width: 56px; height: 56px; }
    .cart-item-actions { grid-column: 1 / -1; flex-direction: row; justify-content: space-between; align-items: center; }
    .form-card { padding: 1.6rem; margin: 1.6rem auto; }
    .dash-panel { padding: 1.3rem; }
    .stat-cards { grid-template-columns: repeat(auto-fit, minmax(130px,1fr)); }
    table.simple { font-size: .8rem; }
}
