:root{
  --primary:#2563eb;
  --accent:#22c55e;
  --bg:#0b1220;
  --surface:#0f1a2e;
  --text:#e5e7eb;

  --border: rgba(255,255,255,.10);
  --muted: rgba(229,231,235,.70);

  color-scheme: dark;
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial;
  background: radial-gradient(1200px 600px at 20% -10%, rgba(37,99,235,.22), transparent 60%),
              radial-gradient(900px 500px at 100% 0%, rgba(34,197,94,.14), transparent 55%),
              var(--bg);
  color: var(--text);
}

/* ===== Native-feel mobile taps ===== */
button, a{
  -webkit-tap-highlight-color: transparent;
  tap-highlight-color: transparent;
}

.topbar{
  position:sticky; top:0; z-index:20;
  display:flex; align-items:center; justify-content:space-between;
  padding:14px 16px;
  background: rgba(11,18,32,.78);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom:1px solid var(--border);

  /* para que el menuPanel absolute se ancle al header */
  position: sticky;
}

.brand{ display:flex; align-items:center; gap:12px; }
#logo{
  width:44px; height:44px; border-radius:14px;
  object-fit: cover;
  background: rgba(255,255,255,.06);
  border:1px solid rgba(255,255,255,.08);
}

.name{
  font-family: Montserrat, Inter, system-ui;
  font-weight: 800;
  font-size: 18px;
  line-height: 1.1;
}
.tagline{ font-size: 12px; color: var(--muted); margin-top: 2px; }

.wrap{
  max-width: 1200px;
  margin: 18px auto;
  padding: 0 16px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 980px){
  .wrap{ grid-template-columns: 1.3fr .7fr; align-items:start; }
}

.card{
  border-radius: 22px;
  padding: 16px;
  border: 1px solid rgba(255,255,255,.08);
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.03));
  box-shadow: 0 18px 40px rgba(0,0,0,.35);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.cardHead{
  display:flex; align-items:flex-start; justify-content:space-between; gap:12px;
}

h2{
  margin:0;
  font-family: Montserrat, Inter, system-ui;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-size: 16px;
}
.muted{ color: var(--muted); }
.small{ font-size: 12px; }

.pill{
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.05);
  padding: 8px 10px;
  border-radius: 999px;
  font-size: 12px;
  color: rgba(229,231,235,.8);
}

.input{
  width: 100%;
  margin-top: 12px;
  padding: 11px 12px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.04);
  color: var(--text);
  outline: none;
}

.grid{
  display:grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 14px;
}
@media(min-width: 720px){ .grid{ grid-template-columns: repeat(3, 1fr); } }

.item{
  border-radius: 18px;
  padding: 12px;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.03);
}

.itemTitle{
  font-family: Montserrat, Inter, system-ui;
  font-weight: 800;
}
.itemCat{ margin-top: 2px; font-size: 12px; color: var(--muted); }
.itemPrice{ margin-top: 10px; color: rgba(229,231,235,.82); }

.row{
  display:flex; align-items:center; justify-content:space-between;
  gap: 10px;
  margin-top: 12px;
}

.btn{
  font-family: Montserrat, Inter, system-ui;
  font-weight: 800;
  border: 0;
  border-radius: 16px;
  padding: 10px 12px;
  cursor: pointer;
  text-decoration:none;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  background: var(--primary);
  color:#fff;
}

.btnGhost{
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.10);
  color: rgba(229,231,235,.90);
}

.btnFull{ width: 100%; padding: 12px 14px; }

.cart{ display:flex; flex-direction:column; gap: 10px; margin-top: 10px; }

.cartItem{
  display:flex; align-items:center; justify-content:space-between; gap: 10px;
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.03);
}

.cartItem strong{
  font-family: Montserrat, Inter, system-ui;
  font-weight: 800;
}

.cartFooter{
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,.10);
  display:flex;
  flex-direction:column;
  gap: 10px;
}

.totalRow{ display:flex; align-items:center; justify-content:space-between; }
.total{
  font-family: Montserrat, Inter, system-ui;
  font-weight: 800;
  font-size: 18px;
}

.footer{
  grid-column: 1 / -1;
  padding: 6px 2px;
  display:flex;
  flex-direction:column;
  gap: 6px;
  color: rgba(229,231,235,.72);
}
.topActions{ display:flex; gap:10px; align-items:center; }

/* ===== IMAGEN EN TARJETA + GALERIA ===== */
.itemImg{
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 16px;
  object-fit: cover;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.05);
  margin-bottom: 10px;
  cursor: pointer;
}

.gMain{
  width: 100%;
  max-height: 58vh;
  object-fit: contain;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.20);
}

.gThumbs{
  display:flex;
  gap:10px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.gThumb{
  width:72px;
  height:72px;
  border-radius: 14px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.04);
  object-fit: cover;
  cursor:pointer;
}
.gThumb.active{
  border-color: rgba(37,99,235,.55);
  box-shadow: 0 0 0 3px rgba(37,99,235,.20);
}

/* ===== MODALES (base) ===== */
.modal{
  position:fixed;
  inset:0;
  z-index:9999;
  display:flex;
  align-items:center;
  justify-content:center;
  padding: 16px;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.hidden{ display:none; }

.modalBox{
  width: min(900px, 100%);
  max-height: calc(100vh - 32px);
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,.10);
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.03));
  box-shadow: 0 22px 60px rgba(0,0,0,.55);
  padding: 14px;

  display:flex;
  flex-direction: column;
  overflow: hidden;
}

.modalBox.modalWide{
  width: min(1180px, 100%);
  max-height: calc(100vh - 32px);
}

.modalHead{
  display:flex; align-items:flex-start; justify-content:space-between; gap:12px;
  margin-bottom: 10px;
  flex: 0 0 auto;
}
.modalTitle{
  font-family: Montserrat, Inter, system-ui;
  font-weight: 800;
  font-size: 16px;
}

.editorToolbar{
  display:flex;
  gap:10px;
  align-items:center;
  margin: 10px 0 12px;
  flex: 0 0 auto;
}
.spacer{ flex:1; }

.tableWrap,
.ordersList{
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.editor{
  width: 100%;
  margin-top: 10px;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.04);
  color: var(--text);
  outline: none;
  resize: vertical;
  min-height: 220px;
}

/* ===== Tabla editor visual ===== */
.tableWrap{
  width: 100%;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.03);
}

.t{
  width: 100%;
  border-collapse: collapse;
  min-width: 920px;
}

.t th, .t td{
  padding: 10px 10px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  vertical-align: middle;
}

.t th{
  text-align:left;
  font-size: 12px;
  color: rgba(229,231,235,.72);
  font-weight: 700;
  background: rgba(255,255,255,.03);
}

.colActive{ width: 70px; }
.colPrice{ width: 120px; }
.colActions{ width: 110px; }
.colPhotos{ width: 280px; }

.inp{
  width: 100%;
  padding: 10px 10px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.04);
  color: var(--text);
  outline: none;
  font-family: Inter, system-ui;
}

.chk{ width: 18px; height: 18px; }

.miniBtns{ display:flex; gap:8px; justify-content:flex-start; }
.btnMini{
  font-family: Montserrat, Inter, system-ui;
  font-weight: 800;
  border-radius: 12px;
  padding: 8px 10px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.05);
  color: rgba(229,231,235,.90);
  cursor:pointer;
}
.btnMini.danger{
  border-color: rgba(220,38,38,.35);
  background: rgba(220,38,38,.14);
}

/* ===== Fotos del editor ===== */
.photoSlots{
  display:flex;
  gap:10px;
  flex-wrap: wrap;
  align-items:center;
}

.slot{
  width:56px;
  height:56px;
  border-radius: 14px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.04);
  background-size: cover;
  background-position:center;
  display:flex;
  align-items:center;
  justify-content:center;
  color: rgba(229,231,235,.65);
  font-size: 11px;
  cursor:pointer;
  position: relative;
}

.slot .x{
  position:absolute;
  top:-8px;
  right:-8px;
  width:22px;
  height:22px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.15);
  background: rgba(220,38,38,.25);
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:12px;
  color:#fff;
}

.fileHidden{ display:none; }

/* ===== Pedidos: colapsar resumen ===== */
#ordersModal.dashCollapsed #dash{ display:none; }

/* ===== Pedidos MAXIMIZADO + espacio para lista ===== */
#ordersModal .modalBox.modalWide{
  height: calc(100vh - 32px);
  max-height: calc(100vh - 32px);
}
#ordersModal #dash{
  max-height: 45%;
  overflow: auto;
}

/* ===== Mobile menu (hamburguesa) PRO + ANIMACIÓN ===== */
.menuBtn{
  display:none;
  padding: 10px 12px;
  border-radius: 14px;
  line-height: 1;
  font-size: 18px;
}

/* Panel glass */
.menuPanel{
  position: absolute;
  right: 12px;
  top: 64px;
  width: min(280px, calc(100vw - 24px));
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,.14);

  background: linear-gradient(180deg,
    rgba(15,26,46,.55),
    rgba(11,18,32,.50)
  );
  backdrop-filter: blur(18px) saturate(135%);
  -webkit-backdrop-filter: blur(18px) saturate(135%);

  /* sombra premium */
  box-shadow:
    0 18px 55px rgba(0,0,0,.55),
    0 1px 0 rgba(255,255,255,.08) inset;

  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 99999;

  /* cerrado por defecto (animable) */
  opacity: 0;
  transform: translateY(-10px) scale(.985);
  pointer-events: none;

  transition:
    opacity .18s ease,
    transform .22s cubic-bezier(.2,.9,.2,1);
}

.menuPanel.isOpen{
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* item feel */
.menuItem{
  appearance:none;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.06);
  color: rgba(229,231,235,.92);
  border-radius: 14px;
  padding: 12px 12px;
  text-align: left;
  font-family: Montserrat, Inter, system-ui;
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
  display:flex;
  align-items:center;
  justify-content:flex-start;
  gap:10px;

  transition: transform .12s ease, background .12s ease;
}

.menuItem:active{
  transform: scale(.99);
}
.menuItem:hover{
  background: rgba(255,255,255,.09);
}

/* Mobile behavior */
@media (max-width: 640px){
  .modal{ padding: 10px; }

  .modalBox, .modalBox.modalWide{
    max-height: calc(100vh - 20px);
    border-radius: 16px;
  }

  #ordersModal .modalBox.modalWide{
    height: calc(100vh - 20px);
    max-height: calc(100vh - 20px);
  }

  #ordersModal #dash{
    max-height: 50%;
  }

  .topActions{ display:none; }
  .menuBtn{ display:inline-flex; }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce){
  .menuPanel{
    transition: none !important;
  }
  .menuItem{
    transition: none !important;
  }
}
