/* Empanada Store — carrito estable y pulido visual 2026 */

:root {
  --es-cart-blue: #315efb;
  --es-cart-ink: #101828;
  --es-cart-muted: #667085;
  --es-cart-line: #e4e7ec;
  --es-cart-surface: #ffffff;
  --es-cart-soft: #f8f9fc;
  --es-cart-orange: #f3a936;
  --es-cart-green: #12a86b;
}

html.dark {
  --es-cart-ink: #f7f9fc;
  --es-cart-muted: #aeb9ca;
  --es-cart-line: rgba(255, 255, 255, .11);
  --es-cart-surface: #0b1220;
  --es-cart-soft: #111a2b;
}

body.empanada-cart-open,
body.empanada-checkout-open {
  overflow: hidden !important;
}

/* La mascota funciona como guía, no como un adorno recortado. */
.es-hero-visual::after {
  content: "Empanadita · guía de compra";
  position: absolute;
  top: 28px;
  right: 26px;
  z-index: 4;
  padding: 8px 12px;
  color: var(--es-muted);
  border: 1px solid var(--es-line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--es-surface) 88%, transparent);
  box-shadow: 0 10px 28px rgba(16, 24, 40, .08);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .08em;
  text-transform: uppercase;
  backdrop-filter: blur(14px);
}

.es-hero-visual:hover .es-hero-stage,
.es-hero-visual:focus-visible .es-hero-stage {
  transform: scale(1.035) rotate(-1deg);
}

.es-hero-stage {
  transition: transform .45s cubic-bezier(.2, .8, .2, 1);
}

.es-hero-readable-bubble {
  max-width: min(84%, 390px) !important;
  min-height: 64px;
  align-items: center;
  border: 1px solid color-mix(in srgb, var(--es-blue) 25%, var(--es-line)) !important;
  box-shadow: 0 18px 42px rgba(28, 48, 96, .16) !important;
}

.es-hero-mascot img.is-changing {
  transform: translateY(8px) scale(.96);
  opacity: 0;
}

/* Panel de carrito */
#cartDrawer.es-cart {
  width: min(100%, 500px) !important;
  max-width: 100vw;
  overflow: hidden;
  border-left: 1px solid var(--es-cart-line) !important;
  background: var(--es-cart-surface) !important;
  box-shadow: -32px 0 80px rgba(16, 24, 40, .22) !important;
  transition: transform .34s cubic-bezier(.2, .8, .2, 1) !important;
}

.es-cart__header {
  position: relative;
  display: flex;
  min-height: 118px;
  padding: 22px 22px 18px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  overflow: hidden;
  border-bottom: 1px solid var(--es-cart-line) !important;
  background:
    radial-gradient(circle at 12% 15%, rgba(243, 169, 54, .20), transparent 34%),
    linear-gradient(135deg, color-mix(in srgb, var(--es-cart-soft) 92%, transparent), var(--es-cart-surface)) !important;
}

.es-cart__header::after {
  content: "";
  position: absolute;
  right: -38px;
  bottom: -70px;
  width: 190px;
  height: 190px;
  border: 1px solid color-mix(in srgb, var(--es-cart-blue) 16%, transparent);
  border-radius: 999px;
  pointer-events: none;
}

.es-cart__identity {
  position: relative;
  z-index: 1;
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 14px;
}

.es-cart__mascot {
  display: grid;
  width: 62px;
  height: 62px;
  flex: 0 0 62px;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(243, 169, 54, .34);
  border-radius: 19px;
  background: linear-gradient(145deg, #fff7e8, #eef2ff);
  box-shadow: 0 10px 24px rgba(16, 24, 40, .10);
}

.es-cart__mascot img {
  width: 76px;
  height: 76px;
  margin-top: 10px;
  object-fit: contain;
}

.es-cart__identity p,
.es-cart__identity h2,
.es-cart__identity span {
  margin: 0;
}

.es-cart__identity p {
  color: var(--es-cart-blue) !important;
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .11em;
  text-transform: uppercase;
}

.es-cart__identity h2 {
  margin-top: 3px;
  color: var(--es-cart-ink) !important;
  font-family: "Space Grotesk", "Manrope", sans-serif;
  font-size: clamp(1.25rem, 4vw, 1.55rem);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -.035em;
}

.es-cart__identity span:not(.es-cart__mascot) {
  display: block;
  margin-top: 5px;
  color: var(--es-cart-muted) !important;
  font-size: 11px;
  font-weight: 700;
}

#cartCloseBtn {
  position: relative;
  z-index: 2;
  width: 42px !important;
  height: 42px !important;
  flex: 0 0 42px;
  color: var(--es-cart-muted) !important;
  border: 1px solid var(--es-cart-line) !important;
  background: color-mix(in srgb, var(--es-cart-surface) 88%, transparent);
}

#cartCloseBtn:hover {
  color: #d92d20 !important;
  background: color-mix(in srgb, #d92d20 8%, var(--es-cart-surface));
}

.es-cart__items {
  padding: 20px !important;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--es-cart-blue) 30%, transparent) transparent;
  background:
    linear-gradient(var(--es-cart-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--es-cart-line) 1px, transparent 1px),
    var(--es-cart-surface);
  background-size: 42px 42px;
  background-blend-mode: soft-light;
}

.es-cart-empty {
  display: grid;
  min-height: 100%;
  padding: 28px 20px;
  place-content: center;
  justify-items: center;
  text-align: center;
}

.es-cart-empty__visual {
  position: relative;
  display: grid;
  width: 154px;
  height: 154px;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--es-cart-orange) 32%, var(--es-cart-line));
  border-radius: 44px;
  background: radial-gradient(circle, rgba(243, 169, 54, .20), transparent 68%), var(--es-cart-soft);
  transform: rotate(-2deg);
}

.es-cart-empty__visual img {
  width: 142px;
  height: 142px;
  object-fit: contain;
  filter: drop-shadow(0 16px 18px rgba(16, 24, 40, .14));
}

.es-cart-empty h3 {
  margin: 22px 0 7px;
  color: var(--es-cart-ink) !important;
  font-family: "Space Grotesk", "Manrope", sans-serif;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -.03em;
}

.es-cart-empty p {
  max-width: 290px;
  margin: 0;
  color: var(--es-cart-muted) !important;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.65;
}

.es-cart-empty a {
  display: inline-flex;
  min-height: 44px;
  margin-top: 18px;
  padding: 10px 16px;
  align-items: center;
  gap: 8px;
  color: #fff !important;
  border-radius: 13px;
  background: linear-gradient(135deg, #1b2a4a, var(--es-cart-blue));
  box-shadow: 0 12px 26px rgba(49, 94, 251, .20);
  font-size: 12px;
  font-weight: 850;
  text-decoration: none;
}

.es-cart-item {
  position: relative;
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) auto;
  gap: 13px;
  padding: 13px;
  border: 1px solid var(--es-cart-line);
  border-radius: 20px;
  background: color-mix(in srgb, var(--es-cart-surface) 94%, var(--es-cart-soft));
  box-shadow: 0 8px 26px rgba(16, 24, 40, .06);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.es-cart-item:hover {
  border-color: color-mix(in srgb, var(--es-cart-blue) 28%, var(--es-cart-line));
  box-shadow: 0 14px 34px rgba(16, 24, 40, .09);
  transform: translateY(-1px);
}

.es-cart-item__visual {
  display: grid;
  width: 76px;
  height: 76px;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--es-cart-line);
  border-radius: 16px;
  background: #fff;
}

.es-cart-item__visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.es-cart-item__body {
  min-width: 0;
  align-self: center;
}

.es-cart-item__body h3 {
  display: -webkit-box;
  overflow: hidden;
  margin: 0;
  color: var(--es-cart-ink) !important;
  font-size: 13px;
  font-weight: 850;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.es-cart-item__unit {
  margin: 5px 0 0 !important;
  color: var(--es-cart-muted) !important;
  font-size: 10px !important;
  font-weight: 700 !important;
}

.es-cart-item__subtotal {
  display: block;
  margin-top: 6px;
  color: var(--es-cart-blue);
  font-size: 13px;
  font-weight: 900;
}

.es-cart-item__actions {
  display: flex;
  align-items: center;
  align-self: center;
  gap: 7px;
}

.es-cart-quantity {
  display: inline-grid;
  grid-template-columns: 34px 30px 34px;
  min-height: 36px;
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--es-cart-line);
  border-radius: 12px;
  background: var(--es-cart-soft);
}

.es-cart-quantity button,
.es-cart-item__remove {
  display: grid;
  min-width: 34px;
  min-height: 34px;
  place-items: center;
  color: var(--es-cart-muted);
  border: 0;
  background: transparent;
  cursor: pointer;
}

.es-cart-quantity button:hover,
.es-cart-quantity button:focus-visible {
  color: var(--es-cart-blue);
  background: color-mix(in srgb, var(--es-cart-blue) 9%, transparent);
}

.es-cart-quantity output {
  color: var(--es-cart-ink);
  font-size: 12px;
  font-weight: 900;
  text-align: center;
}

.es-cart-item__remove {
  border: 1px solid transparent;
  border-radius: 11px;
}

.es-cart-item__remove:hover,
.es-cart-item__remove:focus-visible {
  color: #d92d20;
  border-color: color-mix(in srgb, #d92d20 22%, transparent);
  background: color-mix(in srgb, #d92d20 8%, transparent);
}

.es-cart__footer {
  padding: 18px 20px max(20px, env(safe-area-inset-bottom)) !important;
  border-top: 1px solid var(--es-cart-line) !important;
  background: color-mix(in srgb, var(--es-cart-soft) 78%, var(--es-cart-surface)) !important;
}

.es-cart__assurance {
  display: flex;
  margin-bottom: 14px;
  padding: 11px 12px;
  align-items: center;
  gap: 10px;
  color: var(--es-cart-green);
  border: 1px solid color-mix(in srgb, var(--es-cart-green) 22%, var(--es-cart-line));
  border-radius: 14px;
  background: color-mix(in srgb, var(--es-cart-green) 7%, var(--es-cart-surface));
}

.es-cart__assurance > i {
  font-size: 18px;
}

.es-cart__assurance span,
.es-cart__assurance strong,
.es-cart__assurance small {
  display: block;
}

.es-cart__assurance strong {
  color: var(--es-cart-ink);
  font-size: 11px;
  font-weight: 850;
}

.es-cart__assurance small {
  margin-top: 2px;
  color: var(--es-cart-muted);
  font-size: 9px;
  font-weight: 650;
}

.es-cart__total {
  display: flex;
  margin-bottom: 14px;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  color: var(--es-cart-ink);
  font-size: 14px;
  font-weight: 850;
}

.es-cart__total > span:first-child {
  display: flex;
  flex-direction: column;
}

.es-cart__total small {
  margin-bottom: 2px;
  color: var(--es-cart-muted);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: .07em;
  text-transform: uppercase;
}

#cartTotalSum {
  color: var(--es-cart-ink) !important;
  font-family: "Space Grotesk", "Manrope", sans-serif;
  font-size: 1.65rem !important;
  letter-spacing: -.035em;
}

#btnRealizarCompra {
  min-height: 52px;
  border: 0;
  border-radius: 15px !important;
  background: linear-gradient(135deg, #1b2a4a, var(--es-cart-blue) 68%, #7357ef) !important;
  box-shadow: 0 14px 30px rgba(49, 94, 251, .22) !important;
  font-size: 14px !important;
}

#btnRealizarCompra:disabled {
  color: var(--es-cart-muted) !important;
  background: var(--es-cart-line) !important;
  box-shadow: none !important;
  transform: none !important;
}

.es-cart__clear {
  display: flex;
  min-height: 38px;
  width: 100%;
  margin-top: 7px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: var(--es-cart-muted);
  border: 0;
  border-radius: 11px;
  background: transparent;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.es-cart__clear:hover,
.es-cart__clear:focus-visible,
.es-cart__clear.is-confirming {
  color: #d92d20;
  background: color-mix(in srgb, #d92d20 8%, transparent);
}

.es-cart-toast {
  position: fixed;
  right: 24px;
  bottom: 108px;
  z-index: 2300;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  width: min(390px, calc(100vw - 32px));
  padding: 12px;
  align-items: center;
  gap: 11px;
  color: #f8fafc;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 17px;
  background: rgba(15, 23, 42, .96);
  box-shadow: 0 22px 55px rgba(4, 10, 24, .30);
  transform: translateY(14px);
  opacity: 0;
  transition: transform .2s ease, opacity .2s ease;
}

.es-cart-toast.is-visible {
  transform: translateY(0);
  opacity: 1;
}

.es-cart-toast img {
  width: 44px;
  height: 44px;
  object-fit: contain;
}

.es-cart-toast strong,
.es-cart-toast span {
  display: block;
}

.es-cart-toast strong {
  font-size: 12px;
  font-weight: 850;
}

.es-cart-toast span {
  margin-top: 2px;
  color: #cbd5e1;
  font-size: 10px;
  font-weight: 650;
}

.es-cart-toast button {
  min-height: 38px;
  padding: 8px 11px;
  color: #fff;
  border: 0;
  border-radius: 10px;
  background: var(--es-cart-blue);
  font-size: 10px;
  font-weight: 850;
  cursor: pointer;
}

.es-cart-badge-pop {
  animation: es-cart-badge-pop .34s cubic-bezier(.2, .9, .25, 1.35);
}

@keyframes es-cart-badge-pop {
  45% { transform: scale(1.38); }
}

#cartOverlay {
  background: rgba(6, 11, 22, .62) !important;
  backdrop-filter: blur(5px) !important;
}

#checkoutModalContent {
  border-radius: 30px !important;
  box-shadow: 0 34px 100px rgba(3, 8, 20, .34) !important;
}

@media (max-width: 640px) {
  .es-hero-visual::after {
    top: 16px;
    right: 16px;
  }

  #cartDrawer.es-cart {
    width: 100% !important;
  }

  .es-cart__header {
    min-height: 104px;
    padding: 16px;
  }

  .es-cart__mascot {
    width: 54px;
    height: 54px;
    flex-basis: 54px;
  }

  .es-cart__mascot img {
    width: 66px;
    height: 66px;
  }

  .es-cart__items {
    padding: 14px !important;
  }

  .es-cart-item {
    grid-template-columns: 64px minmax(0, 1fr);
    gap: 11px;
    padding: 11px;
  }

  .es-cart-item__visual {
    width: 64px;
    height: 64px;
  }

  .es-cart-item__actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }

  .es-cart__footer {
    padding: 14px 16px max(16px, env(safe-area-inset-bottom)) !important;
  }

  .es-cart-toast {
    right: 16px;
    bottom: 92px;
  }
}

@media (prefers-reduced-motion: reduce) {
  #cartDrawer.es-cart,
  .es-cart-item,
  .es-cart-toast,
  .es-hero-stage,
  .es-hero-mascot img {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}
