/* VicDJ Web — Design System */

:root {
  --bg: #08090d;
  --bg2: #0d0f15;
  --surface: #111520;
  --surface2: #181d2b;
  --border: rgba(29, 158, 117, 0.13);
  --border-h: rgba(29, 158, 117, 0.4);
  --accent: #1d9e75;
  --accent2: #5dcaa5;
  --accent3: #a8f0d8;
  --glow: rgba(29, 158, 117, 0.22);
  --text: #e9fef6;
  --text2: rgba(233, 254, 246, 0.62);
  --text3: rgba(233, 254, 246, 0.35);
  --danger: #e05050;
  --amber: #e8b341;
  --spotify: #1DB954;
  --radius: 1rem;
  --radius-sm: 0.6rem;
  --radius-pill: 999px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: 'Bebas Neue', var(--font);
  --transition: 0.18s ease;
  --header-h: 60px;
  --tabs-h: 52px;
}

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

html { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100%;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ---- Utility ---- */
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* ---- Loading screen ---- */
#app:empty::after, .loading-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  flex-direction: column;
  gap: 1rem;
}
.loading-logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  animation: pulse 1.6s ease-in-out infinite;
}
.loading-logo .logo-icon { font-size: 2.2rem; }
.loading-logo .logo-text {
  font-family: var(--font-display);
  font-size: 3rem;
  letter-spacing: 0.04em;
  background: linear-gradient(120deg, var(--accent), var(--accent2), var(--accent3), var(--accent2), var(--accent));
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shimmer 3s linear infinite;
}
@keyframes shimmer {
  0% { background-position: 200% center; }
  100% { background-position: -200% center; }
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.6; } }

/* ---- Login Gate ---- */
.gate {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: radial-gradient(ellipse 80% 50% at 50% 0%, rgba(29, 158, 117, 0.08) 0%, transparent 60%);
}
.gate-logo {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 0.4rem;
}
.gate-logo .g-icon { font-size: 2.8rem; }
.gate-logo .g-title {
  font-family: var(--font-display);
  font-size: clamp(3.5rem, 12vw, 5rem);
  letter-spacing: 0.04em;
  background: linear-gradient(120deg, var(--accent) 0%, var(--accent2) 40%, var(--accent3) 55%, var(--accent2) 70%, var(--accent) 100%);
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shimmer 3.5s linear infinite;
}
.gate-tag {
  font-size: 0.72rem;
  letter-spacing: 0.45em;
  text-transform: uppercase;
  color: var(--accent2);
  opacity: 0.75;
  margin-bottom: 2.5rem;
}
.gate-card {
  width: min(400px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) * 1.5);
  padding: 2rem 1.75rem;
  box-shadow: 0 0 60px var(--glow), 0 8px 32px rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.gate-step-label {
  font-size: 0.7rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--accent2);
  opacity: 0.7;
}
.gate-title { font-weight: 700; font-size: 1.1rem; }
.gate-hint { font-size: 0.85rem; color: var(--text2); line-height: 1.5; }
.gate-error {
  font-size: 0.85rem;
  color: var(--amber);
  font-weight: 600;
  text-align: center;
  padding: 0.5rem;
  background: rgba(232, 179, 65, 0.08);
  border-radius: var(--radius-sm);
}

/* ---- Inputs & Buttons ---- */
.inp {
  width: 100%;
  background: rgba(0,0,0,0.4);
  border: 1px solid var(--border-h);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  padding: 0.72rem 1rem;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.inp::placeholder { color: var(--text3); }
.inp:focus {
  border-color: var(--accent2);
  box-shadow: 0 0 0 3px rgba(93, 202, 165, 0.15);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 700;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  padding: 0.65rem 1.1rem;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(120deg, var(--accent), var(--accent2));
  color: #04120d;
  width: 100%;
  padding: 0.8rem;
  font-size: 1rem;
}
.btn-primary:not(:disabled):hover { filter: brightness(1.08); box-shadow: 0 4px 20px var(--glow); }
.btn-ghost {
  background: transparent;
  border: 1px solid var(--border-h);
  color: var(--accent2);
}
.btn-ghost:not(:disabled):hover { background: rgba(93, 202, 165, 0.08); }
.btn-danger {
  background: transparent;
  border: 1px solid rgba(224, 80, 80, 0.35);
  color: var(--danger);
}
.btn-danger:not(:disabled):hover { background: rgba(224, 80, 80, 0.1); }
.btn-icon {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--accent2);
  border-radius: var(--radius-pill);
  width: 2.1rem;
  height: 2.1rem;
  padding: 0;
  font-size: 0.9rem;
  flex-shrink: 0;
}
.btn-icon:not(:disabled):hover { border-color: var(--border-h); background: rgba(93, 202, 165, 0.1); }
.btn-icon.playing { background: var(--accent); color: #04120d; border-color: var(--accent); }
.btn-icon.loading { opacity: 0.6; pointer-events: none; }
.btn-back {
  background: none;
  border: none;
  color: var(--accent2);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0;
  margin-bottom: 0.8rem;
}
.btn-back:hover { color: var(--accent3); }

/* ---- App Shell ---- */
.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

/* ---- Header ---- */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: rgba(8, 9, 13, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 1rem;
  gap: 0.75rem;
}
.header-logo {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}
.header-icon { font-size: 1.3rem; }
.header-brand {
  font-family: var(--font-display);
  font-size: 1.8rem;
  letter-spacing: 0.04em;
  background: linear-gradient(120deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1;
}
.header-stats {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.stats-pill {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 0.3rem 0.9rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent2);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.stats-pill .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); display: inline-block; }
.header-user {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}
.user-name {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text);
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.btn-logout {
  background: none;
  border: 1px solid var(--border);
  color: var(--text3);
  border-radius: var(--radius-pill);
  padding: 0.25rem 0.6rem;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-logout:hover { border-color: var(--danger); color: var(--danger); }

/* ---- Tab Nav ---- */
.tab-nav {
  position: sticky;
  top: var(--header-h);
  z-index: 90;
  background: rgba(8, 9, 13, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  height: var(--tabs-h);
}
.tab-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  background: none;
  border: none;
  color: var(--text3);
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: color var(--transition);
  position: relative;
  padding: 0 0.5rem;
}
.tab-btn .tab-icon { font-size: 1.1rem; }
.tab-btn .tab-label { display: none; }
.tab-btn.active { color: var(--accent2); }
.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 10%;
  width: 80%;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: 2px 2px 0 0;
}
.tab-btn:not(.active):hover { color: var(--text2); }

/* ---- Content ---- */
.content {
  flex: 1;
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  padding: 1.2rem 1rem 2rem;
}

/* ---- Cards ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem;
}
.card + .card { margin-top: 0.7rem; }
.card-accent { border-color: var(--border-h); box-shadow: 0 0 24px var(--glow); }

/* ---- Genre Grid ---- */
.genre-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(8rem, 100%), 1fr));
  gap: 0.6rem;
  margin-top: 0.5rem;
}
.genre-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 0.7rem;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  color: var(--text);
}
.genre-tile:hover {
  border-color: var(--border-h);
  background: var(--surface2);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}
.genre-tile:active { transform: scale(0.97); }
.genre-icon { font-size: 1.8rem; }
.genre-name { font-size: 0.78rem; font-weight: 600; line-height: 1.25; }

/* ---- Artist List ---- */
.artist-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(11rem, 100%), 1fr));
  gap: 0.5rem;
}
.artist-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.7rem 1rem;
  text-align: left;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.artist-btn:hover { border-color: var(--border-h); background: var(--surface2); }
.artist-btn .arrow { color: var(--accent2); opacity: 0.7; }

/* ---- Song List ---- */
.song-list { display: flex; flex-direction: column; gap: 0.45rem; }
.song-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  transition: border-color var(--transition);
  min-width: 0;
}
.song-item:hover { border-color: rgba(29, 158, 117, 0.22); }
.song-item.taken { opacity: 0.55; }
.song-item.new { animation: flash 1.2s ease-out; }
@keyframes flash {
  0% { box-shadow: 0 0 0 2px var(--accent2), 0 0 20px rgba(93, 202, 165, 0.6); }
  100% { box-shadow: none; }
}
.song-num {
  font-weight: 800;
  color: var(--accent2);
  font-size: 0.82rem;
  min-width: 1.5em;
  text-align: right;
  flex-shrink: 0;
}
.song-info { flex: 1; min-width: 0; }
.song-title {
  font-weight: 700;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.song-meta {
  font-size: 0.76rem;
  color: var(--text2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.song-taken-by { color: var(--amber); font-weight: 600; font-size: 0.76rem; }
.song-actions { display: flex; align-items: center; gap: 0.3rem; flex-shrink: 0; }
.humor-msg {
  font-size: 0.78rem;
  color: var(--accent2);
  font-weight: 600;
  text-align: center;
  padding: 0.3rem 0.6rem;
  background: rgba(93, 202, 165, 0.08);
  border-radius: var(--radius-sm);
  margin-top: 0.3rem;
}

/* ---- Search ---- */
.search-wrap {
  position: relative;
  margin-bottom: 1rem;
}
.search-icon {
  position: absolute;
  left: 0.9rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text3);
  font-size: 0.95rem;
  pointer-events: none;
}
.search-inp {
  width: 100%;
  background: rgba(0,0,0,0.35);
  border: 1px solid var(--border-h);
  border-radius: var(--radius-pill);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.95rem;
  padding: 0.65rem 2.8rem 0.65rem 2.6rem;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.search-inp::placeholder { color: var(--text3); }
.search-inp:focus {
  border-color: var(--accent2);
  box-shadow: 0 0 0 3px rgba(93, 202, 165, 0.12);
}
.search-clear {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text3);
  font-size: 1rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}
.search-clear:hover { color: var(--text2); }
.spotify-search-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: transparent;
  border: 1px dashed rgba(29, 185, 84, 0.4);
  border-radius: var(--radius-sm);
  color: var(--spotify);
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.55rem 0.9rem;
  cursor: pointer;
  width: 100%;
  justify-content: center;
  margin-bottom: 0.8rem;
  transition: all var(--transition);
}
.spotify-search-btn:hover { background: rgba(29, 185, 84, 0.08); }

/* ---- Section headers ---- */
.section-title {
  font-size: 0.7rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--accent2);
  opacity: 0.7;
  margin-bottom: 0.6rem;
  font-weight: 600;
}
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.6rem;
}

/* ---- Breadcrumb ---- */
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem;
  margin-bottom: 1rem;
  font-size: 0.82rem;
}
.crumb-btn {
  background: none;
  border: none;
  color: var(--accent2);
  font-family: var(--font);
  font-size: inherit;
  cursor: pointer;
  padding: 0.1rem;
  font-weight: 600;
}
.crumb-btn:hover { color: var(--accent3); }
.crumb-current { color: var(--text); font-weight: 700; }
.crumb-sep { color: var(--text3); }

/* ---- Stats card ---- */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(9rem, 100%), 1fr));
  gap: 0.6rem;
  margin-bottom: 1rem;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  text-align: center;
}
.stat-value {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--accent2);
  line-height: 1;
  margin-bottom: 0.2rem;
}
.stat-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--text3);
}

/* ---- Mis Canciones ---- */
.my-summary {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 0.9rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.my-summary-icon { font-size: 1.6rem; }
.my-summary-text { flex: 1; }
.my-summary-count { font-weight: 800; font-size: 1.05rem; }
.my-summary-dur { font-size: 0.82rem; color: var(--text2); }
.song-synced {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  title: "Sincronizada con Spotify";
}

/* ---- Playlist Cards ---- */
.pl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(10.5rem, 100%), 1fr));
  gap: 0.7rem;
  margin-bottom: 1rem;
}
.pl-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
  transition: all var(--transition);
  color: var(--text);
}
.pl-card:hover {
  border-color: var(--border-h);
  background: var(--surface2);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}
.pl-card:active { transform: scale(0.97); }
.pl-icon { font-size: 2.2rem; }
.pl-label { font-weight: 700; font-size: 0.88rem; text-align: center; line-height: 1.3; }
.pl-count { font-size: 0.72rem; color: var(--text3); }
.pl-detail-header { margin-bottom: 1rem; }
.pl-detail-title { font-size: 1.4rem; font-weight: 800; margin-bottom: 0.25rem; }
.pl-detail-desc { font-size: 0.85rem; color: var(--text2); line-height: 1.45; margin-bottom: 0.7rem; }
.pl-detail-stats { display: flex; gap: 1rem; margin-bottom: 0.75rem; }
.pl-stat { font-size: 0.8rem; color: var(--accent2); font-weight: 600; }
.pl-open-spotify {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: transparent;
  border: 1px solid rgba(29, 185, 84, 0.4);
  border-radius: var(--radius-sm);
  color: var(--spotify);
  font-weight: 700;
  font-size: 0.85rem;
  padding: 0.55rem 0.9rem;
  text-decoration: none;
  transition: background var(--transition);
  width: fit-content;
}
.pl-open-spotify:hover { background: rgba(29, 185, 84, 0.1); }
.genre-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-block;
}
.song-by { font-size: 0.72rem; color: var(--text3); }

/* ---- Load more ---- */
.load-more {
  text-align: center;
  margin-top: 0.8rem;
}

/* ---- Toast ---- */
.toast-layer {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  align-items: center;
  pointer-events: none;
  width: min(92vw, 28rem);
}
.toast {
  background: var(--surface2);
  border: 1px solid var(--border-h);
  border-radius: var(--radius-pill);
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.6rem 1.2rem;
  text-align: center;
  box-shadow: 0 4px 24px rgba(0,0,0,0.5), 0 0 20px var(--glow);
  animation: toastIn 0.25s ease-out;
  pointer-events: auto;
}
.toast.error { border-color: rgba(224, 80, 80, 0.5); box-shadow: 0 4px 24px rgba(0,0,0,0.5); }
@keyframes toastIn { from { transform: translateY(12px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ---- Empty state ---- */
.empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text3);
}
.empty-icon { font-size: 2.5rem; margin-bottom: 0.6rem; }
.empty-text { font-size: 0.9rem; }

/* ---- Spinner ---- */
.spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  color: var(--text3);
  gap: 0.5rem;
  font-size: 0.88rem;
}
.spin {
  width: 1.2rem; height: 1.2rem;
  border: 2px solid var(--border-h);
  border-top-color: var(--accent2);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Desktop ---- */
@media (min-width: 640px) {
  .tab-btn .tab-label { display: inline; }
  .tab-btn .tab-icon { font-size: 1rem; }
  .header-brand { font-size: 2rem; }
  .content { padding: 1.5rem 1.5rem 2rem; }
}

@media (min-width: 900px) {
  :root { --header-h: 64px; --tabs-h: 56px; }
  .content { max-width: 800px; padding: 2rem 2rem 3rem; }
  .genre-grid { grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr)); }
  .pl-grid { grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); }
}
