/* ============================================================
   form-compra.css — Formularios móviles Impekble
   Compartido por: form-compra, form-entrega, form-retiro
   ============================================================ */

:root {
  --verde-oscuro: #312e81;
  --verde-medio:  #4f46e5;
  --verde-claro:  #eef2ff;
  --verde-borde:  #c7d2fe;
  --rojo:         #dc2626;
  --rojo-bg:      #fee2e2;
  --verde-ok:     #16a34a;
  --verde-ok-bg:  #dcfce7;
  --gris-texto:   #374151;
  --gris-suave:   #6b7280;
  --gris-borde:   #e5e7eb;
  --fondo:        #f5f3ff;
  --blanco:       #fff;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--fondo);
  color: var(--gris-texto);
  font-size: 16px;
  min-height: 100vh;
  padding-bottom: 2rem;
}

/* ---- HEADER ---- */
.form-header {
  background: linear-gradient(135deg, #1e1b4b, #312e81);
  color: white;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.form-logo   { font-weight: 800; font-size: 1.15rem; }
.form-titulo { font-size: 0.85rem; opacity: 0.75; flex: 1; }

/* ---- BARRA USUARIO (forms con auth) ---- */
.user-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 1.25rem;
  background: rgba(30,27,75,0.92);
  border-top: 1px solid rgba(255,255,255,0.1);
  font-size: 0.78rem;
  color: rgba(255,255,255,0.8);
}
.user-info img {
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,0.4);
}
.user-info__cerrar {
  margin-left: auto;
  background: none;
  border: none;
  color: rgba(255,255,255,0.6);
  font-size: 0.72rem;
  cursor: pointer;
  text-decoration: underline;
}

/* ---- MAIN ---- */
.form-main {
  max-width: 480px;
  margin: 0 auto;
  padding: 1.25rem 1rem;
}

/* ---- CAMPOS ---- */
.campo { margin-bottom: 1.25rem; }
.campo__label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
  color: var(--verde-oscuro);
}
.req { color: var(--rojo); margin-left: 2px; }

.campo__input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1.5px solid var(--gris-borde);
  border-radius: 10px;
  font-size: 1rem;
  font-family: inherit;
  background: var(--blanco);
  color: var(--gris-texto);
  transition: border-color 0.15s;
  -webkit-appearance: none;
  appearance: none;
}
.campo__input:focus {
  outline: none;
  border-color: var(--verde-medio);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.12);
}
.campo__textarea { resize: vertical; min-height: 80px; }

/* ---- OPCIONES RADIO ---- */
.opciones-pago {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}
.opcion-pago input[type="radio"] { display: none; }
.opcion-pago__label {
  display: block;
  padding: 0.625rem 0.75rem;
  border: 1.5px solid var(--gris-borde);
  border-radius: 10px;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  background: var(--blanco);
  transition: all 0.15s;
  user-select: none;
}
.opcion-pago input[type="radio"]:checked + .opcion-pago__label {
  background: var(--verde-oscuro);
  color: white;
  border-color: var(--verde-oscuro);
}

/* ---- ÁREAS DE FOTO ---- */
.foto-area {
  border: 2px dashed var(--verde-borde);
  border-radius: 12px;
  background: var(--verde-claro);
  min-height: 130px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
  position: relative;
  transition: border-color 0.15s, background 0.15s;
}
.foto-area:active { background: #e0e7ff; }

.foto-placeholder { text-align: center; padding: 1.25rem; pointer-events: none; }
.foto-icono { font-size: 2rem; margin-bottom: 0.4rem; }
.foto-texto { font-weight: 600; color: var(--verde-oscuro); font-size: 0.9rem; }
.foto-sub   { color: var(--gris-suave); font-size: 0.75rem; margin-top: 0.25rem; }

.foto-preview { width: 100%; height: 100%; position: relative; }
.foto-preview img {
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  border-radius: 10px;
}
.foto-quitar {
  position: absolute;
  top: 6px; right: 6px;
  background: rgba(0,0,0,0.6);
  color: white;
  border: none;
  border-radius: 50%;
  width: 28px; height: 28px;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---- BOTÓN ---- */
.btn {
  width: 100%;
  padding: 1rem;
  border-radius: 12px;
  border: none;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: opacity 0.15s, transform 0.1s;
}
.btn:active   { transform: scale(0.98); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.btn--primary {
  background: linear-gradient(135deg, #312e81, #4f46e5);
  color: white;
  font-size: 1.05rem;
  padding: 1.1rem;
}
.btn--primary:hover:not(:disabled) { opacity: 0.92; }

.btn--secondary {
  background: var(--verde-claro);
  color: var(--verde-oscuro);
  border: 1.5px solid var(--verde-borde);
  margin-top: 0.75rem;
}

/* ---- SPINNER ---- */
.spinner {
  width: 20px; height: 20px;
  border: 2.5px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- TOGGLE SWITCH ---- */
.campo--toggle {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  background: var(--blanco);
  border: 1.5px solid var(--gris-borde);
  border-radius: 10px;
  padding: 0.75rem 1rem;
}
.campo__sub {
  display: block;
  font-size: 0.78rem;
  color: var(--gris-suave);
  font-weight: 400;
  line-height: 1.4;
}
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 26px;
  flex-shrink: 0;
  margin-top: 2px;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--gris-borde);
  border-radius: 26px;
  cursor: pointer;
  transition: background 0.2s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 20px; height: 20px;
  left: 3px; top: 3px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle-switch input:checked + .toggle-slider { background: var(--verde-medio); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(18px); }

/* ---- ESTADOS ---- */
.estado {
  text-align: center;
  padding: 2rem 1rem;
  border-radius: 14px;
  margin-bottom: 1rem;
}
.estado--ok    { background: var(--verde-ok-bg); border: 1.5px solid #86efac; }
.estado--error { background: var(--rojo-bg);     border: 1.5px solid #fca5a5; }

.estado__icono  { font-size: 3rem; margin-bottom: 0.5rem; }
.estado--ok    .estado__icono { color: var(--verde-ok); }
.estado--error .estado__icono { color: var(--rojo); }

.estado__titulo { font-size: 1.2rem; font-weight: 700; margin-bottom: 0.4rem; }
.estado--ok    .estado__titulo { color: #14532d; }
.estado--error .estado__titulo { color: #7f1d1d; }

.estado__detalle { color: var(--gris-texto); font-size: 0.9rem; margin-bottom: 1rem; line-height: 1.5; }

.precio-advertencia {
  background: #fef3c7;
  border: 1px solid #f59e0b;
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
  font-size: 0.82rem;
  color: #92400e;
  margin-bottom: 0.75rem;
  line-height: 1.45;
  text-align: left;
}
