/* =================================
   CARRITO DE COMPRAS CONEKTAGO
================================= */

:root {
  --cart-bg: #07101c;
  --cart-bg-soft: #0a1421;
  --cart-surface: #0d1927;
  --cart-surface-strong: #101f30;
  --cart-text: #f7f9fc;
  --cart-text-soft: #b2bdca;
  --cart-text-muted: #7f8da0;
  --cart-border: rgba(0, 153, 255, 0.2);
  --cart-border-strong: rgba(0, 174, 255, 0.48);
  --cart-blue: #0099ff;
  --cart-blue-dark: #006bc4;
  --cart-green: #25d366;
  --cart-green-dark: #159e4a;
  --cart-danger: #ff5c70;
  --cart-shadow: 0 26px 65px rgba(0, 0, 0, 0.48);
}

body[data-theme="light"] {
  --cart-bg: #f5f7fb;
  --cart-bg-soft: #eef2f8;
  --cart-surface: #ffffff;
  --cart-surface-strong: #f8faff;
  --cart-text: #101828;
  --cart-text-soft: #344054;
  --cart-text-muted: #667085;
  --cart-border: rgba(0, 116, 217, 0.18);
  --cart-border-strong: rgba(0, 116, 217, 0.42);
  --cart-blue: #0074d9;
  --cart-blue-dark: #005ba9;
  --cart-green: #159e4a;
  --cart-green-dark: #087a36;
  --cart-shadow: 0 26px 65px rgba(15, 23, 42, 0.2);
}

body.cart-open {
  overflow: hidden;
}

/* Botón flotante */

.cart-floating-button {
  position: fixed;
  right: 22px;
  bottom: calc(22px + env(safe-area-inset-bottom));
  z-index: 1390;
  min-width: 126px;
  height: 54px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 17px;
  color: #ffffff;
  background:
    linear-gradient(135deg, var(--cart-blue), var(--cart-blue-dark));
  box-shadow:
    0 16px 34px rgba(0, 153, 255, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.16);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 850;
  transition:
    transform 0.2s ease,
    filter 0.2s ease,
    opacity 0.2s ease,
    box-shadow 0.2s ease;
}

.cart-floating-button:hover {
  filter: brightness(1.08);
  box-shadow:
    0 19px 39px rgba(0, 153, 255, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
  transform: translateY(-2px);
}

.cart-floating-button:active {
  transform: translateY(0) scale(0.97);
}

.cart-floating-button svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.cart-floating-button.is-bumping {
  animation: cart-bump 0.4s ease;
}

.cart-open .cart-floating-button {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

@keyframes cart-bump {
  0% {
    transform: scale(1);
  }

  45% {
    transform: scale(1.12);
  }

  100% {
    transform: scale(1);
  }
}

.cart-count {
  position: absolute;
  top: -8px;
  right: -7px;
  min-width: 25px;
  height: 25px;
  padding: 0 6px;
  display: none;
  place-items: center;
  border: 2px solid var(--cart-bg);
  border-radius: 999px;
  color: #07120b;
  background: var(--cart-green);
  font-size: 0.66rem;
  font-weight: 950;
  line-height: 1;
}

.cart-count.is-visible {
  display: grid;
}

/* Fondo oscuro */

.cart-overlay {
  position: fixed;
  inset: 0;
  z-index: 1400;
  border: 0;
  background: rgba(0, 0, 0, 0.67);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.25s ease,
    visibility 0.25s ease;
}

.cart-overlay.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Panel lateral */

.cart-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 1410;
  width: min(94vw, 430px);
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-left: 1px solid var(--cart-border);
  color: var(--cart-text-soft);
  background: var(--cart-bg);
  box-shadow: var(--cart-shadow);
  transform: translateX(105%);
  visibility: hidden;
  transition:
    transform 0.28s ease,
    visibility 0.28s ease;
}

.cart-panel.is-open {
  transform: translateX(0);
  visibility: visible;
}

/* Encabezado del carrito */

.cart-panel-header {
  flex: 0 0 auto;
  padding:
    calc(18px + env(safe-area-inset-top))
    18px
    16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  border-bottom: 1px solid var(--cart-border);
  background:
    radial-gradient(
      circle at 95% 0%,
      rgba(0, 153, 255, 0.13),
      transparent 40%
    ),
    var(--cart-surface);
}

.cart-title-area {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.cart-title-icon {
  width: 43px;
  height: 43px;
  flex: 0 0 43px;
  display: grid;
  place-items: center;
  border: 1px solid var(--cart-border-strong);
  border-radius: 13px;
  color: var(--cart-blue);
  background: rgba(0, 153, 255, 0.09);
}

.cart-title-icon svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.cart-title-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.cart-title-copy span {
  color: var(--cart-blue);
  font-size: 0.59rem;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.cart-title-copy h2 {
  margin: 1px 0 0;
  overflow: hidden;
  color: var(--cart-text);
  font-size: 1.15rem;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cart-close-button {
  width: 39px;
  height: 39px;
  flex: 0 0 39px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid var(--cart-border);
  border-radius: 11px;
  color: var(--cart-text);
  background: var(--cart-bg-soft);
  cursor: pointer;
  transition:
    border-color 0.2s ease,
    transform 0.2s ease;
}

.cart-close-button:hover {
  border-color: var(--cart-border-strong);
  transform: rotate(4deg);
}

.cart-close-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

/* Lista de productos */

.cart-content {
  min-height: 0;
  flex: 1 1 auto;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 14px;
  scrollbar-color: var(--cart-blue) transparent;
  scrollbar-width: thin;
}

.cart-items {
  display: grid;
  gap: 10px;
}

.cart-item {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--cart-border);
  border-radius: 16px;
  background:
    linear-gradient(
      145deg,
      var(--cart-surface),
      var(--cart-bg-soft)
    );
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.09);
}

.cart-item-top {
  display: grid;
  grid-template-columns: 43px minmax(0, 1fr) 34px;
  align-items: center;
  gap: 10px;
}

.cart-item-symbol {
  width: 43px;
  height: 43px;
  display: grid;
  place-items: center;
  border: 1px solid var(--cart-border);
  border-radius: 13px;
  color: var(--cart-blue);
  background: rgba(0, 153, 255, 0.08);
  font-size: 1rem;
  font-weight: 950;
  text-transform: uppercase;
}

.cart-item-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cart-item-copy strong {
  overflow: hidden;
  color: var(--cart-text);
  font-size: 0.82rem;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cart-item-copy span {
  color: var(--cart-text-muted);
  font-size: 0.68rem;
}

.cart-remove-button {
  width: 34px;
  height: 34px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 92, 112, 0.17);
  border-radius: 10px;
  color: var(--cart-danger);
  background: rgba(255, 92, 112, 0.055);
  cursor: pointer;
  transition:
    border-color 0.2s ease,
    background-color 0.2s ease,
    transform 0.2s ease;
}

.cart-remove-button:hover {
  border-color: rgba(255, 92, 112, 0.43);
  background: rgba(255, 92, 112, 0.11);
  transform: translateY(-1px);
}

.cart-remove-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.cart-item-bottom {
  margin-top: 13px;
  padding-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--cart-border);
}

.cart-quantity {
  height: 36px;
  display: inline-grid;
  grid-template-columns: 34px 38px 34px;
  align-items: center;
  border: 1px solid var(--cart-border);
  border-radius: 11px;
  overflow: hidden;
  background: var(--cart-bg-soft);
}

.cart-quantity button {
  width: 34px;
  height: 34px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 0;
  color: var(--cart-text);
  background: transparent;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 900;
  transition:
    color 0.18s ease,
    background-color 0.18s ease;
}

.cart-quantity button:hover {
  color: #ffffff;
  background: var(--cart-blue);
}

.cart-quantity span {
  display: block;
  color: var(--cart-text);
  font-size: 0.78rem;
  font-weight: 900;
  text-align: center;
}

.cart-line-total {
  color: var(--cart-green);
  font-size: 0.9rem;
  font-weight: 950;
  white-space: nowrap;
}

/* Carrito vacío */

.cart-empty {
  min-height: 100%;
  padding: 45px 20px;
  display: grid;
  place-content: center;
  justify-items: center;
  color: var(--cart-text-muted);
  text-align: center;
}

.cart-empty[hidden] {
  display: none;
}

.cart-empty-icon {
  width: 76px;
  height: 76px;
  margin-bottom: 15px;
  display: grid;
  place-items: center;
  border: 1px solid var(--cart-border);
  border-radius: 23px;
  color: var(--cart-blue);
  background: rgba(0, 153, 255, 0.07);
}

.cart-empty-icon svg {
  width: 37px;
  height: 37px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.cart-empty strong {
  color: var(--cart-text);
  font-size: 1rem;
}

.cart-empty p {
  max-width: 265px;
  margin: 6px 0 0;
  font-size: 0.75rem;
  line-height: 1.55;
}

/* Resumen */

.cart-summary {
  flex: 0 0 auto;
  padding:
    16px
    18px
    calc(18px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--cart-border);
  background:
    linear-gradient(
      180deg,
      var(--cart-surface),
      var(--cart-bg-soft)
    );
  box-shadow: 0 -12px 28px rgba(0, 0, 0, 0.12);
}

.cart-summary-row {
  margin-bottom: 7px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
}

.cart-summary-row span {
  color: var(--cart-text-muted);
  font-size: 0.73rem;
}

.cart-summary-row strong {
  color: var(--cart-text);
  font-size: 0.78rem;
}

.cart-total-row {
  margin-top: 11px;
  padding-top: 13px;
  border-top: 1px solid var(--cart-border);
}

.cart-total-row span {
  color: var(--cart-text);
  font-size: 0.86rem;
  font-weight: 850;
}

.cart-total-row strong {
  color: var(--cart-green);
  font-size: 1.35rem;
  font-weight: 950;
  letter-spacing: -0.02em;
}

.cart-actions {
  margin-top: 14px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 9px;
}

.cart-clear-button {
  min-width: 46px;
  min-height: 49px;
  padding: 0 13px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 92, 112, 0.2);
  border-radius: 13px;
  color: var(--cart-danger);
  background: rgba(255, 92, 112, 0.055);
  cursor: pointer;
  transition:
    border-color 0.2s ease,
    background-color 0.2s ease,
    transform 0.2s ease;
}

.cart-clear-button:hover:not(:disabled) {
  border-color: rgba(255, 92, 112, 0.45);
  background: rgba(255, 92, 112, 0.11);
  transform: translateY(-1px);
}

.cart-clear-button svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.cart-checkout-button {
  min-height: 49px;
  padding: 11px 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 1px solid rgba(255, 255, 255, 0.17);
  border-radius: 13px;
  color: #ffffff;
  background:
    linear-gradient(
      135deg,
      var(--cart-green),
      var(--cart-green-dark)
    );
  box-shadow: 0 12px 24px rgba(37, 211, 102, 0.19);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 900;
  transition:
    filter 0.2s ease,
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.cart-checkout-button:hover:not(:disabled) {
  filter: brightness(1.07);
  box-shadow: 0 15px 29px rgba(37, 211, 102, 0.27);
  transform: translateY(-2px);
}

.cart-checkout-button svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.cart-clear-button:disabled,
.cart-checkout-button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  filter: grayscale(0.3);
  transform: none;
}

.cart-checkout-note {
  display: block;
  margin-top: 9px;
  color: var(--cart-text-muted);
  font-size: 0.62rem;
  line-height: 1.45;
  text-align: center;
}

/* Notificación */

.cart-toast {
  position: fixed;
  right: 22px;
  bottom: calc(88px + env(safe-area-inset-bottom));
  z-index: 1450;
  max-width: min(340px, calc(100vw - 30px));
  padding: 12px 15px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(37, 211, 102, 0.25);
  border-radius: 13px;
  color: var(--cart-text);
  background: var(--cart-surface);
  box-shadow: var(--cart-shadow);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(12px);
  transition:
    opacity 0.22s ease,
    visibility 0.22s ease,
    transform 0.22s ease;
}

.cart-toast.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.cart-toast-icon {
  width: 27px;
  height: 27px;
  flex: 0 0 27px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #07120b;
  background: var(--cart-green);
  font-size: 0.76rem;
  font-weight: 950;
}

.cart-toast span:last-child {
  overflow: hidden;
  font-size: 0.73rem;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Celulares */

@media (max-width: 767px) {
  .cart-floating-button {
    right: 13px;
    bottom: calc(13px + env(safe-area-inset-bottom));
    min-width: 55px;
    width: 55px;
    height: 55px;
    padding: 0;
    border-radius: 17px;
  }

  .cart-floating-label {
    display: none;
  }

  .cart-panel {
    width: 100%;
    border-left: 0;
  }

  .cart-panel-header {
    padding:
      calc(13px + env(safe-area-inset-top))
      13px
      12px;
  }

  .cart-content {
    padding: 10px;
  }

  .cart-item {
    padding: 12px;
    border-radius: 14px;
  }

  .cart-summary {
    padding:
      13px
      13px
      calc(14px + env(safe-area-inset-bottom));
  }

  .cart-toast {
    right: 12px;
    bottom: calc(80px + env(safe-area-inset-bottom));
    left: 12px;
    max-width: none;
  }
}

@media (max-width: 365px) {
  .cart-item-top {
    grid-template-columns: 39px minmax(0, 1fr) 32px;
    gap: 8px;
  }

  .cart-item-symbol {
    width: 39px;
    height: 39px;
  }

  .cart-remove-button {
    width: 32px;
    height: 32px;
  }

  .cart-total-row strong {
    font-size: 1.2rem;
  }
}

@media (max-height: 650px) {
  .cart-panel-header {
    padding-top: calc(10px + env(safe-area-inset-top));
    padding-bottom: 10px;
  }

  .cart-title-icon {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
  }

  .cart-summary {
    padding-top: 11px;
  }

  .cart-checkout-note {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cart-floating-button,
  .cart-overlay,
  .cart-panel,
  .cart-toast,
  .cart-remove-button,
  .cart-checkout-button {
    animation: none !important;
    transition-duration: 0.01ms !important;
  }
}