/**
 * Mapa estelar 3D - Hoja de estilos canónica e interfaz cósmica prémium
 * Fijate Tools - fijate.com/tools/mapa-estelar-3d/
 */

:root {
  --font-main: 'Inter', system-ui, -apple-system, sans-serif;
  --font-heading: 'Outfit', 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Paleta cósmica espacial */
  --space-bg: #04060c;
  --space-surface: rgba(13, 19, 33, 0.82);
  --space-surface-solid: #0d1321;
  --space-border: rgba(94, 150, 255, 0.16);
  --space-border-hover: rgba(94, 150, 255, 0.35);
  --space-accent: #38bdf8;
  --space-accent-glow: rgba(56, 189, 248, 0.28);
  --space-cyan: #22d3ee;
  --space-gold: #fbbf24;
  --space-text-main: #f1f5f9;
  --space-text-muted: #94a3b8;
  --space-text-dim: #64748b;
}

body {
  font-family: var(--font-main);
  background-color: var(--space-bg);
  color: var(--space-text-main);
  overflow-x: clip;
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, h4, h5, h6,
.brand-title,
.section-title,
.hero-title,
.faq-section-title {
  font-family: var(--font-heading);
}

.mono,
.stat-val,
.telemetry-val,
code {
  font-family: var(--font-mono);
}

/* Layout canónico obligatorio */
.tool-layout {
  max-width: 1240px;
  margin: 1.25rem auto 3rem;
  padding: 0 1rem;
  box-sizing: border-box;
  flex: 1 0 auto;
  width: 100%;
}

.tool-with-sidebar {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
  width: 100%;
}

.tool-main-content {
  flex: 1 1 0%;
  min-width: 0;
  width: 100%;
}

/* Tarjeta principal del visor 3D */
.card-main {
  background: var(--space-surface-solid);
  border: 1px solid var(--space-border);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.55);
  margin-bottom: 2.5rem;
}

/* Viewport 3D Three.js interactivo */
.star-viewport-wrap {
  position: relative;
  width: 100%;
  height: clamp(700px, 78vh, 880px);
  min-height: 700px;
  background: #020408;
  overflow: hidden;
  user-select: none;
}

#star-viewport-container {
  width: 100%;
  height: 100%;
  display: block;
}

#star-viewport-container:fullscreen {
  width: 100vw;
  height: 100vh;
}

/* Capa flotante superior del visor (Omnibar y modos) */
.viewport-top-bar {
  position: absolute;
  top: 1rem;
  left: 1rem;
  right: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  z-index: 20;
  pointer-events: none;
}

.viewport-top-bar > * {
  pointer-events: auto;
}

/* Omnibar de búsqueda rápida */
.omnibar-wrap {
  position: relative;
  width: 320px;
  max-width: 100%;
}

.omnibar-input-box {
  display: flex;
  align-items: center;
  background: rgba(13, 19, 33, 0.88);
  border: 1px solid var(--space-border);
  backdrop-filter: blur(12px);
  border-radius: 24px;
  padding: 0.4rem 0.85rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  transition: all 0.2s ease;
}

.omnibar-input-box:focus-within {
  border-color: var(--space-accent);
  box-shadow: 0 0 0 3px var(--space-accent-glow);
}

.omnibar-icon {
  color: var(--space-accent);
  margin-right: 0.5rem;
  flex-shrink: 0;
}

.omnibar-input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--space-text-main);
  font-size: 0.875rem;
  width: 100%;
  min-width: 0;
}

.omnibar-input::placeholder {
  color: var(--space-text-dim);
}

.omnibar-badge {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--space-text-dim);
  font-size: 0.7rem;
  padding: 0.15rem 0.4rem;
  border-radius: 6px;
  font-family: var(--font-mono);
  margin-left: 0.4rem;
  flex-shrink: 0;
}

.omnibar-btn-clear {
  background: transparent;
  border: none;
  color: var(--space-text-muted);
  cursor: pointer;
  padding: 0.2rem;
  display: none;
  margin-left: 0.25rem;
}

/* Desplegable de resultados del Omnibar */
.omnibar-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: rgba(13, 19, 33, 0.96);
  border: 1px solid var(--space-border);
  border-radius: 14px;
  backdrop-filter: blur(16px);
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.65);
  max-height: 280px;
  overflow-y: auto;
  display: none;
  z-index: 35;
}

.omnibar-item {
  display: flex;
  align-items: center;
  padding: 0.65rem 0.9rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  cursor: pointer;
  transition: background 0.15s ease;
}

.omnibar-item:last-child {
  border-bottom: none;
}

.omnibar-item:hover {
  background: rgba(56, 189, 248, 0.12);
}

.omnibar-star-color {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 0.75rem;
  flex-shrink: 0;
  box-shadow: 0 0 6px currentColor;
}

.omnibar-star-info {
  flex: 1;
  min-width: 0;
}

.omnibar-star-title {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--space-text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.omnibar-star-sub {
  display: block;
  font-size: 0.75rem;
  color: var(--space-text-muted);
}

.badge-spectral {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.45rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  margin-left: 0.5rem;
}

/* Selector de modos de navegación y botón fullscreen */
.viewport-mode-controls {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(13, 19, 33, 0.88);
  border: 1px solid var(--space-border);
  backdrop-filter: blur(12px);
  border-radius: 24px;
  padding: 0.3rem 0.45rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.btn-nav-mode {
  background: transparent;
  border: none;
  color: var(--space-text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.4rem 0.75rem;
  border-radius: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.2s ease;
  min-height: 36px;
}

.btn-nav-mode:hover {
  color: var(--space-text-main);
  background: rgba(255, 255, 255, 0.06);
}

.btn-nav-mode.active {
  background: var(--space-accent);
  color: #04060c;
  box-shadow: 0 2px 10px rgba(56, 189, 248, 0.35);
}

.btn-icon-square {
  background: transparent;
  border: none;
  color: var(--space-text-muted);
  width: 36px;
  height: 36px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-icon-square:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--space-text-main);
}

.btn-icon-square.active {
  color: var(--space-cyan);
}

/* Capa flotante inferior del visor (Telemetría y velocidad Warp) */
.viewport-bottom-bar {
  position: absolute;
  bottom: 1rem;
  left: 1rem;
  right: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  z-index: 20;
  pointer-events: none;
}

.viewport-bottom-bar > * {
  pointer-events: auto;
}

.warp-control-box {
  background: rgba(13, 19, 33, 0.88);
  border: 1px solid var(--space-border);
  backdrop-filter: blur(12px);
  border-radius: 16px;
  padding: 0.6rem 0.9rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.warp-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--space-text-dim);
  font-weight: 700;
}

.warp-slider {
  width: 120px;
  accent-color: var(--space-accent);
  cursor: pointer;
}

.warp-speed-val {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--space-cyan);
  min-width: 58px;
  text-align: right;
}

.coords-badge-box {
  background: rgba(13, 19, 33, 0.88);
  border: 1px solid var(--space-border);
  backdrop-filter: blur(12px);
  border-radius: 16px;
  padding: 0.5rem 0.85rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--space-text-muted);
}

/* Tooltip hover dinámico */
.star-hover-tooltip {
  position: fixed;
  background: rgba(13, 19, 33, 0.94);
  border: 1px solid var(--space-border);
  padding: 0.45rem 0.75rem;
  border-radius: 8px;
  font-size: 0.78rem;
  line-height: 1.35;
  color: var(--space-text-main);
  backdrop-filter: blur(8px);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  z-index: 50;
  display: none;
  white-space: nowrap;
}

/* Barra de accesos directos rápidos a Puntos de Interés */
.poi-quick-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: rgba(8, 12, 22, 0.95);
  border-bottom: 1px solid var(--space-border);
  overflow-x: auto;
  scrollbar-width: thin;
}

.poi-quick-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--space-text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
  margin-right: 0.25rem;
}

.btn-poi-jump {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--space-text-muted);
  font-size: 0.78rem;
  font-weight: 500;
  padding: 0.35rem 0.7rem;
  border-radius: 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  min-height: 32px;
}

.btn-poi-jump:hover {
  background: rgba(56, 189, 248, 0.12);
  border-color: var(--space-accent);
  color: var(--space-text-main);
}

/* Panel inferior con Telemetría e info astrofísica */
.hud-dossier-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 1.5rem;
  padding: 1.5rem;
}

@media (max-width: 900px) {
  .hud-dossier-grid {
    grid-template-columns: 1fr;
  }
}

.hud-star-header {
  margin-bottom: 1rem;
}

.hud-star-title-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.hud-star-name {
  font-size: 1.6rem;
  font-weight: 800;
  color: #fff;
  margin: 0;
}

.badge-constellation {
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: var(--space-accent);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.65rem;
  border-radius: 20px;
}

.hud-star-bayer {
  font-size: 0.85rem;
  color: var(--space-text-muted);
  margin-top: 0.2rem;
}

.hud-star-desc {
  font-size: 0.92rem;
  line-height: 1.6;
  color: #cbd5e1;
  margin-bottom: 1.25rem;
}

/* Rejilla de métricas astrofísicas */
.astrometric-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.75rem;
}

.astro-stat-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 0.75rem;
  transition: border-color 0.15s ease;
}

.astro-stat-card:hover {
  border-color: rgba(94, 150, 255, 0.25);
}

.astro-stat-label {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--space-text-dim);
  margin-bottom: 0.25rem;
}

.astro-stat-val {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--space-text-main);
}

/* Columna lateral derecha del HUD: Estimación de viaje y filtros */
.hud-side-panel {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.travel-time-card {
  background: rgba(56, 189, 248, 0.05);
  border: 1px solid rgba(56, 189, 248, 0.18);
  border-radius: 14px;
  padding: 1rem;
}

.travel-time-title {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--space-accent);
  margin-top: 0;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.travel-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  font-size: 0.82rem;
}

.travel-item:last-child {
  margin-bottom: 0;
}

.travel-item-label {
  color: var(--space-text-muted);
}

.travel-item-val {
  font-family: var(--font-mono);
  font-weight: 700;
  color: #fff;
}

/* Panel de filtros de capas */
.filter-layers-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  padding: 1rem;
}

.filter-layers-title {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--space-text-main);
  margin-top: 0;
  margin-bottom: 0.75rem;
}

.filter-checkbox-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.filter-check-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: var(--space-text-muted);
  cursor: pointer;
  user-select: none;
}

.filter-check-label input {
  accent-color: var(--space-accent);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.filter-check-label:hover {
  color: var(--space-text-main);
}

/* Secciones educativas didácticas y SEO */
.edu-guide-section {
  background: var(--space-surface-solid);
  border: 1px solid var(--space-border);
  border-radius: 18px;
  padding: 2rem;
  margin-bottom: 2.5rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.edu-guide-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
  margin-top: 0;
  margin-bottom: 0.75rem;
}

.edu-guide-subtitle {
  font-size: 0.95rem;
  color: var(--space-text-muted);
  line-height: 1.6;
  margin-bottom: 1.75rem;
}

.edu-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.edu-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 14px;
  padding: 1.25rem;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.edu-card:hover {
  transform: translateY(-2px);
  border-color: rgba(94, 150, 255, 0.3);
}

.edu-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(56, 189, 248, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--space-accent);
  margin-bottom: 0.85rem;
}

.edu-card-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  margin-top: 0;
  margin-bottom: 0.5rem;
}

.edu-card-desc {
  font-size: 0.875rem;
  line-height: 1.6;
  color: #cbd5e1;
  margin: 0;
}

/* Tabla de clasificación espectral OBAFGKM */
.spectral-table-wrap {
  width: 100%;
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 1.5rem;
}

.spectral-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  text-align: left;
}

.spectral-table th {
  background: rgba(255, 255, 255, 0.05);
  color: var(--space-text-main);
  padding: 0.75rem 1rem;
  font-weight: 700;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  white-space: nowrap;
}

.spectral-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: #cbd5e1;
  white-space: nowrap;
}

.spectral-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* Acordeón FAQ accesible */
.faq-section {
  background: var(--space-surface-solid);
  border: 1px solid var(--space-border);
  border-radius: 18px;
  padding: 2rem;
  margin-bottom: 2.5rem;
}

.faq-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: #fff;
  margin-top: 0;
  margin-bottom: 1.25rem;
}

.faq-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.faq-item {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.02);
}

.faq-toggle {
  width: 100%;
  padding: 1rem 1.25rem;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  transition: background 0.15s ease;
  min-height: 48px;
}

.faq-toggle:hover {
  background: rgba(255, 255, 255, 0.04);
}

.faq-icon {
  transition: transform 0.2s ease;
  flex-shrink: 0;
  color: var(--space-accent);
}

.faq-toggle[aria-expanded="true"] .faq-icon {
  transform: rotate(180deg);
}

.faq-content {
  padding: 0 1.25rem 1.25rem;
  font-size: 0.9rem;
  line-height: 1.6;
  color: #cbd5e1;
}

/* Adaptación responsive */
@media (max-width: 768px) {
  .star-viewport-wrap {
    height: 500px;
    min-height: 460px;
  }

  .viewport-top-bar {
    flex-direction: column;
    align-items: stretch;
    top: 0.75rem;
    left: 0.75rem;
    right: 0.75rem;
    gap: 0.5rem;
  }

  .omnibar-wrap {
    width: 100%;
  }

  .viewport-mode-controls {
    justify-content: space-around;
  }

  .viewport-bottom-bar {
    flex-direction: column;
    align-items: stretch;
    bottom: 0.75rem;
    left: 0.75rem;
    right: 0.75rem;
    gap: 0.5rem;
  }

  .warp-control-box {
    justify-content: space-between;
  }

  .coords-badge-box {
    display: none;
  }

  .hud-dossier-grid {
    padding: 1rem;
  }

  .edu-guide-section,
  .faq-section {
    padding: 1.25rem;
  }
}
