/* === PROTECCIÓN CONTRA SELECCIÓN Y CLIC DERECHO === */
* {
  /* Deshabilita la selección de texto */
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  
  /* Deshabilita el menú contextual y drag */
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
  -khtml-user-drag: none;
  -moz-user-drag: none;
  -o-user-drag: none;
}

/* Permite selección solo en inputs y textareas */
input, textarea, [contenteditable="true"] {
  -webkit-user-select: text !important;
  -moz-user-select: text !important;
  -ms-user-select: text !important;
  user-select: text !important;
}

/* === EFECTOS MÁGICOS DE DESVANECIMIENTO === */
.album-card {
  transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  transform-origin: center;
}

.album-fade-out {
  opacity: 0;
  transform: scale(0.8) rotateY(15deg);
  pointer-events: none;
}

.album-fade-in {
  opacity: 1;
  transform: scale(1) rotateY(0deg);
}

.album-magic-enter {
  opacity: 0;
  transform: scale(1.2) rotateY(-15deg);
  animation: magicAppear 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes magicAppear {
  0% {
    opacity: 0;
    transform: scale(1.2) rotateY(-15deg) translateY(-20px);
  }
  50% {
    opacity: 0.7;
    transform: scale(1.05) rotateY(-5deg) translateY(-10px);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotateY(0deg) translateY(0px);
  }
}

.shuffle-button-magic {
  animation: shimmer 0.5s ease-in-out;
}

@keyframes shimmer {
  0% {
    box-shadow: 0 0 0 0 rgba(77, 161, 255, 0.4);  /* Azul celeste con opacidad */
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 0 12px rgba(77, 161, 255, 0.1);  /* Más difuso y suave */
    transform: scale(1.02);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(77, 161, 255, 0);  /* Desvanecimiento completo */
    transform: scale(1);
  }
}

/* === EFECTO DE PARTÍCULAS MÁGICAS === */
.magic-particles {
  position: relative;
  overflow: hidden;
}

.magic-particles::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(
    circle,
    rgba(147, 51, 234, 0.1) 1px,
    transparent 1px
  );
  background-size: 20px 20px;
  animation: particles 2s linear infinite;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.magic-particles.active::before {
  opacity: 1;
}

@keyframes particles {
  0% {
    transform: translate(0, 0) rotate(0deg);
  }
  100% {
    transform: translate(-20px, -20px) rotate(360deg);
  }
}

/* === ESTILOS PARA EL GRID DE ÁLBUMES === */
#albums-grid {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: stretch;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.album-card {
  flex: 0 0 auto;
  width: 280px;
  max-width: 280px;
  margin: 0;
}

/* Responsive para fila horizontal */
@media (max-width: 1023px) {
  .album-card {
    width: 250px;
    max-width: 250px;
  }
}

/* === ANIMACIONES DEL PANEL DE BÚSQUEDA === */
.search-panel-enter {
  animation: searchModalFadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.search-panel-exit {
  animation: searchModalFadeOut 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes searchModalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(-20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes searchModalFadeOut {
  from {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
  to {
    opacity: 0;
    transform: scale(0.9) translateY(-20px);
  }
}

/* === EFECTOS HOVER PARA RESULTADOS DE BÚSQUEDA === */
.search-result-item {
  transition: all 0.2s ease;
}

.search-result-item:hover {
  transform: translateX(4px);
  background-color: rgba(55, 65, 81, 0.8);
}

/* === ANIMACIONES DEL MODAL DE ÁLBUM === */
.modal-enter {
  animation: modalFadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.modal-exit {
  animation: modalFadeOut 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(-20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes modalFadeOut {
  from {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
  to {
    opacity: 0;
    transform: scale(0.9) translateY(-20px);
  }
}

/* === PREVENIR SCROLL HORIZONTAL === */
html,
body {
  overflow-x: hidden;
  max-width: 100vw;
}

.container {
  overflow-x: hidden;
  max-width: 100%;
}

/* === MODAL SIN SCROLL HORIZONTAL === */
#album-info-modal .bg-gray-800 {
  overflow-x: hidden;
  max-width: calc(100vw - 2rem);
  width: 100%;
}

/* Anchos progresivos del modal */
@media (min-width: 640px) {
  #album-info-modal .bg-gray-800 {
    max-width: 28rem; /* 448px */
  }
}

@media (min-width: 768px) {
  #album-info-modal .bg-gray-800 {
    max-width: 32rem; /* 512px */
  }
}

@media (min-width: 1024px) {
  #album-info-modal .bg-gray-800 {
    max-width: 36rem; /* 576px */
  }
}

#album-info-content {
  overflow-x: hidden;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* === ELEMENTOS TRUNCADOS === */
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

/* === FLEXBOX SIN OVERFLOW === */
.flex {
  min-width: 0;
}

.flex-1 {
  min-width: 0;
}

/* === EFECTOS PARA LISTA DE CANCIONES === */
.song-item {
  transition: all 0.2s ease;
}

.song-item:hover {
  background-color: rgba(55, 65, 81, 0.5);
  transform: translateX(2px);
}

.song-item.playing {
  background-color: rgba(34, 197, 94, 0.2);
  border-left: 4px solid #22c55e;
}

/* === EFECTO PARA ÁLBUM PROMOVIDO === */
.album-promoted {
  animation: albumPromoted 1.5s cubic-bezier(0.4, 0, 0.2, 1);
  transform-origin: center;
}

@keyframes albumPromoted {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 rgba(59, 130, 246, 0.5);
  }
  25% {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.8);
  }
  50% {
    transform: scale(1.02);
    box-shadow: 0 0 30px rgba(59, 130, 246, 0.6);
  }
  75% {
    transform: scale(1.01);
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.4);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 rgba(59, 130, 246, 0);
  }
}

/* === MEJORAR TRUNCADO DE TEXTO EN RESULTADOS === */
.search-result-item h4,
.search-result-item p {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* === CONTAINER DE RESULTADOS CON SCROLL VERTICAL === */
.search-results-list {
  overflow-y: auto !important;
  overflow-x: hidden !important;
}

/* === GRADIENTE SUTIL === */
.search-results-container {
  position: relative;
}

.search-results-container::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 20px;
  background: linear-gradient(transparent, rgba(31, 41, 55, 0.8));
  pointer-events: none;
}

/* === RESPONSIVE === */
@media (max-width: 767px) {
  #albums-grid {
    flex-direction: column;
    align-items: center;
  }
  .album-card {
    width: 100%;
    max-width: 320px;
  }
}

/* === BARRA DE PROGRESO INTERACTIVA === */
.w-full.bg-gray-700.rounded-full.h-1\.5 {
  position: relative;
  cursor: pointer;
  transition: transform 0.2s ease;
  overflow: hidden;
}

.w-full.bg-gray-700.rounded-full.h-1\.5:hover {
  transform: scaleY(1.3);
}

.w-full.bg-gray-700.rounded-full.h-1\.5:active {
  transform: scaleY(1.5);
}

/* Efecto de brillo en la barra de progreso */
.w-full.bg-gray-700.rounded-full.h-1\.5::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(34, 197, 94, 0.3), transparent);
  transform: translateX(-100%);
  transition: transform 0.6s ease;
}

.w-full.bg-gray-700.rounded-full.h-1\.5:hover::before {
  transform: translateX(100%);
}

/* Mejorar el indicador de progreso */
#progress-bar {
  position: relative;
  transition: all 0.1s ease;
}

/* Agregar un punto indicador al final de la barra de progreso */
#progress-bar::after {
  content: '';
  position: absolute;
  right: -2px;
  top: 50%;
  width: 8px;
  height: 8px;
  background: #22c55e;
  border-radius: 50%;
  transform: translateY(-50%);
  opacity: 0;
  transition: opacity 0.2s ease;
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.6);
}

.w-full.bg-gray-700.rounded-full.h-1\.5:hover #progress-bar::after {
  opacity: 1;
}

/* Efecto visual cuando se está arrastrando */
.dragging {
  user-select: none;
  cursor: grabbing !important;
}

.dragging #progress-bar::after {
  opacity: 1;
  transform: translateY(-50%) scale(1.2);
}

/* === IMAGEN DE ÁLBUM CLICKEABLE === */
#album-cover {
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
}

#album-cover:hover {
  transform: scale(1.05);
  filter: brightness(1.1);
  box-shadow: 0 4px 15px rgba(77, 161, 255, 0.4);
}

#album-cover:active {
  transform: scale(0.95);
}

/* Indicador visual para mostrar que es clickeable */
#album-cover::before {
  content: '👁️';
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 1;
}

#album-cover:hover::before {
  opacity: 1;
}

/* === FOOTER STYLES === */
footer {
  margin-top: auto; /* Para empujar el footer hacia abajo */
}

footer .bg-blue-100 {
  transition: all 0.3s ease;
}

footer .bg-blue-100:hover {
  background-color: #dbeafe;
  transform: translateY(-1px);
}

/* Animación del indicador de estado */
footer .bg-green-400 {
  animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* Responsive adjustments for footer */
@media (max-width: 640px) {
  footer .grid {
    gap: 1rem;
  }
  
  footer .px-6 {
    padding-left: 1rem;
    padding-right: 1rem;
  }
  
  footer .py-6 {
    padding-top: 1rem;
    padding-bottom: 1rem;
  }
}

/* Asegurar que el body tenga altura mínima completa */
body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* El contenedor principal debe crecer para empujar el footer */
.container {
  flex: 1;
}
