/* ══ MOBILE.CSS — Rokola DJ App ══ */

/* ── MOBILE: FOLDER SHEET ─────────────────────────────── */
#folderSheetOverlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  z-index: 90; backdrop-filter: blur(3px);
}
#folderSheet {
  display: none; position: fixed; left: 0; right: 0; bottom: 0;
  height: 75vh; background: var(--bg2); border-radius: 16px 16px 0 0;
  border-top: 1px solid var(--border); z-index: 100;
  flex-direction: column; transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.32,0.72,0,1);
  padding-bottom: calc(var(--nav-h) + var(--safe-b));
}
#folderSheet.open { transform: translateY(0); }
.sheet-handle { width: 36px; height: 4px; background: var(--border); border-radius: 2px; margin: 0.6rem auto 0; flex-shrink: 0; }
.sheet-header { display: flex; align-items: center; justify-content: space-between; padding: 0.6rem 1rem 0.4rem; flex-shrink: 0; }
.sheet-title { font-size: 0.85rem; font-weight: 600; color: var(--text-hi); }
#folderSheetClose { background: none; border: none; color: var(--text-dim); font-size: 1.1rem; padding: 0.25rem; cursor: pointer; }
#folderSheetTree { flex: 1; overflow-y: auto; padding: 0.25rem 0; }

/* ── MOBILE: SEARCH OVERLAY ───────────────────────────── */
#searchOverlay {
  display: none; position: fixed; inset: 0;
  z-index: 150; flex-direction: column; justify-content: flex-end;
  background: transparent;
  pointer-events: none;
}
#searchOverlay.open { display: flex; pointer-events: all; }

/* Sheet con el input — desliza desde abajo */
#searchSheet {
  background: #15151a;
  border-radius: 20px 20px 0 0;
  padding: 0 0 calc(0.5rem + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -4px 24px rgba(0,0,0,0.5);
  flex-shrink: 0;
  transform: translateY(100%);
  will-change: transform;
  z-index: 2;
}
.sheet-handle {
  width: 36px; height: 4px; background: rgba(255,255,255,0.13);
  border-radius: 2px; margin: 10px auto 0;
}
/* Resultados — entre topbar y el sheet inferior */
#searchOverlayResults {
  position: fixed; left: 0; right: 0;
  top: calc(48px + env(safe-area-inset-top, 0px));
  bottom: 145px;
  overflow-y: auto; padding: 0.4rem 0.75rem;
  background: rgba(12,12,14,0.96);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  z-index: 1;
  pointer-events: all !important;
  display: none;
}
#searchOverlayResults.has-results { display: block; }
.search-overlay-header {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.7rem 1rem 0.5rem; flex-shrink: 0;
}
#searchOverlayInput {
  flex: 1; background: var(--bg3); border: 1px solid var(--border);
  border-radius: 10px; color: var(--text-hi); font-family: var(--mono);
  font-size: 0.85rem; padding: 0.6rem 0.9rem; outline: none;
}
#searchOverlayInput:focus { border-color: #39ff7a; }
#searchOverlayCancel {
  background: rgba(255,255,255,0.07); border: none; border-radius: 50%;
  color: var(--text-dim); width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; cursor: pointer; flex-shrink: 0;
}
#searchOverlayFieldWrap { padding: 0 1rem 0.4rem; }
#searchOverlayField {
  background: transparent; border: none; color: var(--text-dim);
  font-family: var(--mono); font-size: 0.7rem; outline: none; cursor: pointer; width: 100%;
}

/* ── MOBILE: BOTTOM NAV ───────────────────────────────── */
#bottomNav {
  display: none; position: fixed; left: 0; right: 0;
  bottom: 0; height: calc(var(--nav-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  background: rgba(12,12,14,0.97); border-top: 1px solid rgba(255,255,255,0.06);
  backdrop-filter: blur(16px) saturate(1.6);
  z-index: 80; align-items: stretch; justify-content: space-around;
}
.nav-tab {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 0; background: none; border: none;
  color: var(--text-dim); cursor: pointer;
  transition: color 0.15s; min-height: 44px; padding: 0;
}
.nav-tab span:not(.nav-icon):not(.nav-badge) { display: none; }
.nav-tab .nav-icon { font-size: 1.3rem; line-height: 1; }
.nav-tab.active { color: var(--amber); }
.nav-tab.active .nav-icon::after {
  content: ''; display: block; width: 4px; height: 4px;
  background: var(--amber); border-radius: 50%;
  margin: 3px auto 0;
}
.nav-tab .nav-badge {
  position: absolute; top: 6px; right: calc(50% - 18px);
  background: var(--green); color: #0c0c0e; border-radius: 8px;
  font-size: 0.5rem; font-weight: 700; padding: 0 4px; min-width: 14px;
  text-align: center; display: none;
}
.nav-tab .nav-badge.show { display: block; }
.nav-tab { position: relative; }

/* ── MOBILE TRACK LIST ────────────────────────────────── */
.mobile-track-list { display: flex; flex-direction: column; }
.mobile-track-row {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.7rem 1rem 0.7rem 0.75rem;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  cursor: pointer; transition: background 0.1s; -webkit-tap-highlight-color: transparent;
  min-height: 54px;
}
.mobile-track-row:active { background: rgba(255,255,255,0.04); }
.mobile-track-num {
  font-family: var(--mono); font-size: 0.7rem; color: var(--text-dim);
  width: 22px; text-align: right; flex-shrink: 0;
}
.mobile-track-info { flex: 1; min-width: 0; }
.mobile-track-title {
  font-size: 0.97rem; font-weight: 500; color: var(--text-hi);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.3;
}
.mobile-track-artist {
  font-family: var(--mono); font-size: 0.7rem; color: var(--text-dim);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  margin-top: 0.15rem;
}
.mobile-track-actions { display: flex; align-items: center; gap: 0.4rem; flex-shrink: 0; }
.mobile-play-btn {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--bg3); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-dim); cursor: pointer;
  transition: all 0.1s; flex-shrink: 0;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 2px 5px rgba(0,0,0,0.4);
}
.mobile-play-btn:active { transform: scale(0.91); box-shadow: inset 0 2px 4px rgba(0,0,0,0.5); }
.mobile-play-btn.playing {
  background: rgba(57,255,122,0.12); border-color: #39ff7a;
  color: #39ff7a;
  box-shadow: 0 0 0 3px rgba(57,255,122,0.2), 0 0 10px rgba(57,255,122,0.12), inset 0 1px 0 rgba(255,255,255,0.06);
  animation: pulse 1.4s ease infinite;
}

/* ── FULL PLAYER ──────────────────────────────────────── */
/* El full player ocupa toda la pantalla pero la parte superior
   es una zona transparente que permite ver/tocar el contenido */
#fullPlayer {
  position: fixed; inset: 0; z-index: 500;
  display: flex; flex-direction: column;
  background: transparent;
  transform: translateY(100%);
  transition: transform 0.38s cubic-bezier(0.32,0.72,0,1);
  will-change: transform;
  pointer-events: none; /* La zona peek no captura eventos por defecto */
}
#fullPlayer.open { transform: translateY(0); pointer-events: all; }

/* Zona superior transparente: toca para volver sin cerrar el player */
.fp-peek-zone {
  flex: 1; min-height: 80px; max-height: 22vh;
  cursor: pointer;
  background: transparent;
}

/* El sheet propiamente dicho — desde ~22vh hasta abajo */
.fp-sheet {
  display: flex; flex-direction: column;
  background: #0f0f12;
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -8px 40px rgba(0,0,0,0.6);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  flex-shrink: 0;
  /* altura: ocupa lo que necesita, hasta el límite de la pantalla */
  max-height: 82vh;
  overflow: hidden;
}

/* Top bar: handle + ✕ */
.fp-top-bar {
  display: flex; align-items: center; justify-content: center;
  position: relative; height: 40px; flex-shrink: 0; padding: 0 1rem;
}
.fp-handle-bar {
  width: 36px; height: 4px; background: rgba(255,255,255,0.15);
  border-radius: 2px; pointer-events: none;
}
.fp-close-btn {
  position: absolute; right: 1rem; top: 50%; transform: translateY(-50%);
  background: rgba(255,255,255,0.07); border: none; border-radius: 50%;
  width: 30px; height: 30px; display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,0.45); font-size: 0.85rem; cursor: pointer;
  transition: all 0.15s; -webkit-tap-highlight-color: transparent;
}
.fp-close-btn:active { background: rgba(255,255,255,0.18); color: #fff; }

/* Portada — flexible, no desborda */
.fp-cover-wrap {
  display: flex; align-items: center; justify-content: center;
  padding: 0.5rem 2.5rem 0.75rem; position: relative;
  flex-shrink: 0;
}
.fp-cover-bg {
  position: absolute; inset: -40px; filter: blur(60px) saturate(1.4);
  opacity: 0.28; background-size: cover; background-position: center;
  pointer-events: none;
}
.fp-cover-img {
  width: min(58vw, 260px); height: min(58vw, 260px);
  border-radius: 14px; overflow: hidden;
  background: var(--bg3); position: relative; z-index: 1;
  box-shadow: 0 16px 50px rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center;
  font-size: 3.5rem; transition: box-shadow 0.3s;
}
.fp-cover-img img { width: 100%; height: 100%; object-fit: cover; border-radius: 14px; display: block; }
.fp-cover-img.playing { box-shadow: 0 20px 60px rgba(57,255,122,0.2); }

/* Título + artista + carrito */
.fp-info {
  padding: 0 1.75rem 0.5rem; flex-shrink: 0;
  display: flex; align-items: flex-start; justify-content: space-between; gap: 0.75rem;
}
.fp-info-text { min-width: 0; flex: 1; }
.fp-title { font-size: 1.2rem; font-weight: 700; color: var(--text-hi); line-height: 1.25;
  margin-bottom: 0.2rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fp-artist { font-family: var(--mono); font-size: 0.78rem; color: var(--amber);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fp-artist-row { display: flex; align-items: center; gap: 0.5rem; }
.fp-meta-inline { display: flex; gap: 0.4rem; align-items: center; flex-shrink: 0; }
.fp-meta-inline span { font-family: var(--mono); font-size: 0.58rem; color: var(--text-dim); }
.fp-meta-inline span:empty { display: none; }
.fp-cart-btn {
  background: none; border: 1px solid var(--border2); border-radius: 50%;
  width: 32px; height: 32px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-dim); font-size: 0.95rem; cursor: pointer;
  transition: all 0.15s; -webkit-tap-highlight-color: transparent;
}
.fp-cart-btn.in-cart { border-color: var(--green); color: var(--green); background: rgba(62,207,106,0.1); }

/* Barra de progreso */
.fp-progress { padding: 0.25rem 1.75rem 0; flex-shrink: 0; }
.fp-bar-track {
  height: 4px; background: rgba(255,255,255,0.1); border-radius: 2px;
  position: relative; cursor: pointer;
}
.fp-bar-fill { height: 100%; background: var(--amber); border-radius: 2px;
  transition: width 0.5s linear; pointer-events: none; }

/* ─── Controles: [↻ continuo]  [▶/|| PLAY]  [⟳ repetir] ── */
.fp-controls {
  display: flex; align-items: center; justify-content: center;
  gap: 2.5rem; padding: 1.1rem 1.75rem 1.25rem; flex-shrink: 0;
}

/* Botones secundarios: mismo tamaño, simétricos */
.fp-side-btn {
  width: 46px; height: 46px; border-radius: 50%;
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.38); font-size: 1.4rem; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all 0.2s;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
  flex-shrink: 0;
}
.fp-side-btn:active { transform: scale(0.91); }
.fp-side-btn.active {
  background: rgba(57,255,122,0.12); border-color: rgba(57,255,122,0.45);
  color: #39ff7a; box-shadow: 0 0 14px rgba(57,255,122,0.2);
}

/* Botón play/pausa central — Pioneer DDJ400 */
.fp-btn-play {
  width: 80px; height: 80px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all 0.12s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation; user-select: none; flex-shrink: 0;
  /* is-paused (detenido): ► verde sobre negro — call to action */
  background: #0c0c0e; border: 2.5px solid #39ff7a; color: #39ff7a;
  box-shadow: 0 0 0 4px rgba(57,255,122,0.12), 0 0 24px rgba(57,255,122,0.18);
}
/* Reproduciendo (sin is-paused): || negro sobre verde — Pioneer */
.fp-btn-play:not(.is-paused) {
  background: #39ff7a; border: none; color: #0c0c0e;
  box-shadow: 0 4px 24px rgba(57,255,122,0.5), 0 0 28px rgba(57,255,122,0.25);
}
.fp-btn-play:active { transform: scale(0.93); opacity: 0.9; }

/* ── MINI PLAYER (mobile — tappable) ──────────────────── */
#miniPlayerMobile {
  display: none; position: fixed; left: 0.5rem; right: 0.5rem;
  bottom: calc(var(--nav-h) + var(--safe-b) + 0.4rem);
  z-index: 79; background: var(--bg3);
  border: 1px solid var(--border); border-radius: 12px;
  padding: 0.6rem 0.85rem; cursor: pointer;
  box-shadow: 0 4px 24px rgba(0,0,0,0.4);
  align-items: center; gap: 0.75rem;
  transition: opacity 0.2s; -webkit-tap-highlight-color: transparent;
}
#miniPlayerMobile.visible { display: flex; }
.mpm-cover {
  width: 40px; height: 40px; border-radius: 6px; overflow: hidden;
  background: var(--bg4); display: flex; align-items: center;
  justify-content: center; font-size: 1.1rem; flex-shrink: 0;
}
.mpm-cover img { width: 100%; height: 100%; object-fit: cover; }
.mpm-info { flex: 1; min-width: 0; }
.mpm-title { font-size: 0.88rem; font-weight: 500; color: var(--text-hi); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mpm-artist { font-family: var(--mono); font-size: 0.68rem; color: var(--amber); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mpm-progress {
  position: absolute; left: 0; right: 0; bottom: 0; height: 3px;
  background: var(--bg4); border-radius: 0 0 12px 12px; overflow: hidden;
}
.mpm-fill { height: 100%; background: var(--amber); border-radius: 0 0 12px 12px; transition: width 0.5s linear; }
.mpm-play {
  width: 36px; height: 36px; border-radius: 50%;
  background: #39ff7a; border: none;
  display: flex; align-items: center; justify-content: center;
  color: #0c0c0e; flex-shrink: 0; cursor: pointer;
  box-shadow: 0 2px 10px rgba(57,255,122,0.35), 0 0 12px rgba(57,255,122,0.18), inset 0 1px 0 rgba(255,255,255,0.15);
  transition: all 0.1s;
}
.mpm-play:active { transform: scale(0.9); box-shadow: 0 1px 4px rgba(57,255,122,0.3); }

/* ── FOLDER CARD MOBILE ───────────────────────────────── */
.mobile-folder-grid {
  display: flex; flex-direction: column; gap: 1px;
  background: var(--border2); border-radius: 12px; overflow: hidden; margin-bottom: 0.75rem;
}
.mobile-folder-row {
  display: flex; align-items: center; gap: 0.85rem;
  padding: 1rem 1rem; background: var(--bg2); cursor: pointer;
  transition: background 0.1s; -webkit-tap-highlight-color: transparent;
  min-height: 62px;
}
.mobile-folder-row:active { background: var(--bg3); }
.mobile-folder-icon { font-size: 1.5rem; flex-shrink: 0; }
.mobile-folder-name { font-size: 1.05rem; font-weight: 500; color: var(--text-hi); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.3; }
.mobile-folder-count { font-family: var(--mono); font-size: 0.72rem; color: var(--text-dim); flex-shrink: 0; }
.mobile-folder-chevron { color: var(--text-dim); font-size: 1rem; flex-shrink: 0; margin-left: 0.25rem; }

/* ── RESPONSIVE ───────────────────────────────────────── */
@media (max-width: 767px) {
  #bottomNav       { display: flex; }
  #folderSheet     { display: flex; }
  #folderSheetOverlay { display: block; opacity: 0; pointer-events: none; transition: opacity 0.3s; }
  #folderSheetOverlay.open { opacity: 1; pointer-events: all; }
  #btnMobileSearch { display: flex; }
  #treePanel, #resizer { display: none; }
  #searchWrap, #searchField, .topbar-stats, #btnViewList, #btnViewGrid, #btnMobileSearch, #cartBtn { display: none !important; }
  .logo-right { display: flex !important; align-items: baseline; gap: 0.3rem; }
  /* Topbar mobile: ícono izq | spacer | ROKOLA beta der */
  #topbar { justify-content: flex-start; align-items: center; padding: 0 1rem; height: 44px; min-height: 44px; gap: 0; }
  #topbar .logo { flex-shrink: 0; }
  #topbar .logo-img { width: 26px; height: 26px; }
  #topbar .logo-right { margin-left: auto; display: flex; align-items: baseline; gap: 0.3rem; }
  /* Breadcrumb raiz: sin texto "Biblioteca" */
  #breadcrumb:has(.bc-back-spacer:only-child) { display: none; }
  #filterBar { display: none; }
  #miniPlayer { display: none !important; }  /* replaced by mobile mini + full player */

  #contentPanel {
    padding: 0.5rem 0 calc(var(--player-h) + var(--nav-h) + var(--safe-b) + 1rem);
  }
  #breadcrumb { padding: 0.3rem 0.75rem; min-height: 36px; }
  /* Si no hay título (root), colapsar */
  #breadcrumb:empty { display: none; }
  .folder-header { display: none; }

  #toast { bottom: calc(var(--player-h) + var(--nav-h) + var(--safe-b) + 8px); }
}

@media (min-width: 768px) {
  #bottomNav, #folderSheet, #folderSheetOverlay, #searchOverlay,
  #miniPlayerMobile, #fullPlayer { display: none !important; }
}

/* ════════════════════════════════════════════════════════
   JUKEBOX COVERFLOW
   ════════════════════════════════════════════════════════ */

/* Contenedor — altura fija para que no se desborde verticalmente */
.jk-wrap {
  padding: 1rem 0 0.25rem;
  margin-bottom: 0.5rem;
  overflow: hidden;           /* CRÍTICO: recorta lo que sobresale lateralmente */
}

/* El carril del scroll — perspectiva 3D */
.jk-track {
  display: flex;              /* fila horizontal */
  align-items: center;
  overflow-x: scroll;
  overflow-y: visible;        /* permite que las cards sobresalgan verticalmente */
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  scroll-snap-type: x mandatory;
  /* padding lateral dinámico — se setea desde JS */
  padding-top: 12px;
  padding-bottom: 24px;
  gap: 0;                     /* el espaciado lo maneja margin en .jk-card */
  /* Perspectiva para el rotateY 3D */
  perspective: 900px;
  perspective-origin: 50% 50%;
}
.jk-track::-webkit-scrollbar { display: none; }

/* Cada tapa de disco */
.jk-card {
  flex-shrink: 0;
  /* Ancho se sobreescribe desde JS con --jk-w */
  width: var(--jk-w, 56vw);
  max-width: 200px;
  aspect-ratio: 1 / 1;
  margin: 0 6px;
  scroll-snap-align: center;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  position: relative;
  -webkit-tap-highlight-color: transparent;
  /* Estado inicial: lateral derecho — JS lo actualiza en scroll */
  transform: rotateY(-45deg) scale(0.76);
  filter: brightness(0.55);
  box-shadow: 0 4px 18px rgba(0,0,0,0.5);
  transition: box-shadow 0.2s ease;
  will-change: transform, filter;
  /* ¡SIN transition en transform/filter — JS lo maneja frame a frame! */
}
.jk-card img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
  user-select: none;
}
.jk-card .jk-no-cover {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-size: 3rem;
  background: linear-gradient(135deg, var(--bg3), var(--bg4));
}

/* Overlay con nombre — solo visible en la card central */
.jk-label {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 2rem 0.75rem 0.7rem;
  background: linear-gradient(to top, rgba(0,0,0,0.88) 0%, transparent 100%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.jk-card.jk-active .jk-label { opacity: 1; }
.jk-card.jk-active {
  box-shadow: 0 10px 36px rgba(0,0,0,0.65), 0 0 0 1px rgba(255,255,255,0.07);
}
.jk-label-name {
  font-family: var(--sans);
  font-size: 0.85rem; font-weight: 700;
  color: #fff; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
  text-shadow: 0 1px 3px rgba(0,0,0,0.9);
}
.jk-label-count {
  font-family: var(--mono);
  font-size: 0.6rem;
  color: #39ff7a;  /* neon verde */
  margin-top: 0.1rem;
}

/* Puntitos de navegación */
.jk-dots {
  display: flex;
  justify-content: center;
  gap: 5px;
  padding: 0.4rem 0 0.7rem;
}
.jk-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--border);
  transition: background 0.2s, transform 0.2s;
  flex-shrink: 0;
}
.jk-dot.active {
  background: #39ff7a;
  transform: scale(1.4);
}
