/* Search, library, artist and settings.

   Split out of app.css; load order is the cascade, so this file expects to
   come after the ones before it in index.html. */

/* ── Search View ────────────────────────────────── */

#view-search {
  display: flex;
  flex-direction: column;
  block-size: 100%;
}

.search-header {
  padding: 32px 48px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.search-input-wrapper {
  position: relative;
  inline-size: 100%;
  max-inline-size: 560px;
}

.search-input-wrapper svg {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  color: var(--text-muted);
}

#search-input {
  inline-size: 100%;
  block-size: 44px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid transparent;
  padding-inline-start: 48px;
  padding-inline-end: 16px;
  color: var(--text);
  font-size: 14px;
  line-height: 20px;
  font-family: inherit;
  /* No outline:none here: the app-wide ring in cross-cutting.css is what
     marks focus, and an ID-level none outranks its zero specificity. */
  transition: border-color 0.2s var(--ease-out), background 0.2s var(--ease-out);
}

#search-input:focus {
  border-color: rgba(255, 255, 255, 0.14);
}

/* THE ring, not a second invention: same token, same width, same offset as
   the :where() rule this input used to outrank. Written out so the field
   keeps it even if load order ever changes. */
#search-input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

#search-empty {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 20px;
}

#search-results {
  flex: 1;
  overflow-y: auto;
  padding: 0 48px 48px;
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.search-list {
  display: flex;
  flex-direction: column;
}

.search-list--songs .search-row {
  display: flex;
  align-items: center;
  block-size: 52px;
  border-radius: var(--radius-row);
  padding: 0 16px;
  gap: 16px;
  cursor: pointer;
  transition: background 0.15s var(--ease-out);
}

.search-list--songs .search-row:hover {
  background: rgba(255, 255, 255, 0.06);
}

.search-row-cover {
  inline-size: 40px;
  block-size: 40px;
  border-radius: var(--radius-art-sm);
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
  font-size: 18px;
  line-height: 1;
}

/* Same monogram fallback as the shelf cards (see shell.css): the initial
   over the gradient wherever a small slot has no artwork. Sized per slot. */
.search-row-cover,
.artist-card__cover,
.search-artist-cover {
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.92);
  font-weight: 700;
  user-select: none;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.5);
}

.artist-card__cover {
  font-size: 64px;
  line-height: 1;
}

.search-artist-cover {
  font-size: 22px;
  line-height: 1;
}

.search-row-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

.search-row-title {
  font-size: 14px;
  line-height: 20px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-row-artist {
  font-size: 12px;
  line-height: 16px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-row-snippet {
  font-size: 12px;
  line-height: 16px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-list--lyrics .search-row {
  block-size: auto;
  min-block-size: 52px;
  padding-block: 8px;
  align-items: center;
}

.search-row-duration {
  font-size: 12px;
  line-height: 16px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

.search-list--artists .search-row {
  display: flex;
  align-items: center;
  block-size: 64px;
  border-radius: 32px;
  padding: 0 16px;
  gap: 16px;
  cursor: pointer;
  transition: background 0.15s var(--ease-out);
}

.search-list--artists .search-row:hover {
  background: rgba(255, 255, 255, 0.06);
}

.search-artist-cover {
  inline-size: 48px;
  block-size: 48px;
  border-radius: 50%;
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
}

.search-cap-msg {
  font-size: 13px;
  line-height: 20px;
  color: var(--text-dim);
  margin-block-start: 12px;
  padding-inline-start: 16px;
}

.search-grid--albums {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
}

/* ── Recent searches ────────────────────────────────────────
   Idle-only, under the idle copy: a label row with a clear-all action and
   a wrap of query pills. Pills are 44px targets; the clear action borrows
   the same row so it never reads as a second idea. */

.search-recents {
  inline-size: 100%;
  max-inline-size: 440px;
  margin-block-start: 4px;
}

.search-recents[hidden] {
  display: none;
}

.search-recents__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-block-end: 12px;
}

.search-recents__title {
  margin: 0;
  font-size: 13px;
  line-height: 20px;
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--text-dim);
}

.search-recents__clear {
  min-block-size: 44px;
  padding-inline: 12px;
  border: 0;
  background: none;
  font: inherit;
  font-size: 13px;
  line-height: 20px;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-pill);
}

.search-recents__clear:hover {
  color: var(--text);
}

.search-recents__list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.search-recent {
  min-block-size: 44px;
  max-inline-size: 100%;
  padding-inline: 18px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid transparent;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  line-height: 20px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: background 0.15s var(--ease-out);
}

.search-recent:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* ── Library View ───────────────────────────────── */

.lib-grid--albums {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(176px, 1fr));
  row-gap: 24px;
  column-gap: 16px;
}

.lib-grid--artists {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(176px, 1fr));
  row-gap: 32px;
  column-gap: 16px;
}

.artist-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  text-decoration: none;
}
.artist-card__cover {
  inline-size: 176px;
  block-size: 176px;
  border-radius: 50%;
  background-size: cover;
  background-position: center;
  margin-block-end: 16px;
  transition: transform 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out);
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}
.artist-card:hover .artist-card__cover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.6);
}
.artist-card__name {
  font-size: 14px;
  line-height: 20px;
  font-weight: 600;
  color: var(--text);
  margin-block-end: 4px;
  text-align: center;
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.artist-card__count {
  font-size: 12px;
  line-height: 16px;
  color: var(--text-muted);
  text-align: center;
}

.lib-list--songs {
  display: flex;
  flex-direction: column;
}

/* ── Artist View ───────────────────────────────────────────── */

.artist-header {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-start;
  block-size: 459px;
  padding-block-end: 0;
  padding-inline: 0;
}

.artist-header__content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  gap: 24px;
  inline-size: 100%;
}

.artist-header__photo {
  flex: 0 0 auto;
  inline-size: 208px;
  block-size: 208px;
  border-radius: 50%;
  background: rgb(20, 20, 23);
  background-size: cover;
  background-position: center;
}

.artist-header__text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-inline-size: 0;
}

.artist-header__eyebrow {
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.7);
  margin-block-end: 6px;
}

.artist-header__name {
  font-size: 48px;
  font-weight: 700;
  letter-spacing: -1.2px;
  line-height: 48px;
  color: var(--text);
  margin: 0;
  margin-block-end: 4px;
}

.artist-header__meta {
  font-size: 14px;
  line-height: 20px;
  color: rgba(255, 255, 255, 0.6);
  margin-block-end: 20px;
}

.artist-header__controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* The reference's is 87x46 with a hairline border rather than a filled pill. */
.artist-follow-btn {
  block-size: 46px;
  padding-inline: 21px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
  cursor: pointer;
}

.artist-follow-btn:hover {
  background: rgba(255, 255, 255, 0.16);
}

.artist-follow-btn[aria-pressed="true"] {
  background: rgba(255, 255, 255, 0.22);
}

.artist-header__bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  filter: blur(60px);
  transform: scale(1.4);
  z-index: 0;
}

.artist-header__scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(13,10,20,0.1) 0%, var(--page) 100%);
  z-index: 0;
}


/* ── Settings View ─────────────────────────────────────────── */

.settings-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-art);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.settings-card__title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 16px;
  line-height: 24px;
  font-weight: 600;
  margin: 0;
  color: var(--text);
}

.settings-card__title svg {
  width: 20px;
  height: 20px;
  color: var(--accent);
}

.settings-card__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.settings-card__info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.settings-card__label {
  font-size: 14px;
  line-height: 20px;
  color: var(--text);
}

.settings-card__desc {
  font-size: 13px;
  line-height: 20px;
  color: var(--text-muted);
}

.settings-card__controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.settings-btn {
  height: 34px;
  border-radius: 17px;
  padding-inline: 16px;
  font-size: 13px;
  line-height: 20px;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.settings-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

.settings-btn--danger {
  background: rgba(239, 68, 68, 0.15); /* Tailwind red-500 @ 15% */
  color: #ef4444; /* Tailwind red-500 */
}

.settings-btn--danger:hover {
  background: rgba(239, 68, 68, 0.25);
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(255, 255, 255, 0.2);
  transition: 0.2s var(--ease-out);
  border-radius: 22px;
}

.toggle-slider:before {
  position: absolute;
  content: \;
  height: 18px;
  width: 18px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  transition: 0.2s var(--ease-out);
  border-radius: 50%;
}

input:checked + .toggle-slider {
  background-color: var(--accent);
}

input:checked + .toggle-slider:before {
  transform: translateX(18px);
}


/* ─ Liked Songs ───────────────────────────────────────────────
   A playlist header rather than an album one: the art is a gradient
   tile, not a cover, and it sits beside the text as it does in the reference. */

.liked-header {
  display: flex;
  align-items: flex-end;
  gap: 24px;
  padding: 72px 32px 0;
}

.liked-header__art {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  inline-size: 232px;
  block-size: 232px;
  border-radius: var(--radius-art-lg);
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-soft) 46%, var(--bg-glow-2) 100%);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
}

.liked-header__art svg {
  inline-size: 84px;
  block-size: 84px;
  color: rgba(255, 255, 255, 0.92);
}

.liked-header__meta {
  display: flex;
  min-inline-size: 0;
  flex-direction: column;
  align-items: flex-start;
}

.liked-header__title {
  margin: 0 0 10px;
  font-size: 48px;
  font-weight: 700;
  line-height: 48px;
  letter-spacing: -1.2px;
  color: var(--text);
}

.liked-header__controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-block-start: 24px;
}

#view-liked .album-tracks {
  padding-block-start: 40px;
}

.liked-empty {
  margin: 48px 32px;
  font-size: 15px;
  line-height: 22.5px;
  color: var(--text-muted);
}

/* Unlike sits in the row, visible on hover the way the reference's row actions do. */
.track-row__unlike {
  position: relative;
  display: grid;
  place-items: center;
  inline-size: 32px;
  block-size: 32px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  opacity: 0;
  cursor: pointer;
  transition: opacity 0.15s var(--ease-out);
}

/* The paint stays 32px; the hit-area reaches 44px through ::before. */
.track-row__unlike::before {
  content: '';
  position: absolute;
  inset: -6px;
}

.track-row:hover .track-row__unlike,
.track-row:focus-within .track-row__unlike,
.track-row__unlike:focus-visible {
  opacity: 1;
}

/* Touch has no hover to reveal the action with — it is always shown. */
@media (hover: none) {
  .track-row__unlike {
    opacity: 1;
  }
}

.track-row__unlike svg {
  inline-size: 17px;
  block-size: 17px;
}

.album-btn:disabled {
  opacity: 0.4;
  cursor: default;
}


/* ─ Browse ────────────────────────────────────────────────────
   The reference's tile grid, measured on its search page: 263x132 cells at a
   2:1 ratio, 36px radius, label 18px/600 with -0.45px tracking. */

.browse-section {
  padding-inline: 32px;
  margin-block-end: 40px;
}

.browse-section .shelf__title {
  margin-block-end: 16px;
}

.browse-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.browse-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  aspect-ratio: 2 / 1;
  padding: 16px 18px;
  border-radius: var(--radius-art);
  background-size: cover;
  background-position: center;
  overflow: hidden;
  transition: transform 0.15s var(--ease-out);
}

.browse-tile::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.55), transparent 62%);
}

.browse-tile:hover {
  transform: translateY(-2px);
}

.browse-tile__label,
.browse-tile__count {
  position: relative;
  z-index: 1;
}

.browse-tile__label {
  font-size: 18px;
  line-height: 22.5px;
  font-weight: 600;
  letter-spacing: -0.45px;
  color: #fff;
}

.browse-tile__count {
  font-size: 12px;
  line-height: 16px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.75);
}

.browse-count {
  margin: 0 0 20px;
  padding-inline: 32px;
  font-size: 14px;
  line-height: 20px;
  color: var(--text-muted);
}

#view-browse .lib-grid--albums {
  padding-inline: 32px;
}


/* ─ Playlists ─────────────────────────────────────────────── */

.pinned-item__art--playlist {
  background: linear-gradient(135deg, var(--surface-3), var(--surface-2));
  color: var(--text-muted);
}

.pinned-item__art--playlist svg {
  inline-size: 20px;
  block-size: 20px;
  fill: none;
  stroke: currentColor;
}

.liked-header__art--playlist {
  background: linear-gradient(135deg, var(--accent-soft) 0%, var(--bg-glow-2) 62%, var(--surface-3) 100%);
}
