/* ── Reset ──────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #111;
  color: #1a1a1a;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* ── Layout principal ───────────────────────────────────────────────────────── */
.tpv-layout {
  display: flex;
  height: 100vh;
}

/* ── Panel izquierdo ────────────────────────────────────────────────────────── */
.panel-left {
  width: 30%;
  min-width: 340px;
  max-width: 50%;
  background: #1a1a1a;
  color: #fff;
  display: flex;
  flex-direction: column;
  border-right: 1px solid #2a2a2a;
  overflow-y: auto;
  transition: width 0.22s ease, min-width 0.22s ease;
}

.panel-left[data-state="wide"] {
  width: 50%;
  min-width: 200px;
}

.panel-left[data-state="small"] {
  width: 20%;
  min-width: 200px;
}

/* Tab entre paneles */
.panel-tab {
  width: 28px;
  flex-shrink: 0;
  background: #222;
  border: none;
  border-left: 1px solid #2a2a2a;
  border-right: 1px solid #2a2a2a;
  color: #666;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  touch-action: manipulation;
  transition: background 0.12s, color 0.12s;
  z-index: 10;
}
.panel-tab:active { background: #333; color: #fff; }

/* Marca */
.brand {
  padding: 18px 20px 16px;
  border-bottom: 1px solid #2a2a2a;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.brand-name {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.brand-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-tag {
  background: #f5c842;
  color: #111;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 20px;
  letter-spacing: 0.08em;
}


/* Lote / fecha */
.lote-section {
  padding: 16px 20px;
  border-bottom: 1px solid #2a2a2a;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex-shrink: 0;
}

.lote-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.lote-field label {
  font-size: 0.65rem;
  color: #666;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 6px;
}

.auto-note {
  background: #2a3a2a;
  color: #5a9;
  font-size: 0.6rem;
  padding: 1px 5px;
  border-radius: 10px;
}

.lote-field input {
  background: #252525;
  border: 1px solid #333;
  border-radius: 8px;
  color: #fff;
  font-size: 1.1rem;
  padding: 14px 14px;
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
}

.lote-field input:focus {
  outline: none;
  border-color: #555;
}

.lote-field input[readonly] {
  color: #666;
  background: #1f1f1f;
  cursor: default;
}

.fecha-btns {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.fecha-btns-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.btn-hoy {
  width: 100%;
  height: 54px;
  background: #252525;
  color: #bbb;
  border: 1px solid #333;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  touch-action: manipulation;
  transition: background 0.12s;
}
.btn-hoy:active { background: #3a3a3a; color: #fff; }

.btn-dia {
  height: 54px;
  background: #1e1e2e;
  color: #88aadd;
  border: 1px solid #334;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
  transition: background 0.12s;
}
.btn-dia:active { background: #2a2a44; color: #aacfff; }

/* Tamaño */
.tamano-section {
  padding: 16px 20px;
  border-bottom: 1px solid #2a2a2a;
  flex-shrink: 0;
}

.section-label {
  display: block;
  font-size: 0.65rem;
  color: #666;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.tamano-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.tamano-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 18px 8px;
  background: #252525;
  border: 2px solid #333;
  border-radius: 12px;
  color: #666;
  cursor: pointer;
  transition: all 0.12s;
  touch-action: manipulation;
  min-height: 90px;
}

.tamano-btn.active {
  background: #fff;
  border-color: #fff;
  color: #111;
}

.tamano-btn:active { opacity: 0.8; }

.tamano-name {
  font-size: 1.25rem;
  font-weight: 700;
}

.tamano-peso {
  font-size: 0.75rem;
  margin-top: 4px;
  opacity: 0.65;
}

/* Pedido */
.pedido-section {
  padding: 16px 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.pedido-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.btn-reset {
  height: 42px;
  padding: 0 16px;
  background: #2a1a1a;
  color: #c44;
  border: 1px solid #5a2a2a;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
  transition: background 0.12s;
}
.btn-reset:active { background: #3d1a1a; color: #f55; }

.pedido-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  flex: 1;
}

.pedido-empty {
  font-size: 0.85rem;
  color: #444;
  text-align: center;
  padding: 28px 0;
}

.pedido-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #252525;
  border-radius: 10px;
  padding: 12px 12px;
  min-height: 64px;
}

.pedido-nombre {
  font-size: 0.88rem;
  font-weight: 600;
  color: #ddd;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pedido-controls {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.qty-btn {
  height: 52px;
  min-width: 52px;
  padding: 0 12px;
  border-radius: 10px;
  border: none;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
  white-space: nowrap;
}

.qty-btn.minus { background: #333; color: #ccc; }
.qty-btn.minus:active { background: #4a4a4a; }
.qty-btn.plus  { background: #fff;  color: #111; }
.qty-btn.plus:active  { background: #ccc; }
.qty-btn.ten   { opacity: 0.8; font-size: 0.85rem; }

.pedido-qty {
  font-size: 1.4rem;
  font-weight: 700;
  color: #fff;
  min-width: 32px;
  text-align: center;
}

.remove-btn {
  height: 52px;
  width: 52px;
  background: #2a2a2a;
  border: 1px solid #3a3a3a;
  border-radius: 10px;
  color: #555;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
  flex-shrink: 0;
}
.remove-btn:active { background: #3a1a1a; color: #e44; border-color: #e44; }

/* Panel bottom */
.panel-bottom {
  padding: 16px 20px 22px;
  border-top: 1px solid #2a2a2a;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex-shrink: 0;
}

.total-badge {
  background: #252525;
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 0.85rem;
  color: #888;
  text-align: center;
}
.total-badge.hidden { display: none; }

.btn-generate {
  width: 100%;
  padding: 26px;
  background: #f5c842;
  color: #111;
  border: none;
  border-radius: 14px;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  touch-action: manipulation;
  transition: background 0.12s, opacity 0.12s;
}
.btn-generate:active:not(:disabled) { background: #dfb030; }
.btn-generate:disabled { opacity: 0.25; cursor: not-allowed; }

/* ── Panel derecho: grid de sabores ─────────────────────────────────────────── */
.panel-right {
  flex: 1;
  background: #f5f4f0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.sabores-header {
  padding: 14px 22px;
  border-bottom: 1px solid #e2e0d8;
  background: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: #999;
  text-transform: uppercase;
  flex-shrink: 0;
}

.sabores-grid {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 14px;
  align-content: start;
}

/* Botón de sabor */
.sabor-btn {
  position: relative;
  background: #fff;
  border: 2px solid #e2e0d8;
  border-radius: 14px;
  padding: 28px 14px;
  min-height: 120px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
  transition: transform 0.08s, background 0.1s, border-color 0.1s;
  text-align: center;
  user-select: none;
  -webkit-user-select: none;
}

.sabor-btn:active {
  transform: scale(0.93);
}

.sabor-btn.selected {
  background: #111;
  border-color: #111;
  color: #fff;
}

.sabor-btn-nombre {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: 0.01em;
}

.sabor-qty-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: #f5c842;
  color: #111;
  font-size: 0.8rem;
  font-weight: 800;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sabor-qty-badge.hidden { display: none; }

/* ── Responsive: tablet vertical ────────────────────────────────────────────── */
@media (max-width: 700px) {
  .tpv-layout { flex-direction: column; }

  .panel-left {
    width: 100%;
    min-width: unset;
    border-right: none;
    border-bottom: 1px solid #2a2a2a;
    overflow-y: unset;
  }

  .pedido-section { max-height: 200px; }

  html, body { overflow: auto; }
  .tpv-layout { height: auto; }
  .panel-right { height: 60vh; }
}
