/* EBC Frenos — CHECKOUT (One Page Checkout, override del proceso nativo).
 * Traducción de Checkout.jsx del Design System. Se REESTILIZA el motor de pasos
 * de PrestaShop (información personal · direcciones · transporte · pago) sin tocar
 * su lógica: aquí solo se maqueta. Carga la última (stylesheets.tpl) para ganar en
 * cascada sobre el theme.css heredado de Hummingbird.
 *
 * Mapa de piezas nativas → mockup:
 *   section.step            → SectionCard (.ebc-co-card, badge numerado)
 *   .delivery-option__item  → ShipOption
 *   .payment-option         → PayMethod (radio expandible con panel inline)
 *   .cart-summary (aside)   → Summary sticky
 */

/* ============================================================
   Ancho de página: liberar el .container de Bootstrap (cap 1320)
   ============================================================ */
body#checkout .columns-container,
body#checkout .container { max-width: none !important; padding-inline: 0 !important; }
body#checkout #center-column { padding-inline: 0 !important; }

/* Ocultar la navegación de pasos nativa (el mockup no la usa; se mantiene en el
   DOM por si el JS del core la referencia) */
body#checkout .checkout-steps { display: none !important; }

/* ============================================================
   Contenedor + cabecera
   ============================================================ */
.ebc-co {
  width: 100%;
  max-width: var(--page-max, 1280px);
  margin-inline: auto;
  padding: 22px var(--page-gutter, 24px) var(--section-y, 64px);
  font-family: var(--font-body, system-ui, sans-serif);
}

.ebc-co__back {
  display: inline-flex; align-items: center; gap: 8px; margin-bottom: 10px;
  font-family: var(--font-heading, sans-serif); font-weight: 600; font-size: 13px;
  text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-link, #00378d); text-decoration: none;
}
.ebc-co__back:hover { color: var(--text-strong, #14161a); }
.ebc-co__back .material-icons { font-size: 18px; }

.ebc-co__head {
  display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin-bottom: 22px;
}
.ebc-co__title {
  font-family: var(--font-display, sans-serif); font-weight: 800;
  font-size: clamp(28px, 3.4vw, 40px); text-transform: uppercase;
  letter-spacing: -0.01em; color: var(--text-strong, #14161a); margin: 0;
}
.ebc-co__secure {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13.5px; color: var(--text-muted, #5b6270);
}
.ebc-co__secure .material-icons { font-size: 15px; color: var(--fit-yes-fg, #1f8a4c); }

/* ============================================================
   Rejilla: pasos + resumen sticky
   ============================================================ */
.ebc-co__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 400px;
  gap: 30px;
  align-items: start;
}
.ebc-co__main { min-width: 0; display: grid; gap: 18px; }
.ebc-co__main .tab-content { display: grid; gap: 18px; }

/* En móvil: resumen arriba, pasos debajo */
@media (max-width: 940px) {
  .ebc-co__grid { grid-template-columns: 1fr; }
  .ebc-co__aside { order: -1; }
}

/* ============================================================
   PASO = SectionCard
   ============================================================ */
.ebc-co-card {
  background: var(--surface-card, #fff);
  border: 1px solid var(--border-soft, #e7e9ee);
  border-radius: var(--radius-lg, 14px);
  box-shadow: var(--shadow-sm, 0 1px 2px rgba(20,22,26,.06));
  padding: clamp(18px, 2.4vw, 26px);
}
/* neutraliza el display:none del .collapse heredado: la tarjeta siempre se ve;
   el contenido del paso lo gobierna el core (paso actual vs. completado) */
.ebc-co-card.step { display: block !important; }

.ebc-co-card__head {
  display: flex; align-items: center; gap: 12px; margin-bottom: 18px;
}
.ebc-co-card__head hr { display: none; }
.ebc-co-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; flex: none; border-radius: var(--radius-sm, 6px);
  background: var(--graphite-800, #1a1d24); color: #fff;
  font-family: var(--font-data, monospace); font-size: 13px; font-weight: 700;
}
.ebc-co-card__title {
  margin: 0; font-family: var(--font-display, sans-serif); font-weight: 800;
  font-size: 20px; text-transform: uppercase; letter-spacing: 0.01em;
  color: var(--text-strong, #14161a);
}
/* paso completado (no actual): número en verde para dar sensación de progreso */
.ebc-co-card.step--complete .ebc-co-num { background: var(--fit-yes-fg, #1f8a4c); }
.ebc-co-card__body { min-width: 0; }

/* paso aún no alcanzable: tarjeta atenuada, solo número + título (sin contenido) */
.ebc-co-card--pending {
  display: block !important; /* revierte el d-none nativo */
  opacity: 0.55; box-shadow: none; border-style: dashed;
}
.ebc-co-card--pending .ebc-co-card__head { margin-bottom: 0; }
.ebc-co-card--pending .ebc-co-num { background: var(--text-faint, #9aa1ad); }
.ebc-co-card--pending .ebc-co-card__title { margin: 0; }

/* ============================================================
   Formularios (skin EBC sobre Bootstrap)
   ============================================================ */
.ebc-co .form-label,
.ebc-co label.form-label {
  font-family: var(--font-heading, sans-serif); font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-body, #3a3f49);
  margin-bottom: 6px;
}
.ebc-co .form-control,
.ebc-co .form-select {
  height: 46px; padding: 0 14px;
  background: var(--surface-card, #fff);
  border: 1.5px solid var(--border, #d8dce4); border-radius: var(--radius, 8px);
  font-family: var(--font-body, sans-serif); font-size: 15px; color: var(--text-strong, #14161a);
  box-shadow: none;
}
.ebc-co textarea.form-control { height: auto; min-height: 64px; padding: 11px 14px; resize: vertical; }
.ebc-co .form-control:focus,
.ebc-co .form-select:focus {
  border-color: var(--blue-700, #00378d);
  box-shadow: 0 0 0 3px var(--blue-100, #dbe6f7); outline: none;
}
.ebc-co .form-control.is-invalid,
.ebc-co .form-control[aria-invalid="true"] { border-color: var(--fit-no-fg, #c81e1e); }
.ebc-co .invalid-feedback,
.ebc-co .form-control-comment { font-size: 12.5px; color: var(--text-muted, #5b6270); }

/* checkboxes / radios: color de marca */
.ebc-co .form-check-input { accent-color: var(--blue-700, #00378d); }
.ebc-co .form-check-input:focus { box-shadow: 0 0 0 3px var(--blue-100, #dbe6f7); border-color: var(--blue-700, #00378d); }
.ebc-co .form-check-label { font-family: var(--font-body, sans-serif); font-size: 14px; color: var(--text-body, #3a3f49); }

/* Botones */
.ebc-co .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 20px; border-radius: var(--radius, 8px);
  font-family: var(--font-heading, sans-serif); font-weight: 600; font-size: 14px;
  text-transform: uppercase; letter-spacing: 0.03em; cursor: pointer; border: 1.5px solid transparent;
}
.ebc-co .btn .material-icons { font-size: 18px; }
.ebc-co .btn-primary { background: var(--action, #e00209); border-color: var(--action, #e00209); color: #fff; }
.ebc-co .btn-primary:hover { background: var(--action-hover, #b80208); border-color: var(--action-hover, #b80208); color: #fff; }
.ebc-co .btn-primary.disabled, .ebc-co .btn-primary:disabled { opacity: .55; cursor: not-allowed; }
.ebc-co .btn-outline-primary,
.ebc-co .btn-basic {
  background: transparent; border-color: var(--border, #d8dce4); color: var(--text-strong, #14161a);
}
.ebc-co .btn-outline-primary:hover,
.ebc-co .btn-basic:hover { border-color: var(--text-strong, #14161a); background: var(--surface-sunken, #f3f5f8); }

.ebc-co .buttons-wrapper {
  display: flex; gap: 12px; margin-top: 20px; flex-wrap: wrap;
}
.ebc-co .buttons-wrapper--split { justify-content: space-between; }
.ebc-co .buttons-wrapper--end { justify-content: flex-end; }
/* la "vuelta atrás" es secundaria: menos peso */
.ebc-co .js-back { order: -1; }

/* ============================================================
   Paso 1 · Contacto (personal information)
   ============================================================ */
.ebc-co .nav-underline {
  display: flex; gap: 4px; border-bottom: 1px solid var(--border-soft, #e7e9ee);
  margin-bottom: 18px; padding: 0; list-style: none;
}
.ebc-co .nav-underline .nav-link {
  border: none; background: none; padding: 8px 4px 12px; margin-bottom: -1px;
  font-family: var(--font-heading, sans-serif); font-weight: 600; font-size: 14px;
  color: var(--text-muted, #5b6270); border-bottom: 2px solid transparent; cursor: pointer;
}
.ebc-co .nav-underline .nav-link.active {
  color: var(--text-strong, #14161a); border-bottom-color: var(--blue-700, #00378d);
}
.ebc-co .step__account {
  padding: 12px 14px; background: var(--blue-50, #eef3fb);
  border: 1px solid var(--blue-200, #bcd4f4); border-radius: var(--radius-md, 10px);
  font-size: 14px; color: var(--text-body, #3a3f49);
}
.ebc-co .step__account a { color: var(--text-link, #00378d); }

/* ============================================================
   Paso 2 · Direcciones
   ============================================================ */
.ebc-co .address__list { display: grid; gap: 12px; margin-bottom: 12px; }
.ebc-co .address-item,
.ebc-co .js-address-selector label {
  border: 1.5px solid var(--border, #d8dce4); border-radius: var(--radius-md, 10px);
  padding: 14px 16px; background: var(--surface-card, #fff);
}
.ebc-co .js-address-selector label:has(input:checked),
.ebc-co .address-item:has(input:checked) {
  border-color: var(--blue-700, #00378d); background: var(--blue-50, #eef3fb);
}
.ebc-co .address-alias,
.ebc-co .h3 { font-family: var(--font-heading, sans-serif); font-weight: 700; color: var(--text-strong, #14161a); }

/* ============================================================
   Paso 3 · Método de envío = ShipOption
   ============================================================ */
.ebc-co .delivery-options__list { display: grid; gap: 10px; }
.ebc-co .delivery-option__item {
  border: 1.5px solid var(--border, #d8dce4); border-radius: var(--radius-md, 10px);
  background: var(--surface-card, #fff); overflow: hidden; transition: border-color 120ms, background-color 120ms;
}
.ebc-co .delivery-option__item:has(input:checked) {
  border-color: var(--blue-700, #00378d); background: var(--blue-50, #eef3fb);
}
.ebc-co .delivery-option__label {
  display: flex; align-items: center; gap: 13px; margin: 0; padding: 14px 16px; cursor: pointer;
}
.ebc-co .delivery-option__left { display: flex; align-items: center; gap: 13px; flex: 1; min-width: 0; }
.ebc-co .delivery-option__carrier-name {
  font-family: var(--font-heading, sans-serif); font-weight: 600; font-size: 14.5px; color: var(--text-strong, #14161a);
}
.ebc-co .delivery-option__carrier-logo { max-height: 26px; width: auto; }
.ebc-co .delivery-option__content {
  flex: 1; font-family: var(--font-body, sans-serif); font-size: 13px; color: var(--text-muted, #5b6270);
}
.ebc-co .delivery-option__price {
  flex: none; font-family: var(--font-data, monospace); font-weight: 700; font-size: 14.5px;
  font-variant-numeric: tabular-nums; color: var(--text-strong, #14161a);
}
.ebc-co .order-options { margin-top: 16px; }

/* ============================================================
   Paso 4 · Pago = PayMethod
   ============================================================ */
.ebc-co .payment-options__list { display: grid; gap: 10px; }
.ebc-co .payment-option {
  border: 1.5px solid var(--border, #d8dce4); border-radius: var(--radius-md, 10px);
  background: var(--surface-card, #fff); overflow: hidden; transition: border-color 120ms;
}
.ebc-co .payment-option:has(.payment-option__input:checked) { border-color: var(--blue-700, #00378d); }
.ebc-co .payment-option__form-check {
  display: flex; align-items: center; gap: 13px; margin: 0; padding: 15px 16px;
}
.ebc-co .payment-option:has(.payment-option__input:checked) .payment-option__form-check {
  background: var(--blue-50, #eef3fb);
}
.ebc-co .payment-option__label {
  display: flex; align-items: center; gap: 10px; margin: 0; flex: 1; cursor: pointer;
  font-family: var(--font-heading, sans-serif); font-weight: 600; font-size: 14.5px; color: var(--text-strong, #14161a);
}
.ebc-co .payment-option__label img { max-height: 22px; width: auto; }
.ebc-co .payment-option__additional-information,
.ebc-co .js-payment-option-form {
  border-top: 1px solid var(--border-soft, #e7e9ee); background: var(--surface-sunken, #f3f5f8);
  padding: 16px; font-family: var(--font-body, sans-serif); font-size: 13.5px;
  line-height: 1.5; color: var(--text-body, #3a3f49);
}
.ebc-co .js-payment-option-form:empty { display: none; }

/* Condiciones legales */
.ebc-co .js-conditions-to-approve { margin-top: 18px; }
.ebc-co .js-conditions-to-approve .form-check { display: flex; gap: 10px; align-items: flex-start; margin: 8px 0; }
.ebc-co .js-conditions-to-approve a { color: var(--text-link, #00378d); }

/* Aviso de "elige método / acepta condiciones" */
.ebc-co .alert-danger {
  padding: 11px 13px; border-radius: var(--radius-md, 10px);
  background: var(--fit-no-bg, #fdeceb); border: 1px solid var(--fit-no-border, #f3b4b0);
  color: var(--fit-no-fg, #c81e1e); font-size: 13.5px;
}
.ebc-co .alert-success {
  background: var(--fit-yes-bg, #e9f7ef); border: 1px solid var(--fit-yes-border, #a6e3bf);
  color: var(--fit-yes-fg, #1f8a4c);
}

/* Botón "Realizar pedido" a ancho completo */
.ebc-co #payment-confirmation { width: 100%; }
.ebc-co #payment-confirmation .btn-primary { width: 100%; min-height: 52px; font-size: 15px; }

/* ============================================================
   Resumen del pedido (aside sticky)
   ============================================================ */
.ebc-co__aside { min-width: 0; }
.ebc-co__summary {
  position: sticky; top: var(--ebc-stuck-top, 150px);
  background: var(--surface-card, #fff);
  border: 1px solid var(--border, #d8dce4); border-radius: var(--radius-lg, 14px);
  padding: 22px; box-shadow: var(--shadow-sm, 0 1px 2px rgba(20,22,26,.06));
}
.ebc-co__summary-title {
  font-family: var(--font-display, sans-serif); font-weight: 800; font-size: 20px;
  text-transform: uppercase; color: var(--text-strong, #14161a); margin: 0 0 12px;
}

/* Líneas de producto (OrderLine) */
.ebc-co__summary .cart-summary__products { margin-bottom: 12px; }
.ebc-co__summary .cart-summary__products-number {
  font-family: var(--font-data, monospace); font-size: 12.5px; color: var(--text-muted, #5b6270);
  margin-bottom: 8px;
}
.ebc-co__summary .cart-summary-product {
  display: flex; gap: 12px; align-items: center; padding: 10px 0;
  border-bottom: 1px solid var(--border-soft, #e7e9ee);
}
.ebc-co__summary .cart-summary__product:last-child .cart-summary-product { border-bottom: 0; }
.ebc-co__summary .cart-summary-product__image {
  position: relative; width: 58px; height: 58px; flex: none;
  border: 1px solid var(--border-soft, #e7e9ee); border-radius: var(--radius-md, 10px);
  overflow: hidden; background: #fff;
}
.ebc-co__summary .cart-summary-product__image img { width: 100%; height: 100%; object-fit: contain; }
.ebc-co__summary .cart-summary-product__content {
  flex: 1; min-width: 0; display: flex; gap: 10px; justify-content: space-between; align-items: center;
}
.ebc-co__summary .cart-summary-product__link {
  font-family: var(--font-heading, sans-serif); font-weight: 600; font-size: 13.5px; line-height: 1.3;
  color: var(--text-strong, #14161a); text-decoration: none;
}
.ebc-co__summary .cart-summary-product__link:hover { color: var(--text-link, #00378d); }
.ebc-co__summary .cart-summary-product__quantity {
  font-family: var(--font-data, monospace); font-size: 12px; color: var(--text-muted, #5b6270); margin-top: 3px;
}
.ebc-co__summary .cart-summary-product__quantity .label { display: none; }
.ebc-co__summary .cart-summary-product__price .label { font-size: 12.5px; color: var(--text-muted, #5b6270); }
.ebc-co__summary .cart-summary-product__total {
  font-family: var(--font-data, monospace); font-weight: 600; font-size: 14px;
  font-variant-numeric: tabular-nums; color: var(--text-strong, #14161a); white-space: nowrap;
}

/* Filas de subtotal/total (reutiliza el lenguaje del carrito) */
.ebc-co__summary .cart-summary__line {
  display: flex; justify-content: space-between; align-items: baseline; padding: 6px 0; gap: 12px;
}
.ebc-co__summary .cart-summary__label { font-family: var(--font-body, sans-serif); font-size: 14px; color: var(--text-body, #3a3f49); }
.ebc-co__summary .cart-summary__value {
  font-family: var(--font-data, monospace); font-weight: 600; font-size: 14px;
  font-variant-numeric: tabular-nums; color: var(--text-strong, #14161a); white-space: nowrap;
}
.ebc-co__summary #cart-subtotal-discount .cart-summary__value { color: var(--fit-yes-fg, #1f8a4c); }
.ebc-co__summary .cart-summary__total {
  margin-top: 8px; padding-top: 13px; border-top: 1px solid var(--border-soft, #e7e9ee);
}
.ebc-co__summary .cart-summary__line--bold { padding: 0; }
.ebc-co__summary .cart-summary__line--bold .cart-summary__label {
  font-family: var(--font-heading, sans-serif); font-weight: 700; font-size: 16px;
  text-transform: uppercase; color: var(--text-strong, #14161a);
}
.ebc-co__summary .cart-summary__line--bold .cart-summary__value {
  font-weight: 700; font-size: 22px; color: var(--text-price, var(--text-strong, #14161a));
}
.ebc-co__taxnote {
  text-align: right; font-family: var(--font-body, sans-serif); font-size: 12px;
  color: var(--text-muted, #5b6270); margin-top: 2px;
}

/* Cupón (reutiliza el override de cart-voucher.tpl) */
.ebc-co__summary .cart-voucher { margin: 14px 0 0; }
.ebc-co__summary .ebc-voucher__form { display: flex; gap: 8px; }
.ebc-co__summary .ebc-voucher__form input {
  flex: 1; min-width: 0; height: 44px; border: 1.5px solid var(--border, #d8dce4);
  border-radius: var(--radius, 8px); padding: 0 12px; font-size: 14px;
}
.ebc-co__summary .ebc-voucher__apply {
  flex: none; height: 44px; padding: 0 16px; cursor: pointer; background: transparent;
  border: 1.5px solid var(--border, #d8dce4); border-radius: var(--radius, 8px);
  font-family: var(--font-heading, sans-serif); font-weight: 600; font-size: 13px;
  text-transform: uppercase; color: var(--text-strong, #14161a);
}

/* Sello de confianza */
.ebc-co__trust {
  display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap;
  margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border-soft, #e7e9ee);
  font-family: var(--font-body, sans-serif); font-size: 12px; color: var(--text-muted, #5b6270);
}
.ebc-co__trust span { display: inline-flex; align-items: center; gap: 5px; }
.ebc-co__trust .material-icons { font-size: 14px; }

/* ============================================================
   Confirmación de pedido
   ============================================================ */
.ebc-oc {
  width: 100%; max-width: 760px; margin-inline: auto;
  padding: 48px var(--page-gutter, 24px) var(--section-y, 64px);
  font-family: var(--font-body, sans-serif);
}
.ebc-oc__hero { text-align: center; margin-bottom: 24px; }
.ebc-oc__check {
  display: inline-flex; width: 64px; height: 64px; border-radius: 999px;
  background: var(--fit-yes-bg, #e9f7ef); color: var(--fit-yes-fg, #1f8a4c);
  align-items: center; justify-content: center;
}
.ebc-oc__check .material-icons { font-size: 32px; }
.ebc-oc__title {
  font-family: var(--font-display, sans-serif); font-weight: 800;
  font-size: clamp(26px, 3.2vw, 36px); text-transform: uppercase;
  color: var(--text-strong, #14161a); margin: 16px 0 6px;
}
.ebc-oc__lead { font-size: 15px; color: var(--text-muted, #5b6270); margin: 0; }
.ebc-oc__invoice { color: var(--text-link, #00378d); }
.ebc-oc__card {
  background: var(--surface-card, #fff); border: 1px solid var(--border-soft, #e7e9ee);
  border-radius: var(--radius-lg, 14px); box-shadow: var(--shadow-sm, 0 1px 2px rgba(20,22,26,.06));
  padding: 22px; margin-bottom: 16px;
}
.ebc-oc__card-title {
  font-family: var(--font-display, sans-serif); font-weight: 800; font-size: 18px;
  text-transform: uppercase; color: var(--text-strong, #14161a); margin: 0 0 14px;
}
.ebc-oc__meta { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 8px; }
.ebc-oc__meta li { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.ebc-oc__meta span { color: var(--text-muted, #5b6270); }
.ebc-oc__meta strong { color: var(--text-strong, #14161a); font-weight: 600; text-align: right; }
.ebc-oc__actions { display: flex; justify-content: center; margin-top: 8px; }
.ebc-oc__cta {
  display: inline-flex; align-items: center; gap: 9px; min-height: 52px; padding: 0 22px;
  background: var(--action, #e00209); color: #fff; text-decoration: none; border-radius: var(--radius, 8px);
  font-family: var(--font-heading, sans-serif); font-weight: 600; font-size: 14px;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.ebc-oc__cta:hover { background: var(--action-hover, #b80208); color: #fff; }
.ebc-oc__cta .material-icons { font-size: 18px; }

/* ============================================================
   Responsive fino
   ============================================================ */
@media (max-width: 620px) {
  .ebc-co .buttons-wrapper { flex-direction: column-reverse; }
  .ebc-co .buttons-wrapper .btn { width: 100%; }
  .ebc-co .delivery-option__label { flex-wrap: wrap; }
}
