/* ══════════════════════════════════════
   NUNA BEBE — cart.css
   Extiende estilos existentes. NO modifica clases actuales.
══════════════════════════════════════ */

/* ── Variables extra (complementan las de index.html) ── */
:root {
  --cart-z: 300;
  --cart-width: 360px;
  --lb-z: 500;
}

/* ══ PRODUCT-MEDIA — contenedor uniforme de imagen ══
   Se aplica como clase adicional al .slider-wrap existente.
   Las propiedades que ya define .slider-wrap (aspect-ratio,
   overflow, border-radius, background) se mantienen intactas;
   esta clase solo garantiza posicion relativa y display block. */
.product-media {
  position: relative;
  display: block;
  aspect-ratio: 1 / 1;
  width: 100%;
  overflow: hidden;
  background: #f8eef0;
  border-radius: 10px;
  flex-shrink: 0;
}
.product-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ══ CART ICON — icono en header ══ */
.cart-icon-wrap {
  position: relative;
}
.cart-badge {
  position: absolute;
  top: 1px;
  right: 1px;
  background: var(--primary, #FF7A8A);
  color: white;
  font-size: 10px;
  font-weight: 900;
  min-width: 17px;
  height: 17px;
  border-radius: 9px;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  line-height: 1;
  pointer-events: none;
}
.cart-badge.visible {
  display: flex;
}

/* ══ OVERLAY ══ */
.cart-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .45);
  z-index: calc(var(--cart-z) - 1);
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s ease;
}
.cart-overlay.open {
  opacity: 1;
  pointer-events: all;
}

/* ══ DRAWER ══ */
.cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(var(--cart-width), 100vw);
  height: 100dvh;
  background: white;
  z-index: var(--cart-z);
  transform: translateX(100%);
  transition: transform .35s cubic-bezier(.4, 0, .2, 1);
  display: flex;
  flex-direction: column;
  box-shadow: -6px 0 40px rgba(0, 0, 0, .12);
}
.cart-drawer.open {
  transform: translateX(0);
}

/* Header drawer */
.cart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 18px;
  border-bottom: 1.5px solid #ffe0e6;
  flex-shrink: 0;
}
.cart-header h3 {
  font-size: 16px;
  font-weight: 900;
  color: #222;
  font-family: var(--font, 'Nunito', Arial, sans-serif);
}
.cart-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s;
  color: #888;
  font-family: inherit;
}
.cart-close:hover {
  background: #fff0f3;
  color: var(--primary, #FF7A8A);
}

/* Items list */
.cart-items {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overscroll-behavior: contain;
}

/* Estado vacío */
.cart-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #bbb;
  padding: 40px 20px;
  font-family: var(--font, 'Nunito', Arial, sans-serif);
}
.cart-empty-icon {
  font-size: 50px;
  line-height: 1;
}
.cart-empty-title {
  font-size: 14px;
  font-weight: 800;
  color: #ccc;
  margin: 0;
}
.cart-empty-sub {
  font-size: 12px;
  color: #ddd;
  margin: 0;
  text-align: center;
}

/* Item individual */
.cart-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: #fff9fb;
  border-radius: 12px;
  padding: 10px;
  border: 1px solid #ffe0e6;
  animation: cart-item-in .22s ease;
  font-family: var(--font, 'Nunito', Arial, sans-serif);
}
@keyframes cart-item-in {
  from { opacity: 0; transform: translateX(10px); }
  to   { opacity: 1; transform: translateX(0); }
}
.cart-item-img {
  width: 58px;
  height: 58px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  background: #f0e8ea;
}
.cart-item-info {
  flex: 1;
  min-width: 0;
}
.cart-item-name {
  font-size: 12px;
  font-weight: 800;
  color: #222;
  line-height: 1.35;
  margin: 0 0 3px;
}
.cart-item-price {
  font-size: 14px;
  font-weight: 900;
  color: #e60023;
  margin: 0 0 6px;
}
.cart-item-controls {
  display: flex;
  align-items: center;
  gap: 7px;
}
.qty-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1.5px solid #ffe0e6;
  background: white;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, border-color .15s;
  padding: 0;
  color: #444;
  line-height: 1;
  font-family: inherit;
}
.qty-btn:hover {
  background: #fff0f3;
  border-color: var(--primary, #FF7A8A);
}
.qty-display {
  font-size: 14px;
  font-weight: 900;
  min-width: 20px;
  text-align: center;
  color: #222;
}
.cart-item-remove {
  background: none;
  border: none;
  color: #ccc;
  font-size: 15px;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: color .15s, background .15s;
  flex-shrink: 0;
  align-self: flex-start;
  line-height: 1;
  font-family: inherit;
}
.cart-item-remove:hover {
  color: #e60023;
  background: #fff0f3;
}

/* Footer drawer */
.cart-footer {
  padding: 14px 16px 20px;
  border-top: 1.5px solid #ffe0e6;
  flex-shrink: 0;
  background: #fff9fb;
  font-family: var(--font, 'Nunito', Arial, sans-serif);
}
.cart-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.cart-total-label {
  font-size: 14px;
  font-weight: 800;
  color: #555;
}
.cart-total-amount {
  font-size: 22px;
  font-weight: 900;
  color: #e60023;
}

/* ══ LIGHTBOX — visor de imagenes premium ══ */

/* Cursor en imagenes de slider → indica que son clicables */
.slider img {
  cursor: zoom-in;
}

#img-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 10, .93);
  z-index: var(--lb-z);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
  -webkit-tap-highlight-color: transparent;
}
#img-lightbox.open {
  opacity: 1;
  pointer-events: all;
}

#lb-img-wrap {
  position: relative;
  width: min(92vw, 520px);
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  -webkit-user-select: none;
}

#lb-img {
  max-width: 100%;
  max-height: 82dvh;
  border-radius: 14px;
  object-fit: contain;
  display: block;
  pointer-events: none;
  -webkit-user-drag: none;
  transition: opacity .17s ease;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
}
#lb-img.fading {
  opacity: 0;
}

/* Boton cerrar */
#lb-close {
  position: fixed;
  top: 16px;
  right: 16px;
  background: rgba(255, 255, 255, .18);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, .18);
  color: white;
  font-size: 17px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: calc(var(--lb-z) + 1);
  transition: background .2s;
  font-family: inherit;
  line-height: 1;
}
#lb-close:hover {
  background: rgba(255, 255, 255, .3);
}

/* Botones prev / next */
.lb-nav {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, .15);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, .15);
  color: white;
  font-size: 26px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: calc(var(--lb-z) + 1);
  transition: background .2s;
  font-family: inherit;
  line-height: 1;
}
.lb-nav:hover {
  background: rgba(255, 255, 255, .27);
}
#lb-prev { left: 12px; }
#lb-next { right: 12px; }

/* Contador "1 de 3" */
#lb-counter {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, .52);
  color: rgba(255, 255, 255, .9);
  font-size: 12px;
  font-weight: 700;
  padding: 5px 15px;
  border-radius: 20px;
  white-space: nowrap;
  font-family: var(--font, 'Nunito', Arial, sans-serif);
  letter-spacing: .3px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* ══ BTN ADD TO CART ══ */
.btn-add {
  width: 100%;
  padding: 11px 14px;
  background: #E8D4B6;
  color: #553D2A;
  border: none;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  margin-top: 7px;
  transition: transform .15s, box-shadow .15s, background .15s;
  box-shadow: 0 4px 14px rgba(85,61,42,.15);
  font-family: var(--font, 'Nunito', Arial, sans-serif);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 42px;
  letter-spacing: .2px;
}
.btn-add:hover {
  transform: translateY(-1px);
  background: #DECA9E;
  box-shadow: 0 6px 18px rgba(85,61,42,.25);
}
.btn-add:active {
  transform: scale(.97);
}
.btn-add:disabled {
  cursor: default;
  transform: none;
}
.btn-add.added {
  background: linear-gradient(135deg, #28c45a, #1fa84a);
  box-shadow: 0 4px 14px rgba(37,211,102,.28);
}

/* ══ BADGE EXTRA (CRO) ══ */
.badge-cro {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 10px;
  font-weight: 900;
  padding: 3px 8px;
  border-radius: 8px;
  z-index: 2;
  letter-spacing: .2px;
  white-space: nowrap;
}
.badge-cro-hot {
  background: linear-gradient(135deg, #FF7A8A, #ff9aaa);
  color: white;
  box-shadow: 0 2px 8px rgba(255,122,138,.3);
}
.badge-cro-top {
  background: linear-gradient(135deg, #FFB800, #ffd000);
  color: white;
  box-shadow: 0 2px 8px rgba(255,184,0,.3);
}
