﻿
/* ==========================================================================
   Checkout Modal (#modalCheckout) â€” 5-Step Checkout
   ========================================================================== */

/* Step progress bar */
.co-step-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-bottom: 0;
  padding: 10px 0 16px;
  gap: 0;
}
.co-step-indicator {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  cursor: default;
  background: #ebebeb;
  border-radius: 6px;
  padding: 5px 11px;
  transition: background .3s, box-shadow .3s;
}
.co-step-number {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  background: rgba(0,0,0,.1);
  color: #888;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  flex-shrink: 0;
  transition: background .3s, color .3s;
  box-shadow: none;
  border: none;
}
.co-step-label {
  font-size: 11px;
  margin-top: 0;
  color: #888;
  white-space: nowrap;
  letter-spacing: .3px;
  font-weight: 500;
  transition: color .3s;
}
.co-step-indicator.active {
  background: #2f313a;
  box-shadow: 0 3px 10px rgba(47,49,58,.3);
}
.co-step-indicator.active .co-step-number {
  background: rgba(255,255,255,.18);
  color: #fff;
}
.co-step-indicator.active .co-step-label { color: #fff; font-weight: 700; }
.co-step-indicator.completed {
  background: #e6f4ea;
  box-shadow: none;
}
.co-step-indicator.completed .co-step-number {
  background: #28a745;
  color: #fff;
}
.co-step-indicator.completed .co-step-label { color: #28a745; font-weight: 600; }
.co-step-connector {
  flex: 1;
  max-width: 28px;
  min-width: 6px;
  height: 2px;
  background: #e0e0e0;
  margin: 0 3px;
  border-radius: 2px;
  transition: background .4s;
}
.co-step-connector.done { background: #28a745; }

/* Mobile: hide labels, show only numbers */
@media (max-width: 575px) {
  .co-step-label { display: none; }
  .co-step-indicator { padding: 5px 8px; gap: 0; }
}

/* Summary items list */
.co-sum-item-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  overflow: hidden;
}
.co-sum-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid #f0f0f0;
  font-size: 0.82rem;
}
.co-sum-item:last-child { border-bottom: none; }
.co-sum-item-img {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 5px;
  flex-shrink: 0;
  background: #f5f5f5;
}
.co-sum-item-img--placeholder {
  display: inline-block;
  background: #ebebeb;
}
.co-sum-item-name {
  color: #2f313a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.co-sum-item-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.co-sum-item-attrs {
  display: block;
  margin-top: 2px;
  color: #6f7780;
  font-size: 0.75rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.co-sum-item-qty {
  color: #888;
  white-space: nowrap;
}
.co-sum-item-price {
  font-weight: 600;
  color: #2f313a;
  white-space: nowrap;
}

/* Modal wrapper */
#modalCheckout .modal-content {
  border-radius: 0;
  overflow: hidden;
  box-shadow: none;
  overflow-x: hidden;
}
#modalCheckout .modal-header {
  position: relative;
  top: auto;
  right: auto;
  background: #f8f9fa;
  border-bottom: 1px solid #e0e0e0;
  padding: 16px 24px 0;
  flex-direction: column;
  align-items: stretch;
  z-index: auto;
}
#modalCheckout .co-modal-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
#modalCheckout .modal-title {
  font-size: 17px;
  font-weight: 700;
  color: #2f313a;
  margin: 0;
  line-height: 1.3;
}
/* Close button */
#modalCheckout .co-close-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1.5px solid #d0d0d0;
  background: #fff;
  color: #555;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: background .2s, color .2s, border-color .2s, box-shadow .2s;
  padding: 0;
  z-index: 10;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
}
#modalCheckout .co-close-btn:hover {
  background: #2f313a;
  color: #fff;
  border-color: #2f313a;
  box-shadow: 0 3px 10px rgba(47,49,58,.25);
}
#modalCheckout .modal-body {
  padding: 24px;
  overflow-x: hidden;
}

/* Step sections */
#modalCheckout .co-step h6 {
  font-size: 15px;
  font-weight: 700;
  color: #2f313a;
  border-bottom: 2px solid #f0f0f0;
  padding-bottom: 9px;
  margin-bottom: 1.4rem;
}
#modalCheckout .co-step .form-group { margin-bottom: 1.2rem; }
#modalCheckout .co-step label {
  font-size: 13px;
  font-weight: 600;
  color: #555;
  margin-bottom: 5px;
}
#modalCheckout .co-step .form-control {
  border-radius: 6px;
  border-color: #ddd;
  font-size: 14px;
  padding: 9px 12px;
  height: auto;
}
#modalCheckout .co-step textarea.form-control { padding: 10px 12px; }

/* Country-code select integrated in input-group */
#modalCheckout #co-country {
  flex: 0 0 auto;
  width: 100px;
  background: #f5f5f5;
  font-weight: 600;
  color: #2f313a;
  font-size: 13px;
  border-right: 0;
  border-radius: 6px 0 0 6px;
  text-align: center;
  padding: 9px 4px;
  cursor: pointer;
}
#modalCheckout .input-group #co-whatsapp {
  border-radius: 0 6px 6px 0 !important;
  border-left: 0;
}
#modalCheckout .input-group { flex-wrap: nowrap; }

/* Buttons */
.co-step-back {
  background: #f5f5f5;
  color: #555;
  border: 1px solid #ddd;
  padding: 10px 22px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: background .2s, border-color .2s;
  white-space: nowrap;
}
.co-step-back:hover {
  background: #ebebeb;
  border-color: #ccc;
}
.co-btn-row {
  display: flex;
  gap: 10px;
  margin-top: 22px;
  align-items: center;
}
.co-btn-row .ps-btn {
  margin: 0;
  flex: 1;
  border-radius: 6px;
}
#co-confirm-error { margin-top: 10px; }

/* Order summary table */
#co-step-5 .table td {
  padding: 10px 8px;
  font-size: 14px;
  vertical-align: middle;
}
#co-step-5 .table tr:last-child td { border-top: 2px solid #dee2e6; }

/* Shipping / payment method cards â€” custom radio */
#co-shipping-methods .form-check,
#co-payment-methods .form-check {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1.5px solid #e8e8e8;
  border-radius: 10px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: border-color .2s, background .2s, box-shadow .2s;
  background: #fff;
  position: relative;
}
#co-shipping-methods .form-check:hover,
#co-payment-methods .form-check:hover {
  border-color: #2f313a;
  background: #fafafa;
}
/* Hide native radio */
#co-shipping-methods .form-check-input,
#co-payment-methods .form-check-input {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  min-width: 20px;
  border: 2px solid #ccc;
  border-radius: 50%;
  margin: 0;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  position: relative;
  flex-shrink: 0;
}
#co-shipping-methods .form-check-input::after,
#co-payment-methods .form-check-input::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #fff;
  transition: transform .2s;
}
#co-shipping-methods .form-check-input:checked,
#co-payment-methods .form-check-input:checked {
  border-color: #2f313a;
  background: #2f313a;
}
#co-shipping-methods .form-check-input:checked::after,
#co-payment-methods .form-check-input:checked::after {
  transform: translate(-50%, -50%) scale(1);
}
/* Card highlight when checked */
#co-shipping-methods .form-check:has(.form-check-input:checked),
#co-payment-methods .form-check:has(.form-check-input:checked) {
  border-color: #2f313a;
  background: #f5f5f6;
  box-shadow: 0 2px 8px rgba(47,49,58,.12);
}
#co-shipping-methods .form-check-label,
#co-payment-methods .form-check-label {
  font-size: 14px;
  font-weight: 500;
  color: #2f313a;
  cursor: pointer;
  line-height: 1.4;
  flex: 1;
}

/* Leaflet map container inside checkout modal */
#co-map {
  height: 300px !important;
  width: 100%;
  border-radius: 8px;
  z-index: 1;
}
/* Ensure Leaflet tile layers are visible inside the modal */
#co-map .leaflet-layer,
#co-map .leaflet-control-zoom,
#co-map .leaflet-top,
#co-map .leaflet-bottom {
  z-index: 400;
}

/* Desktop-first modal sizing with sticky step footer */
#modalCheckout.modal .modal-dialog {
  width: min(980px, calc(100vw - 2rem));
  max-width: 980px;
  height: calc(100% - 2rem);
  margin: 1rem auto;
}
#modalCheckout .modal-content { height: 100%; border-radius: 12px; display: flex; flex-direction: column; overflow-x: hidden; }
#modalCheckout .modal-body { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; overflow: hidden; overflow-x: hidden; max-height: none; padding-bottom: 0; }
#modalCheckout .co-step { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
#modalCheckout .co-step-body { flex: 1 1 auto; overflow-y: auto; overflow-x: hidden; min-height: 0; padding-bottom: 8px; }
#modalCheckout .co-step-footer { flex-shrink: 0; padding-top: 12px; padding-bottom: 4px; border-top: 1px solid #dee2e6; background: #fff; }

/* Mobile: use full-screen modal */
@media (max-width: 767.98px) {
  #modalCheckout.modal .modal-dialog {
    width: 100vw;
    max-width: 100vw;
    height: 100%;
    margin: 0;
  }

  #modalCheckout .modal-content {
    border-radius: 0;
  }
}

/* ==========================================================================
   Paso 6 — Confirmacion de Pedido
   ========================================================================== */

/* Header con icono de exito */
.co-confirmation-header {
  text-align: center;
  padding: 24px 16px 20px;
  border-bottom: 1px solid #f0f0f0;
  margin-bottom: 18px;
}
.co-confirmation-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #28a745;
  color: #fff;
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 12px;
  box-shadow: 0 4px 14px rgba(40,167,69,.35);
}
.co-confirmation-header h6 {
  font-size: 18px;
  font-weight: 700;
  color: #2f313a;
  margin-bottom: 4px;
  border: none;
  padding: 0;
}

/* Secciones del resumen */
.co-confirm-section {
  border: 1px solid #e9ecef;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 12px;
  background: #fafafa;
}
.co-confirm-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: #888;
  margin-bottom: 6px;
}
.co-conf-row {
  font-size: 14px;
  color: #2f313a;
  line-height: 1.5;
}
.co-conf-row + .co-conf-row { margin-top: 2px; }
