/* ======================================================
   ESPACIO BPM — explorar.css
====================================================== */

@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=DM+Sans:wght@300;400;500&display=swap');

:root {
  --gold:      #d4af37;
  --gold-dim:  #8a7020;
  --gold-glow: rgba(212,175,55,0.12);
  --bg:        #0a0a0a;
  --surface:   #111111;
  --surface2:  #161616;
  --border:    #1e1e1e;
  --text:      #e8e8e8;
  --muted:     #555;
  --sidebar-w: 200px;
  --header-h:  36px;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-weight: 300;
  overflow: hidden;
}

/* ======================================================
   HEADER
====================================================== */

.header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 200;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px 0 0;
  background: rgba(10,10,10,0.96);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-logo-area {
  display: flex;
  align-items: center;
  width: var(--sidebar-w);
  padding: 0 24px;
  border-right: 1px solid var(--border);
  height: 100%;
  flex-shrink: 0;
}

.header-logo {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 0.75rem;
  letter-spacing: 0.3em;
  color: var(--gold);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.section-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 0.7rem;
  letter-spacing: 0.35em;
  color: var(--muted);
}

.back-btn {
  background: transparent;
  border: 1px solid var(--gold-dim);
  color: var(--gold);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  padding: 5px 16px;
  border-radius: 100px;
  cursor: pointer;
  transition: all 0.25s;
}
.back-btn:hover { border-color: var(--gold); opacity: 0.8; }

/* ======================================================
   LAYOUT
====================================================== */

.layout {
  display: flex;
  height: 100vh;
  padding-top: var(--header-h);
}

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  height: 100%;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 24px 0;
  overflow-y: auto;
}

.sidebar-section-label {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 0.58rem;
  letter-spacing: 0.4em;
  color: var(--muted);
  padding: 0 20px 10px;
  opacity: 0.5;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 20px;
  cursor: pointer;
  border-left: 2px solid transparent;
  transition: all 0.2s ease;
}
.nav-item:hover { background: rgba(255,255,255,0.03); border-left-color: var(--border); }
.nav-item.active { background: var(--gold-glow); border-left-color: var(--gold); }

.nav-icon {
  width: 28px; height: 28px;
  border-radius: 6px;
  background: var(--surface2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
}
.nav-item.active .nav-icon { border-color: var(--gold-dim); background: rgba(212,175,55,0.08); }
.nav-icon svg { opacity: 0.5; transition: opacity 0.2s; }
.nav-item.active .nav-icon svg,
.nav-item:hover .nav-icon svg { opacity: 1; }

.nav-text { display: flex; flex-direction: column; gap: 1px; }

.nav-label {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  color: var(--muted);
  transition: color 0.2s;
  line-height: 1;
}
.nav-item:hover .nav-label { color: var(--text); }
.nav-item.active .nav-label { color: var(--gold); }

.nav-sub {
  font-size: 0.6rem;
  color: #333;
  letter-spacing: 0.05em;
  line-height: 1;
  transition: color 0.2s;
}
.nav-item:hover .nav-sub { color: #444; }
.nav-item.active .nav-sub { color: var(--gold-dim); }

/* ======================================================
   MAIN + PANELS
====================================================== */

.main {
  flex: 1;
  height: 100%;
  overflow: hidden;
  position: relative;
}

.panel {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.panel.active {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0);
}

#panel-explorar {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  scrollbar-width: none;
}
#panel-explorar::-webkit-scrollbar { display: none; }

#panel-programa { overflow: hidden; position: relative; height: 100%; }

/* ======================================================
   EXPLORAR — Visor + Figuras
====================================================== */

/* Fila superior */
.explorar-top {
  flex: 0 0 auto;
  display: flex;
  gap: 16px;
  padding: 8px 12px 12px;
  height: calc(100vh - var(--header-h));
}

#visor-container {
  flex: 0 0 auto;
  height: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 14px;
  overflow: hidden;
  background: #000;
  position: relative;
}

#visor-container img,
#visor-container video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.visor-panel {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  justify-content: center;
  padding: 24px;
  background: rgba(0,0,0,0.75);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.visor-panel.visible {
  opacity: 1;
  pointer-events: all;
}

.visor-panel-partitura {
  width: 100%;
  height: auto;
  display: block;
}

/* Árbol figuras */
.figuras-arbol-wrap {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  border: 1px solid var(--border);
  overflow: hidden;
}

#tabla-figuras-svg {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
#tabla-figuras-svg svg {
  width: 100%;
  height: 100%;
  max-height: 100%;
  max-width: 420px;
  object-fit: contain;
  margin: 0 auto;
  display: block;
}

.tabla-arbol-hint {
  position: absolute;
  top: 12px;
  left: 0; right: 0;
  text-align: center;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 0.55rem;
  letter-spacing: 0.35em;
  color: var(--gold-dim);
  opacity: 0.8;
  pointer-events: none;
}

/* Card overlay */
.tabla-figura-panel {
  display: none;
  position: absolute;
  inset: 0;
  flex-direction: column;
  padding: 18px 20px;
  gap: 10px;
  background: rgba(10,10,10,0.92);
  animation: fadeInPanel 0.2s ease;
  overflow-y: auto;
  scrollbar-width: none;
}
.tabla-figura-panel::-webkit-scrollbar { display: none; }
.tabla-figura-panel.visible { display: flex; }

@keyframes fadeInPanel {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.tf-cerrar {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(212,175,55,0.15);
  border: 1px solid var(--gold-dim);
  color: var(--gold);
  font-size: 1rem;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.tf-cerrar:hover {
  background: rgba(212,175,55,0.3);
}

.tabla-figura-nombre {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.4rem;
  letter-spacing: 0.15em;
  color: var(--gold);
  line-height: 1;
}

.tabla-figura-desc {
  font-size: 0.74rem;
  color: #ccc;
  line-height: 1.6;
}

.tabla-figura-stats { display: flex; gap: 16px; }
.tabla-figura-stat  { display: flex; flex-direction: column; gap: 2px; }

.tabla-figura-stat-num {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.6rem;
  color: #fff;
  line-height: 1;
}

.tabla-figura-stat-lbl {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 0.52rem;
  letter-spacing: 0.2em;
  color: #aaa;
}

.tabla-figura-svgs { display: flex; gap: 20px; align-items: flex-start; }

.tabla-figura-svg-bloque {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.tabla-figura-svg-lbl {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 0.48rem;
  letter-spacing: 0.25em;
  color: #aaa;
}

.tabla-figura-svg-wrap {
  width: 48px; height: 68px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px;
  padding: 4px;
}
.tabla-figura-svg-wrap svg { width: 100%; height: 100%; }

.fig-clickable {
  cursor: pointer;
  transition: opacity 0.2s ease;
}
.fig-clickable:hover { opacity: 0.7; }

/* Fila inferior: videos */
.explorar-videos {
  flex: 0 0 auto;
  display: flex;
  flex-direction: row;
  justify-content: center;
  gap: 16px;
  padding: 20px 12px 20px;
  height: 100vh;
  align-items: center;
}

.figuras-video-bloque {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  height: 90%;
}

.figuras-video-titulo {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1rem;
  letter-spacing: 0.3em;
  color: #aaa;
  text-align: center;
  flex-shrink: 0;
}

.figuras-video {
  height: 100%;
  width: auto;
  aspect-ratio: 720 / 900;
  object-fit: cover;
  background: #000;
  display: block;
  border-radius: 8px;
}

/* ======================================================
   PROGRAMA DE ESTUDIO
====================================================== */
/* ======================================================
   TABLET (768px - 1100px)
====================================================== */

@media (max-width: 1100px) {

  .explorar-top {
    flex-direction: column;
    height: auto;
    padding: 8px 12px 0;
    gap: 12px;
  }

  #visor-container {
    aspect-ratio: 1 / 1;
    height: auto;
    width: 100%;
  }

  .figuras-arbol-wrap {
    width: 100%;
    aspect-ratio: 1 / 1;
    flex: 0 0 auto;
  }

  .explorar-videos {
    height: auto;
    flex-direction: column;
    align-items: center;
    padding: 12px 12px 20px;
    gap: 16px;
  }

  .figuras-video-bloque {
    width: 60%;
    height: auto;
  }

  .figuras-video {
    height: auto;
    width: 100%;
    aspect-ratio: 720 / 900;
  }
}

/* ======================================================
   RESPONSIVE
====================================================== */

/* ── Sidebar bottom + layout: arranca antes ── */
/* sidebar bottom para PROGRAMA: arranca antes */
@media (max-width: 1100px) {
  .layout:has(#panel-programa.active) {
    flex-direction: column;
    padding-bottom: 56px;
  }

  .layout:has(#panel-programa.active) .sidebar {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    width: 100%;
    height: 56px;
    flex-direction: row;
    align-items: center;
    justify-content: space-around;
    padding: 0;
    border-right: none;
    border-top: 1px solid var(--border);
    z-index: 100;
  }

  .layout:has(#panel-programa.active) .nav-item {
    flex: 1;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 4px;
    border-left: none;
    border-top: 2px solid transparent;
    gap: 4px;
  }

  .layout:has(#panel-programa.active) .nav-item.active {
    border-left-color: transparent;
    border-top-color: var(--gold);
  }

  .layout:has(#panel-programa.active) .nav-text { display: none; }
  .layout:has(#panel-programa.active) .nav-icon { width: 24px; height: 24px; }
  .layout:has(#panel-programa.active) .main { width: 100%; height: 100%; }
}
/* ── Explorar/visor: ajustes propios ── */
@media (max-width: 768px) {

  .section-title { display: none; }

  .layout:has(#panel-programa.active) .section-title {
    font-size: 0.55rem;
    letter-spacing: 0.2em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
  }

  /* sidebar */
  .layout {
    flex-direction: column;
    padding-bottom: 56px;
  }

  .sidebar {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    width: 100%;
    height: 56px;
    flex-direction: row;
    align-items: center;
    justify-content: space-around;
    padding: 0;
    border-right: none;
    border-top: 1px solid var(--border);
    z-index: 100;
  }

  .sidebar-section-label { display: none; }

  .nav-item {
    flex: 1;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 4px;
    border-left: none;
    border-top: 2px solid transparent;
    gap: 4px;
  }

  .nav-item.active {
    border-left-color: transparent;
    border-top-color: var(--gold);
  }

  .nav-text { display: none; }
  .nav-icon { width: 24px; height: 24px; }
  .main { width: 100%; height: 100%; }

  /* explorar */
  #panel-explorar { overflow-y: auto; }
  /* ... resto del query que ya tenés ... */
}