/* ==========================================================================
   SOLA — Solamente música, solamente adoración Adventista
   Hoja de estilos principal (CSS3 + Utilidades complementarias a Tailwind CSS)
   ========================================================================== */

:root {
  color-scheme: dark;
  --bg-main: #121212;
  --bg-sidebar: #080808;
  --bg-card: #181818;
  --bg-card-hover: #242424;
  --bg-elevated: #282828;
  --bg-player: #0c0c0e;
  --text-primary: #ffffff;
  --text-secondary: #a7a7a7;
  --text-muted: #6a6a6a;
  --accent-gold: #d4af37;
  --accent-gold-hover: #e5c349;
  --accent-emerald: #10b981;
  --accent-blue: #1e3a8a;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --radius-card: 12px;
  --player-height: 92px;
  /* Ambient Glow Dinámico */
  --ambient-rgb: 245, 158, 11;
  --ambient-glow: rgba(var(--ambient-rgb), 0.22);
}

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

html,
body {
  height: 100%;
  background-color: var(--bg-main);
  color: var(--text-primary);
  font-family: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Scrollbar personalizada estilo streaming moderno */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.16);
  border-radius: 9999px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(212, 175, 55, 0.55);
}

/* ==========================================================================
   LAYOUT PRINCIPAL
   ========================================================================== */
.app-shell {
  display: grid;
  grid-template-columns: 270px 1fr;
  height: calc(100vh - var(--player-height));
  width: 100vw;
  overflow: hidden;
}

.sidebar-area {
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
  z-index: 30;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.main-area {
  background: radial-gradient(
    circle at 50% -80px,
    rgba(var(--ambient-rgb), 0.28) 0%,
    rgba(var(--ambient-rgb), 0.08) 32%,
    var(--bg-main) 68%
  ) !important;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  scroll-behavior: smooth;
  transition: background 0.85s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Fondo Ambiental Dinámico en la barra del reproductor inferior */
#main-player-bar {
  background: linear-gradient(
    90deg,
    rgba(var(--ambient-rgb), 0.22) 0%,
    rgba(16, 16, 20, 0.96) 32%,
    rgba(12, 12, 14, 0.98) 70%,
    rgba(var(--ambient-rgb), 0.16) 100%
  ), #0c0c0e !important;
  border-top: 1px solid rgba(var(--ambient-rgb), 0.35) !important;
  box-shadow: 0 -12px 35px -8px rgba(var(--ambient-rgb), 0.3) !important;
  transition: background 0.85s cubic-bezier(0.4, 0, 0.2, 1),
              border-color 0.85s ease,
              box-shadow 0.85s ease;
}

/* ==========================================================================
   TARJETAS MUSICALES REUTILIZABLES (#181818)
   ========================================================================== */
.song-card {
  background-color: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-card);
  padding: 14px;
  transition: background-color 0.25s cubic-bezier(0.2, 0, 0, 1),
              transform 0.28s cubic-bezier(0.2, 0, 0, 1),
              box-shadow 0.28s cubic-bezier(0.2, 0, 0, 1),
              border-color 0.25s ease;
  position: relative;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  will-change: transform, box-shadow;
}

.song-card:hover {
  background-color: var(--bg-card-hover);
  transform: translateY(-6px) scale(1.015);
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.55), 0 0 24px rgba(var(--ambient-rgb), 0.15);
  border-color: rgba(var(--ambient-rgb), 0.4);
}

.song-card.is-playing {
  border-color: rgba(var(--ambient-rgb), 0.75) !important;
  background: linear-gradient(180deg, rgba(var(--ambient-rgb), 0.15) 0%, var(--bg-card) 100%) !important;
  box-shadow: 0 0 25px rgba(var(--ambient-rgb), 0.25) !important;
}

.song-card-cover-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 12px;
  background-color: #202024;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45);
}

.song-card-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s cubic-bezier(0.2, 0, 0, 1), filter 0.35s ease;
}

.song-card:hover .song-card-cover {
  transform: scale(1.06);
  filter: brightness(1.05);
}

/* Botón flotante elástico de reproducción con microinteracción elástica */
.card-play-btn {
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: 46px;
  height: 46px;
  border-radius: 9999px;
  background: linear-gradient(135deg, #fbbf24 0%, #d97706 100%);
  color: #080808;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.5), 0 0 15px rgba(245, 158, 11, 0.4);
  opacity: 0;
  transform: translateY(14px) scale(0.85);
  transition: opacity 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
              transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.25s ease,
              background 0.2s ease;
  border: none;
  cursor: pointer;
  z-index: 10;
}

.song-card:hover .card-play-btn,
.song-card.is-playing .card-play-btn,
.card-play-btn:focus-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.card-play-btn:hover {
  transform: scale(1.12) !important;
  background: linear-gradient(135deg, #fde047 0%, #f59e0b 100%) !important;
  box-shadow: 0 12px 28px rgba(245, 158, 11, 0.65), 0 0 22px rgba(245, 158, 11, 0.55) !important;
}

.card-play-btn:active {
  transform: scale(0.95) !important;
}

/* ==========================================================================
   NAVEGACIÓN SIDEBAR
   ========================================================================== */
.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.925rem;
  transition: all 0.2s ease;
  cursor: pointer;
  border: 1px solid transparent;
  width: 100%;
  text-align: left;
  background: transparent;
}

.nav-link:hover {
  color: var(--text-primary);
  background-color: rgba(255, 255, 255, 0.05);
}

.nav-link.active {
  color: var(--text-primary);
  background: linear-gradient(90deg, rgba(212, 175, 55, 0.16) 0%, rgba(212, 175, 55, 0.03) 100%);
  border-color: rgba(212, 175, 55, 0.28);
  font-weight: 600;
}

.nav-link.active .nav-icon {
  color: var(--accent-gold);
}

/* ==========================================================================
   BARRA DE PROGRESO Y VOLUMEN INTERACTIVOS
   ========================================================================== */
.range-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  outline: none;
  cursor: pointer;
  transition: height 0.15s ease;
}

.range-slider:hover {
  height: 7px;
}

.range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--accent-gold);
  cursor: pointer;
  box-shadow: 0 0 8px rgba(212, 175, 55, 0.8);
  transition: transform 0.15s ease;
}

.range-slider:hover::-webkit-slider-thumb {
  transform: scale(1.2);
}

.range-slider::-moz-range-thumb {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--accent-gold);
  cursor: pointer;
  border: none;
  box-shadow: 0 0 8px rgba(212, 175, 55, 0.8);
}

/* ==========================================================================
   INDICADOR DE REPRODUCCIÓN ACTIVA (ECUALIZADOR ANIMADO)
   ========================================================================== */
.eq-bars {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 14px;
  width: 16px;
}

.eq-bar {
  width: 3px;
  background-color: var(--accent-gold);
  border-radius: 2px;
  animation: eqPulse 0.9s ease-in-out infinite alternate;
}

.eq-bar:nth-child(1) {
  height: 40%;
  animation-delay: 0.1s;
}
.eq-bar:nth-child(2) {
  height: 95%;
  animation-delay: 0.35s;
}
.eq-bar:nth-child(3) {
  height: 60%;
  animation-delay: 0.2s;
}
.eq-bar:nth-child(4) {
  height: 80%;
  animation-delay: 0.45s;
}

.eq-bars.paused .eq-bar {
  animation-play-state: paused;
  height: 25% !important;
}

@keyframes eqPulse {
  0% {
    height: 25%;
  }
  50% {
    height: 100%;
  }
  100% {
    height: 40%;
  }
}

/* ==========================================================================
   EFECTO SKELETON SHIMMER (Carga suave y fluida estilo streaming premium)
   ========================================================================== */
@keyframes shimmerWave {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

.skeleton-shimmer {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.03) 0%,
    rgba(255, 255, 255, 0.09) 50%,
    rgba(255, 255, 255, 0.03) 100%
  ) !important;
  background-size: 200% 100% !important;
  animation: shimmerWave 1.6s cubic-bezier(0.4, 0, 0.2, 1) infinite !important;
  border-radius: 8px;
}

.skeleton-card {
  background-color: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-card);
  padding: 14px;
  display: flex;
  flex-direction: column;
}

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

.fade-in-content {
  animation: fadeInContent 0.32s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* ==========================================================================
   REPRODUCTOR DE YOUTUBE IFRAME (COMPLETAMENTE OCULTO)
   ========================================================================== */
.yt-hidden-player-container {
  position: fixed;
  bottom: -9999px;
  right: -9999px;
  width: 240px;
  height: 240px;
  opacity: 0;
  pointer-events: none;
  z-index: -9999;
  overflow: hidden;
}

.yt-hidden-player-container iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

/* ==========================================================================
   RESPONSIVE DESIGN (TABLET Y MÓVIL)
   ========================================================================== */
@media (max-width: 1024px) {
  .app-shell {
    grid-template-columns: 230px 1fr;
  }
}

@media (max-width: 768px) {
  :root {
    --player-height: 112px;
  }

  .app-shell {
    grid-template-columns: 1fr;
    height: calc(100vh - var(--player-height));
  }

  .sidebar-area {
    position: fixed;
    top: 0;
    left: 0;
    bottom: var(--player-height);
    width: 280px;
    transform: translateX(-100%);
    box-shadow: 12px 0 32px rgba(0, 0, 0, 0.75);
  }

  .sidebar-area.mobile-open {
    transform: translateX(0);
  }
}

/* Utilidades de truncamiento de texto */
.line-clamp-1 {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ==========================================================================
   DROPDOWNS Y SELECTS NATIVOS EN MODO OSCURO (Cross-platform Windows / Chrome)
   ========================================================================== */
select {
  color-scheme: dark !important;
  background-color: #18181b !important;
  color: #ffffff !important;
}

select option {
  background-color: #18181b !important;
  color: #ffffff !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  padding: 8px 12px !important;
}

select option:checked,
select option:hover,
select option:focus {
  background-color: #27272a !important;
  color: #f59e0b !important;
}

#header-country-select,
#sidebar-country-select,
#admin-filter-country,
#new-song-country,
#new-song-genre,
#new-artist-country,
#new-artist-type,
#import-album-country,
#import-album-genre {
  color-scheme: dark !important;
  background-color: #18181b !important;
  color: #ffffff !important;
}

/* ==========================================================================
   SECCIONES COLAPSABLES CON ANIMACIÓN SUAVE (1ª Línea + Despliegue Elegante)
   ========================================================================== */
.section-expandable {
  transition: max-height 0.45s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.35s ease,
              margin-top 0.35s ease;
  will-change: max-height, opacity;
}

.section-expandable.is-collapsed {
  max-height: 0 !important;
  opacity: 0 !important;
  margin-top: 0 !important;
  pointer-events: none !important;
  overflow: hidden !important;
}

.section-expandable.is-expanded {
  max-height: 5000px !important;
  opacity: 1 !important;
  margin-top: 1rem !important;
  pointer-events: auto !important;
}

.no-scrollbar::-webkit-scrollbar {
  display: none;
}
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

section[id^="home-"] {
  scroll-margin-top: 110px;
}

.rotate-180 {
  transform: rotate(180deg) !important;
}

/* Eliminar la 'x' nativa de WebKit para evitar doble 'x' en inputs de búsqueda */
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-results-button,
input[type="search"]::-webkit-search-results-decoration {
  -webkit-appearance: none;
  appearance: none;
  display: none;
}

/* Identidad Visual: Logotipo animado SOLA */
#sola-brand-video {
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform;
}

#sola-brand-logo-btn:hover #sola-brand-video {
  transform: scale(1.05);
}

/* ==========================================================================
   EXPERIENCIA MÓVIL Y GESTOS TÁCTILES (PUNTO 5)
   ========================================================================== */

#main-player-bar {
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}

#mobile-fullscreen-player {
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
  padding-bottom: max(env(safe-area-inset-bottom, 0px), 1.5rem);
}

/* Animaciones de retroalimentación Swipe horizontal */
@keyframes swipeSongLeft {
  0% { transform: translateX(0); opacity: 1; }
  35% { transform: translateX(-24px); opacity: 0.6; }
  100% { transform: translateX(0); opacity: 1; }
}

@keyframes swipeSongRight {
  0% { transform: translateX(0); opacity: 1; }
  35% { transform: translateX(24px); opacity: 0.6; }
  100% { transform: translateX(0); opacity: 1; }
}

.swipe-feedback-left {
  animation: swipeSongLeft 0.32s cubic-bezier(0.16, 1, 0.3, 1);
}

.swipe-feedback-right {
  animation: swipeSongRight 0.32s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Transición elástica al abrir/cerrar pantalla completa */
.fullscreen-player-enter {
  animation: slideUpPlayer 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.fullscreen-player-exit {
  animation: slideDownPlayer 0.28s cubic-bezier(0.7, 0, 0.84, 0) forwards;
}

@keyframes slideUpPlayer {
  from {
    transform: translateY(100%);
    opacity: 0.85;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes slideDownPlayer {
  from {
    transform: translateY(0);
    opacity: 1;
  }
  to {
    transform: translateY(100%);
    opacity: 0;
  }
}
