/* modal-carrito.css — Modal unificado para agregar producto al carrito */

/* ── Toast ─────────────────────────────────────────────────────────────── */
.js-cart-toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: #dc2626;
  color: #fff;
  padding: 11px 26px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  transition: opacity .22s ease, transform .22s ease;
  pointer-events: none;
  z-index: 999999;
}

.js-cart-toast--visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.js-cart-toast--success {
  background: #0aa64f;
}

/* ── Scroll lock ─────────────────────────────────────────────────────── */
body.modal-open {
  overflow: hidden;
}

/* ── Modal base ────────────────────────────────────────────────────────── */
.addProductModal {
  position: fixed;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100000;
  padding: 20px;
}

.addProductModal.is-hidden {
  display: none;
}

.addProductModal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(3px);
}

.addProductModal__box {
  position: relative;
  width: min(480px, 96vw);
  max-height: 90vh;
  overflow-y: auto;
  border-radius: 14px;
  background: #fff;
  padding: 16px 20px 20px;
  box-shadow: 0 18px 45px rgba(0,0,0,.35);
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ── Header ────────────────────────────────────────────────────────────── */
.addProductModal__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.addProductModal__label {
  font-weight: 900;
  font-size: 16px;
  color: #111;
}

.addProductModal__close {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: #e5e7eb;
  font-size: 18px;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.addProductModal__close:hover {
  background: #d1d5db;
}

/* ── Product info ──────────────────────────────────────────────────────── */
.addProductModal__product {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 12px;
  align-items: center;
}

.addProductModal__thumbWrap {
  border-radius: 10px;
  overflow: hidden;
  background: #f9fafb;
  box-shadow: 0 3px 8px rgba(0,0,0,.07);
  padding: 8px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.addProductModal__thumb {
  width: 100%;
  max-height: 80px;
  object-fit: contain;
}

.addProductModal__name {
  font-weight: 900;
  font-size: 15px;
  color: #111;
  text-transform: uppercase;
  line-height: 1.3;
  margin-bottom: 4px;
}

.addProductModal__priceRow {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.addProductModal__price {
  font-weight: 700;
  font-size: 18px;
  color: #0aa64f;
  line-height: 1;
}

/* ── Section (lotes, qty) ──────────────────────────────────────────────── */
.addProductModal__section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.addProductModal__section.is-hidden {
  display: none;
}

.addProductModal__sectionTitle {
  font-weight: 700;
  font-size: 13px;
  color: #374151;
  margin: 0;
}

/* ── Lote table ────────────────────────────────────────────────────────── */
.addProductModal__loteList {
  max-height: 160px;
  overflow-y: auto;
}

.addProductModal__loteTable {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.addProductModal__loteTable th {
  text-align: left;
  padding: 5px 8px;
  background: #f3f4f6;
  font-weight: 700;
  color: #374151;
  position: sticky;
  top: 0;
}

.addProductModal__loteTable td {
  padding: 5px 8px;
  border-bottom: 1px solid #e5e7eb;
}

.addProductModal__loteRow {
  cursor: pointer;
}

.addProductModal__loteRow:hover td {
  background: #eff6ff;
}

.addProductModal__loteRow.is-selected td {
  background: #dbeafe;
}

.addProductModal__loteRow.is-disabled {
  opacity: .45;
  cursor: not-allowed;
}

.addProductModal__loteRow.is-disabled:hover td {
  background: transparent;
}

/* ── Lote info (selected lote summary) ─────────────────────────────────── */
.addProductModal__loteInfo {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 6px;
  padding: 6px 12px;
}

.addProductModal__loteInfo.is-hidden {
  display: none;
}

.addProductModal__loteDetail {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 12px;
  color: #166534;
}

/* ── Qty controls ──────────────────────────────────────────────────────── */
.addProductModal__qtyRow {
  display: flex;
  align-items: center;
  gap: 8px;
}

.addProductModal__qtyBtn {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: none;
  background: #0b78c6;
  color: #fff;
  font-weight: 900;
  font-size: 17px;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.addProductModal__qtyBtn:hover {
  background: #0960a3;
}

.addProductModal__qtyInput {
  width: 44px;
  text-align: center;
  font-size: 16px;
  font-weight: 900;
  border: none;
  border-bottom: 2px solid rgba(0,0,0,.25);
  background: transparent;
  outline: none;
  -moz-appearance: textfield;
}

.addProductModal__qtyInput::-webkit-outer-spin-button,
.addProductModal__qtyInput::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* ── Error message ─────────────────────────────────────────────────────── */
.addProductModal__error {
  color: #dc2626;
  font-size: 13px;
  font-weight: 600;
  margin: 4px 0 0;
}

.addProductModal__error.is-hidden {
  display: none;
}

/* ── Success message ───────────────────────────────────────────────────── */
.addProductModal__success {
  color: #16a34a;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  padding: 6px 10px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  margin: 0;
}

.addProductModal__success.is-hidden {
  display: none;
}

/* ── Bloque integrado: Cantidad + Subtotal en una sola fila ─────────────── */
.addProductModal__qtyBlock {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.addProductModal__qtyBlock .addProductModal__section {
  flex: 1;
  min-width: 0; /* previene overflow en flex child */
}

.addProductModal__summary {
  flex-shrink: 0;
  text-align: right;
  padding-top: 0;
  border-top: none;
}

.addProductModal__summary .addProductModal__sectionTitle {
  margin-bottom: 2px;
}

.addProductModal__summary strong {
  display: block;
  font-size: 18px;
  font-weight: 900;
  color: #111;
  line-height: 1.2;
}

/* ── Submit button ─────────────────────────────────────────────────────── */
.addProductModal__submitBtn {
  width: 100%;
  padding: 11px 13px;
  border: none;
  border-radius: 10px;
  background: #0b78c6;
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  letter-spacing: .5px;
  margin-top: 2px;
  transition: background .15s;
}

.addProductModal__submitBtn:hover:not(:disabled) {
  background: #0960a3;
}

.addProductModal__submitBtn:disabled {
  background: #9ca3af;
  cursor: not-allowed;
}

/* ── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .addProductModal__box {
    padding: 14px 16px 18px;
  }

  .addProductModal__product {
    grid-template-columns: 72px 1fr;
    text-align: left;
  }

  .addProductModal__priceRow {
    justify-content: flex-start;
  }

  .addProductModal__qtyRow {
    justify-content: flex-start;
  }

  .addProductModal__loteDetail {
    justify-content: flex-start;
    gap: 10px;
  }

  .addProductModal__loteList {
    max-height: 130px;
  }

  .addProductModal__submitBtn {
    padding: 12px;
    font-size: 14px;
  }
}
