/* ================================================================
   CHECKOUT MOBILE — WebPilot Tienda
   Optimizaciones UX móvil: progress bar, express pay, autocomplete,
   campos grandes, validación inline, summary colapsable, sticky CTA
   Diana — 02/03/2026
   ================================================================ */

/* ── PROGRESS BAR ─────────────────────────────────────────────── */
.checkout-progress {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 28px 10px;
  background: #0d1829;
  border-bottom: 1px solid rgba(0,212,255,0.12);
  position: sticky;
  top: 0;
  z-index: 2;
  gap: 0;
}
.checkout-progress::before {
  /* connector line behind steps */
  content: '';
  position: absolute;
  left: 20%;
  right: 20%;
  top: 22px;
  height: 2px;
  background: rgba(255,255,255,0.08);
  z-index: 0;
}
.progress-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  flex: 1;
  position: relative;
  z-index: 1;
}
.progress-step-dot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(255,255,255,0.07);
  border: 2px solid rgba(255,255,255,0.14);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 800;
  color: rgba(255,255,255,0.3);
  transition: all 0.3s ease;
}
.progress-step.done .progress-step-dot {
  background: rgba(37,99,235,0.2);
  border-color: #2563eb;
  color: #2563eb;
}
.progress-step.active .progress-step-dot {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
  box-shadow: 0 0 14px rgba(37,99,235,0.55);
}
.progress-step-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.25);
  transition: color 0.3s ease;
  white-space: nowrap;
}
.progress-step.done .progress-step-label {
  color: rgba(37,99,235,0.65);
}
.progress-step.active .progress-step-label {
  color: #2563eb;
}
/* Connector segments between steps */
.progress-connector {
  flex: 1;
  height: 2px;
  background: rgba(255,255,255,0.09);
  margin-bottom: 14px;
  transition: background 0.3s;
}
.progress-connector.done {
  background: #2563eb;
}

/* ── EXPRESS PAY SECTION ──────────────────────────────────────── */
.express-pay-section {
  background: rgba(255,255,255,0.025);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 14px;
  padding: 18px 18px 14px;
  margin-bottom: 22px;
}
.express-pay-title {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: rgba(255,255,255,0.38);
  text-align: center;
  margin-bottom: 13px;
}
.express-pay-buttons {
  display: flex;
  gap: 10px;
}
.btn-express-pay {
  flex: 1;
  border: none;
  border-radius: 11px;
  padding: 13px 14px;
  font-size: .88rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: transform .14s, opacity .14s, box-shadow .14s;
  font-family: system-ui,-apple-system,'Segoe UI',Roboto,Arial,sans-serif;
  min-height: 46px;
}
.btn-apple-pay {
  background: #000;
  color: #fff;
}
.btn-apple-pay:hover {
  opacity: .88;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
}
.btn-google-pay {
  background: #fff;
  color: #1f1f1f;
  border: 1.5px solid #dadce0;
}
.btn-google-pay:hover {
  background: #f8f8f8;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}
.btn-express-pay svg {
  flex-shrink: 0;
}
.express-pay-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
}
.express-pay-divider::before,
.express-pay-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(255,255,255,0.09);
}
.express-pay-divider span {
  font-size: .73rem;
  color: rgba(255,255,255,0.32);
  white-space: nowrap;
}
.express-notice {
  font-size: .8rem;
  color: #00D4FF;
  text-align: center;
  padding: 8px 0 4px;
  animation: fadeIn .25s ease;
}

/* ── INLINE VALIDATION ────────────────────────────────────────── */
.form-group input.field-invalid {
  border-color: rgba(239,68,68,0.75) !important;
  background: rgba(239,68,68,0.06) !important;
}
.form-group input.field-valid {
  border-color: rgba(34,197,94,0.55) !important;
}
.field-error-msg {
  font-size: .71rem;
  color: #f87171;
  margin-top: 2px;
  display: none;
  line-height: 1.4;
}
.field-error-msg.visible {
  display: block;
  animation: fadeIn .2s ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── SECURITY BADGE ───────────────────────────────────────────── */
.pay-security-badge {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px 12px;
  margin-top: 12px;
  font-size: .75rem;
  color: rgba(255,255,255,0.38);
}
.pay-security-badge .badge-item {
  display: flex;
  align-items: center;
  gap: 4px;
}
.pay-security-badge .sep {
  color: rgba(255,255,255,0.18);
}

/* ── SUMMARY COLAPSABLE (MÓVIL) ───────────────────────────────── */
.summary-toggle-btn {
  display: none;
}
.summary-collapsible-body {
  /* desktop: always visible */
}
@media (max-width: 768px) {
  .summary-toggle-btn {
    display: flex;
    width: 100%;
    background: none;
    border: none;
    cursor: pointer;
    color: inherit;
    padding: 0;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 0;
  }
  .summary-toggle-btn .toggle-label {
    font-size: .82rem;
    font-weight: 700;
    color: #00D4FF;
    text-transform: uppercase;
    letter-spacing: .06em;
    display: flex;
    align-items: center;
    gap: 6px;
  }
  .summary-toggle-btn .toggle-icon {
    color: rgba(255,255,255,0.35);
    font-size: .9rem;
    transition: transform .25s;
    display: inline-block;
  }
  .summary-toggle-btn[aria-expanded="true"] .toggle-icon {
    transform: rotate(180deg);
  }
  .summary-collapsible-body {
    overflow: hidden;
    max-height: 0;
    transition: max-height .3s ease;
  }
  .summary-collapsible-body.open {
    max-height: 500px;
  }
}

/* ── MOBILE FIELD SIZES ───────────────────────────────────────── */
@media (max-width: 768px) {
  .form-group input,
  .form-group textarea,
  .form-group select {
    min-height: 48px !important;
    font-size: 16px !important;   /* ← evita zoom automático iOS */
    padding: 13px 15px !important;
  }
  .form-group label {
    font-size: .8rem !important;
  }
  /* 3 columnas → 1 columna en móvil */
  .form-row-3 {
    grid-template-columns: 1fr !important;
  }
}

/* ── STICKY CTA MÓVIL ─────────────────────────────────────────── */
.checkout-sticky-cta {
  display: none;
}
@media (max-width: 768px) {
  .checkout-sticky-cta {
    display: block;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 5500;
    background: rgba(13,24,41,0.97);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid rgba(0,212,255,0.2);
    padding: 12px 20px 24px; /* 24px bottom: safe area iOS */
    padding-bottom: max(24px, env(safe-area-inset-bottom, 24px));
    transform: translateY(100%);
    transition: transform .3s cubic-bezier(.2,.8,.2,1);
  }
  .checkout-sticky-cta.visible {
    transform: translateY(0);
  }
  .btn-pay-sticky {
    width: 100%;
    background: #00D4FF;
    color: #0B1120;
    border: none;
    border-radius: 12px;
    padding: 15px;
    font-size: 1rem;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: system-ui,-apple-system,'Segoe UI',Roboto,Arial,sans-serif;
    transition: background .2s;
  }
  .btn-pay-sticky:hover { background: #00A8CC; }
  .btn-pay-sticky:disabled { opacity: .55; cursor: not-allowed; }
  /* Espacio para que el sticky CTA no tape el btn-pay original */
  #checkout-modal .modal-body {
    padding-bottom: 90px !important;
  }
}

/* ── PROGRESS BAR RESPONSIVE ──────────────────────────────────── */
@media (max-width: 480px) {
  .checkout-progress {
    padding: 10px 12px 8px;
  }
  .progress-step-dot {
    width: 22px;
    height: 22px;
    font-size: 9px;
  }
  .progress-step-label {
    font-size: 8px;
  }
  .checkout-progress::before {
    top: 21px;
  }
}
