/* =========================================================
   INVENTARIO BAUMANN — mismos tokens de marca que el sitio
   (css/styles.css), pensado para pantallas de trabajo:
   sidebar en desktop (Stripe/Linear), barra inferior en
   mobile (Treinta), chips tonales y superficies elevadas
   (Material 3), tarjetas de KPI arriba (Odoo).
   ========================================================= */
:root {
  --black:      #0a0a0a;
  --black-soft: #141414;
  --black-card: #1b1b1b;
  --line:       #2b2b2b;
  --red:        #e21210;
  --red-dark:   #b40e0c;
  --red-soft:   rgba(226, 18, 16, .14);
  --green:      #2ea043;
  --green-dark: #23843a;
  --green-soft: rgba(46, 160, 67, .16);
  --white:      #ffffff;
  --gray-100:   #f5f5f5;
  --gray-300:   #cfcfcf;
  --gray-500:   #8a8a8a;

  --font-display: 'Anton', Impact, sans-serif;
  --font-body:    'Inter', -apple-system, Segoe UI, Roboto, sans-serif;

  --radius: 14px;
  --radius-sm: 10px;
  --nav-w: 248px;
  --bottom-nav-h: 68px;

  --shadow-lg: 0 20px 50px rgba(0, 0, 0, .45);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--black);
  color: var(--gray-100);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: .5px;
  margin: 0;
}

.hidden { display: none !important; }
.icon { width: 1.3em; height: 1.3em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }

/* =========================== BUTTONS =========================== */

button {
  font: inherit;
  cursor: pointer;
  background: var(--red);
  color: var(--white);
  border: none;
  border-radius: 999px;
  padding: 13px 20px;
  font-size: .95rem;
  font-weight: 700;
  width: 100%;
  box-shadow: 0 8px 22px rgba(226, 18, 16, .28);
  transition: transform .15s ease, background .2s ease, box-shadow .2s ease, opacity .2s ease;
}
button:hover { background: var(--red-dark); transform: translateY(-1px); }
button:active { transform: translateY(0); }
button:disabled { opacity: .6; cursor: default; transform: none; }

button.secundario {
  background: transparent;
  color: var(--gray-100);
  border: 1px solid var(--line);
  box-shadow: none;
  margin-top: 10px;
}
button.secundario:hover { border-color: var(--red); color: var(--red); background: transparent; }

/* =========================== LOGIN =========================== */

#login-view {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background:
    radial-gradient(900px 420px at 85% -10%, rgba(226, 18, 16, .16), transparent 60%),
    var(--black);
}

.login-card {
  background: var(--black-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 36px 28px;
  width: 100%;
  max-width: 340px;
  text-align: center;
  box-shadow: var(--shadow-lg);
}

.login-logo {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  margin-bottom: 16px;
  box-shadow: 0 0 0 3px var(--line);
}

.login-card h1 { font-size: 1.4rem; margin-bottom: 6px; }
.login-card p { color: var(--gray-500); margin: 0 0 20px; font-size: .9rem; }

.login-card input {
  width: 100%;
  padding: 13px;
  font-size: 1rem;
  background: var(--black-soft);
  color: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
}
.login-card input:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
.login-card button { margin-top: 6px; }

/* =========================== APP SHELL / NAV =========================== */

#app-view { min-height: 100vh; }

.app-nav {
  position: fixed;
  z-index: 100;
  display: flex;
  background: var(--black-soft);
}

.nav-brand { display: none; align-items: center; gap: 10px; }
.nav-logo { width: 34px; height: 34px; border-radius: 50%; }
.nav-brand-text { font-family: var(--font-display); font-size: 1rem; letter-spacing: .4px; display: flex; flex-direction: column; line-height: 1.15; }
.nav-brand-text small { font-size: .58rem; letter-spacing: 2.5px; color: var(--red); font-weight: 700; }

.nav-items { display: contents; }

.tab-btn, .nav-logout {
  background: none;
  box-shadow: none;
  color: var(--gray-500);
  border-radius: var(--radius-sm);
  font-size: .68rem;
  font-weight: 600;
  width: auto;
}
.tab-btn:hover, .nav-logout:hover { background: rgba(255, 255, 255, .05); color: var(--white); transform: none; }
.tab-btn.active { color: var(--red); }

main {
  padding: 20px 16px calc(var(--bottom-nav-h) + 24px);
  max-width: 760px;
  margin: 0 auto;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.section-head { margin-bottom: 16px; }
.section-head h2 { font-size: 1.15rem; color: var(--white); }
.subhead { font-size: .95rem; color: var(--gray-300); text-transform: none; letter-spacing: 0; margin: 20px 0 10px; }
.section-hint { color: var(--gray-500); font-size: .85rem; margin: -8px 0 16px; }

.btn-entrada { background: var(--green); box-shadow: 0 8px 22px rgba(46, 160, 67, .28); }
.btn-entrada:hover { background: var(--green-dark); }

/* ---- mobile: barra inferior tipo Treinta ---- */
@media (max-width: 899px) {
  .app-nav {
    bottom: 0; left: 0; right: 0;
    height: var(--bottom-nav-h);
    border-top: 1px solid var(--line);
    align-items: stretch;
    padding: 0 4px;
  }
  .tab-btn, .nav-logout {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 6px 2px;
  }
}

/* ---- desktop: sidebar tipo Stripe/Linear ---- */
@media (min-width: 900px) {
  .app-nav {
    top: 0; left: 0; bottom: 0;
    width: var(--nav-w);
    flex-direction: column;
    border-right: 1px solid var(--line);
    padding: 22px 14px;
    gap: 4px;
  }
  .nav-brand { display: flex; padding: 4px 10px 22px; }
  .nav-items { display: flex; flex-direction: column; gap: 2px; }
  .tab-btn, .nav-logout {
    flex-direction: row;
    justify-content: flex-start;
    gap: 12px;
    padding: 11px 14px;
    text-align: left;
    font-size: .92rem;
  }
  .tab-btn.active { background: var(--red-soft); color: var(--red); }
  .nav-logout { margin-top: auto; }

  main { margin-left: var(--nav-w); padding: 40px 44px; max-width: 900px; }
}

/* =========================== STATS (Odoo/Treinta) =========================== */

.stats-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.stat-tile {
  flex: 1;
  min-width: 130px;
  background: var(--black-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.stat-tile .stat-value { font-family: var(--font-display); font-size: 1.7rem; color: var(--white); line-height: 1; }
.stat-tile .stat-label { font-size: .68rem; text-transform: uppercase; letter-spacing: 1.2px; color: var(--gray-500); margin-top: 6px; display: block; }
.stat-tile.stat-alerta .stat-value { color: var(--red); }
.stat-tile-valor { min-width: 180px; }
.stat-tile-valor .stat-value { font-size: 1.25rem; white-space: nowrap; }

/* =========================== SEARCH =========================== */

.panel-header { margin-bottom: 12px; }

#stock-buscar {
  width: 100%;
  padding: 11px 14px;
  background: var(--black-card);
  color: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
#stock-buscar:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
#stock-buscar::placeholder { color: var(--gray-500); }

/* =========================== LISTA / CARDS (filas tipo Stripe en desktop) =========================== */

.lista { display: flex; flex-direction: column; gap: 8px; }

.card {
  background: var(--black-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  transition: border-color .15s ease, background .15s ease;
}

.card-bajo { border-color: rgba(226, 18, 16, .45); }

.card-title {
  font-weight: 600;
  font-family: var(--font-body);
  text-transform: none;
  letter-spacing: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

/* Medidor de nivel de stock (stock actual / stock ideal, marca en el minimo) */
.meter { margin: 8px 0 2px; }
.meter-track {
  position: relative;
  height: 10px;
  border-radius: 999px;
  background: var(--line);
}
.meter-fill {
  height: 100%;
  border-radius: 999px;
  transition: width .2s ease;
}
.meter-tick {
  position: absolute;
  top: -2px;
  bottom: -2px;
  width: 2px;
  border-radius: 1px;
  background: rgba(255, 255, 255, .55);
}
.meter-ok .meter-track { background: var(--green-soft); }
.meter-ok .meter-fill { background: var(--green); }
.meter-bajo .meter-track { background: var(--red-soft); }
.meter-bajo .meter-fill { background: var(--red); }

.card-body {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: .88rem;
  color: var(--gray-300);
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}

.card-footer {
  font-size: .82rem;
  color: var(--gray-500);
  margin-top: 6px;
}

.sugerido { color: var(--red); font-weight: 700; }

.badge {
  font-size: .66rem;
  padding: 3px 10px;
  border-radius: 999px;
  font-weight: 700;
  letter-spacing: .3px;
}
.badge-ok { background: var(--green-soft); color: var(--green); }
.badge-bajo { background: var(--red-soft); color: var(--red); }
.badge-neutral { background: rgba(255, 255, 255, .07); color: var(--gray-300); }

.vacio { color: var(--gray-500); text-align: center; padding: 26px; font-size: .9rem; }

@media (min-width: 900px) {
  .lista:has(.card) { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--black-card); gap: 0; }
  .card {
    border: none; border-bottom: 1px solid var(--line); border-radius: 0;
    display: flex; align-items: center; justify-content: space-between; gap: 20px;
  }
  .lista .card:last-child { border-bottom: none; }
  .card:hover { background: var(--black-soft); }
  .card-title { flex: 0 0 240px; }
  .card-body { flex: 1; margin-top: 0; }
  .card-footer { flex: 0 0 200px; text-align: right; margin-top: 0; }
}

/* =========================== FORMS =========================== */

.form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--black-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
  max-width: 440px;
}

.form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: .82rem;
  color: var(--gray-300);
  font-weight: 600;
}

.form-row { display: flex; gap: 14px; }
.form-row label { flex: 1; }

.form input, .form select {
  padding: 11px 12px;
  background: var(--black-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: .95rem;
  font-family: var(--font-body);
  color: var(--white);
}
.form input:focus, .form select:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }

.input-with-btn { display: flex; gap: 8px; }
.input-with-btn input { flex: 1; }

.btn-scan-icon {
  width: 44px;
  flex-shrink: 0;
  padding: 0;
  background: var(--black-soft);
  border: 1px solid var(--line);
  color: var(--gray-300);
  box-shadow: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-scan-icon:hover { border-color: var(--red); color: var(--red); background: var(--black-soft); }
.btn-ver-password.activo { border-color: var(--red); color: var(--red); }

.btn-scan {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--black-soft);
  border: 1px dashed var(--line);
  color: var(--gray-100);
  box-shadow: none;
  order: -1;
}
.btn-scan:hover { border-color: var(--red); color: var(--red); background: var(--black-soft); }

.msg { min-height: 1.2em; font-size: .85rem; margin: 0; }
.msg.ok { color: var(--green); }
.msg.error, .error { color: var(--red); }

/* =========================== REPORTES =========================== */

.reporte-bloque {
  background: var(--black-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  max-width: 620px;
}
.reporte-bloque h3 { font-family: var(--font-body); text-transform: none; letter-spacing: 0; font-size: 1rem; font-weight: 700; margin-bottom: 10px; }

.config-titulo { font-family: var(--font-body); text-transform: none; letter-spacing: 0; font-size: 1rem; font-weight: 700; margin: 0 0 4px; }

.enviar-con-formato { display: flex; gap: 8px; margin-top: 10px; }
.enviar-con-formato select {
  flex: 0 0 100px;
  padding: 11px 10px;
  background: var(--black-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--white);
  font-size: .9rem;
}
.enviar-con-formato button { margin-top: 0; }

.reporte-contenido table {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
  font-variant-numeric: tabular-nums;
}

.reporte-contenido td, .reporte-contenido th {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}
.reporte-contenido th { color: var(--gray-500); font-weight: 600; text-transform: uppercase; font-size: .68rem; letter-spacing: .6px; }
.reporte-contenido p { color: var(--gray-300); font-size: .9rem; }

/* =========================== MODAL SIMPLE (cambiar contraseña) =========================== */

.simple-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(10, 10, 10, .8);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.simple-modal-card {
  background: var(--black-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  width: 100%;
  max-width: 360px;
  box-shadow: var(--shadow-lg);
}
.simple-modal-card h3 { font-family: var(--font-body); text-transform: none; letter-spacing: 0; font-size: 1.05rem; margin-bottom: 16px; }
.simple-modal-card form { display: flex; flex-direction: column; gap: 12px; }
.simple-modal-card label { display: flex; flex-direction: column; gap: 6px; font-size: .82rem; color: var(--gray-300); font-weight: 600; }
.simple-modal-card input {
  padding: 11px 12px;
  background: var(--black-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--white);
  font-size: .95rem;
}
.simple-modal-card input:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }

/* =========================== SCANNER (cámara) =========================== */

.scanner-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(10, 10, 10, .96);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 24px;
}

.scanner-frame {
  position: relative;
  width: 100%;
  max-width: 420px;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
  border: 1px solid var(--line);
}

#scanner-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scanner-guide {
  position: absolute;
  inset: 20% 8%;
  border: 2px solid var(--red);
  border-radius: var(--radius-sm);
  box-shadow: 0 0 0 999px rgba(0, 0, 0, .35);
  pointer-events: none;
}

#scanner-msg { color: var(--gray-100); font-size: .9rem; text-align: center; }
#scanner-cancelar, #btn-scanner-cancelar { max-width: 220px; }
