/* styles.css
  -----------------------------------------------------------------------------
  Tema: Vivir Seguros (naranja/azules)
  Propósito:
  - Variables CSS para branding y consistencia visual.
  - Layout móvil responsivo con vistas y título pegado al header.
  - Tarjetas, botones y componentes (cámara, acordeón, pago, recibo).
  Nota: Coloca tus logos en /assets o deja el fallback tipográfico del HTML.
----------------------------------------------------------------------------- */

:root{
  /* Branding Vivir Seguros */
  --brand: #15717C;        /* Naranja principal */
  --brand-600: #d68300;    /* Hover naranja */
  --brand-700: #c27400;    /* Activo naranja */
  --secondary: #046875;    
  --bg: #f0f0f0;           /* Gris claro (fondo) */
  --card: #ffffff;
  --text: #192a56;         /* Azul marino (texto) */

  --muted: #6b7280;
  --border: #e5e7eb;
  --error: #dc2626;
  --shadow: 0 6px 20px rgba(0,0,0,.06);
  --radius-lg: 16px;
  --radius-sm: 10px;
  --tap-size: 44px;

  /* Bienvenida y title card */
  --welcome-grad-top: #15717C;  /* púrpura base */
  --welcome-grad-bot: #046875;  /* violeta brillante para contraste */
  --title-bg: #15717C;          /* Banda bajo header */
}

*{ box-sizing: border-box; }
html, body{ height: 100%; }
body{
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.app{
  max-width: 430px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

@media (min-width: 480px){ .app{ max-width: 520px; } }
@media (min-width: 768px){ .app{ max-width: 680px; } }
@media (min-width: 1024px){ .app{ max-width: 840px; } }

.hidden{ display: none !important; }

/* Header */
.app-header{
  position: sticky;
  top: 0;
  z-index: 10;
  background: linear-gradient(180deg, #046875, #15717C);
  backdrop-filter: saturate(140%) blur(6px);
  border-bottom: none;
  padding: 12px 16px 6px;
  box-shadow: 0 2px 10px rgba(0,0,0,.12);
}
.brand{
  display: flex; align-items: center; justify-content: center;
}
.brand-img{
  height: 72px; object-fit: contain;
}
.progress{ display: flex; gap: 6px; margin-top: 10px; justify-content: center; }
.progress .dot{
  width: 8px; height: 8px; border-radius: 999px;
  background: rgba(255,255,255,.45);
  transition: background-color .2s ease, box-shadow .2s ease, transform .1s ease;
}
.progress .dot.is-current{
  background: #FFD54F;
  box-shadow: 0 0 0 3px rgba(255,213,79,.25);
  transform: scale(1.05);
}
.progress .dot.is-done{
  background: var(--brand);
  box-shadow: 0 0 0 2px rgba(239,147,0,.25);
}

/* Footer */
.app-footer{
  margin-top: auto;
  padding: 16px;
  text-align: center;
  color: var(--muted);
}

/* Vistas */
.view{ display: none; padding: 0 16px 16px; }
.view.active{ display: block; }
.view-title{ margin: 12px 0; font-size: 20px; }

/* Bienvenida */
.view-welcome{
  min-height: 100dvh; padding: 32px 24px; place-items: center; color: #fff;
}
.view-welcome.active{ display: grid; place-items: center; }
body.welcome-mode{ background: linear-gradient(180deg, var(--welcome-grad-top), var(--welcome-grad-bot)); }

.welcome-content{
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 16px; max-width: 520px; margin: 0 auto;
}
.welcome-title{ margin: 0; font-weight: 800; font-size: clamp(24px, 4vw, 34px); }
.welcome-subtitle{ margin: 0; opacity: .95; font-size: clamp(14px, 2.2vw, 18px); }
.welcome-logo{
  width: clamp(160px, 32vw, 280px);
  height: auto;
  margin: 8px 0 4px;
}

/* Grid de tipos de vehículo */
.veh-grid{
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px; width: 100%; margin-top: 8px;
}
.veh-card{
  background: var(--card); border: 2px solid transparent; border-radius: var(--radius-lg);
  padding: 14px; display: grid; place-items: center; gap: 8px; min-height: var(--tap-size);
  box-shadow: 0 10px 24px rgba(0,0,0,.08); cursor: pointer;
}
.veh-card:focus{ outline: 2px solid #fff; outline-offset: -2px; }
.veh-card.active{ border-color: #fff; box-shadow: 0 0 0 4px rgba(255,255,255,.18), var(--shadow); }
.veh-emoji{ font-size: 22px; }
.veh-text{ color: var(--text); font-weight: 700; }

/* CTA bienvenida */
.welcome-cta{ min-width: clamp(220px, 40vw, 320px); margin-top: 8px; }

/* Title card pegado al header */
.title-card{
  position: sticky; top: calc(0px + 60px); margin: 0 -16px 16px; background: var(--title-bg);
  color: #fff; border-bottom-left-radius: var(--radius-lg); border-bottom-right-radius: var(--radius-lg);
  padding: 24px; z-index: 5; margin-top: -1px;
}
.title-card-text{ margin: 0; font-size: 18px; }

/* Contenedor bajo título */
.container-under-title{ margin-top: 8px; }

/* Tarjetas base */
.card{
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 16px; box-shadow: var(--shadow);
}
.card-title{ margin: 0 0 8px; }

/* Texto auxiliar */
.muted{ color: var(--muted); }

/* Botones */
.btn{
  appearance: none; border: 1px solid transparent; border-radius: var(--radius-lg);
  padding: 12px 16px; min-height: var(--tap-size); font-weight: 700; cursor: pointer;
  transition: transform .05s ease, box-shadow .2s ease, background-color .2s ease; box-shadow: var(--shadow);
}
.btn:active{ transform: translateY(1px); }
.btn:disabled{ opacity: .5; cursor: not-allowed; box-shadow: none; }
.btn-primary {
  background: linear-gradient(180deg, #019187, #01766e);
  color: #fff;
}
.btn-primary:hover {
  background: linear-gradient(180deg, #01b0a5, #01635b);
}

.btn-secondary{ background: #fff; color: var(--text); border: 1px solid var(--border); }
.btn-accent{ background: var(--secondary); color: #fff; }
.btn-outline{ background: #fff; color: var(--text); border: 1px solid var(--border); }
.btn-light{ background: #f3f4f6; color: #111827; border: 1px solid #e5e7eb; }

/* Acciones */
.actions{ display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.actions-bottom{ margin-top: 24px; padding-bottom: 8px; }
@media (max-width: 360px){ .actions{ grid-template-columns: 1fr; } }

/* Tarjetas de planes */
.plan-card {
  background: var(--card);
  border: 2px solid transparent;
  border-radius: var(--radius-lg);
  padding: 16px;
  width: 100%;
  margin: 0 auto 12px;
  display: flex; flex-direction: column; gap: 10px;
  text-align: left; cursor: pointer;
  transition: all .2s ease;
  box-shadow: var(--shadow);
}

.plan-card .plan-head{
  display: flex; justify-content: space-between; align-items: center;
  font-weight: 800; font-size: 16px; color: var(--text);
}

.plan-card .plan-price{
  font-size: 14px; font-weight: 800; color: var(--brand);
  text-align: right;
}

.plan-card .plan-feats{
  display: grid; gap: 4px; font-size: 14px; color: var(--muted);
}

/* Resaltar totales en planes */
.plan-total {
  display: block;
  margin-top: 8px;
  font-weight: 700;
  font-size: 16px;
  color: var(--brand); /* usa el color base */
}


.plan-card[aria-pressed="true"]{
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(239,147,0,.12), var(--shadow);
  background: #fffdf7;
}
/* Acordeón por subtipo (ya tienes base; aseguro padding) */
.accordion .accordion-content { padding: 0 16px 14px; }

/* DOCUMENTOS: cámara y carga */
.docs-grid{ display: grid; gap: 12px; }
@media (min-width: 520px){ .docs-grid{ grid-template-columns: 1fr 1fr; } }

.camera-panel{ display: grid; gap: 12px; }
.camera-preview{
  position: relative; background: #0b1210; border-radius: var(--radius-lg);
  overflow: hidden; min-height: 180px; max-height: 180px; border: 1px solid #0f1f19;
}
#vidCedula, #imgCedula, #vidCarnet, #imgCarnet{ display: none; width: 100%; height: auto; }
#vidCedula.active, #imgCedula.active, #vidCarnet.active, #imgCarnet.active{ display: block; }

.upload-box{
  display: grid; place-items: center; width: 100%; padding: 22px; border: 2px dashed var(--border);
  border-radius: var(--radius-lg); color: var(--muted); background: #fafafa; cursor: pointer; text-align: center; font-size: 14px;
}
.upload-box:hover{ background: #f3f4f6; color: var(--text); }

/* Formularios */
.form-field{ display: grid; gap: 6px; margin: 10px 0; }
label{ font-weight: 700; }
input[type="text"], input[type="tel"]{
  width: 100%; border-radius: var(--radius-lg); border: 1px solid var(--border);
  padding: 12px 14px; background: #fff; min-height: var(--tap-size); font-size: 16px;
}
.error{ color: var(--error); min-height: 18px; }

/* Acordeón */
.accordion{
  border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--card); margin-bottom: 12px; box-shadow: var(--shadow);
}
.accordion-summary{
  list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 14px 16px; cursor: pointer; font-weight: 800; color: var(--secondary);
}
.accordion summary::-webkit-details-marker{ display:none }
.accordion-content{ padding: 0 16px 14px; }
.accordion[open] .accordion-indicator{ transform: rotate(180deg); }

/* Pago (maquetado) */
.pay-grid{ display: grid; gap: 12px; }
.pay-card{
  display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start;
  border: 2px solid transparent; border-radius: var(--radius-lg); padding: 14px; background: var(--card); box-shadow: var(--shadow);
}
.pay-card input[type="radio"]{ margin-top: 4px; }
.pay-card[aria-checked="true"], .pay-card:has(input[type="radio"]:checked){
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(239,147,0,.12), var(--shadow);
}
.pay-head{ display: flex; align-items: center; gap: 8px; }
.pay-emoji{ font-size: 22px; }
.fake-fields{ display: grid; gap: 6px; margin-top: 6px; }
.fake-field{
  border: 1px dashed var(--border); border-radius: 10px; padding: 10px 12px; color: var(--muted); background: #fafafa;
}

/* Summary / Recibo */
.summary{ display: grid; gap: 8px; margin-top: 8px; }
.summary-row{ display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.summary-row strong{ color: var(--secondary); }

/* Accesibilidad: región de estado */
.sr-status{
  position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden;
}

/* ===== Modal básico para “Puestos a asegurar” ===== */
.modal{
  position: fixed;
  inset: 0;
  display: none;                /* se controla con .show */
  place-items: center;
  background: rgba(0,0,0,.45);
  z-index: 50;
  padding: 16px;
}
.modal.show{ display: grid; }

.modal-dialog{
  width: 100%;
  max-width: 420px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 18px 16px;
}
.modal-title{ margin: 0 0 6px; font-size: 18px; }
.modal-text{ margin: 0 0 10px; color: var(--muted); }
.modal-actions{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.muted { color: var(--muted); font-size: 12px; }
.flex-row { display: flex; align-items: center; }
.flex-col { display: flex; flex-direction: column; }
.btn-sm { padding: 6px 10px; font-size: 13px; }

/* === Campos consistentes: input, select y textarea === */
.form-field input[type="text"],
.form-field input[type="tel"],
.form-field input[type="email"],
.form-field input[type="date"],
.form-field input[type="number"],
.form-field select,
.form-field textarea {
  width: 100%;
  font-size: 16px;                 /* evita zoom en iOS */
  line-height: 1.2;
  padding: 12px 14px;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 1px 0 rgba(0,0,0,0.03), inset 0 0 0 9999px rgba(0,0,0,0.02);
  color: #24324a;
  transition: border-color .15s ease, box-shadow .15s ease;
  -webkit-appearance: none;        /* iOS */
  appearance: none;
}

.form-field input[type="date"] {
  padding-right: 42px;             /* espacio para el icono */
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23600581' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 20px 20px;
}

/* Quita el picker nativo molesto en algunos navegadores */
.form-field input[type="date"]::-webkit-calendar-picker-indicator {
  opacity: 0; cursor: pointer;
}

/* Select con caret personalizado */
.form-field select {
  padding-right: 40px;             /* espacio para la flecha */
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23600581' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 18px 18px;
}

/* Textarea “Dirección” con la misma estética */
.form-field textarea {
  min-height: 88px;
  resize: vertical;
}

/* Estados: hover / focus / disabled */
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  outline: none;
  border-color: var(--secondary, #600581);
  box-shadow: 0 0 0 3px rgba(96, 5, 129, 0.15);
}

.form-field input[disabled],
.form-field select[disabled],
.form-field textarea[disabled] {
  background: #f7f7f9;
  color: #8a8fa0;
  cursor: not-allowed;
}

/* Placeholders un poco más suaves */
.form-field ::placeholder { color: #96a0b5; opacity: 1; }

.btn-chip{
  padding: 6px 10px;
  border-radius: 999px;
  background: #f3f3f6;
  border: 1px solid #e5e7eb;
  font-size: .95rem;
  transition: background .15s ease;
}
.btn-chip:hover{ background:#eee; }
.copy-row{ display:flex; justify-content:space-between; align-items:center; gap:10px; }
