/* Variables de Diseño */
:root {
  --bg-primary: #0a0b10;
  --bg-card: rgba(18, 20, 32, 0.65);
  --border-color: rgba(255, 255, 255, 0.08);
  --accent-color: #8b5cf6; /* Violeta */
  --accent-secondary: #06b6d4; /* Cian */
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --shadow-lg: 0 10px 30px -10px rgba(0, 0, 0, 0.7);
  --gradient-accent: linear-gradient(135deg, var(--accent-color) 0%, var(--accent-secondary) 100%);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: 'Plus Jakarta Sans', 'Outfit', sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
  position: relative;
}

/* Esferas decorativas de fondo */
.bg-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(140px);
  z-index: -1;
  opacity: 0.25;
}

.bg-glow-1 {
  width: 500px;
  height: 500px;
  background: var(--accent-color);
  top: -10%;
  left: -10%;
}

.bg-glow-2 {
  width: 600px;
  height: 600px;
  background: var(--accent-secondary);
  bottom: -15%;
  right: -10%;
}

/* Contenedor Principal */
.app-container {
  width: 100%;
  max-width: 1200px;
  padding: 2.5rem 1.5rem;
  z-index: 1;
}

/* Cabecera */
.app-header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.logo-area {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.logo-icon {
  font-size: 2.5rem;
  background: var(--gradient-accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: pulse-logo 3s ease-in-out infinite;
}

.app-header h1 {
  font-family: 'Outfit', sans-serif;
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.05em;
  background: linear-gradient(to right, #ffffff, #d1d5db);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle {
  font-size: 1rem;
  color: var(--text-secondary);
  font-weight: 400;
}

/* Layout de Rejilla */
.main-layout {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 2rem;
  align-items: start;
}

/* Tarjetas (Glassmorphism) */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  padding: 2rem;
  box-shadow: var(--shadow-lg);
}

/* Sección Izquierda: Reproductor */
.player-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.visualizer-container {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  max-width: 320px;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 2rem;
}

#visualizer-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  border-radius: 50%;
  pointer-events: none;
}

.cover-wrapper {
  position: relative;
  width: 230px;
  height: 230px;
  border-radius: 50%;
  padding: 8px;
  background: linear-gradient(135deg, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0.15) 100%);
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 15px 35px rgba(0,0,0,0.5);
  z-index: 2;
  overflow: hidden;
  transition: var(--transition);
}

.player-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  transition: var(--transition);
}

/* Efecto Disco Giratorio cuando se reproduce */
.cover-wrapper.playing {
  animation: spin 16s linear infinite;
  box-shadow: 0 0 30px rgba(139, 92, 246, 0.4);
}

.vinyl-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 35px;
  height: 35px;
  background: var(--bg-primary);
  border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.15);
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.8);
}

.song-info {
  margin-bottom: 1.5rem;
  width: 100%;
}

.song-info h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.song-info p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Barra de Progreso */
.progress-container {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 1rem;
  margin-bottom: 2rem;
}

.time-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  width: 42px;
}

.progress-bar {
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  position: relative;
  cursor: pointer;
  overflow: visible;
  transition: height 0.1s;
}

.progress-bar:hover {
  height: 8px;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--gradient-accent);
  border-radius: 4px;
  position: absolute;
  top: 0;
  left: 0;
}

.progress-knob {
  position: absolute;
  top: 50%;
  left: 0%;
  transform: translate(-50%, -50%) scale(0);
  width: 14px;
  height: 14px;
  background: #ffffff;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0,0,0,0.5);
  transition: transform 0.15s ease-out;
  pointer-events: none;
  z-index: 5;
}

.progress-bar:hover .progress-knob {
  transform: translate(-50%, -50%) scale(1);
}

/* Controles de audio */
.controls-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.control-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.control-btn:hover {
  color: var(--text-primary);
  transform: scale(1.08);
}

.control-btn.active {
  color: var(--accent-secondary);
  text-shadow: 0 0 10px rgba(6, 182, 212, 0.4);
}

.secondary-btn {
  font-size: 1.4rem;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.05);
}

.secondary-btn:hover {
  background: rgba(255,255,255,0.08);
}

.main-btn {
  font-size: 2.2rem;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: var(--gradient-accent);
  color: #ffffff;
  box-shadow: 0 8px 25px rgba(139, 92, 246, 0.45);
}

.main-btn:hover {
  transform: scale(1.06);
  box-shadow: 0 10px 30px rgba(139, 92, 246, 0.6);
  color: #ffffff;
}

/* Control de Volumen */
.volume-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  max-width: 250px;
  background: rgba(255,255,255,0.02);
  padding: 0.6rem 1rem;
  border-radius: 50px;
  border: 1px solid rgba(255,255,255,0.04);
}

.volume-container i {
  color: var(--text-secondary);
  font-size: 1.1rem;
  width: 20px;
}

.volume-slider {
  flex: 1;
  -webkit-appearance: none;
  background: rgba(255, 255, 255, 0.1);
  height: 4px;
  border-radius: 2px;
  outline: none;
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ffffff;
  cursor: pointer;
  transition: var(--transition);
}

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

#volume-val {
  font-size: 0.8rem;
  color: var(--text-secondary);
  width: 32px;
  text-align: right;
}

/* Sección Derecha: Utilidades */
.sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* Tabs Panel */
.add-music-card {
  padding: 0;
  overflow: hidden;
}

.tabs-header {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.02);
}

.tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 1.2rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  transition: var(--transition);
}

.tab-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.01);
}

.tab-btn.active {
  color: var(--text-primary);
  border-bottom: 2px solid var(--accent-color);
  background: rgba(255, 255, 255, 0.03);
}

.tabs-content {
  padding: 1.75rem;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
}

/* Formularios */
.action-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.input-group {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 0.8rem 1rem;
  gap: 0.75rem;
  transition: var(--transition);
}

.input-group:focus-within {
  border-color: var(--accent-color);
  box-shadow: 0 0 10px rgba(139, 92, 246, 0.25);
  background: rgba(255, 255, 255, 0.06);
}

.input-group i {
  color: var(--text-secondary);
  font-size: 1.2rem;
}

.input-group input, .input-group select {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 0.95rem;
  outline: none;
  width: 100%;
}

.action-btn {
  background: var(--gradient-accent);
  color: #ffffff;
  border: none;
  border-radius: 12px;
  padding: 0.9rem;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  transition: var(--transition);
  box-shadow: 0 4px 15px rgba(139, 92, 246, 0.2);
}

.action-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(139, 92, 246, 0.35);
}

.action-btn:disabled {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Subida de Archivos Drag & Drop */
.file-drop-zone {
  border: 2px dashed rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  padding: 2.2rem;
  text-align: center;
  background: rgba(255, 255, 255, 0.01);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
}

.file-drop-zone:hover, .file-drop-zone.dragover {
  border-color: var(--accent-secondary);
  background: rgba(6, 182, 212, 0.03);
}

.file-drop-zone i {
  font-size: 2.8rem;
  color: var(--accent-secondary);
}

.file-drop-zone p {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.file-label {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  margin-top: 0.3rem;
}

.file-label:hover {
  background: rgba(255, 255, 255, 0.15);
}

.selected-file {
  font-size: 0.8rem;
  color: var(--accent-secondary);
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 0.5rem;
}

.hidden {
  display: none !important;
}

/* Spinner e Indicador de Carga */
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.status-msg {
  font-size: 0.85rem;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-top: 1rem;
  animation: fadeIn 0.3s ease-out;
}

.status-msg.success {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.2);
  color: #10b981;
}

.status-msg.error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

.status-msg.info {
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.2);
  color: #3b82f6;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Biblioteca de Canciones */
.playlist-card {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  max-height: 480px;
}

.playlist-header {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.playlist-header h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.2rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.search-box {
  display: flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 0.5rem 0.8rem;
  gap: 0.5rem;
}

.search-box i {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.search-box input {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 0.85rem;
  outline: none;
  width: 100%;
}

.playlist-songs {
  overflow-y: auto;
  flex: 1;
  padding-right: 0.25rem;
}

/* Custom Scrollbar para la Lista */
.playlist-songs::-webkit-scrollbar {
  width: 5px;
}

.playlist-songs::-webkit-scrollbar-track {
  background: transparent;
}

.playlist-songs::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}

.playlist-songs::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Elementos de la Lista */
.song-item {
  display: flex;
  align-items: center;
  padding: 0.75rem;
  border-radius: 12px;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
  margin-bottom: 0.5rem;
  gap: 0.75rem;
}

.song-item:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.05);
}

.song-item.active {
  background: rgba(139, 92, 246, 0.1);
  border-color: rgba(139, 92, 246, 0.2);
}

.song-item-cover {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.05);
}

.song-item-detail {
  flex: 1;
  min-width: 0;
}

.song-item-title {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.15rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.song-item-artist {
  font-size: 0.75rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.source-badge {
  font-size: 0.65rem;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-weight: 600;
}

.badge-youtube {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.badge-upload {
  background: rgba(6, 182, 212, 0.15);
  color: #06b6d4;
}

.song-item-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.song-item-duration {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.delete-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0.25rem;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.delete-btn:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
  transform: scale(1.1);
}

/* Estados Vacíos */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
  color: var(--text-secondary);
  text-align: center;
  gap: 0.8rem;
}

.empty-state i {
  font-size: 2.5rem;
  opacity: 0.4;
}

.empty-state p {
  font-size: 0.85rem;
}

/* Animaciones */
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

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

@keyframes pulse-logo {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(1.05); }
}

/* Adaptabilidad (Responsivo) */
@media (max-width: 868px) {
  .main-layout {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  
  .app-container {
    padding: 1.5rem 1rem;
  }
  
  .card {
    padding: 1.5rem;
  }
}

/* ==========================================================================
   ESTILOS ADICIONALES PARA DASHBOARD Y LOGIN
   ========================================================================== */

/* Login Administrativo */
.login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  width: 100%;
  padding: 1.5rem;
  z-index: 10;
}

.login-card {
  width: 100%;
  max-width: 420px;
  animation: fadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.login-subtitle {
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

/* Enlaces y Navegación */
.admin-link {
  color: var(--accent-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: var(--transition);
}

.admin-link:hover {
  color: var(--text-primary);
  text-shadow: 0 0 8px rgba(6, 182, 212, 0.3);
}

/* Badges e Identificadores */
.badge-admin {
  font-size: 0.8rem;
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: rgba(139, 92, 246, 0.15);
  color: var(--accent-color);
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  border: 1px solid rgba(139, 92, 246, 0.25);
  text-shadow: none;
}

/* Controles de Ordenación y Playlist */
.control-btn:disabled,
.order-btn-up:disabled,
.order-btn-down:disabled {
  opacity: 0.2 !important;
  cursor: not-allowed !important;
  pointer-events: none !important;
}

/* Estilos de Select/Inputs en el Dashboard */
select option {
  background: var(--bg-primary);
  color: var(--text-primary);
}

input[type="number"] {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 0.95rem;
  outline: none;
  width: 100%;
}
