/* SleepHome — carrito clásico. Requiere tokens.css + components.css. Solo is_cart().
   Fuente: SleepHome Final.dc.html (Carrito). */

/* Kadence mete margin-top 5rem al .content-area; el espacio superior lo da
   el padding del hero, no ese margen. */
body.woocommerce-cart .content-area { margin-top: 0; }

/* ============ Hero ============ */

.shm-cart-hero {
  padding: 44px 48px 24px;
  text-align: center;
}

.shm-cart-hero .shm-eyebrow {
  font-size: var(--text-eyebrow);
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--color-brand);
  font-weight: var(--fw-medium);
  margin: 0 0 12px;
}

/* Especificidad 0,2,0 para anular el margin-top del h1 de Kadence. */
.shm-cart-hero .shm-cart-hero__title {
  font-family: var(--font-heading);
  font-weight: var(--fw-bold);
  font-size: 38px;
  margin: 0;
  color: var(--color-text);
}

/* ============ Layout ============ */

.shm-cart {
  max-width: 1060px;
  margin: 0 auto;
  padding: 8px 48px 60px;
}

.shm-cart__grid {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 36px;
  align-items: start;
}

/* ============ Lista de items ============ */

.shm-cart__items {
  border: 1px solid var(--color-border);
  border-radius: 14px;
  overflow: hidden;
}

.shm-cart__item {
  display: flex;
  gap: 18px;
  align-items: center;
  padding: 22px;
  border-bottom: 1px solid var(--color-bg-sunken);
}

.shm-cart__item:last-child { border-bottom: 0; }

.shm-cart__thumb {
  width: 80px;
  height: 80px;
  border-radius: 10px;
  overflow: hidden;
  flex: none;
  background: var(--color-bg-sunken);
}

.shm-cart__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.shm-cart__item-main { flex: 1; }

.shm-cart__item-name {
  font-size: 17px;
  color: var(--color-text);
  font-weight: var(--fw-medium);
  margin-bottom: 4px;
}

.shm-cart__item-meta { color: var(--color-text-tertiary); font-weight: var(--fw-regular); }

.shm-cart__item-sub { font-size: 15px; color: var(--color-text-tertiary); }

.shm-cart__remove { color: #c77; text-decoration: none; }
.shm-cart__remove:hover { color: var(--color-sale); text-decoration: underline; }

.shm-cart__item-price {
  font-family: var(--font-heading);
  font-size: 18px;
  color: var(--color-price);
  white-space: nowrap;
}

/* ============ Resumen ============ */

.shm-cart__summary {
  border: 1px solid var(--color-border-input);
  border-radius: 14px;
  overflow: hidden;
}

.shm-cart__summary-head {
  background: var(--color-accent);
  color: var(--color-text-on-accent);
  padding: 16px 24px;
  font-family: var(--font-heading);
  font-size: 19px;
}

.shm-cart__summary-body { padding: 22px 24px; }

.shm-cart__row {
  display: flex;
  justify-content: space-between;
  font-size: 15px;
  color: var(--color-text-secondary);
  margin-bottom: 12px;
}

.shm-cart__row-val { color: var(--color-text); }
.shm-cart__row-ship { color: var(--color-brand-strong); }

/* Selector de método de envío (Woo) */
.shm-cart__ship {
  padding: 4px 0 4px;
  margin-bottom: 12px;
  border-top: 1px solid var(--color-bg-sunken);
  border-bottom: 1px solid var(--color-bg-sunken);
}
.shm-cart__ship-label {
  display: block;
  font-size: 15px;
  color: var(--color-text-secondary);
  margin: 12px 0 8px;
}
.shm-cart__summary .shm-cart__ship-methods { list-style: none; margin: 0; padding: 0; }
.shm-cart__summary .shm-cart__ship-method { margin: 0 0 6px; padding: 0; text-indent: 0; }
.shm-cart__summary .shm-cart__ship-method::before { display: none; }
.shm-cart__ship-method:last-child { margin-bottom: 4px; }

.shm-cart__ship-opt {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 0;
  font-size: 15px;
  color: var(--color-text);
  cursor: pointer;
}
.shm-cart__summary .shm-cart__ship-opt input[type="radio"] {
  accent-color: var(--color-brand-strong);
  width: 16px;
  height: 16px;
  margin: 0;
  padding: 0;
  flex: none;
}
/* Woo mete el precio (¢0 / Gratis) dentro del label; se ve tenue. */
.shm-cart__ship-opt .amount,
.shm-cart__ship-opt .woocommerce-Price-amount { color: var(--color-text-tertiary); font-weight: var(--fw-regular); }

.shm-cart__ship-note {
  display: inline-block;
  margin: 2px 0 6px 26px;
  font-size: 15px;
  color: var(--color-brand-strong);
  text-decoration: underline;
}
.shm-cart__ship-note:hover { color: var(--color-brand); }

/* Cupón */
.shm-cart__coupon {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.shm-cart__coupon-input {
  flex: 1;
  border: 1px solid var(--color-border-input);
  border-radius: var(--radius-input);
  padding: 11px 14px;
  font-size: 15px;
  font-family: var(--font-body);
  color: var(--color-text);
  background: var(--color-bg);
}

.shm-cart__coupon-input::placeholder { color: var(--color-text-muted); }

.shm-cart__coupon-apply {
  border: 1px solid var(--color-brand-strong);
  color: var(--color-brand-strong);
  background: var(--color-bg);
  font-size: 15px;
  font-weight: var(--fw-semibold);
  padding: 11px 16px;
  border-radius: var(--radius-input);
  cursor: pointer;
  font-family: var(--font-body);
  transition: background .2s ease, color .2s ease;
}

.shm-cart__coupon-apply:hover { background: var(--color-brand-strong); color: var(--color-text-on-brand); }

.shm-cart__total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 17px;
  padding-top: 16px;
  border-top: 1px solid var(--color-border-input);
  margin-bottom: 18px;
}

.shm-cart__total > span:first-child { font-weight: var(--fw-semibold); color: var(--color-text); }
.shm-cart__total-val { font-family: var(--font-heading); font-size: 23px; color: var(--color-price); }

.shm-cart__checkout {
  display: block;
  background: var(--btn-primary-bg);
  color: var(--btn-primary-text);
  text-align: center;
  font-size: 16px;
  font-weight: var(--fw-semibold);
  padding: 16px;
  border-radius: var(--radius-btn);
  text-decoration: none;
  transition: background .2s ease;
}

.shm-cart__checkout:hover { background: var(--btn-primary-bg-hover); color: var(--btn-primary-text); }

.shm-cart__continue {
  text-align: center;
  margin-top: 12px;
  font-size: 16px;
}

.shm-cart__continue a { color: var(--color-brand-strong); text-decoration: none; }
.shm-cart__continue a:hover { text-decoration: underline; }

/* ============ Carrito vacío ============ */

.shm-cart-empty {
  max-width: 640px;
  margin: 0 auto;
  padding: 20px 48px 80px;
  text-align: center;
}

.shm-cart-empty__text {
  font-size: 17px;
  color: var(--color-text-secondary);
  font-weight: var(--fw-light);
  margin: 0 0 26px;
}

/* ============ Responsive ============ */

@media (max-width: 820px) {
  .shm-cart__grid { grid-template-columns: 1fr; }
  .shm-cart-hero__title { font-size: 30px; }
}

@media (max-width: 560px) {
  /* El padding de escritorio (48px por lado) dejaba al nombre ~55px de ancho
     y partía el título palabra por palabra. */
  .shm-cart-hero { padding: 28px 20px 18px; }
  .shm-cart { padding: 8px 20px 48px; }
  .shm-cart-empty { padding: 16px 20px 56px; }

  /* Ítem en 2 columnas: miniatura | (nombre + detalle + precio). */
  .shm-cart__item {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr);
    align-items: start;
    gap: 14px;
    padding: 16px;
  }
  .shm-cart__thumb { width: 72px; height: 72px; }

  .shm-cart__item-main { grid-column: 2; }
  .shm-cart__item-name { overflow-wrap: anywhere; }

  /* El precio baja bajo el nombre en vez de robarle ancho. */
  .shm-cart__item-price {
    grid-column: 2;
    margin-top: 6px;
    font-size: 17px;
  }

  .shm-cart__summary-body { padding: 20px; }
  .shm-cart__summary-head { padding: 14px 20px; }
}
