/*
  Citas en Línea · HSJM — sistema de diseño compartido (público + panel).
  Identidad idéntica al sistema de horarios: azul marino institucional, logos,
  fachada con velo azul. Sin CDN ni fuentes externas.

  Rendimiento: todos los efectos animan SOLO transform/opacity (compuestos en GPU).
  Los efectos de cursor se activan únicamente con ratón (hover:hover) y se desactivan
  con "reducir movimiento" del sistema.
*/
:root {
  --azul: #0f2942; --azul-2: #16385a; --azul-3: #1d5a94;
  --cian: #38bdf8; --glow: rgba(56, 189, 248, .55);
  --tinta: #1b2733; --tinta-2: #455466; --linea: #d5dde6; --fondo-claro: #f3f6fa;
  --verde: #1b6b43; --verde-bg: #e4f4ea; --rojo: #b3202a; --rojo-bg: #fbe9ea;
  --ambar: #8a5200; --ambar-bg: #fdf0d9; --gris-bg: #e8edf2;
  --radio: 16px; --sombra: 0 6px 22px rgba(15, 41, 66, .14); --sombra-alta: 0 16px 40px rgba(15, 41, 66, .28);
  --ease: cubic-bezier(.2, .8, .2, 1);
}
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 100%; scroll-behavior: smooth; }
html[data-texto="1"] { font-size: 112.5%; }
html[data-texto="2"] { font-size: 125%; }
body {
  margin: 0; min-height: 100vh; color: var(--tinta); line-height: 1.55; font-size: 1rem;
  font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--azul); position: relative; overflow-x: hidden;
}
/* Fondo institucional: fachada + velo azul (igual que el sistema de horarios) */
body::before { content: ""; position: fixed; inset: 0; z-index: -3; background: url("/static/images/fachada_hsjm_limpia.jpg") center / cover; }
body::after { content: ""; position: fixed; inset: 0; z-index: -2;
  background: linear-gradient(180deg, rgba(15, 41, 66, .92) 0%, rgba(15, 41, 66, .84) 55%, rgba(15, 41, 66, .95) 100%); }
/* Aurora: dos halos que derivan lentamente (solo transform) */
.aurora { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.aurora i { position: absolute; width: 70vmax; height: 70vmax; border-radius: 50%; will-change: transform; opacity: .55;
  background: radial-gradient(circle at center, rgba(56, 189, 248, .32), transparent 62%); animation: deriva 38s ease-in-out infinite alternate; }
.aurora i:first-child { top: -35vmax; left: -20vmax; }
.aurora i:last-child { bottom: -40vmax; right: -25vmax; animation-duration: 46s; animation-delay: -12s;
  background: radial-gradient(circle at center, rgba(29, 90, 148, .5), transparent 62%); }
@keyframes deriva { from { transform: translate3d(0, 0, 0) scale(1); } to { transform: translate3d(10vmax, 6vmax, 0) scale(1.18); } }

h1, h2, h3 { margin: 0 0 .5em; line-height: 1.2; letter-spacing: -.01em; color: var(--azul); }
a { color: var(--azul-3); }
.saltar { position: absolute; left: -999px; top: 8px; background: #fff; padding: 10px 16px; border-radius: 8px; z-index: 100; }
.saltar:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--cian); outline-offset: 3px; box-shadow: 0 0 0 6px rgba(56, 189, 248, .25); border-radius: 8px; }

/* ---------- Encabezado ---------- */
.encabezado { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 10px clamp(14px, 3vw, 32px); background: rgba(15, 41, 66, .96); color: #fff; box-shadow: 0 2px 14px rgba(0, 0, 0, .25); }
.encabezado .logos { display: flex; gap: 10px; }
.encabezado img.logo { width: 56px; height: 56px; border-radius: 50%; background: #fff; object-fit: cover; box-shadow: 0 2px 8px rgba(0, 0, 0, .35); }
.encabezado .titulos { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.encabezado .titulos strong { font-size: 1rem; }
.encabezado .titulos span { font-size: .8rem; color: #cfdcea; }
.encabezado .espacio { flex: 1; }

/* ---------- Menú con indicador animado ---------- */
.nav { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.nav a, .nav button.nav-btn { position: relative; color: #fff; text-decoration: none; font-weight: 600; font-size: .95rem; background: none; border: 0;
  padding: 10px 14px; border-radius: 10px; cursor: pointer; font-family: inherit; min-height: 44px; display: inline-flex; align-items: center; }
.nav a::after { content: ""; position: absolute; left: 14px; right: 14px; bottom: 5px; height: 3px; border-radius: 3px;
  background: linear-gradient(90deg, var(--cian), #7dd3fc); transform: scaleX(0); transition: transform .3s var(--ease); }
.nav a:hover::after, .nav a[aria-current="page"]::after { transform: scaleX(1); }
.nav a[aria-current="page"] { background: rgba(255, 255, 255, .1); }

/* ---------- Botones: brillo, glow, elevación, ripple ---------- */
.btn { position: relative; overflow: hidden; isolation: isolate; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px; padding: 0 28px; border: 0; border-radius: 14px; cursor: pointer; font-weight: 700; font-size: 1.05rem; line-height: 1.1; font-family: inherit;
  text-decoration: none; color: #fff; background: linear-gradient(135deg, var(--azul) 0%, var(--azul-3) 100%);
  box-shadow: 0 4px 14px rgba(15, 41, 66, .3); transition: transform .22s var(--ease), box-shadow .25s ease; -webkit-tap-highlight-color: transparent; }
.btn::before { content: ""; position: absolute; z-index: -1; top: 0; left: 0; width: 45%; height: 100%; pointer-events: none;
  background: linear-gradient(110deg, transparent, rgba(255, 255, 255, .5), transparent); transform: skewX(-20deg) translateX(-160%); }
.btn::after { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; pointer-events: none; opacity: 0;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .35), 0 0 26px 6px var(--glow); transition: opacity .25s ease; }
.btn:active { transform: scale(.97); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; box-shadow: none; transform: none; }
.btn-sec { color: var(--azul); background: #fff; border: 2px solid var(--linea); box-shadow: none; }
.btn-sec::before { background: linear-gradient(110deg, transparent, rgba(56, 189, 248, .35), transparent); }
.btn-ok { background: linear-gradient(135deg, #14532d, var(--verde)); }
.btn-peligro { background: linear-gradient(135deg, #7f1d1d, var(--rojo)); }
.btn-chico { min-height: 42px; padding: 0 16px; font-size: .92rem; border-radius: 11px; }
.btn.cargando { pointer-events: none; opacity: .85; }
.btn.cargando::after { opacity: 1; box-shadow: none; inset: auto; width: 20px; height: 20px; left: auto; right: 14px; top: calc(50% - 10px);
  border: 3px solid rgba(255, 255, 255, .4); border-top-color: #fff; border-radius: 50%; animation: gira .7s linear infinite; z-index: 1; }
@keyframes gira { to { transform: rotate(360deg); } }
@media (hover: hover) and (pointer: fine) {
  .btn:not(:disabled):hover { transform: translateY(-3px) scale(1.025); box-shadow: 0 14px 30px rgba(15, 41, 66, .35); }
  .btn:not(:disabled):hover::before { animation: destello .85s ease; }
  .btn:not(:disabled):hover::after { opacity: 1; }
  .btn-sec:not(:disabled):hover { border-color: var(--azul-3); box-shadow: 0 10px 24px rgba(29, 90, 148, .22), 0 0 18px var(--glow); }
}
@keyframes destello { to { transform: skewX(-20deg) translateX(420%); } }
.f-ripple { position: absolute; border-radius: 50%; background: rgba(255, 255, 255, .55); transform: scale(0); animation: onda .6s ease-out; pointer-events: none; z-index: 0; }
.btn-sec .f-ripple, .chip-hora .f-ripple, .dia .f-ripple { background: rgba(29, 90, 148, .28); }
@keyframes onda { to { transform: scale(3.2); opacity: 0; } }

/* ---------- Tarjetas 3D ---------- */
.tilt { position: relative; transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); transition: transform .35s var(--ease), box-shadow .3s ease, border-color .25s ease; }
.tilt.tilt-activo { transition: transform .08s linear, box-shadow .3s ease, border-color .25s ease; will-change: transform; }
.tilt::before { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .3s ease;
  background: radial-gradient(260px circle at var(--mx, 50%) var(--my, 50%), rgba(56, 189, 248, .22), transparent 60%); }
@media (hover: hover) and (pointer: fine) {
  .tilt:not(:disabled):hover { box-shadow: var(--sombra-alta), 0 0 0 2px var(--cian), 0 0 28px var(--glow); }
  .tilt:not(:disabled):hover::before { opacity: 1; }
}

/* ---------- Animaciones de entrada ---------- */
.entrada { opacity: 0; animation: entra .6s var(--ease) forwards; animation-delay: calc(var(--i, 0) * 70ms); }
@keyframes entra { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
.paso { animation: paso-entra .38s var(--ease) both; }
.paso[data-dir="atras"] { animation-name: paso-entra-atras; }
@keyframes paso-entra { from { opacity: 0; transform: translateX(26px); } to { opacity: 1; transform: none; } }
@keyframes paso-entra-atras { from { opacity: 0; transform: translateX(-26px); } to { opacity: 1; transform: none; } }

/* ---------- Formularios ---------- */
.campo { margin-bottom: 18px; }
.campo label, .etiqueta { display: block; font-weight: 700; margin-bottom: 6px; color: var(--azul); }
.campo .ayuda { display: block; font-size: .9rem; color: var(--tinta-2); margin-top: 4px; }
.campo .error { display: none; margin: 6px 0 0; font-size: .95rem; font-weight: 600; color: var(--rojo); }
.campo.con-error .error { display: block; animation: sacude .35s ease; }
.campo.con-error input, .campo.con-error select { border-color: var(--rojo); background: #fff8f8; }
@keyframes sacude { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
input[type=text], input[type=tel], input[type=email], input[type=password], input[type=search], input[type=date], select, textarea {
  width: 100%; min-height: 52px; padding: 12px 14px; font: inherit; font-size: 1.05rem; color: var(--tinta); background: #fff;
  border: 2px solid var(--linea); border-radius: 12px; transition: border-color .2s ease, box-shadow .25s ease; }
textarea { min-height: 96px; resize: vertical; }
input:hover, select:hover, textarea:hover { border-color: #aebccb; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--azul-3); box-shadow: 0 0 0 4px rgba(56, 189, 248, .3); }
.check { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; font-size: 1rem; }
.check input { width: 26px; height: 26px; flex: none; margin-top: 2px; accent-color: var(--azul-3); }

/* ---------- Mensajes ---------- */
.alerta { padding: 14px 16px; border-radius: 12px; font-weight: 500; border-left: 5px solid; margin: 0 0 16px; }
.alerta-info { background: #e7f2fb; border-color: var(--azul-3); color: #123a5e; }
.alerta-ok { background: var(--verde-bg); border-color: var(--verde); color: #0f4a2d; }
.alerta-error { background: var(--rojo-bg); border-color: var(--rojo); color: #7a141b; }
.alerta-aviso { background: var(--ambar-bg); border-color: #c98a1c; color: #5c3700; }
.insignia { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; font-size: .85rem; font-weight: 700; }
.insignia.PENDIENTE { background: var(--ambar-bg); color: var(--ambar); }
.insignia.REGISTRADA { background: var(--verde-bg); color: var(--verde); }
.insignia.RECHAZADA { background: var(--rojo-bg); color: var(--rojo); }
.insignia.CANCELADA, .insignia.VENCIDA { background: var(--gris-bg); color: #3b4a5a; }

/* ---------- Toasts / diálogo / esqueletos ---------- */
.f-toasts { position: fixed; z-index: 90; right: 16px; bottom: 16px; display: grid; gap: 10px; max-width: min(92vw, 380px); }
.f-toast { padding: 14px 18px; border-radius: 12px; color: #fff; font-weight: 600; box-shadow: var(--sombra-alta); background: var(--azul-2); animation: entra .35s var(--ease); }
.f-toast.error { background: var(--rojo); } .f-toast.ok { background: var(--verde); }
dialog.dialogo { border: 0; border-radius: 18px; padding: 26px; max-width: min(92vw, 440px); box-shadow: var(--sombra-alta); }
dialog.dialogo::backdrop { background: rgba(15, 41, 66, .6); }
dialog.dialogo[open] { animation: entra .3s var(--ease); }
.dialogo .acciones { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 20px; }
.esqueleto { border-radius: var(--radio); min-height: 96px; background: linear-gradient(100deg, #e8eef4 30%, #f6f9fc 50%, #e8eef4 70%); background-size: 200% 100%; animation: brilla 1.3s linear infinite; }
@keyframes brilla { to { background-position: -200% 0; } }
.oculto-visual { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .aurora i { animation: none; }
  .entrada { opacity: 1; }
}
@media print { .aurora, .encabezado, .pie, .no-imprimir, .f-toasts { display: none !important; } body { background: #fff; } body::before, body::after { display: none; } }
