@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;800&display=swap');

:root {
  --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
  --surface-glass: rgba(255, 255, 255, 0.05);
  --surface-border: rgba(255, 255, 255, 0.1);
  --primary: #8b5cf6;
  --primary-hover: #7c3aed;
  --secondary: #ec4899;
  --text-main: #f8fafc;
  --text-muted: #cbd5e1;
}

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

body {
  font-family: 'Outfit', sans-serif;
  background: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Tipografía */
h1, h2, h3 {
  font-weight: 800;
  letter-spacing: -0.02em;
}

.text-gradient {
  background: linear-gradient(to right, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Utilidad Glassmorphism */
.glass {
  background: var(--surface-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--surface-border);
  border-radius: 24px;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

/* Navbar */
header {
  padding: 2rem 5%;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-size: 2rem;
}

nav a {
  color: var(--text-main);
  text-decoration: none;
  font-weight: 600;
  padding: 0.5rem 1.5rem;
  border-radius: 99px;
  transition: all 0.3s ease;
  background: var(--surface-glass);
  border: 1px solid var(--surface-border);
  white-space: nowrap;
}

nav a:hover {
  background: var(--primary);
  border-color: var(--primary);
}

/* Contenedor Principal */
main {
  flex: 1;
  padding: 2rem 5%;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

.hero {
  text-align: center;
  margin-bottom: 4rem;
  animation: fadeInDown 0.8s ease;
}

.hero p {
  color: var(--text-muted);
  font-size: 1.2rem;
  margin-top: 1rem;
}

/* Grid de Audios */
.audio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 2rem;
}

/* Tarjeta de Audio */
.audio-card {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  animation: fadeInUp 0.6s ease backwards;
}

.audio-card:hover {
  transform: translateY(-5px);
}

.audio-card h3 {
  font-size: 1.25rem;
  color: var(--text-main);
  word-break: break-word;
}

.audio-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.play-btn {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.2rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.play-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.5);
}

.progress-container {
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
  cursor: pointer;
}

.progress-bar {
  height: 100%;
  background: var(--primary);
  width: 0%;
  transition: width 0.1s linear;
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--surface-border);
  padding-top: 1rem;
}

.date {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.share-buttons {
  display: flex;
  gap: 0.5rem;
}

.share-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.2rem;
  transition: color 0.2s ease, transform 0.2s ease;
}

.share-btn:hover {
  color: var(--primary);
  transform: scale(1.2);
}

/* Animaciones */
@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

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

/* Cargando */
.loader {
  text-align: center;
  color: var(--text-muted);
  font-size: 1.2rem;
  padding: 3rem;
}

/* Formulario Upload */
.upload-container {
  max-width: 500px;
  margin: 4rem auto;
  padding: 3rem 2rem;
  text-align: center;
}

.upload-container h2 {
  margin-bottom: 2rem;
}

.form-group {
  margin-bottom: 1.5rem;
  text-align: left;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--text-muted);
}

.form-control {
  width: 100%;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--surface-border);
  border-radius: 12px;
  color: white;
  font-family: inherit;
  font-size: 1rem;
  transition: border-color 0.3s;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
}

.btn-submit {
  width: 100%;
  padding: 1rem;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.3s, transform 0.2s;
  margin-top: 1rem;
}

.btn-submit:hover {
  opacity: 0.9;
  transform: translateY(-2px);
}

#upload-status {
  margin-top: 1.5rem;
  font-size: 0.95rem;
}

.status-success { color: #4ade80; }
.status-error { color: #f87171; }

/* Buscador y Filtros */
.filters-container {
  padding: 1.5rem;
  margin-bottom: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.search-box {
  display: flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--surface-border);
  border-radius: 99px;
  padding: 0.8rem 1.5rem;
  transition: border-color 0.3s;
}

.search-box:focus-within {
  border-color: var(--primary);
}

.search-box i {
  color: var(--text-muted);
  margin-right: 1rem;
}

.search-box input {
  flex: 1;
  background: none;
  border: none;
  color: white;
  font-family: inherit;
  font-size: 1rem;
  outline: none;
}

.categories-pills {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.pill {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--surface-border);
  color: var(--text-muted);
  padding: 0.5rem 1.2rem;
  border-radius: 99px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
  transition: all 0.2s;
}

.pill:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

.pill.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.badge {
  display: inline-block;
  background: rgba(139, 92, 246, 0.2);
  color: #c4b5fd;
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  margin-bottom: 0.5rem;
  border: 1px solid rgba(139, 92, 246, 0.3);
}

/* Responsividad para móviles */
@media (max-width: 600px) {
  header {
    padding: 1rem 5%;
    flex-direction: column;
    gap: 1rem;
  }
  
  .logo {
    font-size: 1.5rem;
  }
  
  .hero h1 {
    font-size: 2rem;
  }
  
  .filters-container {
    padding: 1rem;
  }
  
  .search-box {
    padding: 0.6rem 1rem;
  }
}

/* Botones de Administración */
.card-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
}

.admin-buttons {
  display: flex;
  gap: 0.4rem;
  flex-shrink: 0;
}

.admin-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--surface-border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  transition: all 0.2s;
}

.admin-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: white;
}

.admin-btn.delete-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.4);
}

.admin-btn.edit-btn:hover {
  background: rgba(139, 92, 246, 0.2);
  color: #c4b5fd;
  border-color: rgba(139, 92, 246, 0.4);
}

/* Sort Pills */
.sort-pills {
  display: flex;
  gap: 0.6rem;
}

.sort-pill {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--surface-border);
  color: var(--text-muted);
  padding: 0.45rem 1.1rem;
  border-radius: 99px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.25s ease;
}

.sort-pill:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

.sort-pill.active {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-color: transparent;
  color: white;
  font-weight: 600;
  box-shadow: 0 2px 12px rgba(139, 92, 246, 0.3);
}

/* Admin Stats (solo visible para admin) */
.admin-stats {
  display: flex;
  gap: 1rem;
  padding: 0.5rem 0.8rem;
  background: rgba(139, 92, 246, 0.08);
  border: 1px solid rgba(139, 92, 246, 0.15);
  border-radius: 10px;
  font-size: 0.8rem;
}

.admin-stats .stat {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--text-muted);
}

.admin-stats .stat i {
  font-size: 0.7rem;
}

.admin-stats .stat.score {
  color: #f59e0b;
  font-weight: 600;
}

/* Reset button */
.admin-btn.reset-btn:hover {
  background: rgba(251, 191, 36, 0.2);
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.4);
}

/* Modales */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  animation: fadeIn 0.3s forwards;
}

.modal-content {
  width: 90%;
  max-width: 400px;
  padding: 2rem;
  text-align: center;
  background: var(--bg-gradient);
}

.modal-content h3 {
  margin-bottom: 1.5rem;
}

.modal-actions {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-top: 1.5rem;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Toast Notification */
#share-toast {
  position: fixed;
  bottom: -120px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 20px rgba(139, 92, 246, 0.15);
  z-index: 9999;
  transition: bottom 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  max-width: 90vw;
  width: max-content;
}

#share-toast.show {
  bottom: 2rem;
}

#share-toast .toast-icon {
  font-size: 1.6rem;
  color: #4ade80;
  flex-shrink: 0;
}

#share-toast .toast-body {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

#share-toast .toast-body strong {
  font-size: 0.95rem;
  color: #f8fafc;
}

#share-toast .toast-body span {
  font-size: 0.85rem;
  color: #c4b5fd;
}

#share-toast .toast-body small {
  font-size: 0.75rem;
  color: #94a3b8;
}
