/* =========================================================
   Mar-Plast Ofertas — style.css
   ========================================================= */

/* El atributo `hidden` tiene que ganarle a cualquier `display` propio.
   Sin esto, .drawer-overlay { display: flex } dejaba el panel del carrito
   visible para siempre, tapando toda la pantalla. */
[hidden] {
  display: none !important;
}

/* 1. CSS Variables */
:root {
  /* ── Marca ── */
  --azul:       #0066B2;
  --azul-dark:  #004f8f;
  --naranja:    #f48120;
  --naranja-dark: #d4690f;
  --rojo:       #e53935;
  --verde:      #2e7d32;

  /* ── Texto ── */
  --text:           #333;
  --text-muted:     #555;
  --text-secondary: #777;
  --text-faint:     #aaa;
  --text-disabled:  #bbb;
  --text-placeholder: #ccc;
  --text-dim:         #888;

  /* ── Superficies ── */
  --bg:           #f0f2f5;
  --bg-subtle:    #f5f5f5;
  --bg-hover:     #fafafa;
  --bg-footer:    #f8f8f8;
  --bg-field:     #f9f9f9;
  --surface-dark: #2c2c2c;

  /* ── Bordes ── */
  --border:        #ddd;
  --border-light:  #eee;
  --border-lighter: #f0f0f0;

  /* ── Semánticos ── */
  --orange-bg:   #fff8f0;
  --orange-border: #ffe0b2;
  --green-bg:    #e8f5e9;
  --placeholder-bg: #e0e0e0;
}

/* 2. Reset & base */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Focus visible global — teclado y lectores de pantalla */
*:focus { outline: none; }
*:focus-visible {
  outline: 2px solid var(--azul);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Respeto por preferencias de movimiento reducido */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, Arial, sans-serif;
  font-size: 13px;
  background: var(--bg);
  color: var(--text);
}

/* Header + barra de categorias: un solo bloque pegado arriba.
   Antes cada uno era sticky por separado y .tabs usaba top: 53px fijo,
   que dejo de coincidir cuando el header mobile paso a dos filas. */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
}

/* 3. Header */
.header {
  background: var(--azul);
  color: white;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-logo {
  height: 34px;
  object-fit: contain;
  filter: brightness(0) invert(1);
}

.header-brand .name {
  font-weight: 900;
  font-size: 18px;
  letter-spacing: 1px;
}

.header-brand .sub {
  font-size: 9px;
  opacity: 0.65;
}

.header-right {
  display: flex;
  gap: 10px;
  align-items: center;
}

.admin-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  text-decoration: none;
  transition: background .15s;
  flex-shrink: 0;
}
.admin-btn:hover { background: rgba(255, 255, 255, 0.22); }
.admin-btn svg { width: 18px; height: 18px; }

.search-box {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 4px;
  padding: 6px 14px;
  color: white;
  font-size: 11px;
  width: 220px;
}

.search-box::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

.cart-btn {
  background: var(--naranja);
  border: none;
  color: white;
  padding: 0 16px;
  height: 44px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: bold;
  cursor: pointer;
  white-space: nowrap;
}

/* 4. Tabs */
.tabs {
  background: white;
  border-bottom: 3px solid var(--azul);
  display: flex;
  padding: 0 20px;
  /* visible, no auto: si no, el panel desplegable del boton queda recortado */
  overflow: visible;
}

.tab {
  background: none;
  border: none;
  font-family: inherit;
  padding: 8px 18px;
  font-size: 11px;
  color: var(--text-muted);
  cursor: pointer;
  border-right: 1px solid var(--border-light);
  white-space: nowrap;
  user-select: none;
}

.tab:hover {
  background: var(--bg-subtle);
}

/* La pestaña "ver todo" se separa del resto con una linea */
.tab-todos {
  font-weight: 700;
  border-right: 2px solid var(--border-light);
}

.tab.active {
  background: var(--azul);
  color: white;
  font-weight: bold;
}

/* Boton "Categorías" con las que no entran en pantalla */
.cat-mas-wrap { position: relative; margin-left: auto; }

.cat-mas-btn {
  padding: 8px 14px;
  font-size: 11px;
  font-weight: 700;
  font-family: inherit;
  color: var(--azul);
  background: white;
  border: none;
  border-left: 1px solid var(--border-light);
  cursor: pointer;
  white-space: nowrap;
}

.cat-mas-btn.tiene-activa { background: var(--azul); color: white; }

.cat-mas-btn .cat-mas-n { font-weight: 600; opacity: 0.85; }

.cat-mas-panel {
  position: absolute;
  right: 0;
  top: 100%;
  min-width: 260px;
  max-height: 60vh;
  overflow-y: auto;
  background: white;
  border: 1px solid var(--border-light);
  border-radius: 0 0 8px 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  z-index: 101;
}

.cat-mas-item {
  display: block;
  width: 100%;
  padding: 10px 14px;
  font-size: 12px;
  font-family: inherit;
  text-align: left;
  background: none;
  border: none;
  border-bottom: 1px solid var(--border-lighter);
  cursor: pointer;
}

.cat-mas-item:hover { background: var(--bg-subtle); }
.cat-mas-item.activa { background: var(--azul); color: white; font-weight: 700; }

.tab .count {
  font-size: 9px;
  opacity: 0.65;
  margin-left: 4px;
}

/* 5. Section title */
.section-title {
  padding: 12px 20px 4px;
  font-size: 13px;
  font-weight: bold;
  color: var(--text);
}

/* 6. Table styles */
.table-head {
  display: grid;
  grid-template-columns: 130px 1fr 90px 130px 80px;
  background: var(--surface-dark);
  color: white;
  padding: 7px 20px;
  gap: 10px;
  font-size: 9px;
  font-weight: bold;
  letter-spacing: 0.5px;
  align-items: center;
}

.table-row {
  display: grid;
  grid-template-columns: 130px 1fr 90px 130px 80px;
  padding: 6px 20px;
  gap: 10px;
  align-items: center;
  border-bottom: 1px solid var(--border-lighter);
  background: white;
  transition: background 0.15s;
}

.table-row:hover {
  background: var(--bg-hover);
}

.table-row.selected {
  background: var(--orange-bg);
}

/* 7. Thumbnail
   Se adapta al ancho de su columna en vez de usar un tamaño fijo: con medidas
   fijas, en tablet la foto era mas ancha que la columna y tapaba el texto. */
.thumb {
  width: 100%;
  max-width: 120px;
  aspect-ratio: 1 / 1;
  height: auto;
  border-radius: 6px;
  cursor: zoom-in;
  border: 2px solid transparent;
  transition: border-color 0.2s;
  object-fit: cover;
}

.thumb:hover {
  border-color: var(--azul);
}

.thumb-placeholder {
  width: 100%;
  max-width: 120px;
  aspect-ratio: 1 / 1;
  height: auto;
  border-radius: 6px;
  background: var(--placeholder-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  color: var(--text-faint);
  text-align: center;
  line-height: 1.2;
  flex-shrink: 0;
  overflow: hidden;
}

/* Ya cargo la foto: se saca el recuadro gris de "sin imagen" */
.thumb-placeholder.con-foto {
  background: none;
  border: none;
  cursor: zoom-in;
}

/* 8. Product info */
.prod-name {
  font-weight: bold;
  cursor: pointer;
  line-height: 1.3;
}

.prod-name:hover {
  color: var(--azul);
  text-decoration: underline;
}

.prod-sku {
  color: var(--text-faint);
  font-size: 9px;
  margin-top: 2px;
}

/* En desktop/tablet hay espacio de sobra: el subtitulo puede leerse mejor.
   En mobile (ver @media max-width: 480px) se deja como esta, mas chico. */
@media (min-width: 481px) {
  .prod-sku {
    font-size: 11px;
    color: #666;
  }
}

.prod-desc-preview {
  font-size: 10px;
  color: var(--text-dim);
  margin-top: 3px;
  line-height: 1.4;
  max-width: 320px;
}

/* 9. Price */
.price-offer {
  color: var(--rojo);
  font-weight: bold;
  font-size: 12px;
}

.iva-legend {
  color: var(--gris, #888);
  font-weight: 600;
  font-size: 9px;
  white-space: nowrap;
}

.price-orig {
  text-decoration: line-through;
  color: var(--text-disabled);
  font-size: 9px;
}

/* 10. Stock */
/* 11. Quantity controls */
.qty-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
}

.qty-btn {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  border-radius: 4px;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: all 0.15s;
}

.qty-btn:hover {
  background: var(--azul);
  color: white;
  border-color: var(--azul);
}

.qty-btn.plus:hover {
  background: var(--naranja);
  border-color: var(--naranja);
}

.qty-input {
  width: 44px;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px;
  text-align: center;
  font-size: 11px;
  outline: none;
}

.qty-input.has-value {
  border: 2px solid var(--naranja);
  color: var(--naranja);
  font-weight: bold;
}

.qty-input:focus {
  border-color: var(--azul);
}

/* 12. Subtotal */
.subtotal {
  font-size: 11px;
  color: var(--text-placeholder);
}

.subtotal.has-value {
  color: var(--naranja);
  font-weight: bold;
  font-size: 12px;
}

/* 13. Footer */
.footer {
  position: sticky;
  bottom: 0;
  z-index: 99;
  background: var(--bg-footer);
  border-top: 2px solid var(--azul);
  padding: 10px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer-info {
  font-size: 11px;
  color: var(--text-muted);
}

.footer-total {
  color: var(--naranja);
  font-size: 15px;
  font-weight: bold;
  margin-left: 6px;
}

.send-btn {
  background: var(--naranja);
  border: none;
  color: white;
  padding: 0 24px;
  height: 44px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
  letter-spacing: 0.5px;
}

.send-btn:hover {
  background: var(--naranja-dark);
}

/* 14. Modal base */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 200;
  align-items: center;
  justify-content: center;
}

.modal-overlay.active {
  display: flex;
}

.modal-box {
  background: white;
  border-radius: 8px;
  width: 580px;
  max-width: 95vw;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.25);
}

.modal-header {
  background: var(--azul);
  color: white;
  padding: 12px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-radius: 8px 8px 0 0;
}

.modal-header h3 {
  font-size: 13px;
  font-weight: bold;
}

.modal-close {
  background: none;
  border: none;
  color: white;
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
}

.modal-close:hover {
  opacity: 0.8;
}

.modal-body {
  padding: 18px;
}

/* 15. Modal producto specifics */
.modal-img-wrap {
  width: 100%;
  height: 320px;
  background: var(--bg-subtle);
  border-radius: 6px;
  margin-bottom: 14px;
  overflow: hidden;
  position: relative;
  cursor: zoom-in;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-img-wrap img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

.modal-carr-ctrl {
  position: absolute;
  z-index: 2;
  pointer-events: all;
}

.modal-carr-prev,
.modal-carr-next {
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0,0,0,.45);
  color: white;
  border: none;
  border-radius: 6px;
  width: 34px;
  height: 52px;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: background .15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-carr-prev { left: 8px; }
.modal-carr-next { right: 8px; }
.modal-carr-prev:hover,
.modal-carr-next:hover { background: rgba(0,0,0,.65); }

.modal-carr-counter {
  bottom: 36px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,.5);
  color: white;
  font-size: 11px;
  padding: 2px 10px;
  border-radius: 100px;
  white-space: nowrap;
}

.modal-carr-dots {
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
}

.modal-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255,255,255,.4);
  cursor: pointer;
  transition: background .15s;
}

.modal-dot.active { background: white; }

/* 15b. Lightbox (visor de imagen a pantalla completa).
   La imagen y los controles ocupan zonas SEPARADAS: nada se dibuja encima de
   la foto, porque tapaba textos y detalles del producto.
   [ barra: contador ......... cerrar ]
   [   ‹        imagen        ›       ] */
.lb-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  flex-direction: column;
}

.lb-barra {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
}

.lb-fila {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 8px 16px;
}

/* min-width/height 0: sin esto la imagen no se achica y empuja las flechas
   fuera de la pantalla. */
.lb-img {
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
  display: block;
}

.lb-btn,
.lb-close {
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: background 0.15s;
}

.lb-btn:hover,
.lb-close:hover { background: rgba(255, 255, 255, 0.3); }

.lb-btn { width: 44px; height: 44px; font-size: 26px; }
.lb-close { width: 40px; height: 40px; font-size: 18px; }

.lb-counter {
  color: rgba(255, 255, 255, 0.75);
  font-size: 12px;
  white-space: nowrap;
}

.modal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.modal-field label {
  font-size: 9px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: block;
  margin-bottom: 2px;
}

.modal-field span {
  font-size: 12px;
  font-weight: bold;
  color: var(--text);
}

.modal-desc {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 14px;
  background: var(--bg-field);
  padding: 10px;
  border-radius: 4px;
}

.modal-qty-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--orange-bg);
  padding: 10px 14px;
  border-radius: 6px;
  border: 1px solid var(--orange-border);
}

.modal-add-btn {
  background: var(--naranja);
  border: none;
  color: white;
  padding: 8px 20px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
  margin-left: auto;
}

/* 15b. FAQ */
.faq-item {
  border-bottom: 1px solid var(--border);
}

.faq-item:last-child {
  border-bottom: none;
}

.faq-pregunta {
  width: 100%;
  background: none;
  border: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  color: var(--text);
}

.faq-flecha {
  transition: transform .15s;
  flex-shrink: 0;
}

.faq-item.abierta .faq-flecha {
  transform: rotate(180deg);
}

.faq-respuesta {
  display: none;
  padding: 0 0 14px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

.faq-item.abierta .faq-respuesta {
  display: block;
}

/* 16. Modal orden specifics */
.order-form {
  padding: 14px 18px;
  border-top: 1px solid var(--border-light);
}

.order-form label {
  font-size: 10px;
  color: var(--text-secondary);
  display: block;
  margin-bottom: 3px;
  margin-top: 10px;
}

.order-form input,
.order-form textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 7px 10px;
  font-size: 11px;
  outline: none;
  font-family: 'Segoe UI', system-ui, -apple-system, Arial, sans-serif;
}

.order-form input:focus,
.order-form textarea:focus {
  border-color: var(--azul);
}

.order-form textarea {
  height: 60px;
  resize: vertical;
}

.confirm-btn {
  background: var(--azul);
  border: none;
  color: white;
  padding: 10px 28px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
  margin-top: 12px;
  width: 100%;
}

.confirm-btn:hover {
  background: var(--azul-dark);
}

.order-note {
  text-align: center;
  font-size: 9px;
  color: var(--text-faint);
  margin-top: 8px;
}

/* 17. Inline styles extraídos */
.modal-qty-label {
  font-size: 11px;
  font-weight: bold;
  color: var(--text-muted);
}

.modal-subtotal-text {
  font-size: 11px;
  color: var(--naranja);
  font-weight: bold;
  margin-left: 8px;
}

.cart-btn svg { flex-shrink: 0; }

/* 18. Empty state */
.empty-state {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-faint);
  font-size: 13px;
}

/* 18. Responsive — tablet (≤768px) */
@media (max-width: 768px) {
  .table-head,
  .table-row {
    grid-template-columns: 80px 1fr 90px 120px 70px;
    padding: 8px 12px;
    gap: 8px;
  }

  .header {
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 12px;
  }

  .search-box {
    width: 100%;
    order: 3;
  }

  .tabs {
    font-size: 10px;
    padding: 0;
  }

  .tab {
    padding: 6px 10px;
  }

  /* Categorías en mobile y tablet: un solo botón a lo ancho, sin pestañas
     sueltas al costado. El JS manda todas al panel debajo de este ancho. */
  .cat-mas-wrap {
    width: 100%;
    margin-left: 0;
  }

  .cat-mas-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    padding: 11px 16px;
    font-size: 12px;
    text-align: left;
    border-left: none;
  }

  .cat-mas-btn .cat-mas-n {
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .cat-mas-btn .cat-mas-flecha { flex-shrink: 0; }

  .cat-mas-panel {
    left: 0;
    right: 0;
    min-width: 0;
    width: 100%;
    border-radius: 0;
  }

  .cat-mas-item { padding: 13px 16px; font-size: 13px; }
}

/* 19. Responsive — móvil (≤480px): layout card por fila */
@media (max-width: 480px) {
  /* Header mobile: logo centrado arriba; debajo fila [admin | búsqueda | carrito] */
  .header {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 8px 12px;
  }
  .header-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
  }
  .header-brand .sub { display: none; }

  .header-right {
    width: 100%;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
  }

  /* En 320px no entra "$98.994 · 6 items": queda "$98.994 · 6" */
  .cart-items-label { display: none; }
  /* Izquierda: acceso admin */
  .header-right .admin-btn {
    order: 1;
    flex-shrink: 0;
    width: 36px;
    height: 36px;
  }
  /* El boton de FAQ no entra comodo junto a admin/busqueda/carrito en 320px:
     se oculta en mobile, es una funcion de baja frecuencia de uso. */
  .faq-btn { display: none; }
  /* Medio: barra de búsqueda — fondo blanco, letras azules */
  .header-right .search-box {
    order: 2;
    flex: 1 1 auto;
    width: auto;
    /* Sin esto un input no baja de su ancho por defecto (~170px) dentro de un
       flex, y empuja al carrito fuera de la pantalla en 320px. */
    min-width: 0;
    height: 36px;
    box-sizing: border-box;
    background: #fff;
    color: var(--azul);
    border-color: #fff;
    font-weight: 600;
  }
  .header-right .search-box::placeholder { color: rgba(0, 102, 178, 0.55); }
  /* Derecha: resumen del carrito */
  .header-right .cart-btn {
    order: 3;
    flex-shrink: 0;
    height: 36px;
    font-size: 10px;
    padding: 0 10px;
  }

  /* Ocultar cabecera de tabla — se vuelve implícita por el layout */
  .table-head { display: none; }

  /* Cada fila → layout de 2 filas:
     [foto]  [nombre + sku + desc]  [precio]
                    [qty controls]  [subtotal] */
  .table-row {
    display: grid;
    grid-template-columns: 90px 1fr auto;
    grid-template-rows: auto auto;
    padding: 10px 12px;
    gap: 4px 10px;
    align-items: start;
  }

  /* Foto — ocupa las 2 filas */
  .table-row .thumb-placeholder,
  .table-row .thumb {
    grid-column: 1;
    grid-row: 1 / 3;
    align-self: center;
  }

  /* Nombre/sku → fila 1 */
  .table-row .tr-info {
    grid-column: 2;
    grid-row: 1;
  }

  /* Precio → fila 1, columna derecha */
  .table-row .tr-price {
    grid-column: 3;
    grid-row: 1;
    text-align: right;
  }

  /* En mobile, la leyenda "(+ IVA)" va debajo de cada precio */
  .table-row .iva-legend {
    display: block;
    margin-top: 1px;
  }

  /* Controles qty → fila 2, col central */
  .table-row .qty-wrap {
    grid-column: 2;
    grid-row: 2;
  }

  /* Subtotal → fila 2, col derecha */
  .table-row .subtotal {
    grid-column: 3;
    grid-row: 2;
    text-align: right;
    align-self: center;
  }

  /* Lightbox: controles mas chicos para que la foto gane ancho */
  .lb-fila { gap: 4px; padding: 0 4px 12px; }
  .lb-btn { width: 38px; height: 38px; font-size: 22px; }

  /* Footer compacto */
  .footer {
    flex-direction: column;
    gap: 8px;
    padding: 10px 12px;
  }
  .send-btn { width: 100%; }

  /* Modal a pantalla completa en móvil */
  .modal-box {
    width: 100%;
    max-width: 100%;
    max-height: 95vh;
    border-radius: 12px 12px 0 0;
    margin-top: auto;
  }

  .modal-overlay {
    align-items: flex-end;
  }
}

/* ── Aviso de productos quitados del pedido guardado ─────────── */
.aviso-carrito {
  padding: 10px 20px;
  background: #fff6ed;
  color: #b54708;
  font-size: 12px;
  border-bottom: 1px solid #fddcab;
}

/* ── Panel lateral del pedido ────────────────────────────────── */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 200;
  display: flex;
  justify-content: flex-end;
}

.drawer {
  width: min(420px, 100%);
  background: white;
  display: flex;
  flex-direction: column;
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.2);
  /* El track de pasos mide 300% del panel: sin esto, los pasos que todavia
     no toca ver se dibujan al costado y quedan a la vista. */
  overflow: hidden;
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--azul);
  color: white;
  flex-shrink: 0;
}

.drawer-head h3 { margin: 0; font-size: 15px; }

.drawer-close {
  background: none;
  border: none;
  color: white;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
}

/* Track de los dos pasos: el panel se desliza en vez de saltar a otra
   pantalla, asi el cliente no pierde el hilo de donde esta. */
.drawer-pasos {
  flex: 1;
  display: flex;
  width: 300%;
  min-height: 0;
  transform: translateX(0);
  transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
}

.drawer-pasos.en-datos        { transform: translateX(-33.3333%); }
.drawer-pasos.en-confirmacion { transform: translateX(-66.6666%); }

.drawer-paso {
  width: 33.3333%;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.drawer-volver {
  background: none;
  border: none;
  color: white;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 0 8px 0 0;
  margin-right: 2px;
}

.drawer-head h3 { flex: 1; }

.drawer-body { flex: 1; overflow-y: auto; min-height: 0; }

.drawer-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-lighter);
}

/* Producto que quedo en 0: sigue a la vista para poder recuperarlo de un
   toque, pero atenuado, para que se note que no esta sumando al pedido. */
.drawer-item.sin-cantidad {
  opacity: 0.55;
  background: var(--bg-subtle);
}

.drawer-item.sin-cantidad .drawer-item-sub {
  color: var(--text-muted);
  font-weight: 600;
}

.drawer-item-sku {
  font-size: 10px;
  font-weight: 700;
  color: var(--azul);
  letter-spacing: 0.3px;
}

.drawer-item-titulo { font-size: 12px; line-height: 1.35; }
.drawer-item-precio { font-size: 11px; color: var(--text-muted); }

.drawer-item-controles {
  display: flex;
  align-items: center;
  gap: 10px;
}

.drawer-item-sub {
  margin-left: auto;
  font-weight: 700;
  font-size: 13px;
}

.drawer-borrar {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 15px;
  padding: 2px 4px;
  flex-shrink: 0;
}

.drawer-vacio {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.6;
}

.drawer-foot {
  padding: 14px 18px;
  border-top: 2px solid var(--border-light);
  background: var(--bg-subtle);
  flex-shrink: 0;
}

.drawer-resumen { font-size: 11px; color: var(--text-muted); }
.drawer-total-monto { font-size: 17px; font-weight: 900; margin: 4px 0 10px; }
.drawer-foot .send-btn { width: 100%; }

/* ── Resumen compacto en la pantalla de envío ────────────────── */
.orden-resumen {
  padding: 14px 18px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-light);
}

.orden-resumen-linea {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--text-muted);
}

.orden-volver {
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--azul);
  text-decoration: underline;
  cursor: pointer;
}

.orden-resumen-total {
  margin-top: 6px;
  font-size: 18px;
  font-weight: 900;
  color: var(--text);
}

/* Formulario de envío dentro del panel */
.drawer .order-form {
  border-top: none;
}

/* En pantallas chicas el panel ocupa todo, como una pantalla propia */
@media (max-width: 600px) {
  .drawer { width: 100%; }
}

/* ── Botón de descarga del Excel ─────────────────────────────── */
/* Naranja pleno: el comprobante no se puede pasar por alto, y no compite con
   el azul del boton de confirmar, que es la accion principal del paso 2. */
.btn-excel {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 13px 14px;
  margin-bottom: 10px;
  background: var(--naranja);
  color: white;
  border: none;
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.2px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(244, 129, 32, 0.35);
  transition: background 0.15s;
}

.btn-excel svg { width: 17px; height: 17px; flex-shrink: 0; }
.btn-excel:hover:not(:disabled) { background: var(--naranja-dark); }
.btn-excel:disabled { opacity: 0.6; cursor: default; }

/* En la confirmacion es la accion principal de la pantalla */
.btn-excel-grande {
  padding: 16px;
  font-size: 14px;
}

.btn-excel-grande svg { width: 20px; height: 20px; }

/* ── Paso de confirmación ────────────────────────────────────── */
.envio-ok {
  padding: 36px 24px;
  text-align: center;
}

.envio-ok-icono {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: #e7f6ec;
  color: #027a48;
  font-size: 28px;
  line-height: 56px;
}

.envio-ok h4 {
  margin: 0 0 6px;
  font-size: 18px;
  color: var(--text);
}

.envio-ok p {
  margin: 0 0 20px;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

.envio-ok-nota {
  font-size: 11px !important;
  margin: 8px 0 24px !important;
}

.btn-volver-catalogo {
  background: none;
  border: none;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--azul);
  text-decoration: underline;
  cursor: pointer;
}
