/* =========================================================
   CHECKOUT — Estilos específicos
   Requiere styles.css cargado antes (variables CSS, base, btn-primary)
   ========================================================= */

/* ── Body override ── */
.checkout-body {
  background: var(--c-bg-soft);
  padding-bottom: 0;
}

/* =========================================================
   HEADER
   ========================================================= */
.co-header {
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  position: sticky;
  top: 0;
  z-index: 50;
}
.co-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.75rem 1.75rem;
}
.co-header__logo {
  display: block;
  flex-shrink: 0;
}
.co-header__logo img {
  height: 44px;
  width: auto;
  display: block;
}
.co-header__secure {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--c-text-muted);
  letter-spacing: 0.04em;
}
.co-header__secure svg {
  width: 15px;
  height: 15px;
  color: #1a9e4a;
  flex-shrink: 0;
}

/* =========================================================
   LAYOUT PRINCIPAL
   ========================================================= */
.co-main {
  min-height: calc(100vh - 68px);
  padding: 2rem 1.75rem 4rem;
}
.co-layout {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 2.2rem;
  max-width: 1100px;
  margin: 0 auto;
  align-items: start;
}

/* =========================================================
   COLUMNA IZQUIERDA — RESUMEN
   ========================================================= */
.co-summary {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 1.6rem;
  overflow: hidden;
  position: sticky;
  top: 84px;
}

/* Toggle mobile (oculto en desktop) */
.co-summary__toggle {
  display: none;
  width: 100%;
  padding: 1rem 1.25rem;
  background: var(--c-sky);
  border: none;
  cursor: pointer;
  color: #fff;
  font-family: var(--f-body);
  font-size: 0.95rem;
  font-weight: 700;
  align-items: center;
  gap: 0.6rem;
  text-align: left;
}
.co-summary__toggle-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
}
.co-summary__toggle-label svg { width: 18px; height: 18px; }
.co-summary__toggle-price { font-size: 1.1rem; }
.co-summary__toggle-chevron {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  transition: transform 0.35s ease;
}
.co-summary__toggle[aria-expanded="true"] .co-summary__toggle-chevron {
  transform: rotate(180deg);
}

/* Body del resumen */
.co-summary__body {
  padding: 1.6rem;
}

/* Producto principal */
.co-product {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--c-border);
  margin-bottom: 1.25rem;
}
.co-product__img {
  position: relative;
  flex-shrink: 0;
}
.co-product__img img {
  width: 68px;
  height: 68px;
  object-fit: contain;
  border-radius: 0.75rem;
  background: var(--c-bg-soft);
}
.co-product__qty {
  position: absolute;
  top: -7px;
  right: -7px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--c-text);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.co-product__info { flex: 1; }
.co-product__name {
  font-size: 0.95rem;
  color: var(--c-text);
  margin-bottom: 0.25rem;
  line-height: 1.4;
}
.co-product__sub {
  font-size: 0.8rem;
  color: var(--c-text-soft);
  margin: 0;
}
.co-product__price {
  font-size: 1rem;
  font-weight: 600;
  color: var(--c-text-muted);
  text-decoration: line-through;
  text-decoration-color: var(--c-text-soft);
  flex-shrink: 0;
}

/* Bonos */
.co-bonos { margin-bottom: 1.25rem; }
.co-bonos__title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--c-text-soft);
  margin-bottom: 0.75rem;
}
.co-bonos__list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.co-bonos__list li {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.88rem;
}
.co-bonos__list img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  border-radius: 0.5rem;
  background: var(--c-bg-soft);
  flex-shrink: 0;
}
.co-bonos__list > li > div {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.co-bonos__name {
  font-weight: 600;
  color: var(--c-text);
  line-height: 1.3;
}
.co-bonos__note {
  font-size: 0.78rem;
  color: var(--c-text-soft);
}
.co-bonos__free {
  font-size: 0.8rem;
  font-weight: 700;
  color: #1a9e4a;
  flex-shrink: 0;
}

/* Totales */
.co-totals {
  border-top: 1px solid var(--c-border);
  padding-top: 1rem;
  margin-bottom: 1.25rem;
}
.co-totals__row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.92rem;
  color: var(--c-text-muted);
  padding: 0.3rem 0;
}
.co-totals__row s {
  text-decoration-color: var(--c-red);
  font-weight: 600;
}
.co-totals__row--discount {
  color: #1a9e4a;
  font-weight: 600;
}
.co-totals__row--total {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--c-text);
  border-top: 1px solid var(--c-border-strong);
  margin-top: 0.4rem;
  padding-top: 0.6rem;
}
.co-totals__row--total strong {
  font-family: var(--f-display);
  font-size: 1.5rem;
  color: var(--c-ink);
}
.co-totals__cuota {
  font-size: 0.85rem;
  color: var(--c-text-soft);
  margin-top: 0.4rem;
  text-align: right;
}
.co-totals__cuota strong { color: var(--c-sky); }

/* Garantía */
.co-guarantee {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: rgba(46, 168, 232, 0.07);
  border: 1px solid rgba(46, 168, 232, 0.2);
  border-radius: 1rem;
  padding: 1rem;
}
.co-guarantee img {
  width: 52px;
  height: 52px;
  object-fit: contain;
  flex-shrink: 0;
}
.co-guarantee__title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--c-text);
  margin-bottom: 0.2rem;
}
.co-guarantee__text {
  font-size: 0.8rem;
  color: var(--c-text-soft);
  line-height: 1.4;
  margin: 0;
}

/* =========================================================
   COLUMNA DERECHA — FORMULARIO
   ========================================================= */
.co-form-wrap {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 1.6rem;
  padding: 2rem 2rem;
}
.co-form { display: flex; flex-direction: column; gap: 1.5rem; }

/* Fieldset */
.co-fieldset {
  border: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.co-fieldset__legend {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--c-text);
  margin-bottom: 0.5rem;
  float: none;
  width: 100%;
}
.co-fieldset__num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--c-sky);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 700;
  flex-shrink: 0;
}

/* Filas de campos */
.co-fields-row { display: flex; gap: 1rem; }
.co-fields-row--2 > * { flex: 1; min-width: 0; }

/* Campo individual */
.co-field { display: flex; flex-direction: column; gap: 0.3rem; }

/* Label */
.co-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--c-text-muted);
}

/* Input base */
.co-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1.5px solid var(--c-border-strong);
  border-radius: 0.75rem;
  font-family: var(--f-body);
  font-size: 1rem;
  color: var(--c-text);
  background: var(--c-bg);
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
  outline: none;
  -webkit-appearance: none;
}
.co-input::placeholder { color: var(--c-text-soft); }
.co-input:focus {
  border-color: var(--c-sky);
  box-shadow: 0 0 0 3px rgba(46, 168, 232, 0.15);
  background: var(--c-surface);
}
.co-input.is-valid {
  border-color: #1a9e4a;
  box-shadow: 0 0 0 3px rgba(26, 158, 74, 0.1);
}
.co-input.is-error {
  border-color: var(--c-red);
  box-shadow: 0 0 0 3px rgba(225, 31, 31, 0.12);
}
.co-input--uppercase { text-transform: uppercase; letter-spacing: 0.04em; }

/* Hint y error */
.co-field__hint {
  font-size: 0.78rem;
  color: var(--c-text-soft);
  margin: 0;
  line-height: 1.4;
}
.co-field__error {
  font-size: 0.8rem;
  color: var(--c-red);
  font-weight: 600;
  margin: 0;
  min-height: 1em;
  display: none;
}
.co-field__error.visible { display: block; }

/* Wrap con icono a la derecha */
.co-input-wrap { position: relative; }
.co-input-wrap .co-input { padding-right: 3.2rem; }

/* Iconos de tarjeta */
.co-card-icons {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  gap: 0.25rem;
  align-items: center;
}
.co-card-icon {
  width: 36px;
  height: 24px;
  border-radius: 4px;
  opacity: 0.35;
  transition: opacity 0.3s ease;
  flex-shrink: 0;
}
.co-card-icon.active { opacity: 1; }
.co-card-icon.faded { opacity: 0.12; }

/* Toggle CVV */
.co-cvv-toggle {
  position: absolute;
  right: 0.6rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--c-text-soft);
  padding: 0.25rem;
  display: flex;
  align-items: center;
}
.co-cvv-toggle svg { width: 17px; height: 17px; }
.co-cvv-toggle:hover { color: var(--c-sky); }

/* Botón de ayuda CVV */
.co-cvv-help {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--c-text-soft);
  padding: 0;
  display: inline-flex;
  align-items: center;
}
.co-cvv-help svg { width: 14px; height: 14px; }
.co-cvv-help:hover { color: var(--c-sky); }

/* Tooltip CVV */
.co-cvv-tooltip {
  background: var(--c-ink);
  color: #fff;
  font-size: 0.8rem;
  padding: 0.5rem 0.8rem;
  border-radius: 0.5rem;
  margin-top: 0.35rem;
  line-height: 1.4;
  position: relative;
}
.co-cvv-tooltip::before {
  content: '';
  position: absolute;
  top: -5px;
  left: 1.2rem;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-bottom: 5px solid var(--c-ink);
}

/* =========================================================
   TABS MÉTODO DE PAGO
   ========================================================= */
.co-payment-tabs {
  display: flex;
  gap: 0.5rem;
  border-bottom: 2px solid var(--c-border);
  padding-bottom: 0.1rem;
  margin-bottom: 1.2rem;
}
.co-tab {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1rem;
  border: none;
  background: none;
  font-family: var(--f-body);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--c-text-muted);
  cursor: pointer;
  border-radius: 0.5rem 0.5rem 0 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.co-tab svg { width: 15px; height: 15px; }
.co-tab--active {
  color: var(--c-sky);
  border-bottom-color: var(--c-sky);
  background: rgba(46, 168, 232, 0.06);
}
.co-tab:hover:not(.co-tab--active) { color: var(--c-text); background: var(--c-bg-soft); }

/* Paneles */
.co-tab-panel { display: block; }
.co-tab-panel--hidden { display: none; }

/* Panel transferencia */
.co-transfer-info {
  padding: 1.5rem;
  background: rgba(46, 168, 232, 0.07);
  border: 1px solid rgba(46, 168, 232, 0.2);
  border-radius: 1rem;
}
.co-transfer-info p {
  font-size: 0.95rem;
  color: var(--c-text-muted);
  line-height: 1.6;
  margin: 0;
}

/* =========================================================
   SUBMIT + TRUST
   ========================================================= */
.co-submit { display: flex; flex-direction: column; gap: 1rem; }
.co-form-error {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 1rem;
  background: rgba(225, 31, 31, 0.08);
  border: 1px solid rgba(225, 31, 31, 0.3);
  border-radius: 0.75rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--c-red);
}
.co-form-error svg { width: 18px; height: 18px; flex-shrink: 0; }
.co-submit__btn {
  width: 100%;
  justify-content: center;
  font-size: 1.1rem;
  padding: 1.35rem 2rem;
  position: relative;
}
.co-submit__btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none !important;
  filter: none !important;
}
.co-submit__spinner {
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Trust row */
.co-trust-row {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.6rem 1.2rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--c-text-soft);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.co-trust-row span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.co-trust-row svg { width: 13px; height: 13px; color: #1a9e4a; }

/* Cards aceptadas */
.co-cards-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
}
.co-cards-row svg { width: 40px; height: 27px; border-radius: 4px; }
.co-cards-row__ssl {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--c-text-soft);
  border: 1.5px solid var(--c-border-strong);
  border-radius: 4px;
  padding: 0.3rem 0.55rem;
}
.co-cards-row__ssl svg { width: 12px; height: 12px; color: #1a9e4a; }

/* =========================================================
   FOOTER
   ========================================================= */
.co-footer {
  background: var(--c-surface);
  border-top: 1px solid var(--c-border);
  padding: 1.8rem 1.75rem;
  text-align: center;
}
.co-footer__legal {
  max-width: 720px;
  margin: 0 auto 0.75rem;
  font-size: 0.8rem;
  color: var(--c-text-soft);
  line-height: 1.6;
}
.co-footer__legal a {
  color: var(--c-sky);
  text-decoration: underline;
}
.co-footer__copy {
  font-size: 0.78rem;
  color: var(--c-text-soft);
  opacity: 0.7;
  margin: 0;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 960px) {
  .co-layout {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .co-summary {
    position: static;
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-top: none;
    order: -1;
  }
  .co-summary__toggle { display: flex; }
  .co-summary__body {
    display: none;
    padding: 1.25rem;
  }
  .co-summary__body.is-open { display: block; }
  .co-form-wrap {
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-top: none;
  }
  .co-main { padding: 0 0 3rem; }
  .co-header__inner { padding: 0.65rem 1rem; }
}

@media (max-width: 600px) {
  .co-fields-row--2 { flex-direction: column; }
  .co-form-wrap { padding: 1.5rem 1.1rem; }
  .co-submit__btn { font-size: 1rem; padding: 1.2rem 1.5rem; }
}
