/* css/main.css - Base: variables, tipografía, estructura, botones, formularios, modales. */

:root {
    --navy: #03045e;
    --navy-2: #0a2a8f;
    --azul: #0077b6;
    --celeste: #e8f1fb;
    --oro: #e9b44c;
    --verde: #0f9d6b;
    --verde-claro: #e6f6ef;
    --rojo: #c92a2a;
    --rojo-claro: #fdeaea;
    --ambar: #b7791f;
    --ambar-claro: #fdf3dc;
    --texto: #16203a;
    --texto-suave: #5b6784;
    --borde: #d8e0ee;
    --fondo: #f4f7fc;
    --blanco: #ffffff;
    --radio: 14px;
    --sombra: 0 1px 2px rgba(3, 4, 94, .06), 0 8px 24px rgba(3, 4, 94, .08);
    --fuente: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: var(--fuente);
    font-size: 1rem;
    line-height: 1.55;
    color: var(--texto);
    background: var(--fondo);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

body.modal-abierto { overflow: hidden; }
img, svg { max-width: 100%; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; color: var(--navy); letter-spacing: -.01em; }
p { margin: 0 0 .75rem; }
a { color: var(--azul); }
:focus-visible { outline: 3px solid var(--oro); outline-offset: 2px; border-radius: 6px; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--navy); color: #fff; padding: .6rem 1rem; border-radius: 8px; z-index: 300; }
.skip-link:focus { left: 8px; }

.container { width: 100%; max-width: 1120px; margin: 0 auto; padding: 1.5rem 16px 3rem; flex: 1; }
.container[hidden] { display: none; }
.muted { color: var(--texto-suave); }
.hint { color: var(--texto-suave); font-size: .85rem; margin: .35rem 0 0; }
.centrado { text-align: center; }
.vacio { color: var(--texto-suave); text-align: center; padding: 1.25rem; background: var(--blanco); border: 1px dashed var(--borde); border-radius: var(--radio); }

/* ---------- Encabezado ---------- */
.site-header { background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 100; border-bottom: 3px solid var(--oro); }
.header-inner { max-width: 1120px; margin: 0 auto; padding: .6rem 16px; display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: .7rem; text-decoration: none; color: #fff; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 1.15rem; letter-spacing: .02em; }
.brand-text small { color: #b9c4ee; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; }
.nav-toggle { display: none; background: transparent; color: #fff; border: 1px solid rgba(255, 255, 255, .4); border-radius: 8px; padding: .5rem .9rem; font: inherit; cursor: pointer; }
.nav-menu { display: flex; align-items: center; gap: .25rem; flex-wrap: wrap; }
.nav-menu a, .nav-salir { color: #e7ecff; text-decoration: none; padding: .5rem .8rem; border-radius: 8px; font-weight: 500; font-size: .95rem; background: none; border: 0; cursor: pointer; font-family: inherit; }
.nav-menu a:hover, .nav-salir:hover { background: rgba(255, 255, 255, .12); }
.nav-menu a[aria-current="page"] { background: rgba(255, 255, 255, .16); color: #fff; box-shadow: inset 0 -2px 0 var(--oro); }

/* ---------- Pie ---------- */
.site-footer { text-align: center; padding: 1.5rem 16px; color: var(--texto-suave); font-size: .85rem; border-top: 1px solid var(--borde); background: var(--blanco); }
.site-footer p { margin: 0; }

/* ---------- Botones ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
    padding: .7rem 1.3rem; min-height: 44px; border-radius: 10px; border: 1px solid transparent;
    background: var(--navy); color: #fff; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
    transition: background .15s, transform .05s, box-shadow .15s;
}
.btn:hover { background: var(--navy-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { background: #c5cde0; color: #7a859f; cursor: not-allowed; transform: none; }
.btn-block { display: flex; width: 100%; }
.btn-secundario { background: var(--blanco); color: var(--navy); border-color: var(--borde); }
.btn-secundario:hover { background: var(--celeste); }
.btn-peligro { background: var(--rojo); }
.btn-peligro:hover { background: #a61e1e; }
.btn-whatsapp { background: #128c4a; }
.btn-whatsapp:hover { background: #0e7239; }
.btn-sm { padding: .4rem .8rem; min-height: 36px; font-size: .88rem; border-radius: 8px; }

/* ---------- Formularios ---------- */
.field { display: flex; flex-direction: column; gap: .35rem; margin-bottom: 1rem; }
.field label { font-weight: 600; font-size: .9rem; color: var(--navy); }
input[type="text"], input[type="email"], input[type="password"], input[type="tel"], input[type="number"], input[type="date"], input[type="search"], select {
    width: 100%; min-height: 44px; padding: .6rem .8rem; font: inherit; color: var(--texto);
    background: var(--blanco); border: 1px solid #b9c4dc; border-radius: 10px;
}
input:focus, select:focus { outline: 3px solid rgba(0, 119, 182, .3); border-color: var(--azul); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 0 1rem; }
.field-check { justify-content: flex-end; }
.check { display: flex; align-items: center; gap: .6rem; font-weight: 500; cursor: pointer; min-height: 44px; }
.check input { width: 20px; height: 20px; accent-color: var(--navy); }
.error-msg { background: var(--rojo-claro); color: #8f1d1d; border: 1px solid #f2b8b8; padding: .65rem .85rem; border-radius: 10px; font-size: .92rem; }
.error-msg[hidden] { display: none; }
.alert { padding: .85rem 1rem; border-radius: 12px; margin-bottom: 1rem; }
.alert-warn { background: var(--ambar-claro); border: 1px solid #f0d28a; color: #7a4f08; }
.card-box { background: var(--blanco); border: 1px solid var(--borde); border-radius: var(--radio); padding: 1.25rem; margin-bottom: 1.25rem; box-shadow: var(--sombra); }
.perfil-sec-title { font-size: 1.15rem; margin-bottom: .75rem; }

/* ---------- Modales ---------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(3, 4, 40, .6); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 500; animation: aparecer .15s ease-out; }
.modal-card { background: var(--blanco); border-radius: 18px; width: 100%; max-width: 460px; max-height: 92vh; overflow-y: auto; padding: 1.5rem; box-shadow: 0 20px 60px rgba(0, 0, 0, .35); }
.modal-card.modal-ancho { max-width: 640px; }
.modal-card h3 { font-size: 1.3rem; }
.modal-body { margin-bottom: 1.25rem; }
.modal-actions { display: flex; gap: .6rem; justify-content: flex-end; flex-wrap: wrap; }
.modal-actions .btn { flex: 1 1 auto; }
.spinner { width: 42px; height: 42px; margin: .5rem auto 1rem; border: 4px solid var(--celeste); border-top-color: var(--navy); border-radius: 50%; animation: girar .8s linear infinite; }

/* ---------- Avisos ---------- */
#toasts { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 600; display: flex; flex-direction: column; gap: .5rem; width: min(92vw, 420px); }
.toast { padding: .8rem 1rem; border-radius: 12px; color: #fff; font-weight: 500; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); animation: subir .25s ease-out; background: var(--verde); transition: opacity .3s; }
.toast-error { background: var(--rojo); }
.toast-aviso { background: var(--ambar); }
.toast.saliendo { opacity: 0; }

.whatsapp-float { position: fixed; right: 16px; bottom: 16px; width: 54px; height: 54px; border-radius: 50%; background: #128c4a; color: #fff; display: flex; align-items: center; justify-content: center; box-shadow: 0 6px 18px rgba(0, 0, 0, .3); z-index: 90; }
.whatsapp-float:hover { background: #0e7239; }

@keyframes aparecer { from { opacity: 0; } to { opacity: 1; } }
@keyframes subir { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes girar { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

@media (max-width: 720px) {
    .nav-toggle { display: inline-block; }
    .nav-menu { display: none; width: 100%; flex-direction: column; align-items: stretch; padding-bottom: .5rem; }
    .nav-menu.abierto { display: flex; }
    .nav-menu a, .nav-salir { text-align: left; padding: .75rem; }
    .modal-card { padding: 1.15rem; }
}

/* ---------- Agregados v2 ---------- */
.site-header:empty { min-height: 66px; }
.site-footer .pie-links { margin-bottom: .35rem; }
.site-footer a { color: var(--texto-suave); }
.btn-mp { background: #009ee3; }
.btn-mp:hover { background: #007eb5; }
.btn-link { background: none; border: 0; padding: .5rem 0; font: inherit; color: var(--azul); text-decoration: underline; cursor: pointer; }
.btn-link.peligro { color: var(--rojo); }
.centrado-bloque { display: block; margin: .75rem auto 0; }
.btn[aria-busy="true"] { cursor: progress; opacity: .85; }
.skeleton { height: 44px; border-radius: 10px; margin: .5rem 0; background: linear-gradient(90deg, #e9eef7 25%, #f4f7fc 50%, #e9eef7 75%); background-size: 200% 100%; animation: brillo 1.2s infinite linear; }
.skeleton.corto { width: 60%; }
@keyframes brillo { to { background-position: -200% 0; } }
.estado-vacio { text-align: center; padding: 2.5rem 1rem; max-width: 520px; margin: 0 auto; }
.estado-vacio .estado-icono { margin: 0 auto 1rem; }
.estado-icono { width: 72px; height: 72px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 2.1rem; font-weight: 800; background: var(--celeste); color: var(--navy); margin: 0 auto .75rem; }
.chip-demo { display: inline-block; background: var(--ambar-claro); color: #7a4f08; border: 1px solid #f0d28a; border-radius: 999px; padding: .05rem .55rem; font-size: .78rem; font-weight: 700; }
.form-grid.compacto { gap: 0 .75rem; }
textarea { width: 100%; min-height: 80px; padding: .6rem .8rem; font: inherit; color: var(--texto); background: var(--blanco); border: 1px solid #b9c4dc; border-radius: 10px; resize: vertical; }
details.plegable > summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; margin: 0; }
details.plegable > summary::after { content: '+'; font-size: 1.4rem; color: var(--texto-suave); }
details.plegable[open] > summary { margin-bottom: 1rem; }
details.plegable[open] > summary::after { content: '−'; }
details.plegable > summary::-webkit-details-marker { display: none; }
@supports (padding: max(0px)) { .whatsapp-float { bottom: max(16px, env(safe-area-inset-bottom)); } }
.container { padding-bottom: 5.5rem; }
