/* ============================================================
   MundoVideos — diseño de exploración oscuro
   Tipografía: Space Grotesk (títulos) + Archivo (cuerpo)
   ============================================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg-deep: #0a1128;
  --bg-panel: rgba(13, 20, 45, 0.94);
  --bg-card: #121a38;
  --border: #232e55;
  --text: #e8ecf7;
  --text-dim: #9aa6c6;
  --accent: #ffb347;
  --accent-2: #5eead4;
  --red: #ff5d5d;
}

html, body {
  height: 100%;
  font-family: 'Archivo', system-ui, sans-serif;
  background: var(--bg-deep);
  color: var(--text);
  overflow: hidden;
}

/* ---------- Topbar ---------- */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  background: rgba(10, 17, 40, 0.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 11px; }
.brand-mark { font-size: 26px; line-height: 1; }
.brand h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.02em;
}
.brand h1 span { color: var(--accent); }
.tagline { color: var(--text-dim); font-size: 11px; margin-top: -2px; }

.lang-wrap { display: flex; align-items: center; gap: 8px; }
.lang-label { color: var(--text-dim); font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; }
.lang-select {
  appearance: none; -webkit-appearance: none;
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 14px;
  font-family: 'Archivo', sans-serif;
  font-size: 14px;
  cursor: pointer;
  transition: border-color 0.15s ease-out;
}
.lang-select:focus { outline: none; border-color: var(--accent); }
.lang-select:hover { border-color: var(--accent-2); }

/* ---------- Mapa ---------- */
#map {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  width: 100%; height: 100%;
  background: var(--bg-deep);
}
/* Control de zoom — reacomodar para no chocar con el panel */
.leaflet-top.leaflet-right { top: 70px; }
.leaflet-control-zoom a {
  background: var(--bg-card) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}

/* ---------- Región badge ---------- */
.region-badge {
  position: fixed;
  top: 70px; left: 18px;
  z-index: 900;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 16px;
  backdrop-filter: blur(8px);
  max-width: 260px;
  animation: fadeUp 0.35s ease-out both;
}
.region-badge.hidden { display: none; }
.region-label {
  display: block;
  color: var(--accent);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}
#region-name { font-family: 'Space Grotesk', sans-serif; font-size: 15px; line-height: 1.25; display: block; margin-top: 2px; }

/* ---------- Panel de videos ---------- */
.videos-panel {
  position: fixed;
  top: 74px; right: 14px;
  z-index: 950;
  width: min(390px, calc(100vw - 28px));
  max-height: calc(100vh - 96px);
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 18px 50px rgba(0,0,0,0.45);
  animation: fadeUp 0.4s ease-out both;
}
.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--border);
}
.panel-kicker {
  display: block;
  color: var(--accent);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  margin-bottom: 2px;
}
.panel-title-wrap h2 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
}
.panel-close {
  background: none; border: none;
  color: var(--text-dim);
  font-size: 26px; line-height: 1;
  cursor: pointer;
  padding: 0 4px;
  transition: color 0.15s ease-out;
}
.panel-close:hover { color: var(--text); }
.panel-close:active { transform: scale(0.93); }

.videos-list {
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.videos-list::-webkit-scrollbar { width: 6px; }
.videos-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* Card de video */
.vid-card {
  display: flex;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px;
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
  transition: transform 0.2s ease-out, border-color 0.2s ease-out, box-shadow 0.2s ease-out;
}
.vid-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
}
.vid-card:active { transform: scale(0.98); }
.vid-thumb {
  width: 112px; height: 63px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg-deep);
}
.vid-info { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.vid-title {
  font-weight: 600;
  font-size: 13.5px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.vid-channel {
  color: var(--text-dim);
  font-size: 12px;
  display: flex; align-items: center; gap: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.vid-badge {
  background: var(--accent);
  color: #1a1508;
  font-size: 10px; font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  flex-shrink: 0;
}
.vid-lang {
  color: var(--accent-2);
  font-size: 11px;
}

/* ---------- Estados ---------- */
.videos-loading {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: 34px 18px;
  color: var(--text-dim);
}
.spinner {
  width: 34px; height: 34px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
.videos-empty, .videos-error {
  padding: 26px 18px;
  text-align: center;
  color: var(--text-dim);
  font-size: 14px; line-height: 1.5;
}
.videos-error { color: var(--red); }
.hidden { display: none !important; }

/* ---------- Intro hint ---------- */
.intro-hint {
  position: fixed;
  left: 50%; bottom: 26px;
  transform: translateX(-50%);
  z-index: 900;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 20px;
  backdrop-filter: blur(8px);
  font-size: 14px;
  animation: fadeUp 0.6s ease-out 0.5s both;
  opacity: 0.95;
}
.intro-hint.hidden { display: none; }
.intro-hint strong { color: var(--accent); }

.noscript {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-deep);
  color: var(--text);
  padding: 20px;
  text-align: center;
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

@media (max-width: 560px) {
  .videos-panel { width: calc(100vw - 20px); right: 10px; top: 66px; max-height: 46vh; }
  .tagline { display: none; }
  .lang-label { display: none; }
  .region-badge { top: 64px; }
}