/* css/pages/checkout.css
   Checkout PRO (carrito más lindo + sticky resumen)
*/

.checkout {
  padding: 18px 0 44px;
}

.checkout-form-card {
  position: relative;
}

.checkout-title {
  font-size: 34px;
  margin: 18px 0 6px;
  letter-spacing: -0.02em;
}

.checkout-subtitle {
  margin: 0 0 18px;
  color: var(--muted);
}

/* Layout */
.checkout-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 18px;
  align-items: start;
}

@media (max-width: 980px) {
  .checkout-grid {
    grid-template-columns: 1fr;
  }
}

/* Cards */
.checkout-card {
  border: 1px solid rgba(17, 17, 17, 0.1);
  border-radius: calc(var(--radius) + 10px);
  background: rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
  padding: 16px;
}

.checkout-card .card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.checkout-card .card-title {
  font-family: var(--font-serif);
  font-size: 18px;
  margin: 0;
}

.checkout-card .card-meta {
  font-size: 13px;
  color: var(--muted);
}

/* Sticky panel (derecha) */
.checkout-sticky {
  position: sticky;
  top: 92px;
}

@media (max-width: 980px) {
  .checkout-sticky {
    position: static;
  }
}

/* --- Alerts / issues --- */
.checkout-alert {
  border: 1px solid rgba(255, 140, 120, 0.35);
  background: rgba(255, 140, 120, 0.08);
  border-radius: calc(var(--radius) + 6px);
  padding: 12px;
  margin-bottom: 12px;
}

.checkout-alert strong {
  display: block;
  margin-bottom: 6px;
}

.checkout-alert ul {
  margin: 8px 0 0;
  padding-left: 18px;
  color: rgba(0, 0, 0, 0.8);
}

/* --- Empty --- */
.empty-box {
  border: 1px dashed rgba(17, 17, 17, 0.18);
  border-radius: calc(var(--radius) + 6px);
  background: rgba(255, 255, 255, 0.18);
  padding: 14px;
  display: grid;
  gap: 12px;
  place-items: center;
  text-align: center;
}

.empty-box__icon {
  width: 54px;
  height: 54px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.45);
  border: 1px solid rgba(17, 17, 17, 0.08);
  font-size: 24px;
}

.empty-box__copy {
  display: grid;
  gap: 4px;
}

.empty-box__title {
  font-family: var(--font-serif);
  font-size: 18px;
  color: var(--text);
}

.empty-box__text {
  color: var(--muted);
  max-width: 34ch;
}

.empty-box__actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

/* --- Cart list --- */
.checkout-summary {
  display: grid;
  gap: 10px;
}

/* Item card */
.cart-item {
  border: 1px solid rgba(17, 17, 17, 0.1);
  border-radius: calc(var(--radius) + 6px);
  background: rgba(255, 255, 255, 0.18);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.06);
  padding: 12px;
  display: grid;
  gap: 10px;
}

.cart-item.is-warn {
  border-color: rgba(255, 140, 120, 0.35);
  background: rgba(255, 140, 120, 0.06);
}

.cart-item__top {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: start;
}

.cart-item__name {
  display: grid;
  gap: 2px;
}

.cart-item__name strong {
  font-size: 14.5px;
  color: var(--text);
  line-height: 1.2;
}

.cart-item__meta {
  font-size: 12px;
  color: var(--muted);
}

.cart-item__warn {
  margin-top: 4px;
  font-size: 12px;
  color: rgba(200, 60, 40, 0.95);
  font-weight: 700;
}

.cart-item__lineTotal {
  font-weight: 900;
  color: var(--text);
  white-space: nowrap;
}

/* Bottom: qty + unit price + remove */
.cart-item__bottom {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
}

@media (max-width: 520px) {
  .cart-item__bottom {
    grid-template-columns: 1fr;
    justify-items: start;
  }
}

/* Qty pill */
.qty {
  font-weight: 800;
  min-width: 22px;
  text-align: center;
}

.checkout-row__qty {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(17, 17, 17, 0.14);
  border-radius: 999px;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.35);
}

.qty-btn {
  appearance: none;
  -webkit-appearance: none;
  background-image: none;
  text-shadow: none;

  width: 30px;
  height: 30px;
  border-radius: 999px;
  border: 1px solid rgba(17, 17, 17, 0.14);
  background: rgba(255, 255, 255, 0.55);
  color: rgba(0, 0, 0, 0.8);
  cursor: pointer;
  font-weight: 900;
  line-height: 1;

  transition:
    transform 0.12s ease,
    background 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease;
}

.qty-btn:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.75);
  border-color: rgba(17, 17, 17, 0.22);
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.08);
}

.qty-btn:active {
  transform: translateY(0);
}

.qty-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Right side bits */
.cart-item__unit {
  font-size: 12px;
  color: var(--muted);
}

.cart-item__remove {
  border: 1px solid rgba(17, 17, 17, 0.14);
  background: rgba(255, 255, 255, 0.35);
  color: rgba(0, 0, 0, 0.78);
  padding: 8px 10px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 800;
  font-size: 12px;
  transition:
    transform 0.12s ease,
    background 0.18s ease,
    box-shadow 0.18s ease;
}

.cart-item__remove:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.6);
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.08);
}

/* Totals + sticky summary */
.checkout-totals {
  margin-top: 12px;
  border-top: 1px solid rgba(17, 17, 17, 0.1);
  padding-top: 12px;
  display: grid;
  gap: 8px;
}

.checkout-totals > div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.checkout-totals .muted {
  color: var(--muted);
}

.checkout-totals strong {
  color: var(--text);
}

/* Form */
.checkout-box {
  display: grid;
  gap: 12px;
}

.checkout-box .form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 700px) {
  .checkout-box .form-grid {
    grid-template-columns: 1fr;
  }

  .checkout-mobile-cta {
    display: block;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 150;
    padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
    background: linear-gradient(to top, rgba(231, 221, 207, 0.98), rgba(231, 221, 207, 0.88));
    border-top: 1px solid rgba(17, 17, 17, 0.08);
    backdrop-filter: blur(10px);
  }

  .checkout-mobile-cta__btn {
    width: min(var(--max), 100%);
    min-height: 50px;
    margin: 0 auto;
    display: flex;
  }
}

.field span {
  display: block;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(0, 0, 0, 0.7);
  margin-bottom: 6px;
}

@media (max-width: 520px) {
  .checkout-title {
    font-size: 28px;
  }

  .checkout-card {
    padding: 14px;
  }

  .checkout-actions,
  .checkout-actions .btn-primary,
  .checkout-actions .btn-secondary,
  .checkout-clear {
    width: 100%;
  }

  .checkout-row__qty {
    width: 100%;
    justify-content: space-between;
  }

  .cart-item__lineTotal {
    white-space: normal;
  }
}

.field textarea {
  min-height: 92px;
  resize: vertical;
}

.field input:focus-visible,
.field select:focus-visible,
.field textarea:focus-visible {
  border-color: rgba(107, 78, 61, 0.35);
  box-shadow: 0 0 0 4px rgba(107, 78, 61, 0.12);
}

/* Actions */
.checkout-actions {
  display: grid;
  gap: 10px;
  margin-top: 2px;
}

.checkout-actions .btn-primary,
.checkout-actions .btn-secondary {
  width: 100%;
  justify-content: center;
}

/* Discreet clear button */
.checkout-clear {
  margin-top: 10px;
  border: 1px solid rgba(17, 17, 17, 0.14);
  background: transparent;
  color: rgba(0, 0, 0, 0.72);
  padding: 10px 12px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.03em;
  transition:
    transform 0.12s ease,
    background 0.18s ease,
    box-shadow 0.18s ease;
}

.checkout-clear:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.45);
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.08);
}

.checkout-clear:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.checkout-mobile-cta {
  display: none;
}

@media (max-width: 520px) {
  .checkout {
    padding: 12px 0 96px;
  }

  .checkout-title {
    font-size: 26px;
    margin-top: 10px;
  }

  .checkout-subtitle {
    margin-bottom: 12px;
  }

  .checkout-grid {
    gap: 12px;
  }

  .checkout-card {
    padding: 12px;
    border-radius: calc(var(--radius) + 6px);
  }

  .checkout-card .card-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .cart-item {
    padding: 10px;
  }

  .cart-item__top {
    grid-template-columns: 1fr;
  }

  .cart-item__lineTotal {
    justify-self: start;
  }

  .checkout-row__qty {
    width: fit-content;
  }

  .checkout-totals > div {
    align-items: flex-start;
  }

  .checkout-box .form-grid {
    grid-template-columns: 1fr;
  }

  .checkout-actions .btn-primary,
  .checkout-actions .btn-secondary {
    min-height: 46px;
  }

  .checkout-clear {
    width: 100%;
  }

  .empty-box__actions {
    width: 100%;
  }

  .empty-box__actions .btn-primary,
  .empty-box__actions .btn-secondary {
    width: 100%;
  }
}
