/* ==========================================================================
   css/checkout.css — Checkout, confirmación de pedido
   Depende de css/style.css
   ========================================================================== */

/* ── Sección principal ───────────────────────────────────────────────────── */
.checkout-section,
.order-confirmed-section { padding: 2rem 0 5rem; }

/* ── Indicador de pasos ──────────────────────────────────────────────────── */
.checkout-steps {
  display: flex; align-items: center; justify-content: center;
  gap: 0; margin-bottom: 2.5rem;
}
.step-item {
  display: flex; flex-direction: column; align-items: center; gap: .35rem;
  position: relative;
}
.step-num {
  width: 36px; height: 36px;
  border-radius: var(--radius-full);
  background: var(--bg-muted); color: var(--text-muted);
  border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .9rem;
  transition: all var(--t-normal);
}
.step-label { font-size: .75rem; font-weight: 600; color: var(--text-muted); white-space: nowrap; }
.step-item.active .step-num  { background: var(--primary); color: white; border-color: var(--primary); }
.step-item.active .step-label { color: var(--primary); }
.step-item.done .step-num {
  background: var(--success-light); color: #065f46;
  border-color: #6ee7b7;
}
.step-item.done .step-num::before { content: '✓'; }
.step-connector {
  width: 60px; height: 2px;
  background: var(--border);
  margin-bottom: 1.25rem;
}

/* ── Layout principal ────────────────────────────────────────────────────── */
.checkout-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 2rem;
  align-items: start;
}

/* ── Tarjeta de paso ─────────────────────────────────────────────────────── */
.checkout-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
}
.checkout-card-title {
  font-size: 1.15rem; font-weight: 700; color: var(--text-main);
  margin-bottom: 1.5rem; padding-bottom: .75rem;
  border-bottom: 1px solid var(--border);
}

/* ── Formulario ──────────────────────────────────────────────────────────── */
.checkout-form   { display: flex; flex-direction: column; gap: 1.1rem; }
.form-group      { display: flex; flex-direction: column; gap: .35rem; }
.form-label      { font-size: .85rem; font-weight: 600; color: var(--text-main); }
.required        { color: var(--danger); }
.form-hint       { font-size: .78rem; color: var(--text-muted); }

.form-input {
  width: 100%; padding: .65rem .85rem;
  border: 1px solid var(--border); border-radius: var(--radius-md);
  font-size: .9rem; background: white; color: var(--text-main);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.form-input:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.form-input::placeholder { color: var(--text-light); }

/* Filas de 2 y 3 columnas */
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-row-3 { display: grid; grid-template-columns: 1fr auto; gap: 1rem; }

/* ── Botones de navegación ───────────────────────────────────────────────── */
.checkout-form-actions {
  display: flex; align-items: center;
  justify-content: space-between; gap: 1rem;
  margin-top: .5rem;
}
.checkout-form-actions--center { justify-content: center; }

.btn-checkout-next {
  padding: .72rem 2rem; border-radius: var(--radius-md);
  background: var(--primary); color: white;
  font-weight: 700; font-size: .95rem;
  border: none; cursor: pointer;
  transition: all var(--t-fast);
}
.btn-checkout-next:hover { background: var(--primary-hover); transform: translateY(-1px); }

.btn-checkout-back {
  font-size: .88rem; font-weight: 600; color: var(--text-muted);
  text-decoration: none; transition: color var(--t-fast);
}
.btn-checkout-back:hover { color: var(--primary); }

/* ── Errores ─────────────────────────────────────────────────────────────── */
.checkout-errors {
  background: var(--danger-light); color: #991b1b;
  border: 1px solid #fca5a5; border-radius: var(--radius-md);
  padding: 1rem 1.25rem; margin-bottom: 1.25rem; font-size: .88rem;
}
.checkout-errors p { margin: .25rem 0; }
.btn-back-cart {
  display: inline-block; margin-top: .75rem;
  font-weight: 700; color: var(--primary); font-size: .88rem;
}

/* ── Secciones de revisión (paso 3) ─────────────────────────────────────── */
.checkout-review-section {
  margin-bottom: 1.5rem; padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}
.checkout-review-section:last-of-type { border-bottom: none; margin-bottom: 0; }
.review-section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: .75rem;
}
.review-section-header h3 { font-size: .95rem; font-weight: 700; color: var(--text-main); }
.btn-review-edit { font-size: .82rem; color: var(--primary); font-weight: 600; }

.review-dl {
  display: grid; grid-template-columns: 110px 1fr;
  gap: .35rem .75rem; font-size: .88rem;
}
.review-dl dt { color: var(--text-muted); font-weight: 600; }
.review-dl dd { color: var(--text-main); }

.review-address { font-size: .9rem; color: var(--text-main); line-height: 1.6; }

/* ── Tabla de ítems en checkout ──────────────────────────────────────────── */
.checkout-items-table-wrap { overflow-x: auto; margin-bottom: .75rem; }
.checkout-items-table {
  width: 100%; border-collapse: collapse; font-size: .88rem;
}
.checkout-items-table th {
  text-align: left; font-size: .76rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted);
  padding: .5rem .5rem; border-bottom: 2px solid var(--border);
}
.checkout-items-table td {
  padding: .6rem .5rem; border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.co-product-name { font-weight: 600; display: block; color: var(--text-main); }
.co-variant      { font-size: .78rem; color: var(--text-muted); display: block; }
.co-qty, .co-price, .co-subtotal { text-align: right; white-space: nowrap; }
.checkout-items-table tfoot td {
  font-weight: 700; padding: .55rem .5rem;
  border-bottom: none;
}
.co-subtotal-row td { border-top: 2px solid var(--border); color: var(--text-main); }
.co-shipping-row .co-shipping-pending { color: var(--text-muted); font-style: italic; font-weight: 400; }

.checkout-shipping-notice {
  font-size: .78rem; color: var(--text-muted);
  background: #fffbeb; border: 1px solid #fde68a;
  border-radius: var(--radius-sm); padding: .6rem .75rem;
}

/* ── Botón confirmar ─────────────────────────────────────────────────────── */
.btn-confirm-order {
  display: flex; align-items: center; gap: .6rem;
  padding: .85rem 2.5rem; border-radius: var(--radius-md);
  background: #059669; color: white;
  font-weight: 700; font-size: 1rem;
  border: none; cursor: pointer;
  transition: all var(--t-fast);
}
.btn-confirm-order:hover:not(:disabled) {
  background: #047857; transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(5,150,105,.3);
}
.btn-confirm-order:disabled { opacity: .6; cursor: not-allowed; transform: none; }

.checkout-confirm-form { margin-top: 1.5rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }

/* ── Sidebar del checkout ────────────────────────────────────────────────── */
.checkout-sidebar { position: sticky; top: 88px; }
.checkout-sidebar-box {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.25rem;
}
.sidebar-title {
  font-size: .9rem; font-weight: 700; margin-bottom: 1rem;
  padding-bottom: .75rem; border-bottom: 1px solid var(--border);
  color: var(--text-main);
}
.sidebar-item {
  display: grid; grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: .1rem .5rem; margin-bottom: .85rem;
  padding-bottom: .85rem; border-bottom: 1px solid var(--border);
}
.sidebar-item:last-of-type { border-bottom: none; margin-bottom: 0; }
.sidebar-item-name         { font-weight: 600; font-size: .88rem; color: var(--text-main); grid-column: 1; }
.sidebar-item-variant      { font-size: .76rem; color: var(--text-muted); grid-column: 1; }
.sidebar-item-qty-price    { font-size: .78rem; color: var(--text-muted); grid-column: 1; }
.sidebar-item-subtotal     { font-size: .9rem; font-weight: 700; color: var(--text-main); grid-column: 2; grid-row: 1; align-self: start; }
.sidebar-divider           { height: 1px; background: var(--border); margin: .75rem 0; }
.sidebar-total-row         { display: flex; justify-content: space-between; font-size: .9rem; font-weight: 700; color: var(--text-main); }
.sidebar-shipping-row      { display: flex; justify-content: space-between; font-size: .82rem; color: var(--text-muted); margin-top: .35rem; }
.sidebar-shipping-pending  { font-style: italic; }

/* ── Pantalla de pedido confirmado ───────────────────────────────────────── */
.order-success-header { text-align: center; padding: 2.5rem 1rem 2rem; }
.order-success-icon {
  width: 72px; height: 72px; margin: 0 auto 1rem;
  background: var(--success-light); color: #059669;
  border-radius: var(--radius-full);
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem; font-weight: 900;
  border: 3px solid #6ee7b7;
}
.order-success-title  { font-size: 2rem; font-weight: 800; color: var(--text-main); margin-bottom: .5rem; }
.order-success-subtitle { font-size: 1.05rem; color: var(--text-muted); margin-bottom: .5rem; }
.order-success-desc   { font-size: .9rem; color: var(--text-muted); max-width: 480px; margin: 0 auto; }

.order-confirmed-layout {
  display: grid; grid-template-columns: 1fr 300px; gap: 2rem; align-items: start;
}

.order-detail-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.5rem; margin-bottom: 1.25rem;
}
.order-detail-title {
  font-size: .95rem; font-weight: 700; color: var(--text-main);
  margin-bottom: 1rem; padding-bottom: .6rem; border-bottom: 1px solid var(--border);
}

.order-confirmed-sidebar { position: sticky; top: 88px; display: flex; flex-direction: column; gap: 1rem; }
.order-status-card {
  background: var(--success-light); border: 1px solid #6ee7b7;
  border-radius: var(--radius-lg); padding: 1.25rem; text-align: center;
}
.order-status-badge {
  display: inline-block; background: #059669; color: white;
  font-size: .78rem; font-weight: 700; padding: .25rem .75rem;
  border-radius: var(--radius-full); margin-bottom: .6rem;
}
.order-status-desc { font-size: .85rem; color: #065f46; }

.order-info-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.25rem;
}
.order-info-card h3 {
  font-size: .88rem; font-weight: 700; color: var(--text-main);
  margin-bottom: .75rem; padding-bottom: .5rem; border-bottom: 1px solid var(--border);
}

.btn-back-catalog {
  display: block; text-align: center; padding: .7rem 1rem;
  background: var(--primary); color: white; border-radius: var(--radius-md);
  font-weight: 700; font-size: .9rem; transition: all var(--t-fast);
}
.btn-back-catalog:hover { background: var(--primary-hover); }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 860px) {
  .checkout-layout,
  .order-confirmed-layout { grid-template-columns: 1fr; }
  .checkout-sidebar,
  .order-confirmed-sidebar { position: static; }
  .checkout-sidebar { order: -1; }
  .form-row-2 { grid-template-columns: 1fr; }
  .form-row-3 { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .checkout-steps   { gap: 0; }
  .step-connector   { width: 30px; }
  .step-label       { font-size: .65rem; }
  .checkout-card    { padding: 1.25rem; }
  .checkout-section { padding: 1rem 0 4rem; }
}

/* ── WhatsApp en pedido confirmado ───────────────────────────────────────── */
.btn-wa-confirmed {
  display: flex; align-items: center; justify-content: center;
  gap: .5rem; margin-top: .75rem; width: 100%;
  padding: .72rem 1rem; border-radius: var(--radius-md);
  background: #25d366; color: #fff;
  font-weight: 700; font-size: .9rem;
  text-decoration: none;
  transition: all var(--t-fast);
}
.btn-wa-confirmed:hover { background: #128c7e; transform: translateY(-1px); }
