/* ============================================================
   MEDETORAX — Dr. Willfredy Castaño Ruiz
   Estilos holográficos, partículas cinemáticas y componentes
   Complementa Tailwind CSS (CDN)
   ============================================================ */

:root {
  --holo-cyan: #22d3ee;
  --holo-blue: #3b82f6;
  --holo-deep: #030b1a;
  --holo-navy: #0a1628;
  --holo-glow: rgba(34, 211, 238, 0.35);
}

html {
  scroll-behavior: smooth;
  overflow-x: clip;
}

body {
  background-color: var(--holo-deep);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  overflow-x: hidden;
}

/* ---------- Canvas de partículas cinemáticas ---------- */
#particle-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

/* Todo el contenido flota sobre las partículas */
.content-layer {
  position: relative;
  z-index: 1;
}

/* ---------- Tipografía display ---------- */
.font-display {
  font-family: 'Space Grotesk', 'Inter', sans-serif;
}

/* ---------- Texto holográfico degradado ---------- */
.holo-text {
  background: linear-gradient(120deg, #67e8f9 0%, #3b82f6 45%, #a5b4fc 70%, #67e8f9 100%);
  background-size: 220% 220%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: holo-shift 7s ease-in-out infinite;
}

@keyframes holo-shift {
  0%, 100% { background-position: 0% 50%; }
  50%      { background-position: 100% 50%; }
}

/* ---------- Tarjetas de vidrio holográfico ---------- */
.holo-card {
  position: relative;
  background: linear-gradient(150deg, rgba(15, 30, 55, 0.72), rgba(8, 18, 38, 0.85));
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(103, 232, 249, 0.16);
  border-radius: 1.25rem;
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1),
              border-color 0.45s ease,
              box-shadow 0.45s ease;
  transform-style: preserve-3d;
  will-change: transform;
}

.holo-card::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(130deg,
    rgba(103, 232, 249, 0.55),
    rgba(59, 130, 246, 0.05) 30%,
    rgba(59, 130, 246, 0.05) 70%,
    rgba(165, 180, 252, 0.45));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.45s ease;
  pointer-events: none;
}

.holo-card:hover {
  border-color: rgba(103, 232, 249, 0.45);
  box-shadow: 0 0 40px -8px var(--holo-glow),
              0 24px 60px -20px rgba(2, 8, 20, 0.9);
}

.holo-card:hover::before { opacity: 1; }

/* Brillo interior tipo lente al pasar el mouse (posición via JS) */
.holo-card .holo-sheen {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%),
              rgba(103, 232, 249, 0.10), transparent 45%);
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}

.holo-card:hover .holo-sheen { opacity: 1; }

/* ---------- Panel HUD flotante (hero) ---------- */
.hud-panel {
  position: relative;
  border: 1px solid rgba(103, 232, 249, 0.25);
  background: rgba(6, 16, 34, 0.55);
  backdrop-filter: blur(12px);
  border-radius: 1rem;
  overflow: hidden;
  animation: hud-float 6s ease-in-out infinite;
}

.hud-panel::after {
  content: "";
  position: absolute;
  left: 0; right: 0;
  height: 60px;
  top: -60px;
  background: linear-gradient(to bottom, transparent, rgba(103, 232, 249, 0.12), transparent);
  animation: scanline 4.5s linear infinite;
}

@keyframes scanline {
  0%   { top: -60px; }
  100% { top: 110%; }
}

@keyframes hud-float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-10px); }
}

.hud-float-delay-1 { animation-delay: 1.2s; }
.hud-float-delay-2 { animation-delay: 2.4s; }

/* Esquinas de mira holográfica */
.hud-corners::before,
.hud-corners::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border-color: rgba(103, 232, 249, 0.8);
  border-style: solid;
}
.hud-corners::before {
  top: 10px; left: 10px;
  border-width: 2px 0 0 2px;
  border-radius: 4px 0 0 0;
}
.hud-corners::after {
  bottom: 10px; right: 10px;
  border-width: 0 2px 2px 0;
  border-radius: 0 0 4px 0;
}

/* ---------- Anillo de pulso (indicadores vivos) ---------- */
.pulse-dot {
  position: relative;
  width: 10px;
  height: 10px;
  border-radius: 9999px;
  background: var(--holo-cyan);
}
.pulse-dot::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 9999px;
  border: 1px solid var(--holo-cyan);
  animation: pulse-ring 2.2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
@keyframes pulse-ring {
  0%   { transform: scale(0.5); opacity: 0.9; }
  100% { transform: scale(1.8); opacity: 0; }
}

/* ---------- Botones ---------- */
.btn-holo {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.9rem 1.9rem;
  border-radius: 9999px;
  font-weight: 600;
  color: #04121f;
  background: linear-gradient(120deg, #67e8f9, #3b82f6 80%);
  box-shadow: 0 0 24px -4px var(--holo-glow);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.btn-holo:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 44px -4px rgba(34, 211, 238, 0.55);
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.9rem 1.9rem;
  border-radius: 9999px;
  font-weight: 600;
  color: #a5f3fc;
  border: 1px solid rgba(103, 232, 249, 0.35);
  background: rgba(103, 232, 249, 0.05);
  transition: background 0.3s ease, border-color 0.3s ease, transform 0.3s ease;
}
.btn-ghost:hover {
  background: rgba(103, 232, 249, 0.12);
  border-color: rgba(103, 232, 249, 0.7);
  transform: translateY(-2px);
}

/* ---------- Revelado en scroll ---------- */
.reveal {
  opacity: 0;
  transform: translateY(34px);
  transition: opacity 0.9s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}
.reveal-delay-1 { transition-delay: 0.12s; }
.reveal-delay-2 { transition-delay: 0.24s; }
.reveal-delay-3 { transition-delay: 0.36s; }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .hud-panel, .hud-panel::after { animation: none; }
  .holo-text { animation: none; }
}

/* ---------- Header con desenfoque ---------- */
.site-header {
  background: rgba(3, 11, 26, 0.72);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(103, 232, 249, 0.10);
}

.nav-link {
  position: relative;
  transition: color 0.3s ease;
}
.nav-link::after {
  content: "";
  position: absolute;
  left: 0; bottom: -6px;
  width: 0;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--holo-cyan), var(--holo-blue));
  transition: width 0.35s ease;
}
.nav-link:hover { color: #67e8f9; }
.nav-link:hover::after { width: 100%; }

/* ---------- Botón flotante multicanal ---------- */
.fab-container {
  position: fixed;
  right: 1.4rem;
  bottom: 1.4rem;
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.8rem;
}

.fab-main {
  width: 64px;
  height: 64px;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #22d3ee, #2563eb);
  color: #04121f;
  box-shadow: 0 0 30px -2px var(--holo-glow), 0 12px 30px -10px rgba(0, 0, 0, 0.7);
  cursor: pointer;
  border: none;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.fab-main:hover { transform: scale(1.07); }
.fab-main .fab-icon { transition: transform 0.35s ease; }
.fab-container.open .fab-main .fab-icon { transform: rotate(135deg); }

.fab-options {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.7rem;
}

.fab-option {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.65rem 1.1rem;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 600;
  color: #e0f2fe;
  background: rgba(8, 20, 42, 0.92);
  border: 1px solid rgba(103, 232, 249, 0.3);
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 24px -8px rgba(0, 0, 0, 0.6);
  opacity: 0;
  transform: translateY(14px) scale(0.92);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
              border-color 0.3s ease, box-shadow 0.3s ease;
  white-space: nowrap;
}
.fab-container.open .fab-option {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
.fab-container.open .fab-option:nth-child(1) { transition-delay: 0.10s; }
.fab-container.open .fab-option:nth-child(2) { transition-delay: 0.05s; }
.fab-container.open .fab-option:nth-child(3) { transition-delay: 0s; }
.fab-option:hover {
  border-color: rgba(103, 232, 249, 0.8);
  box-shadow: 0 0 22px -4px var(--holo-glow);
}
.fab-option .fab-badge {
  width: 34px;
  height: 34px;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ---------- Iframes (mapas / videos) ---------- */
.holo-frame {
  border-radius: 1rem;
  overflow: hidden;
  border: 1px solid rgba(103, 232, 249, 0.22);
  box-shadow: 0 18px 50px -18px rgba(2, 8, 20, 0.9);
  background: #06101f;
}
.holo-frame iframe {
  display: block;
  width: 100%;
  border: 0;
}

/* Proporción robusta de videos incrustados: respaldo independiente del CDN de
   Tailwind, para que los embeds nunca colapsen aunque el CDN tarde o falle. */
.holo-frame.aspect-video { aspect-ratio: 16 / 9; }
.holo-frame.aspect-\[9\/16\] { aspect-ratio: 9 / 16; }
.holo-frame.aspect-video iframe,
.holo-frame.aspect-\[9\/16\] iframe { width: 100%; height: 100%; }

/* ---------- Línea de tiempo (procedimiento paso a paso) ---------- */
.timeline-line {
  background: linear-gradient(to bottom, rgba(103, 232, 249, 0.6), rgba(59, 130, 246, 0.15));
}

/* ---------- Widget Doctoralia sobre fondo oscuro ---------- */
.doctoralia-shell {
  background: #f8fafc;
  border-radius: 1.25rem;
  padding: 1rem;
  box-shadow: 0 0 44px -10px var(--holo-glow);
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--holo-deep); }
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #164e63, #1e3a8a);
  border-radius: 8px;
}
::-webkit-scrollbar-thumb:hover { background: #0e7490; }

/* ---------- Selección de texto ---------- */
::selection {
  background: rgba(34, 211, 238, 0.35);
  color: #f0fdff;
}
