/* ==========================================================
   M+ — DESIGN TOKENS
   Conceito: "crossfade" — o app existe no ponto onde Spotify (verde)
   e SoundCloud (laranja) se misturam. Fundo tinta fria e quase-preta
   (não o aubergine morno de antes), texto branco-frio nítido (a cor
   antiga do texto "puxava" pro creme e ficava murcha sobre o roxo/
   âmbar), e um terceiro tom — o "acento M+" — que é DO APP, não de
   nenhuma plataforma, e é customizável nas Configurações > Aparência.
   ========================================================== */
:root {
  --bg: #080809;
  --bg-glow:
    radial-gradient(1200px 600px at 10% -10%, color-mix(in srgb, var(--accent, #8b7cff) 6%, transparent), transparent 60%),
    radial-gradient(900px 500px at 105% 0%, rgba(52,211,153,0.035), transparent 55%);
  --surface: #101012;
  --surface-2: #171719;
  --surface-3: #202023;
  --surface-4: #2a2a2e;
  --border: #262629;
  --border-soft: #1a1a1c;
  --text: #ffffff;
  --text-dim: #a6a6a9;
  --text-faint: #6c6c70;

  --accent-spotify: #34d399;
  --accent-soundcloud: #ff8a4c;

  /* Acento do app — sobrescrito em runtime por js/appearance.js a partir
     da escolha salva em Configurações > Aparência. accent-ink é o texto
     legível sobre o acento (calculado por luminância, não fixo). */
  --accent: #8b7cff;
  --accent-strong: #a89bff;
  --accent-ink: #14121f;

  --danger: #ff5f7e;
  --success: #34d399;

  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;

  --font-display: "Bricolage Grotesque", "Space Grotesk", "Inter", sans-serif;
  --font-body: "Inter", "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", monospace;

  --shadow-card: 0 14px 34px rgba(0,0,0,0.5);
  --shadow-soft: 0 4px 16px rgba(0,0,0,0.4);
  --shadow-glow: 0 8px 24px color-mix(in srgb, var(--accent) 35%, transparent);
  --ease: cubic-bezier(.4,0,.2,1);
  --ease-spring: cubic-bezier(.34,1.56,.64,1);

  /* Densidade — alternável em Aparência, afeta o respiro das listas */
  --row-py: 8px;
  --row-gap: 14px;
}

body.density-compact {
  --row-py: 5px;
  --row-gap: 10px;
}

/* Tema claro — ativado via appearance.js (html[data-theme="light"]).
   Ícones/textos usam currentColor em todo o app, então nada precisa de
   filtro de inversão manual: eles já herdam a cor certa automaticamente
   quando essas variáveis mudam, incluindo a marca M+. */
html[data-theme="light"] {
  --bg: #f6f5fa;
  --bg-glow:
    radial-gradient(1200px 600px at 10% -10%, color-mix(in srgb, var(--accent, #8b7cff) 5%, transparent), transparent 60%);
  --surface: #ffffff;
  --surface-2: #f1eff6;
  --surface-3: #e7e4ee;
  --surface-4: #dad6e4;
  --border: #e1ddea;
  --border-soft: #ebe8f1;
  --text: #16141d;
  --text-dim: #5d5a68;
  --text-faint: #8d8a97;
  --shadow-card: 0 14px 34px rgba(30,20,50,0.14);
  --shadow-soft: 0 4px 16px rgba(30,20,50,0.1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
}

body {
  background-image: var(--bg-glow);
  background-attachment: fixed;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input[type="text"], input[type="range"] { font-family: inherit; }
::selection { background: var(--accent); color: var(--accent-ink); }
.hidden { display: none !important; }
a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-4); border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); background-clip: padding-box; }

/* ==========================================================
   LAYOUT
   ========================================================== */
.app-shell {
  display: grid;
  grid-template-rows: 1fr auto;
  grid-template-columns: 268px 1fr;
  grid-template-areas: "sidebar main" "player player";
  height: 100vh;
  gap: 0;
}

.sidebar {
  grid-area: sidebar;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 20px 16px 16px;
  background: var(--surface);
  border-right: 1px solid var(--border-soft);
  overflow: hidden;
}

.main { grid-area: main; overflow-y: auto; padding: 30px 40px 28px; }

/* ==========================================================
   BRAND
   ========================================================== */
.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 4px 6px 4px 4px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s ease;
  width: fit-content;
}
.brand:hover { background: var(--surface-2); }
.brand-mark { color: var(--accent); display: flex; filter: drop-shadow(0 2px 8px color-mix(in srgb, var(--accent) 45%, transparent)); }
.brand-text {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--text) 40%, var(--accent) 150%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand-text em { color: var(--accent); font-style: normal; -webkit-text-fill-color: var(--accent); }

/* ==========================================================
   SUA BIBLIOTECA (sidebar nav)
   ========================================================== */
.library-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 6px;
}
.library-header h3 {
  font-family: var(--font-display);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-faint);
  font-weight: 600;
  margin: 0;
}

.icon-btn {
  width: 30px; height: 30px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-dim);
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s var(--ease);
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); transform: scale(1.06); }

.library-list { display: flex; flex-direction: column; gap: 3px; min-height: 0; flex: 1; }
.library-list-scroll { list-style: none; margin: 6px 0 0; padding: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; flex: 1; min-height: 0; }

.library-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 8px;
  border-radius: var(--radius-sm);
  text-align: left;
  width: 100%;
  transition: background 0.14s ease;
  position: relative;
}
.library-item:hover { background: var(--surface-2); }
.pinned-item { margin-bottom: 4px; }

.library-tile {
  width: 34px; height: 34px;
  border-radius: 7px;
  background: var(--surface-3);
  color: var(--text-dim);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.liked-tile {
  background: linear-gradient(135deg, var(--accent), #ff6f8e);
  color: #1c0f16;
}
.liked-api-tile {
  background: linear-gradient(135deg, var(--accent-spotify), var(--accent-soundcloud));
  color: #0f1c14;
}
.shuffle-tile {
  background: var(--surface-4);
  color: var(--accent);
}

.library-item-text { display: flex; flex-direction: column; overflow: hidden; gap: 1px; flex: 1; min-width: 0; }
.library-item-title { font-size: 0.85rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.library-item-sub { font-size: 0.72rem; color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.library-item-delete {
  width: 26px; height: 26px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-faint);
  opacity: 0;
  flex-shrink: 0;
  transition: opacity 0.14s ease, color 0.14s ease, background 0.14s ease;
}
.library-item:hover .library-item-delete { opacity: 1; }
.library-item-delete:hover { color: var(--danger); background: var(--surface-3); }

/* ==========================================================
   SIDEBAR FOOTER — contas + configurações
   ========================================================== */
.sidebar-footer {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding-top: 10px;
  border-top: 1px solid var(--border-soft);
}

.connect-btn {
  display: flex;
  align-items: center;
  text-align: left;
  gap: 8px;
  padding: 9px 11px;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 0.79rem;
  font-weight: 500;
  color: var(--text-dim);
  transition: border-color 0.15s ease, transform 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.connect-btn:hover { border-color: var(--text-faint); color: var(--text); transform: translateY(-1px); }
.connect-btn.connected {
  border-color: var(--accent-spotify);
  color: var(--accent-spotify);
  background: color-mix(in srgb, var(--accent-spotify) 10%, var(--surface-2));
}
#connect-soundcloud.connected {
  border-color: var(--accent-soundcloud);
  color: var(--accent-soundcloud);
  background: color-mix(in srgb, var(--accent-soundcloud) 10%, var(--surface-2));
}

.status-dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 6px currentColor;
  flex-shrink: 0;
}

.settings-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 11px;
  border-radius: var(--radius);
  color: var(--text-dim);
  font-size: 0.79rem;
  font-weight: 500;
  transition: background 0.14s ease, color 0.14s ease;
}
.settings-btn:hover { background: var(--surface-2); color: var(--text); }

/* ==========================================================
   BUSCA + FILTROS
   ========================================================== */
.search-header { display: flex; flex-direction: column; gap: 16px; margin-bottom: 4px; }

.search-bar {
  width: 100%;
  max-width: 520px;
  padding: 13px 20px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.95rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.search-bar::placeholder { color: var(--text-faint); }
.search-bar:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface-3);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}

.filters { display: flex; gap: 10px; flex-wrap: wrap; }

.pill-group { display: flex; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: 999px; border: 1px solid var(--border); }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--text-dim);
  transition: background 0.18s var(--ease), color 0.18s var(--ease), transform 0.18s var(--ease);
}
.pill:hover { color: var(--text); }
.pill.active { background: var(--accent); color: var(--accent-ink); font-weight: 600; transform: scale(1.04); }

.pill-icon { flex-shrink: 0; opacity: 0.85; }
.pill.active .pill-icon { opacity: 1; }
.pill[data-value="spotify"] .pill-icon { color: var(--accent-spotify); }
.pill[data-value="soundcloud"] .pill-icon { color: var(--accent-soundcloud); }
.pill.active[data-value="spotify"] .pill-icon,
.pill.active[data-value="soundcloud"] .pill-icon { color: var(--accent-ink); }

/* ==========================================================
   CABEÇALHO DE RESULTADOS — normal, "capa grande" e navegação
   ========================================================== */
.results-header {
  display: flex;
  align-items: baseline;
  gap: 16px;
  flex-wrap: wrap;
  margin: 28px 0 18px;
  padding: 0;
  border-radius: var(--radius-lg);
  transition: padding 0.2s ease, background 0.2s ease;
}
.results-header h2 {
  font-family: var(--font-display);
  font-size: 1.18rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}
.results-sub { display: flex; align-items: center; gap: 14px; }
.results-sub-text { font-size: 0.83rem; color: var(--text-dim); }

/* selo de "crossfade" — o sinal visual assinatura do app: um degradê
   que atravessa as duas cores das plataformas passando pelo acento
   do app no meio, usado com moderação em cabeçalhos grandes. */
.results-header-big {
  align-items: center;
  padding: 36px 32px;
  background:
    linear-gradient(120deg, color-mix(in srgb, var(--accent-spotify) 18%, transparent) 0%,
      color-mix(in srgb, var(--accent) 22%, transparent) 48%,
      color-mix(in srgb, var(--accent-soundcloud) 16%, transparent) 100%),
    var(--surface-2);
  border: 1px solid var(--border);
}
.results-header-big h2 { font-size: 2.2rem; font-weight: 700; letter-spacing: -0.01em; }
.results-header-big .results-sub { flex-direction: row-reverse; }

.back-btn {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  margin-right: 2px;
  transition: background 0.14s ease, color 0.14s ease, transform 0.14s var(--ease);
}
.back-btn:hover { background: var(--surface-3); color: var(--text); transform: translateX(-2px); }

.play-all-btn {
  width: 46px; height: 46px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  display: flex; align-items: center; justify-content: center;
  padding-left: 3px;
  box-shadow: var(--shadow-glow);
  transition: transform 0.16s var(--ease-spring), box-shadow 0.16s var(--ease);
}
.play-all-btn:hover { transform: scale(1.08); }

.empty { color: var(--text-faint); font-size: 0.9rem; padding: 10px 4px; }
.home-hint { margin-top: 18px; }

/* ==========================================================
   HOME — acesso rápido
   ========================================================== */
.home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
}
.home-tile {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 11px;
  text-align: left;
  overflow: hidden;
  transition: background 0.16s ease, transform 0.16s var(--ease), border-color 0.16s ease;
}
.home-tile:hover { background: var(--surface-3); transform: translateY(-2px); border-color: var(--accent); }
.home-tile-icon {
  width: 50px; height: 50px;
  border-radius: 8px;
  background: var(--surface-4);
  color: var(--text-dim);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.home-tile-liked .home-tile-icon {
  background: linear-gradient(135deg, var(--accent), #ff6f8e);
  color: #1c0f16;
}
.home-tile-title { font-size: 0.9rem; font-weight: 600; }

/* ==========================================================
   PRATELEIRAS (Início + página de artista)
   ========================================================== */
.home-shelves { margin-top: 32px; display: flex; flex-direction: column; gap: 30px; }
.shelf-title {
  font-family: var(--font-display);
  font-size: 1.02rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 12px;
}
.shelf-row {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding: 2px 2px 6px;
  scroll-snap-type: x proximity;
}
.shelf-row::-webkit-scrollbar { height: 6px; }

.shelf-row-wrap { position: relative; }
.shelf-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 30px; height: 30px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-3);
  border: 1px solid var(--border);
  color: var(--text);
  box-shadow: var(--shadow-soft);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease, background 0.15s ease, transform 0.15s var(--ease);
  z-index: 3;
}
.shelf-row-wrap:hover .shelf-nav { opacity: 1; pointer-events: auto; }
.shelf-nav:hover { background: var(--surface-4); transform: translateY(-50%) scale(1.08); }
.shelf-nav-prev { left: -6px; }
.shelf-nav-next { right: -6px; }
.shelf-nav-disabled { opacity: 0 !important; pointer-events: none !important; }

.shelf-card, .album-card {
  flex: 0 0 154px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  text-align: left;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  scroll-snap-align: start;
  transition: background 0.16s ease, transform 0.16s var(--ease), border-color 0.16s ease;
  position: relative;
}
.shelf-card:hover, .album-card:hover { background: var(--surface-3); transform: translateY(-3px); border-color: var(--accent); }
.shelf-card-art, .album-card-art {
  width: 100%; aspect-ratio: 1 / 1;
  border-radius: 7px;
  object-fit: cover;
  background: var(--surface-3);
  margin-bottom: 8px;
  box-shadow: var(--shadow-soft);
}
.shelf-card-title, .album-card-title {
  font-size: 0.84rem; font-weight: 600;
  width: 100%;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.shelf-card-artist, .album-card-sub {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.74rem; color: var(--text-dim);
  width: 100%;
  overflow: hidden;
}
.shelf-card-artist-text, .album-card-sub-text {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
}
.shelf-card-badge { margin-top: 4px; }

.shelf-card-skeleton { cursor: default; }
.shelf-card-skeleton .shelf-card-art { background: none; }

.shelf-artist-card { flex: 0 0 148px; scroll-snap-align: start; }
.shelf-row .artist-card { flex: 0 0 148px; }

/* ==========================================================
   PÁGINA DE ARTISTA
   ========================================================== */
.artist-header {
  display: flex;
  align-items: flex-end;
  gap: 22px;
  padding: 34px 32px;
  border-radius: var(--radius-lg);
  margin: 0 0 30px;
  background:
    linear-gradient(120deg, color-mix(in srgb, var(--accent-spotify) 16%, transparent) 0%,
      color-mix(in srgb, var(--accent) 20%, transparent) 55%,
      color-mix(in srgb, var(--accent-soundcloud) 16%, transparent) 100%),
    var(--surface-2);
  border: 1px solid var(--border);
}
.artist-avatar-lg {
  width: 108px; height: 108px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface-4);
  box-shadow: var(--shadow-card);
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: 2.4rem;
  font-weight: 600;
  color: var(--text-dim);
}
.artist-meta { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.artist-eyebrow { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.09em; color: var(--text-dim); font-weight: 600; }
.artist-name-lg { font-family: var(--font-display); font-size: 2.4rem; font-weight: 700; letter-spacing: -0.01em; margin: 0; line-height: 1.05; }
.artist-stats { font-size: 0.83rem; color: var(--text-dim); }

.section-title {
  font-family: var(--font-display);
  font-size: 1.02rem;
  font-weight: 600;
  margin: 0 0 12px;
}
.artist-section { margin-bottom: 30px; }

/* ==========================================================
   LISTA DE FAIXAS
   ========================================================== */
.track-list { display: flex; flex-direction: column; gap: 1px; }

.track-row {
  display: grid;
  grid-template-columns: 40px 1fr auto auto auto;
  align-items: center;
  gap: var(--row-gap);
  padding: var(--row-py) 11px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.14s ease;
}
.track-row:hover { background: var(--surface-2); }

.track-art { width: 40px; height: 40px; border-radius: 6px; object-fit: cover; background: var(--surface-3); }

.track-meta { display: flex; flex-direction: column; overflow: hidden; gap: 2px; min-height: 46px; justify-content: center; }
.track-title { font-size: 0.9rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track-artist { font-size: 0.77rem; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track-extra { font-size: 0.7rem; color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.track-duration {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-faint);
  min-width: 34px;
  text-align: right;
}

/* Indicador de origem discreto — uma bolinha colorida com tooltip, no
   lugar do selo de texto "Spotify"/"SoundCloud" repetido em cada linha
   (era a maior fonte de poluição visual da lista). */
.source-dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  vertical-align: middle;
  box-shadow: 0 0 5px currentColor;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.track-row:hover .source-dot,
.shelf-card:hover .source-dot,
.artist-card .source-dot,
.album-card .source-dot { opacity: 1; }
.source-dot-spotify { background: var(--accent-spotify); color: var(--accent-spotify); }
.source-dot-soundcloud { background: var(--accent-soundcloud); color: var(--accent-soundcloud); }

.badge {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid;
  white-space: nowrap;
}
.badge-spotify { color: var(--accent-spotify); border-color: color-mix(in srgb, var(--accent-spotify) 45%, transparent); background: color-mix(in srgb, var(--accent-spotify) 8%, transparent); }
.badge-soundcloud { color: var(--accent-soundcloud); border-color: color-mix(in srgb, var(--accent-soundcloud) 45%, transparent); background: color-mix(in srgb, var(--accent-soundcloud) 8%, transparent); }

.preview-tag { font-size: 0.65rem; color: var(--text-faint); white-space: nowrap; font-style: italic; }

/* Ações da linha (curtir/adicionar/remover) só aparecem no hover — a
   curtida ativa continua sempre visível, pra dar pra ver o que já
   curtiu sem precisar passar o mouse em cada faixa. */
.track-row-actions { display: flex; align-items: center; gap: 2px; }
.like-btn, .remove-btn, .add-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
  opacity: 0;
  transition: transform 0.15s var(--ease), color 0.15s ease, background 0.15s ease, opacity 0.12s ease;
}
.track-row:hover .like-btn,
.track-row:hover .remove-btn,
.track-row:hover .add-btn,
.like-btn.liked { opacity: 1; }

.like-btn, .remove-btn { padding: 5px 7px; border-radius: 50%; }
.like-btn:hover, .remove-btn:hover { color: var(--text); background: var(--surface-3); transform: scale(1.12); }
.like-btn.liked { color: var(--accent); animation: pop 0.32s var(--ease); }
.remove-btn:hover { color: var(--danger); }
@keyframes pop { 0% { transform: scale(1); } 45% { transform: scale(1.4) rotate(-6deg); } 100% { transform: scale(1); } }

.add-btn { padding: 5px 8px; border-radius: 50%; }
.add-btn:hover { color: var(--accent); background: var(--surface-3); transform: scale(1.1) rotate(90deg); }

.playlist-menu {
  z-index: 60;
  min-width: 180px;
  max-width: 240px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 6px;
  opacity: 0;
  transform: translateY(-4px);
}
.menu-enter { animation: menuIn 0.16s var(--ease) forwards; }
@keyframes menuIn { to { opacity: 1; transform: translateY(0); } }
.playlist-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  transition: background 0.12s ease;
}
.playlist-menu-item:hover { background: var(--surface-3); }
.playlist-menu-empty { padding: 10px; font-size: 0.78rem; color: var(--text-faint); max-width: 200px; }

/* ==========================================================
   ARTIST / GENERIC GRID (busca por artista)
   ========================================================== */
.artist-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 16px; }
.artist-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
  padding: 16px 10px;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px solid var(--border);
  transition: background 0.16s ease, transform 0.16s var(--ease), border-color 0.16s ease;
}
.artist-card:hover { background: var(--surface-3); transform: translateY(-3px); border-color: var(--accent); }
.artist-avatar {
  width: 76px; height: 76px;
  border-radius: 50%;
  background: var(--surface-4);
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--text-dim);
}
.artist-avatar img { width: 100%; height: 100%; object-fit: cover; }
.artist-name { font-size: 0.86rem; font-weight: 600; }
.artist-followers { font-size: 0.7rem; color: var(--text-faint); }

/* ==========================================================
   BARRA DE REPRODUÇÃO
   ========================================================== */
.now-playing {
  grid-area: player;
  display: grid;
  grid-template-columns: 1fr minmax(280px, 640px) 1fr;
  align-items: center;
  gap: 20px;
  padding: 12px 22px;
  background: var(--surface);
  border-top: 1px solid var(--border-soft);
  min-height: 76px;
}
.now-playing.empty-state .now-controls,
.now-playing.empty-state .now-side { opacity: 0.45; pointer-events: none; }
.now-playing.empty-state .now-info { opacity: 0.55; }

.now-info { display: flex; align-items: center; gap: 12px; min-width: 0; }
.now-art-wrap { position: relative; flex-shrink: 0; }
.now-art-wrap img { width: 50px; height: 50px; border-radius: 7px; object-fit: cover; background: var(--surface-3); box-shadow: var(--shadow-soft); display: block; }
/* Único indicador de qual motor está tocando — um ponto discreto no
   canto da capa, no lugar do selo de texto + ponto na barra que
   existiam antes (dois indicadores pra mesma informação era ruído). */
.now-source-dot {
  position: absolute;
  right: -2px; bottom: -2px;
  width: 11px; height: 11px;
  border-radius: 50%;
  border: 2px solid var(--surface);
  box-shadow: 0 0 5px currentColor;
}
.now-source-dot.on-spotify { background: var(--accent-spotify); color: var(--accent-spotify); }
.now-source-dot.on-soundcloud { background: var(--accent-soundcloud); color: var(--accent-soundcloud); }
.now-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.now-text span:first-child { font-family: var(--font-display); font-size: 0.9rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.now-text span:last-child { font-size: 0.78rem; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.now-controls { display: flex; flex-direction: column; align-items: center; gap: 7px; width: 100%; }

.transport { display: flex; align-items: center; gap: 18px; }
.transport button { display: flex; align-items: center; justify-content: center; color: var(--text-dim); transition: color 0.14s ease, transform 0.14s var(--ease); }
.transport button:hover { color: var(--text); transform: scale(1.08); }
#play-pause {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--text);
  color: var(--bg);
  transition: transform 0.15s var(--ease-spring), background 0.15s ease;
}
#play-pause:hover { transform: scale(1.07); background: var(--accent); color: var(--accent-ink); }

.seek-row { display: flex; align-items: center; gap: 9px; width: 100%; }
.time-label { font-family: var(--font-mono); font-size: 0.66rem; color: var(--text-faint); min-width: 30px; text-align: center; user-select: none; }

.seek-track {
  position: relative;
  flex: 1;
  height: 14px;
  display: flex;
  align-items: center;
  cursor: pointer;
}
.seek-track::before {
  content: "";
  position: absolute;
  left: 0; right: 0;
  height: 4px;
  border-radius: 999px;
  background: var(--surface-4);
}
.seek-fill {
  position: absolute;
  left: 0;
  height: 4px;
  border-radius: 999px;
  width: 0%;
  /* feixe "crossfade": o sinal visual assinatura do app também aparece
     aqui — o degradê verde→acento→laranja atravessando a barra de
     progresso, como se as duas plataformas se misturassem tocando. */
  background: linear-gradient(90deg, var(--accent-spotify), var(--accent), var(--accent-soundcloud));
  transition: width 0.1s linear;
}
.seek-thumb {
  position: absolute;
  left: 0%;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--text);
  transform: translateX(-50%) scale(0);
  transition: transform 0.14s var(--ease);
  box-shadow: 0 0 0 3px var(--surface);
}
.seek-track:hover .seek-thumb { transform: translateX(-50%) scale(1); }

.now-side { display: flex; align-items: center; justify-content: flex-end; gap: 14px; }
.volume-control { display: flex; align-items: center; gap: 8px; }
.volume-icon { color: var(--text-dim); flex-shrink: 0; }

/* input[type=range] customizado — trilho fino + thumb que só cresce no
   hover/foco, consistente nos três motores de renderização */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 90px;
  height: 14px;
  background: transparent;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent) var(--vol, 80%), var(--surface-4) var(--vol, 80%));
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  margin-top: -4px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--text);
  box-shadow: 0 0 0 3px var(--surface);
  transform: scale(0.001);
  transition: transform 0.14s var(--ease);
}
input[type="range"]:hover::-webkit-slider-thumb,
input[type="range"]:focus-visible::-webkit-slider-thumb { transform: scale(1); }
input[type="range"]::-moz-range-track { height: 4px; border-radius: 999px; background: var(--surface-4); }
input[type="range"]::-moz-range-progress { height: 4px; border-radius: 999px; background: var(--accent); }
input[type="range"]::-moz-range-thumb {
  width: 12px; height: 12px;
  border: none;
  border-radius: 50%;
  background: var(--text);
  box-shadow: 0 0 0 3px var(--surface);
}


/* ==========================================================
   MODAL DE CONFIGURAÇÕES
   ========================================================== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(6,7,11,0.6);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal-card {
  width: 100%;
  max-width: 460px;
  max-height: min(88vh, 720px);
  overflow-y: auto;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 26px 26px 30px;
  animation: modalIn 0.2s var(--ease);
}
@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: translateY(0) scale(1); } }

.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.modal-head h2 { font-family: var(--font-display); font-size: 1.3rem; margin: 0; }

.modal-section { padding: 16px 0; border-top: 1px solid var(--border); }
.modal-section:first-of-type { border-top: none; padding-top: 4px; }
.modal-section h4 {
  font-family: var(--font-display);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  margin: 0 0 12px;
  font-weight: 600;
}

.modal-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 0;
}
.modal-row strong { font-size: 0.87rem; font-weight: 600; }
.modal-hint { font-size: 0.78rem; color: var(--text-dim); margin: 3px 0 0; line-height: 1.4; }

.modal-btn {
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.15s ease, transform 0.15s var(--ease), border-color 0.15s ease;
  flex-shrink: 0;
}
.modal-btn:hover { background: var(--surface-4); transform: translateY(-1px); }
.modal-btn-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.modal-btn-danger:hover { background: color-mix(in srgb, var(--danger) 14%, transparent); }

/* ---- Aparência: acentos, densidade ---- */
.appearance-row { padding: 10px 0; }
.accent-swatches { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.accent-swatch {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 2px solid transparent;
  background: var(--sw);
  transition: transform 0.14s var(--ease-spring), border-color 0.14s ease;
}
.accent-swatch:hover { transform: scale(1.1); }
.accent-swatch.active { border-color: var(--text); transform: scale(1.1); }
.accent-swatch-custom {
  width: 28px; height: 28px;
  border-radius: 50%;
  padding: 0;
  border: 2px solid var(--border);
  overflow: hidden;
  background: conic-gradient(from 0deg, #ff5f7e, #ffb454, #34d399, #4fb2ff, #8b7cff, #ff5f7e);
}
.accent-swatch-custom input[type="color"] {
  width: 140%; height: 140%;
  margin: -20%;
  border: none;
  cursor: pointer;
  background: none;
}

.density-toggle {
  display: flex;
  gap: 4px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px;
  margin-top: 8px;
  width: fit-content;
}
.density-option {
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--text-dim);
  transition: background 0.15s ease, color 0.15s ease;
}
.density-option.active { background: var(--accent); color: var(--accent-ink); font-weight: 600; }

/* ==========================================================
   TOAST
   ========================================================== */
.toast {
  position: fixed;
  bottom: 96px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: var(--surface-3);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 0.84rem;
  max-width: min(420px, calc(100vw - 40px));
  box-shadow: var(--shadow-card);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s var(--ease);
  z-index: 200;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto; }
.toast-success { border-color: color-mix(in srgb, var(--success) 50%, var(--border)); }
.toast-error { border-color: color-mix(in srgb, var(--danger) 50%, var(--border)); }
.toast-info { border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); }

/* ==========================================================
   SKELETONS
   ========================================================== */
.skeleton {
  background: linear-gradient(100deg, var(--surface-3) 30%, var(--surface-4) 50%, var(--surface-3) 70%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-radius: 6px;
}
@keyframes shimmer { 0% { background-position: 140% 0; } 100% { background-position: -40% 0; } }

.skeleton-list { display: flex; flex-direction: column; gap: 4px; }
.skeleton-row { display: flex; align-items: center; gap: 13px; padding: 10px 11px; }
.skeleton-art { width: 40px; height: 40px; border-radius: 6px; flex-shrink: 0; }
.skeleton-meta { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.skeleton-line { height: 11px; }
.shelf-card-skeleton .skeleton-line { margin-top: 6px; }

/* ==========================================================
   RESPONSIVO
   ========================================================== */
/* ==========================================================
   MOBILE — barra superior + gaveta deslizante + player expansível
   Nada fica inacessível: biblioteca/configurações abrem pela gaveta,
   e o player mantém TODOS os controles (só ficam num painel que expande
   ao tocar na faixa atual, em vez de sumirem).
   ========================================================== */
.mobile-topbar { display: none; }
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 89;
}
.now-expand-hint { display: none; }

@media (max-width: 880px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr auto;
    grid-template-areas: "topbar" "main" "player";
    height: 100vh;
  }

  .mobile-topbar {
    grid-area: topbar;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: var(--surface);
    border-bottom: 1px solid var(--border-soft);
    position: sticky;
    top: 0;
    z-index: 80;
  }
  .mobile-topbar-brand { font-family: var(--font-display); font-size: 1.1rem; font-weight: 700; }
  .mobile-topbar-brand em { color: var(--accent); font-style: normal; }

  /* A sidebar vira uma gaveta deslizante — mesmo HTML/JS de sempre,
     só a posição/visibilidade mudam por CSS. */
  .sidebar {
    position: fixed;
    top: 0; bottom: 0; left: 0;
    width: min(84vw, 320px);
    z-index: 90;
    transform: translateX(-100%);
    transition: transform 0.22s var(--ease);
    box-shadow: var(--shadow-card);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay:not(.hidden) { display: block; }

  .main { padding: 16px 14px 20px; }

  /* Player: linha compacta sempre visível (capa+título+play/pular).
     Tocar nela expande um painel com transporte completo, barra de
     progresso e volume — nenhum controle fica inacessível. */
  .now-playing {
    grid-template-columns: 1fr auto;
    grid-template-areas: "info info" "controls controls" "side side";
    row-gap: 10px;
    padding: 10px 14px;
    align-items: center;
  }
  .now-info { grid-area: info; cursor: pointer; }
  .now-expand-hint { display: flex; }
  .now-controls, .now-side { grid-area: controls; }
  .now-side { grid-area: side; }
  .now-controls, .now-side {
    display: none;
    max-height: 0;
    overflow: hidden;
  }
  .now-playing.expanded .now-controls,
  .now-playing.expanded .now-side {
    display: flex;
    max-height: none;
  }
  .now-playing.expanded { row-gap: 14px; padding-bottom: 16px; }
  .now-playing.expanded .now-side { justify-content: center; }
  .now-expand-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px; height: 26px;
    color: var(--text-faint);
    flex-shrink: 0;
    transition: transform 0.2s var(--ease);
  }
  .now-playing.expanded .now-expand-hint { transform: rotate(180deg); color: var(--text); }

  .results-header-big { padding: 24px 20px; }
  .artist-header { flex-direction: column; align-items: flex-start; padding: 24px 20px; }
  .artist-name-lg { font-size: 1.7rem; }
  .track-row { grid-template-columns: 34px 1fr auto; }
  .track-duration, .source-dot { display: none; }
}
