/*==================== CARRITO PAGE STYLES ====================*/
/* Premium Redesign — TodoGlobos Silvia */
/* Consistent with index.css and productos.css design language */

/* ==================== BODY / FONDO ==================== */
body {
  background-color: #f5f0ff;
  background-image:
    radial-gradient(ellipse at 0% 0%, rgba(123, 79, 255, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 100% 100%, rgba(255, 78, 205, 0.05) 0%, transparent 50%);
  color: var(--text-color);
  min-height: 100dvh;
}

/* ==================== HEADER OVERRIDE ==================== */
.header {
  box-shadow: 0 2px 20px rgba(123, 79, 255, 0.12);
}

/* ==================== PAGE WRAPPER ==================== */
.carrito__page-wrapper {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1rem 12rem;
  padding-top: 3rem;
  /* below fixed header */
}

/* ==================== PAGE TITLE ==================== */
.carrito__page-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  margin-top: 0.5rem;
}

.carrito__page-title i {
  font-size: 1.8rem;
  background: var(--background-gradiente);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.carrito__page-title h1 {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--dark-color);
  margin: 0;
  text-align: left;
}

.carrito__page-title .carrito__item-count {
  background: var(--boton-gradiente);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: 2rem;
  margin-left: 0.25rem;
  vertical-align: middle;
}

/* ==================== LAYOUT (lista + resumen) ==================== */
.carrito__layout {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* ---- DESKTOP: columnas con scroll solo en la lista ---- */
@media screen and (min-width: 900px) {

  /* El wrapper = toda la ventana. padding-top:5rem ya declarado en la regla base.
     box-sizing:border-box incluye ese padding en la altura, sin overflow de página. */
  .carrito__page-wrapper {
    height: 100dvh;
    padding-bottom: 2rem;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    overflow: hidden;
    padding-top: 6rem;

  }

  /* El título nunca se encoge */
  .carrito__page-title {
    flex-shrink: 0;
  }

  /* El layout dos columnas ocupa el resto y tiene overflow controlado */
  .carrito__layout {
    flex-direction: row;
    align-items: stretch;
    /* ambas columnas igual altura */
    flex: 1 1 0;
    /* ocupa el espacio restante del wrapper */
    min-height: 0;
    /* permite que flex hijo haga scroll */
    gap: 1.5rem;
  }

  /* Columna productos: scrolleable internamente */
  .carrito__lista-col {
    flex: 1 1 60%;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 0.5rem;
    /* evita que la scrollbar tape contenido */
    /* Scrollbar sutil */
    scrollbar-width: thin;
    scrollbar-color: rgba(123, 79, 255, 0.25) transparent;
  }

  .carrito__lista-col::-webkit-scrollbar {
    width: 5px;
  }

  .carrito__lista-col::-webkit-scrollbar-track {
    background: transparent;
  }

  .carrito__lista-col::-webkit-scrollbar-thumb {
    background: rgba(123, 79, 255, 0.3);
    border-radius: 10px;
  }

  /* Columna resumen: sticky al costado, nunca scrollea */
  .carrito__resumen-col {
    flex: 0 0 340px;
    align-self: flex-start;
    position: sticky;
    top: 0;
    /* dentro del flex ya está posicionado al tope de la columna */
  }
}

/* Hide summary card on mobile (bottom bar handles it) */
.carrito__resumen-col {
  display: none;
}

@media screen and (min-width: 900px) {
  .carrito__resumen-col {
    display: block;
  }
}

/* ==================== ITEMS LIST HEADING ==================== */
.carrito__lista-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(123, 79, 255, 0.1);
}

.carrito__lista-heading span {
  font-size: 0.85rem;
  color: #888;
  font-weight: 500;
}

/* ==================== PRODUCTO CARD ==================== */
.contenedor__carrito {
  margin-bottom: 0.85rem;
}

.carrito__productos {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(123, 79, 255, 0.1);
  border-radius: 1.25rem;
  padding: 1rem;
  box-shadow: 0 4px 20px rgba(123, 79, 255, 0.07);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.carrito__productos:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(123, 79, 255, 0.14);
  border-color: rgba(123, 79, 255, 0.22);
}

/* ---- MOBILE: card en columna para que la descripción nunca se corte ---- */
.carrito__producto {
  display: grid;
  /* imagen | info | precio+controles */
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
}

/* ==================== PRODUCT IMAGE ==================== */
.img__carrito-seleccionado {
  flex-shrink: 0;
  width: 80px;
  height: 80px;
  border-radius: 1rem;
  overflow: hidden;
  background: linear-gradient(135deg, #f0e8ff 0%, #fce4f7 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(123, 79, 255, 0.15);
}

.img__carrito {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 1rem;
}

/* ==================== PRODUCT INFO ==================== */
.carrito__producto-titulo {
  min-width: 0;
  width: 100%;
  /* Sobreescribe el width: 60% global de styles.css para que ocupe todo el espacio disponible */
  /* crucial: permite que el texto se corte con ellipsis dentro del grid */
  margin: 0;
}

.carrito__producto-titulo small {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--first-color);
  background: rgba(123, 79, 255, 0.08);
  padding: 0.15rem 0.5rem;
  border-radius: 2rem;
  margin-bottom: 0.3rem;
}

.carrito__producto-titulo h3 {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--dark-color);
  /* Permite wrap para que textos largos no desborden */
  white-space: normal;
  word-break: break-word;
  overflow-wrap: break-word;
  margin: 0;
  line-height: 1.35;
}

.carrito__producto-titulo h3 b {
  font-weight: 800;
  color: var(--first-color);
}

/* ==================== PRICE + QUANTITY ==================== */
.carrito__producto-seleccionado {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.4rem;
  flex-shrink: 0;
  /* nunca se achica; el título cede espacio */
}

.carrito__producto-seleccionado p {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--dark-color);
  margin: 0;
  padding: 0;
  white-space: nowrap;
  /* el precio nunca rompe línea */
}

/* ==================== QUANTITY CONTROLS ==================== */
.cantidad__seleccionada {
  display: flex;
  align-items: center;
  gap: 0;
  background: rgba(255, 255, 255, 0.9);
  border: 1.5px solid rgba(123, 79, 255, 0.2);
  border-radius: 2rem;
  /* pill shape del contenedor */
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(123, 79, 255, 0.1);
  width: auto;
}

.cantidad__seleccionada span {
  min-width: 28px;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--dark-color);
  padding: 0 0.2rem;
  user-select: none;
}

/* Botones completamente redondos dentro del pill */
.restar__cantidad,
.aumentar__cantidad {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  /* ← totalmente redondo */
  border: none;
  margin: 3px;
  /* pequeño margen para ver el redondo contra el borde del pill */
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.15s ease;
  font-family: var(--body-font);
  flex-shrink: 0;
}

.restar__cantidad {
  background: rgba(220, 0, 80, 0.1);
}

.aumentar__cantidad {
  background: var(--boton-gradiente);
  box-shadow: 0 2px 8px rgba(123, 79, 255, 0.3);
}

.restar__cantidad i {
  font-size: 0.85rem;
  color: #cc0044;
}

.aumentar__cantidad i {
  font-size: 0.85rem;
  color: #fff;
}

.restar__cantidad:hover {
  background: rgba(220, 0, 80, 0.18);
  transform: scale(1.08);
}

.aumentar__cantidad:hover {
  filter: brightness(1.1);
  transform: scale(1.08);
  box-shadow: 0 4px 12px rgba(123, 79, 255, 0.45);
}

/* ==================== OCULTO SPECIFICITY FIX ==================== */
/* Prevent ID-selector specificity from overriding .oculto class */
#carrito-vacio.oculto,
#carrito-con-productos.oculto,
#carrito-acciones.oculto {
  display: none !important;
}

/* ==================== CARRITO VACIO ==================== */
#carrito-vacio {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: calc(100dvh - 14rem);
  padding: 6rem 1rem 1rem;
}

.carrito__empty-icon-wrap {
  position: relative;
}

.carrito__empty-icon-wrap::before {
  content: '';
  position: absolute;
  inset: -20px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(123, 79, 255, 0.08) 0%, transparent 70%);
  z-index: 0;
}

.img-carrito {
  position: relative;
  z-index: 1;
  max-width: 200px;
  border-radius: 50%;
  filter: drop-shadow(0 10px 30px rgba(123, 79, 255, 0.3));
  animation: carrito-float 3s ease-in-out infinite;
}

@keyframes carrito-float {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-10px);
  }
}

.img__carrito-vacio h2 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--dark-color);
  margin-bottom: 0.75rem;
}

.img__carrito-vacio span {
  font-size: 0.9rem;
  color: #777;
  line-height: 1.6;
  max-width: 340px;
  display: block;
  margin: 0 auto;
}

/* ==================== RESUMEN / SUMMARY CARD ==================== */
.carrito__resumen-card {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(123, 79, 255, 0.12);
  border-radius: 1.5rem;
  padding: 1.5rem;
  box-shadow: 0 8px 40px rgba(123, 79, 255, 0.1);
}

.carrito__resumen-card h2 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--dark-color);
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(123, 79, 255, 0.1);
  text-align: left;
}

/* Líneas de resumen */
.resumen__linea {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  font-size: 0.88rem;
  color: #666;
}

.resumen__linea.total {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--dark-color);
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 2px solid rgba(123, 79, 255, 0.15);
  margin-bottom: 1.25rem;
}

.resumen__linea .resumen__label {
  font-weight: 500;
}

.resumen__linea.total .resumen__label {
  font-weight: 700;
}

.resumen__monto {
  font-weight: 600;
  color: var(--dark-color);
}

.resumen__linea.total .resumen__monto {
  background: var(--background-gradiente);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-size: 1.3rem;
  font-weight: 800;
}

/* Nota envío */
.resumen__envio-nota {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(123, 79, 255, 0.06);
  border-radius: 0.75rem;
  padding: 0.6rem 0.85rem;
  font-size: 0.75rem;
  color: var(--first-color);
  font-weight: 600;
  margin-bottom: 1.5rem;
}

.resumen__envio-nota i {
  font-size: 1rem;
}

/* ==================== ACTION BUTTONS ==================== */
.btn__realizar-pedido {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 1rem 1.5rem;
  background-image: var(--boton-gradiente);
  color: #fff;
  font-family: var(--body-font);
  font-size: 1rem;
  font-weight: 700;
  border: none;
  border-radius: 2rem;
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(123, 79, 255, 0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
  letter-spacing: 0.02em;
  margin-bottom: 0.75rem;
}

.btn__realizar-pedido i {
  font-size: 1.2rem;
}

.btn__realizar-pedido:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(123, 79, 255, 0.45);
  filter: brightness(1.05);
}

.btn__realizar-pedido:active {
  transform: translateY(0);
}

.btn__seguir-comprando {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.85rem 1.5rem;
  background: rgba(123, 79, 255, 0.07);
  color: var(--first-color);
  font-family: var(--body-font);
  font-size: 0.9rem;
  font-weight: 600;
  border: 1.5px solid rgba(123, 79, 255, 0.2);
  border-radius: 2rem;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.btn__seguir-comprando i {
  font-size: 1rem;
}

.btn__seguir-comprando:hover {
  background: rgba(123, 79, 255, 0.13);
  border-color: rgba(123, 79, 255, 0.35);
  transform: translateY(-1px);
}

/* ==================== EMPTY STATE BUTTON ==================== */
.btn__comenzar-pedido {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  margin-top: 2rem;
  padding: 1rem 2rem;
  background-image: var(--boton-gradiente);
  color: #fff;
  font-family: var(--body-font);
  font-size: 1rem;
  font-weight: 700;
  border: none;
  border-radius: 2rem;
  cursor: pointer;
  box-shadow: 0 8px 28px rgba(123, 79, 255, 0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn__comenzar-pedido:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 36px rgba(123, 79, 255, 0.45);
}

/* ==================== FIN PADDING SPACER ==================== */
.contenedor__carrito-fin {
  height: 1rem;
  padding: 0;
  margin: 0;
}

/* ==================== TOASTIFY OVERRIDES ==================== */
.addtoastify,
.delettoastify {
  color: #fff;
  padding: 0.75rem 1.5rem;
  border-radius: 2rem;
  background-image: var(--boton-gradiente);
  font-size: 0.85rem;
  font-weight: 700;
  box-shadow: 0 6px 20px rgba(123, 79, 255, 0.35);
  font-family: var(--body-font);
}

/* ==================== MOBILE FIXED BOTTOM BAR ==================== */
.carrito__acciones {
  position: fixed;
  width: 100%;
  bottom: 0;
  left: 0;
  z-index: var(--z-fixed);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid rgba(123, 79, 255, 0.15);
  box-shadow: 0 -8px 30px rgba(123, 79, 255, 0.12);
  padding: 0.75rem 1rem 1.25rem;
}

/* Hide bottom bar on desktop (resumen card takes over) */
@media screen and (min-width: 900px) {
  .carrito__acciones {
    display: none;
  }
}

.carrito__acciones .total__general {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 0.25rem 0.6rem;
  border-bottom: 1px solid rgba(123, 79, 255, 0.1);
  margin-bottom: 0.6rem;
}

.carrito__acciones .total__general p:first-child {
  font-size: 0.9rem;
  font-weight: 600;
  color: #888;
}

.carrito__acciones #monto-total {
  font-size: 1.2rem;
  font-weight: 800;
  background: var(--background-gradiente);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  padding: 0;
}

.carrito__acciones .botones__acciones-carrito {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0;
}

/* Override old button styles within the bottom bar */
.carrito__acciones .realizar__pedido {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.85rem 1.5rem;
  background-image: var(--boton-gradiente);
  color: #fff;
  font-family: var(--body-font);
  font-size: 0.95rem;
  font-weight: 700;
  border: none;
  border-radius: 2rem;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(123, 79, 255, 0.3);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.carrito__acciones .realizar__pedido:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(123, 79, 255, 0.4);
}

.carrito__acciones .seguir__comprando {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.7rem 1.5rem;
  background: rgba(123, 79, 255, 0.07);
  color: var(--first-color);
  font-family: var(--body-font);
  font-size: 0.85rem;
  font-weight: 600;
  border: 1.5px solid rgba(123, 79, 255, 0.2);
  border-radius: 2rem;
  cursor: pointer;
  box-shadow: none;
  transition: background 0.2s ease;
  background-image: none;
}

.carrito__acciones .seguir__comprando.active {
  background-image: var(--boton-gradiente);
  color: #fff;
  border: none;
}

/* ==================== CARRITO VACIO BUTTON BAR ==================== */
#carrito-volver {
  position: static;
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
  margin-top: 0;
}

#carrito-volver .botones__acciones-carrito {
  padding: 0;
}

#carrito-volver .seguir__comprando.active {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem 2rem;
  font-size: 1rem;
  font-weight: 700;
  border-radius: 2rem;
  box-shadow: 0 8px 28px rgba(123, 79, 255, 0.35);
  background-image: var(--boton-gradiente);
  color: #fff;
  border: none;
  font-family: var(--body-font);
  cursor: pointer;
  width: auto;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#carrito-volver .seguir__comprando.active:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 36px rgba(123, 79, 255, 0.45);
}

/* ==================== SECTION CARRITO ==================== */
.section-carrito {
  padding-top: 0;
}

/* ==================== BREAKPOINTS ==================== */
@media screen and (max-width: 400px) {
  .carrito__page-title h1 {
    font-size: 1.3rem;
  }

  .img__carrito-seleccionado {
    width: 60px;
    height: 60px;
  }

  .carrito__producto-titulo h3 {
    font-size: 0.82rem;
  }

  /* En pantallas muy pequeñas, los botones ligeramente menores */
  .restar__cantidad,
  .aumentar__cantidad {
    width: 28px;
    height: 28px;
    margin: 2px;
  }
}

@media screen and (min-width: 600px) and (max-width: 899px) {

  /* Tablet: imagen un poco más grande */
  .img__carrito-seleccionado {
    width: 88px;
    height: 88px;
  }

  .carrito__productos {
    padding: 1.25rem;
  }
}

/* ==================== MOBILE: LAYOUT DE 2 FILAS (< 900px) ==================== */
/* Fila 1: imagen | título/variedad  →  Fila 2: precio | controles            */
@media screen and (max-width: 899px) {
  .carrito__producto {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    grid-template-areas:
      "imagen  info"
      "footer  footer";
    gap: 0.6rem;
    align-items: start;
  }

  .img__carrito-seleccionado {
    grid-area: imagen;
    align-self: center;
  }

  .carrito__producto-titulo {
    grid-area: info;
    min-width: 0;
    align-self: center;
  }

  /* h3 puede wrappear libremente: no hay nada a su derecha que lo compita */
  .carrito__producto-titulo h3 {
    white-space: normal;
    word-break: break-word;
    overflow-wrap: break-word;
    overflow: visible;
  }

  /* La fila inferior: precio a la izquierda, controles a la derecha */
  .carrito__producto-seleccionado {
    grid-area: footer;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    border-top: 1px dashed rgba(123, 79, 255, 0.12);
    padding-top: 0.5rem;
    margin-top: 0.1rem;
  }

  .carrito__producto-seleccionado p {
    font-size: 0.95rem;
    font-weight: 700;
  }
}

/* ==================== DESKTOP: GRID 3 COLUMNAS (≥ 900px) ==================== */
@media screen and (min-width: 900px) {
  .carrito__producto {
    grid-template-columns: 80px 1fr auto;
    grid-template-rows: auto;
    grid-template-areas: "imagen info footer";
    gap: 1rem;
    align-items: center;
  }

  .img__carrito-seleccionado {
    grid-area: imagen;
  }

  .carrito__producto-titulo {
    grid-area: info;
  }

  .carrito__producto-seleccionado {
    grid-area: footer;
    flex-direction: column;
    align-items: flex-end;
    border-top: none;
    padding-top: 0;
    margin-top: 0;
    width: auto;
  }

  .carrito__producto-titulo h3 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    white-space: normal;
  }

  .img__carrito-seleccionado {
    width: 80px;
    height: 80px;
  }
}