/* Portal de clientes Yarrus — re-skin sobre Bootstrap para igualar el sistema de diseño
   de la app admin (assets/app.css). Se carga DESPUÉS de Bootstrap para sobreescribir.
   Sólo diseño: no cambia estructura ni lógica. Paleta = tokens de app.css. */

:root {
  --y-primary: #c81a20;
  --y-primary-hover: #a5141a;
  --y-bg: #f5f5f6;
  --y-surface: #fff;
  --y-border: #dcdcdc;
  --y-text: #2f2f2f;
  --y-muted: #6b6b6b;
  --y-accent-soft: #fbe9ea;
  --y-radius: 8px;
  --y-shadow: 0 1px 3px rgba(0,0,0,.08);
}

body {
  background: var(--y-bg) !important;
  color: var(--y-text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif !important;
  line-height: 1.45;
}

/* ---- Login / registro ---- */
.auth-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.container-auth {
  background: var(--y-surface);
  border: 1px solid var(--y-border);
  border-radius: var(--y-radius);
  box-shadow: var(--y-shadow);
  max-width: 420px;
  width: 100%;
  padding: 32px;
}
.logo-container { text-align: center; margin-bottom: 24px; }
.logo-container img { max-height: 72px; margin-bottom: 12px; }
.logo-container h1 { color: var(--y-primary); font-size: 26px; font-weight: 700; margin-bottom: 8px; }
.logo-container p, .welcome-text { color: var(--y-muted); font-size: 14px; }
.welcome-text { text-align: center; margin-bottom: 20px; }
.link-register, .link-login, .link-back { text-align: center; margin-top: 20px; }
.link-register a, .link-login a, .link-back a { color: var(--y-primary); font-weight: 600; text-decoration: none; }
.link-register a:hover, .link-login a:hover, .link-back a:hover { text-decoration: underline; }
.link-login p, .link-back p { margin-bottom: 0; color: var(--y-muted); }

/* Texto de ayuda arriba de un campo (registro / recuperar contraseña) */
.auth-hint { color: var(--y-muted); font-size: 14px; margin-bottom: 20px; }
.auth-hint strong { color: var(--y-text); }

/* Botones a todo el ancho en las pantallas de auth, como en login */
.container-auth .btn-primary,
.container-auth .btn-secondary { width: 100%; text-align: center; }
.container-auth form + form { margin-top: 10px; }

/* ---- Indicador de pasos (registro / recuperar contraseña) ---- */
.step-indicator { display: flex; margin-bottom: 28px; }
.step { flex: 1; text-align: center; position: relative; min-width: 0; }
/* Línea que une cada paso con el anterior; queda detrás de los círculos */
.step::before {
  content: ""; position: absolute; top: 15px; left: 0; right: 50%;
  height: 2px; background: var(--y-border);
}
.step:first-child::before { display: none; }
.step.active::before { background: var(--y-primary); }
.step-number {
  position: relative; width: 32px; height: 32px; margin: 0 auto 8px;
  border-radius: 50%; background: var(--y-surface);
  border: 2px solid var(--y-border); color: var(--y-muted);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700;
}
.step.active .step-number {
  background: var(--y-primary); border-color: var(--y-primary); color: #fff;
}
.step-label { font-size: 12px; font-weight: 600; color: var(--y-muted); }
.step.active .step-label { color: var(--y-text); }

/* ---- Selector de tipo de documento (cédula / RUT) ---- */
.doc-options { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 20px; }
.doc-option { position: relative; }
/* El radio se oculta pero sigue siendo enfocable: el foco se ve en el label. */
.doc-option input[type="radio"] { position: absolute; opacity: 0; pointer-events: none; }
.doc-option label {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  margin: 0; padding: 20px 12px; cursor: pointer;
  border: 2px solid var(--y-border); border-radius: var(--y-radius);
  background: var(--y-surface); color: var(--y-text);
  font-size: 14px; font-weight: 600;
  transition: border-color .15s ease, background .15s ease;
}
.doc-option label i { font-size: 26px; color: var(--y-muted); transition: color .15s ease; }
.doc-option label:hover { border-color: var(--y-primary); background: var(--y-accent-soft); }
.doc-option input:checked + label { border-color: var(--y-primary); background: var(--y-accent-soft); }
.doc-option input:checked + label i { color: var(--y-primary); }
.doc-option input:focus-visible + label { box-shadow: 0 0 0 3px rgba(200, 26, 32, .15); }

/* ---- Campo del código de 6 dígitos ---- */
.input-codigo {
  letter-spacing: .5em; text-align: center;
  font-size: 22px; font-weight: 700; padding-left: 12px;
}

/* ---- Pantalla de registro exitoso ---- */
.auth-exito { text-align: center; padding: 4px 0; }
.auth-exito i { font-size: 56px; color: #1d7a3d; }
.auth-exito h2 { font-size: 22px; font-weight: 700; color: var(--y-text); margin: 12px 0 8px; }
.auth-exito p { color: var(--y-muted); font-size: 14px; margin-bottom: 0; }

/* ---- Navbar (barra de marca) ---- */
.navbar {
  background: var(--y-primary) !important;
  box-shadow: var(--y-shadow);
}
.navbar-brand, .navbar-page-title { color: #fff !important; font-weight: 600; }
.navbar-page-title { font-size: 18px; margin-left: 12px; }
.navbar-brand-group { display: flex; align-items: center; }
.navbar-logo-badge {
  background: #fff; display: inline-flex; align-items: center;
  padding: 4px 10px; border-radius: 6px;
}
.navbar-logo-badge img { max-height: 32px; margin: 0; display: block; }
.user-menu-btn {
  background: none; border: none; color: #fff !important; font-weight: 600;
  cursor: pointer; padding: .5rem 1rem; font-size: 16px; display: flex; align-items: center; gap: 5px;
}
.user-menu-btn:hover { opacity: .85; }

/* ---- Contenedor ---- */
.container-main { padding: 24px 0; }

/* ---- Cards ---- */
.card {
  background: var(--y-surface);
  border: 1px solid var(--y-border) !important;
  border-radius: var(--y-radius);
  box-shadow: var(--y-shadow);
  margin-bottom: 24px;
}
.card-header {
  background: var(--y-bg) !important;
  color: var(--y-text) !important;
  border-bottom: 1px solid var(--y-border);
  border-radius: var(--y-radius) var(--y-radius) 0 0 !important;
  font-weight: 600;
  padding: 12px 16px;
}
.card-header i { color: var(--y-primary); }
.card-body { padding: 20px; }

/* ---- Info / detalle (fichas) ---- */
.info-item, .detail-item { padding: 10px 0; }
.info-item { padding: 12px 0; border-bottom: 1px solid var(--y-border); }
.detail-row {
  padding: 12px 0; border-bottom: 1px solid var(--y-border);
  display: grid; grid-template-columns: 1fr 1fr; gap: 20px;
}
.info-label, .detail-label {
  color: var(--y-muted); font-size: 12px; font-weight: 600;
  text-transform: uppercase; margin-bottom: 4px;
}
.info-value, .detail-value { color: var(--y-text); font-size: 16px; font-weight: 600; }
.info-value-vacio { color: var(--y-muted); font-weight: 400; font-style: italic; }
.poliza-info { background: var(--y-bg); padding: 15px; border-radius: 6px; margin-bottom: 20px; }

/* ---- Tabs (dashboard) ---- */
.nav-link {
  color: var(--y-muted); border: none; padding: 15px 20px;
  font-weight: 600; cursor: pointer; background: none;
}
.nav-link:hover { color: var(--y-primary); }
.nav-link.active { color: var(--y-primary); border-bottom: 3px solid var(--y-primary); }

/* ---- Tablas (igual que app.css) ---- */
table.table, .card-body table {
  width: 100%; background: var(--y-surface); border-collapse: collapse;
  box-shadow: none; border-radius: 0;
}
table.table thead, .card-body table thead { background: var(--y-bg); color: var(--y-text); }
table.table thead th, .card-body table thead th {
  background: var(--y-bg); color: var(--y-text); font-weight: 600;
  text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--y-border);
}
table.table td, .card-body table td {
  text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--y-border); vertical-align: middle;
}
table.table tbody tr:hover, .card-body table tbody tr:hover { background: var(--y-accent-soft); }

/* ---- Badges de estado ---- */
.estado-vigente, .estado-vencido, .estado-porvencer {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
}
.estado-vigente { background: #e3f2e8; color: #1d7a3d; }
.estado-vencido { background: #fbe9e8; color: #8a1512; }
/* Aviso de vencimiento próximo: ámbar, para que no se lea como error ni como "todo bien". */
.estado-porvencer { background: #fdf1dc; color: #8a5a12; margin-left: 6px; }

/* ---- Botones (rojo YARRÚS) ---- */
.btn-primary, .btn-detalle, .btn-back, .logout-btn {
  background: var(--y-primary); color: #fff; border: none;
  border-radius: 6px; font-weight: 600; text-decoration: none;
  display: inline-block; transition: background .2s;
}
.btn-primary { padding: 10px 20px; }
.btn-detalle { padding: 6px 14px; font-size: 12px; white-space: nowrap; text-align: center; }
td .btn-detalle { min-width: 110px; }
.btn-back { padding: 8px 18px; margin-bottom: 20px; }
.logout-btn { padding: .375rem .75rem; }
.btn-primary:hover, .btn-detalle:hover, .btn-back:hover, .logout-btn:hover {
  background: var(--y-primary-hover); color: #fff; text-decoration: none;
}
.btn-secondary {
  background: var(--y-surface); color: var(--y-text); border: 1px solid var(--y-border);
  border-radius: 6px; font-weight: 600; padding: 10px 20px; text-decoration: none;
}
.btn-secondary:hover { background: var(--y-bg); color: var(--y-text); }

/* ---- Fila resaltada al volver ---- */
.fila-resaltada td { animation: resaltarFila 3s ease-out; }
@keyframes resaltarFila {
  0%, 40% { background: #fff3cd; }
  100% { background: transparent; }
}

/* ---- WhatsApp flotante ---- */
.wa-fab {
  position: fixed; bottom: 24px; right: 24px; width: 60px; height: 60px;
  border-radius: 50%; background: #25D366; color: #fff; border: none;
  display: flex; align-items: center; justify-content: center; font-size: 32px;
  box-shadow: 0 4px 12px rgba(0,0,0,.25); z-index: 1050; cursor: pointer; text-decoration: none;
  transition: transform .15s ease, background .2s ease;
}
.wa-fab:hover { color: #fff; background: #1ebe57; transform: scale(1.1); }
.wa-fab:active { transform: scale(.92); }

/* El panel se despliega animado al hacer click en el FAB (toggle de .open) */
.wa-panel {
  position: fixed; bottom: 96px; right: 24px; width: 300px; max-width: calc(100vw - 48px);
  background: #fff; border-radius: 12px; box-shadow: 0 8px 30px rgba(0,0,0,.25);
  z-index: 1050; overflow: hidden;
  opacity: 0; visibility: hidden; transform: translateY(16px) scale(.95);
  transform-origin: bottom right;
  transition: opacity .22s ease, transform .22s cubic-bezier(.2,.8,.2,1), visibility .22s;
}
.wa-panel.open { opacity: 1; visibility: visible; transform: translateY(0) scale(1); }
@media (prefers-reduced-motion: reduce) {
  .wa-panel { transition: opacity .15s ease, visibility .15s; transform: none; }
  .wa-panel.open { transform: none; }
}
.wa-panel-header { background: #075E54; color: #fff; padding: 14px 16px; font-weight: 600; }
.wa-contact {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  text-decoration: none; color: #1a1a2e; border-top: 1px solid #eee;
}
.wa-contact:hover { background: #f2f7f5; color: #1a1a2e; text-decoration: none; }
.wa-contact img, .wa-avatar {
  width: 52px; height: 52px; border-radius: 50%; object-fit: cover; flex: 0 0 52px;
}
.wa-avatar {
  background: #25D366; color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 18px;
}
.wa-contact .wa-nombre { font-weight: 600; }
.wa-contact .wa-ciudad { font-size: 12px; color: #555; }
.wa-contact .wa-tel { font-size: 12px; color: #888; }
.wa-contact i { margin-left: auto; color: #25D366; font-size: 22px; }

/* ---- Formularios ---- */
.form-group label { font-weight: 500; color: var(--y-text); margin-bottom: 6px; font-size: 13px; }
.form-control {
  border: 1px solid var(--y-border); border-radius: 6px; padding: 10px 12px; font-size: 14px;
}
.form-control:focus {
  border-color: var(--y-primary) !important;
  box-shadow: 0 0 0 3px rgba(200, 26, 32, .15) !important;
}
.form-control:disabled { background-color: var(--y-bg); color: var(--y-muted); }

/* ---- Alerts / flash ---- */
.alert { border-radius: var(--y-radius); border: none; margin-bottom: 20px; padding: 12px 16px; }
.alert-danger { background: #fbe9e8; color: #8a1512; }
.alert-success { background: #e3f2e8; color: #1d7a3d; }
.alert-warning { background: #fdf1dc; color: #8a5a12; }
/* Los links dentro de un alert heredan su color, así no meten un rojo distinto al de la paleta. */
.alert a { color: inherit; font-weight: 700; text-decoration: underline; }

/* ---- Estado vacío ---- */
.empty-state { color: var(--y-muted); text-align: center; padding: 40px 20px; }
.empty-state-icon { font-size: 48px; margin-bottom: 12px; color: var(--y-border); }

/* ---- Responsive: fichas y tablas apiladas ---- */
@media (max-width: 768px) {
  .detail-row { grid-template-columns: 1fr; gap: 10px; }
  table.table { font-size: 13px; }
}
@media (max-width: 480px) {
  .container-auth { padding: 20px; }
  /* "Verificación" no entra a 12px en pantallas angostas */
  .step-label { font-size: 11px; }
  .doc-option label { padding: 16px 8px; }
}
