/* ====================================================================
   ROCOLA SAI — Sistema de diseño compartido
   San Andrés & Providencia · Caribe · Golden hour sobre el mar
   ==================================================================== */

:root {
  --bg-deep:      #071b24;
  --bg-mid:       #0b3040;
  --bg-glow:      #0f4a52;
  --accent:       #14b8ac;
  --accent-2:     #0e8f8a;
  --accent-light: #7ce8c9;
  --coral:        #ff6b4a;
  --gold:         #ffb545;
  --gold-light:   #ffd98a;
  --danger:       #ff5a4e;
  --warning:      #ffb545;
  --success:      #4fd68c;

  --grad-sunset:  linear-gradient(135deg, var(--coral), var(--gold));
  --grad-sea:     linear-gradient(135deg, var(--accent-light), var(--accent));

  --text:         #fff6ea;
  --text-dim:     #c9d6cf;
  --text-faint:   #82a099;

  --glass:        rgba(255, 246, 234, 0.06);
  --glass-strong: rgba(255, 246, 234, 0.12);
  --glass-border: rgba(255, 246, 234, 0.14);

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;

  --shadow-soft: 0 8px 30px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 40px rgba(255, 138, 76, 0.3);

  --font-head: 'Fredoka', 'Segoe UI', sans-serif;
  --font-body: 'Manrope', 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--text);
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.035 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
    radial-gradient(circle at 88% 4%, rgba(255, 181, 69, 0.28), transparent 42%),
    radial-gradient(circle at 6% 8%, rgba(255, 107, 74, 0.14), transparent 38%),
    radial-gradient(circle at 20% 100%, rgba(20, 184, 172, 0.28), transparent 46%),
    linear-gradient(165deg, var(--bg-deep) 0%, var(--bg-mid) 55%, #0a2632 100%);
  background-repeat: repeat, no-repeat, no-repeat, no-repeat, no-repeat;
  background-size: 120px 120px, auto, auto, auto, auto;
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-head);
  letter-spacing: -0.01em;
  font-weight: 600;
}

a { color: var(--gold-light); }

::selection { background: var(--coral); color: #241000; }

/* Custom scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: linear-gradient(var(--coral), var(--gold)); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold); }

.container-app {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 18px 60px;
}

/* ---------- Top navigation ---------- */
.topnav {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  background: rgba(7, 27, 36, 0.72);
  border-bottom: 1px solid var(--glass-border);
}

.topnav-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 1.08rem;
  white-space: nowrap;
}

.brand-badge {
  width: 38px; height: 38px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem;
  background: var(--grad-sunset);
  box-shadow: 0 4px 16px rgba(255, 138, 76, 0.45);
  transition: transform 0.3s ease;
}
.brand:hover .brand-badge { transform: rotate(-8deg) scale(1.05); }

.nav-links {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-dim);
  text-decoration: none;
  border: 1px solid transparent;
  transition: all 0.2s ease;
}

.nav-link:hover { color: var(--text); background: var(--glass); }
.nav-link.active {
  color: #2a1300;
  background: var(--grad-sunset);
  border-color: transparent;
}

/* ---------- Equalizer flourish ---------- */
.eq-bars {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 4px;
  height: 20px;
  margin: 10px auto 0;
}
.eq-bar {
  width: 4px;
  border-radius: 3px;
  background: var(--grad-sunset);
  animation: eq-bounce 1.1s ease-in-out infinite;
}
.eq-bar:nth-child(1) { height: 30%; animation-delay: -0.9s; }
.eq-bar:nth-child(2) { height: 70%; animation-delay: -0.6s; }
.eq-bar:nth-child(3) { height: 100%; animation-delay: -1.1s; }
.eq-bar:nth-child(4) { height: 55%; animation-delay: -0.3s; }
.eq-bar:nth-child(5) { height: 40%; animation-delay: -0.15s; }

@keyframes eq-bounce {
  0%, 100% { transform: scaleY(0.35); }
  50% { transform: scaleY(1); }
}

/* ---------- Wave divider ---------- */
.wave-divider {
  width: 100%;
  height: 40px;
  margin: 6px 0 22px;
  line-height: 0;
}
.wave-divider svg { width: 100%; height: 100%; display: block; }

/* ---------- Hero ---------- */
.hero {
  text-align: center;
  padding: 44px 12px 6px;
}

.hero h1 {
  font-size: clamp(1.8rem, 4vw, 2.7rem);
  font-weight: 600;
  margin: 0 0 8px;
  background: linear-gradient(100deg, var(--gold-light), var(--coral) 55%, var(--accent-light));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero p {
  color: var(--text-dim);
  font-size: clamp(0.95rem, 2vw, 1.1rem);
  margin: 0;
}

/* ---------- Cards / panels ---------- */
.panel {
  position: relative;
  background: linear-gradient(165deg, rgba(255, 246, 234, 0.07), rgba(255, 246, 234, 0.03));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  padding: 26px;
  overflow: hidden;
}
.panel::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--grad-sunset);
}

@media (max-width: 560px) {
  .panel { padding: 18px; border-radius: var(--radius-md); }
}

.panel-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-head);
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0 0 16px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 22px;
  align-items: start;
}

@media (max-width: 900px) {
  .grid-2 { grid-template-columns: 1fr; }
}

/* ---------- Form controls ---------- */
.input, .textarea {
  width: 100%;
  background: rgba(0, 0, 0, 0.25);
  border: 1.5px solid var(--glass-border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 13px 16px;
  font-size: 1rem;
  font-family: var(--font-body);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.textarea { resize: vertical; line-height: 1.5; min-height: 160px; }

.input::placeholder, .textarea::placeholder { color: var(--text-faint); }

.input:focus, .textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 4px rgba(255, 181, 69, 0.2);
}

.search-row {
  display: flex;
  gap: 10px;
}

@media (max-width: 480px) {
  .search-row { flex-direction: column; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 999px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.96rem;
  padding: 12px 22px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease, background 0.15s ease;
  white-space: nowrap;
}

.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.btn-primary {
  background: var(--grad-sunset);
  color: #2a1300;
  box-shadow: 0 6px 20px rgba(255, 138, 76, 0.35);
}
.btn-primary:hover:not(:disabled) { box-shadow: 0 8px 26px rgba(255, 138, 76, 0.5); transform: translateY(-1px); }

.btn-ghost {
  background: var(--glass);
  color: var(--text);
  border: 1px solid var(--glass-border);
}
.btn-ghost:hover { background: var(--glass-strong); }

.btn-warning { background: var(--warning); color: #402700; }
.btn-warning:hover:not(:disabled) { filter: brightness(1.08); }

.btn-danger { background: var(--danger); color: #380603; }
.btn-danger:hover:not(:disabled) { filter: brightness(1.08); }

.btn-sm { padding: 8px 14px; font-size: 0.85rem; }
.btn-lg { padding: 15px 28px; font-size: 1.02rem; }
.btn-block { width: 100%; }
.btn-icon { padding: 10px; width: 40px; height: 40px; border-radius: 12px; }

/* ---------- Result / queue item cards ---------- */
.song-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.song-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(255, 246, 234, 0.045);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 12px;
  transition: background 0.18s ease, transform 0.18s ease, border-color 0.18s ease;
  animation: fadeInUp 0.35s ease both;
}

.song-card.clickable { cursor: pointer; }
.song-card.clickable:hover {
  background: rgba(255, 181, 69, 0.1);
  border-color: rgba(255, 181, 69, 0.4);
  transform: translateY(-2px);
}

/* Vinyl-record thumbnail */
.song-thumb {
  position: relative;
  width: 56px;
  height: 56px;
  flex: 0 0 auto;
  border-radius: 50%;
  padding: 5px;
  background:
    radial-gradient(circle at 50% 50%, rgba(255,246,234,0.9) 0 5%, transparent 5.5%),
    repeating-radial-gradient(circle at 50% 50%, #141b1d 0 2px, #22292b 2px 4px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45), inset 0 0 0 1px rgba(255, 246, 234, 0.08);
  transition: transform 0.6s ease;
}
.song-card.clickable:hover .song-thumb,
.song-card.playing .song-thumb { animation: spin-vinyl 3.2s linear infinite; }

.song-thumb img {
  width: 100%; height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.55);
}

.song-thumb::after {
  content: "▶";
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem;
  color: #fff;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.18s ease;
}
.song-card.clickable:hover .song-thumb::after { opacity: 1; }

@keyframes spin-vinyl { to { transform: rotate(360deg); } }

.song-info { flex: 1 1 auto; min-width: 0; }
.song-title {
  font-weight: 600;
  font-size: 0.92rem;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.song-meta { font-size: 0.78rem; color: var(--text-dim); margin-top: 4px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.badge-client { background: rgba(79, 214, 140, 0.18); color: var(--success); }
.badge-admin  { background: rgba(255, 107, 74, 0.18); color: var(--coral); }
.badge-num    { background: rgba(255, 181, 69, 0.18); color: var(--gold-light); }

.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-head);
  font-size: 1.1rem;
  font-weight: 600;
  margin: 34px 0 14px;
}
.section-title .count {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--glass-strong);
  color: var(--text-dim);
}

/* ---------- Empty / loading states ---------- */
.empty-state, .loading-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 38px 16px;
  color: var(--text-dim);
  border: 1px dashed var(--glass-border);
  border-radius: var(--radius-md);
}
.empty-state .icon, .loading-state .icon { font-size: 1.8rem; display: block; margin-bottom: 8px; }

.skeleton {
  border-radius: var(--radius-md);
  height: 72px;
  background: linear-gradient(90deg, rgba(255,246,234,0.04) 25%, rgba(255,246,234,0.09) 37%, rgba(255,246,234,0.04) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
}

@keyframes shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: 0 0; }
}

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

/* ---------- Listas guardadas ---------- */
.playlist-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.playlist-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(255, 246, 234, 0.045);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  animation: fadeInUp 0.35s ease both;
}

.playlist-info { min-width: 0; }
.playlist-name {
  font-weight: 700;
  font-size: 0.95rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.playlist-meta { font-size: 0.78rem; color: var(--text-dim); margin-top: 2px; }
.playlist-actions { display: flex; gap: 6px; flex: 0 0 auto; }

/* ---------- Bulk-add preview list ---------- */
.bulk-preview {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
  margin-top: 12px;
  padding-right: 4px;
}

.bulk-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 246, 234, 0.035);
  font-size: 0.82rem;
}

.bulk-row .dot {
  width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto;
  background: var(--text-faint);
}
.bulk-row.ok .dot { background: var(--success); }
.bulk-row.err .dot { background: var(--danger); }
.bulk-row.dup .dot { background: var(--gold); }
.bulk-row .line { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-dim); }
.bulk-row .status { flex: 0 0 auto; font-weight: 700; }
.bulk-row.ok .status { color: var(--success); }
.bulk-row.err .status { color: var(--danger); }
.bulk-row.dup .status { color: var(--gold-light); }

.field-hint {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: rgba(255, 181, 69, 0.07);
  border: 1px dashed rgba(255, 181, 69, 0.35);
  font-size: 0.8rem;
  color: var(--text-dim);
  line-height: 1.5;
}
.field-hint strong { color: var(--gold-light); font-family: var(--font-head); font-weight: 600; }
.field-hint ul { margin: 6px 0 0; padding-left: 18px; }
.field-hint li { margin-bottom: 3px; }
.field-hint code {
  background: rgba(0, 0, 0, 0.3);
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 0.76rem;
  color: var(--gold-light);
}

.bulk-counter {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

/* ---------- Toasts ---------- */
#toastStack {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(360px, calc(100vw - 32px));
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: linear-gradient(165deg, #0e3244, #081f2b);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(10px);
  animation: toastIn 0.25s ease both;
  font-size: 0.88rem;
}
.toast.success { border-left: 4px solid var(--success); }
.toast.error   { border-left: 4px solid var(--danger); }
.toast.warning { border-left: 4px solid var(--gold); }
.toast.info    { border-left: 4px solid var(--accent); }
.toast .close { margin-left: auto; cursor: pointer; opacity: 0.6; }
.toast .close:hover { opacity: 1; }

@keyframes toastIn { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: translateX(0); } }
.toast.leaving { animation: toastOut 0.2s ease forwards; }
@keyframes toastOut { to { opacity: 0; transform: translateX(24px); } }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(4, 14, 20, 0.65);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  z-index: 210;
  padding: 20px;
  animation: fadeIn 0.18s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-box {
  background: linear-gradient(165deg, #0e3244, #071b24);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 26px;
  max-width: 420px;
  width: 100%;
  box-shadow: var(--shadow-soft);
  animation: fadeInUp 0.2s ease;
}
.modal-box h3 { margin: 0 0 10px; font-size: 1.15rem; font-family: var(--font-head); }
.modal-box p { color: var(--text-dim); margin: 0 0 22px; line-height: 1.5; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ---------- Misc ---------- */
.pill-actions { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; margin: 24px 0; }

.spinner {
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 2.5px solid rgba(0,0,0,0.25);
  border-top-color: currentColor;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
