/* ==========================================================================
   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); }

/* ── Estilos de Logística Local y Mapas (v1.2.0) ────────────────────────── */
.delivery-mode-selector {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.5rem;
}
.delivery-mode-option {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  background: white;
  cursor: pointer;
  transition: all var(--t-fast);
}
.delivery-mode-option:hover {
  border-color: #cbd5e1;
}
.delivery-mode-option.is-selected {
  border-color: var(--primary);
  background: rgba(37, 99, 235, 0.04);
}
.delivery-mode-option input[type="radio"] {
  margin-top: 0.2rem;
}
.delivery-mode-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.delivery-mode-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0.25rem 0 0;
}

/* Contenedor del Mapa en Checkout */
.checkout-map-wrap {
  position: relative;
  margin-bottom: 1.25rem;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
}
#checkout-delivery-map {
  height: 280px;
  width: 100%;
  z-index: 1;
}
.checkout-map-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 1000;
  background: rgba(15, 23, 42, 0.92);
  color: white;
  padding: 0.45rem 0.85rem;
  border-radius: 9999px;
  font-size: 0.85rem;
  font-weight: 600;
  backdrop-filter: blur(4px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  gap: 0.45rem;
  pointer-events: none;
}
.checkout-map-badge strong {
  color: #38bdf8;
}

/* Tarjeta informativa de retiro en tienda */
.pickup-store-card {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}
.pickup-store-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* Selector de Métodos de Pago en Paso 3 */
.payment-methods-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin: 1.25rem 0;
}
.payment-option-card {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding: 0.95rem 1.15rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  background: white;
  cursor: pointer;
  transition: all var(--t-fast);
}
.payment-option-card:hover {
  border-color: #cbd5e1;
}
.payment-option-card.is-selected {
  border-color: var(--primary);
  background: rgba(37, 99, 235, 0.03);
}
.payment-option-card input[type="radio"] {
  margin-top: 0.25rem;
}
.payment-option-label {
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.payment-option-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 0.25rem 0 0;
}
.payment-fee-badge {
  display: inline-block;
  background: #fef3c7;
  color: #92400e;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  margin-left: 0.35rem;
}
