/* ============================================================
   CUENTA (Mi cuenta) – CSS
   Mobile-first, sin dependencias de otros CSS
============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Nunito+Sans:wght@400;700;900&family=Montserrat:wght@700&display=swap');

:root{
  --bg: #f6f8fb;
  --panel: #ffffff;
  --ink: #111;
  --muted: #5b6b7b;

  --accent: #00bcd4;
  --accent-2: #008fb9;

  --ok: #19c37d;
  --warn: #ff9800;
  --err: #ef5350;

  --radius: 14px;
  --shadow: 0 8px 24px rgba(16,24,40,.10);

  --fs-h1: clamp(22px, 4vw, 32px);
  --fs-h2: clamp(18px, 3.2vw, 24px);

  /* Tamaños del ZOOM (ajustes rápidos) */
  --zoom-w-mobile: 72vw;   /* ancho máx en móvil */
  --zoom-h-mobile: 54vh;   /* alto  máx en móvil */

  --zoom-w-tablet: 60vw;   /* 768–1199px */
  --zoom-h-tablet: 62vh;

  --zoom-w-desktop: 50vw;  /* ≥1200px */
  --zoom-h-desktop: 60vh;
}

*{ box-sizing:border-box }
html,body{ height:100% }
body{
  margin:0;
  font-family:'Nunito Sans',system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
  color:var(--ink);
  background:
    radial-gradient(900px 420px at 85% -10%, rgba(0,188,212,.10), transparent 60%),
    var(--bg);
}
/* bloquea el scroll del body cuando el lightbox está abierto */
body.no-scroll{ overflow:hidden; height:100% }

/* ================= Topbar ================= */
.topbar{
  position:sticky; top:0; z-index:50;
  background:#fff; border-bottom:1px solid #e6ecf2;
  backdrop-filter:blur(6px);
}
.topbar .wrap{
  max-width:1200px; margin:0 auto;
  padding:10px 16px;
  display:flex; align-items:center; gap:14px;
}
.topbar .brand{
  font-weight:900; color:#0a2540; text-decoration:none;
  white-space:nowrap;
}
.topbar .nav{
  margin-left:auto;
  display:flex; align-items:center; gap:18px;
  flex-wrap:wrap;
}
.topbar .nav a{
  font-weight:800; color:#223; text-decoration:none;
  padding:2px 0; border-bottom:2px solid transparent;
  display:inline-block;
  white-space:nowrap;
}
.topbar .nav a:hover{ color:var(--accent) }
.topbar .nav a.active{
  color:var(--accent);
  border-bottom-color:var(--accent);
}
@media (max-width:520px){
  .topbar .nav{ overflow-x:auto; gap:14px; -webkit-overflow-scrolling:touch }
  .topbar .nav::-webkit-scrollbar{ display:none }
}

/* ================= Contenedor base ================= */
.container{ max-width:1200px; margin:16px auto; padding:0 16px }

/* ================= Tarjetas / bloques ================= */
.card{
  background:var(--panel);
  border:1px solid #e6ecf2;
  border-radius:var(--radius);
  padding:16px;
  box-shadow:var(--shadow);
  margin-bottom:16px;
}

/* ================= Hero ================= */
.hero h1{
  font-family:'Montserrat',sans-serif;
  font-size:var(--fs-h1);
  margin:0 0 6px;
  color:#0a2540;
}
.hero p{ margin:0; color:#4b5563 }

/* ================= Botones ================= */
.btn{
  appearance:none; border:0; cursor:pointer;
  padding:10px 16px; border-radius:9999px; font-weight:900;
  background:linear-gradient(135deg,var(--accent) 0%,var(--accent-2) 100%);
  color:#fff;
  transition:transform .15s ease, opacity .15s ease, box-shadow .15s ease;
}
.btn:hover{ box-shadow:0 6px 16px rgba(0,0,0,.15) }
.btn:active{ transform:translateY(1px); opacity:.95 }
.btn.secondary{ background:#0a2540 }

/* Mensajes */
.msg{ margin-top:10px; font-weight:800 }
.msg.small{ font-size:13px; color:var(--muted) }

/* ================= Formulario (login) ================= */
.form .row{ display:grid; grid-template-columns:1fr; gap:12px; margin-bottom:12px }
@media (min-width:700px){ .form .row{ grid-template-columns:1fr 1fr } }
.field .label{ display:block; font-weight:900; color:#334155; margin-bottom:6px; font-size:14px }
.field input{
  width:100%; padding:12px 14px; border-radius:10px;
  border:1.5px solid #d0d7de; background:#fff; color:#111; font-size:16px;
  transition:border-color .2s, box-shadow .2s;
}
.field input:focus{
  border-color:var(--accent);
  box-shadow:0 0 0 4px rgba(0,188,212,.15);
  outline:0;
}
.input-wrap{ display:grid; grid-template-columns:1fr auto; gap:8px; align-items:center }
.toggle-pass{
  border:1px solid #e6ecf2; background:#f6f8fb; color:#0a2540;
  padding:10px 12px; border-radius:10px; font-weight:800; cursor:pointer;
}
.toggle-pass:active{ transform:translateY(1px) }

/* ================= Panel de datos ================= */
.panel-head{ display:flex; align-items:center; gap:12px; flex-wrap:wrap; margin-bottom:12px }
.panel-head .who{ font-weight:900; color:#0a2540 }
.panel-head .label{ font-size:12px; color:#64748b; font-weight:800 }
.panel-head .who-name{ font-size:16px }
.panel-head .muted{ color:#64748b }

/* KPIs */
.kpis{ display:grid; grid-template-columns:repeat(2,1fr); gap:10px; margin-bottom:10px }
@media (min-width:700px){ .kpis{ grid-template-columns:repeat(4,1fr) } }
.kpi{ background:#f8fafc; border:1px solid #e6ecf2; border-radius:12px; padding:10px }
.kpi .label{ font-size:12px; color:#64748b; font-weight:800 }
.kpi .val{ font-weight:900; font-size:20px; color:#0a2540 }

/* Tabs */
.tabs{ display:flex; gap:8px; margin:4px 0 12px; flex-wrap:wrap }
.tab-btn{
  border:1px solid #e6ecf2; background:#f6f8fb; color:#0a2540;
  padding:9px 12px; border-radius:9999px; font-weight:900; cursor:pointer;
}
.tab-btn.active{
  background:linear-gradient(135deg,var(--accent) 0%,var(--accent-2) 100%);
  color:#fff; border-color:transparent;
}

/* ================= Tablas (siempre tablas con scroll) ================= */
.table-wrap{
  width:100%;
  overflow-x:auto;
  -webkit-overflow-scrolling:touch;
  border:1px solid #e6ecf2;
  border-radius:12px;
  position:relative;
}
.table-wrap::after{
  content:"";
  position:sticky; right:0; top:0; width:26px; height:100%;
  pointer-events:none;
  background:linear-gradient(90deg,transparent,rgba(0,0,0,.06));
}
.table-wrap::-webkit-scrollbar{ height:8px }
.table-wrap::-webkit-scrollbar-thumb{ background:#cfd8e3; border-radius:9999px }

table{ width:100%; border-collapse:separate; border-spacing:0 }
thead th{
  position:sticky; top:0; z-index:1;
  background:#eef2f7; color:#0a2540;
  text-align:left; font-size:13px; letter-spacing:.3px; text-transform:uppercase;
  padding:10px; border-bottom:1px solid #dfe7ef;
  white-space:nowrap;
}
tbody td{
  background:#fff; padding:12px 10px; border-bottom:1px solid #eef2f7;
  vertical-align:middle;
  white-space:nowrap;
}
.table-wrap th + th,
.table-wrap td + td{ padding-left:18px }

/* anchos mínimos para forzar scroll cuando haga falta */
#itemsTable{ min-width:720px }
#preTable{   min-width:1000px }

.right{ text-align:right }

/* ================= Miniaturas (botón) ================= */
.thumb{
  display:inline-flex;
  width:44px; height:44px;
  border-radius:8px; overflow:hidden;
  border:1px solid #e6ecf2;
  padding:0; margin:0;
  background:transparent;
  appearance:none;
  cursor:zoom-in;
}
.thumb img{
  width:100%; height:100%; object-fit:cover; display:block;
  transition: transform .18s ease;
}
.thumb:hover img{ transform:scale(1.06) }
.thumb:focus-visible{
  outline:3px solid rgba(0,188,212,.35);
  outline-offset:2px;
  border-color:var(--accent);
}

/* ================= Badges ================= */
.badge{
  display:inline-flex; align-items:center; justify-content:center;
  height:26px; padding:0 10px; border-radius:9999px;
  font-weight:900; font-size:12px; line-height:1;
}
.badge.state{ background:#eef2f7; color:#0a2540 }
.badge.state.en-almacen{ background:#eef7ff; color:#0b71c5 }
.badge.state.enviado{    background:#e8f4ff; color:#0a66c2 }
.badge.state.retirado{   background:#f1f5f9; color:#334155 }
.badge.state.en-camino{  background:#e7fcfa; color:#0b8a7a }
.badge.state.reservado{  background:#f5eaff; color:#6b21a8 }
.badge.state.llegado{    background:#e9f9ef; color:#0a7f56 }
.badge.state.entregado{  background:#e9f9ef; color:#0a7f56 }
.badge.state.cancelado{  background:#ffe7e7; color:#b2261c }

.badge.days{ min-width:46px; justify-content:center }
.badge.days.ok{    background:rgba(25,195,125,.12); color:#0a7f56; border:1px solid rgba(25,195,125,.35) }
.badge.days.warn{  background:rgba(255,152,0,.12); color:#b36a00; border:1px solid rgba(255,152,0,.35) }
.badge.days.danger{background:rgba(239,83,80,.12); color:#b2261c; border:1px solid rgba(239,83,80,.35) }

.muted{ color:var(--muted) }

/* ============================================================
   LIGHTBOX (Mi Cuenta) – igual al de Catálogo
   (reemplaza el antiguo .img-modal)
============================================================ */
.lb{
  position:fixed; inset:0;
  background:rgba(0,0,0,.85);
  display:grid; place-items:center;
  padding:8px;
  z-index:1000;
  overflow:auto;
  -webkit-overflow-scrolling:touch;
  overscroll-behavior:contain;
}
.lb[hidden]{ display:none !important }

.lb__content{ position:relative }

/* límites DUROS con min() para no exceder el viewport */
.lb img{
  display:block;
  width:auto; height:auto;
  max-width: min(var(--zoom-w-mobile), calc(100vw - 24px));
  max-height: min(var(--zoom-h-mobile), calc(100vh - 24px));
  object-fit:contain;
  border-radius:12px;
  box-shadow:0 12px 40px rgba(0,0,0,.6);
  box-sizing:border-box;
  transform:translateZ(0);
}

/* Tablet */
@media (min-width:768px){
  .lb img{
    max-width: min(var(--zoom-w-tablet),  calc(100vw - 32px));
    max-height: min(var(--zoom-h-tablet), calc(100vh - 32px));
  }
}

/* Desktop */
@media (min-width:1200px){
  .lb img{
    max-width: min(var(--zoom-w-desktop),  calc(100vw - 48px));
    max-height: min(var(--zoom-h-desktop), calc(100vh - 48px));
  }
}

.lb .lb-close{
  position:fixed; top:12px; right:16px;
  width:40px; height:40px;
  display:grid; place-items:center;
  background:rgba(255,255,255,.15);
  border:1px solid rgba(255,255,255,.35);
  color:#fff; font-size:28px; line-height:1;
  border-radius:9999px; cursor:pointer;
}
.lb .lb-close:hover{ background:rgba(255,255,255,.28) }

/* ================= Footer ================= */
.site-footer{
  text-align:center; color:#64748b; font-weight:800;
  padding:18px 12px; margin:30px 0 10px;
}
