/* Admin — Sonic Pulse. Most styling is Tailwind utilities in admin.html and
 * the Catalogue tab inside host.html. This stylesheet holds rules tied to the
 * DOM that admin-ui.js emits (status badges, play/edit icon-button states) —
 * Tailwind can't be applied to JS-generated elements without changing
 * admin-ui.js. */

/* ---- Status badges ------------------------------------------------------- */

.badge {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.badge--active {
  background: rgba(76, 215, 246, 0.15);
  color: #4cd7f6;
  border: 1px solid rgba(76, 215, 246, 0.35);
}
.badge--archived {
  background: rgba(255, 176, 205, 0.15);
  color: #ffb0cd;
  border: 1px solid rgba(255, 176, 205, 0.35);
}

/* Per-row Play button: small round icon, toggles to pause while playing. */
.play-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(208, 188, 255, 0.24);
  background: rgba(208, 188, 255, 0.06);
  color: #cbc3d7;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.play-btn svg { display: block; }
@media (hover: hover) {
  .play-btn:hover {
    color: #4cd7f6;
    border-color: #4cd7f6;
  }
}
.play-btn.is-playing {
  background: #4cd7f6;
  color: #003640;
  border-color: #4cd7f6;
  box-shadow: 0 0 12px rgba(76, 215, 246, 0.4);
}

/* Per-row action cluster: play + edit side by side, centered in the cell. */
.track-actions {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

/* Secondary round icon button (edit). Mirrors .play-btn sizing, primary tint. */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(208, 188, 255, 0.24);
  background: rgba(208, 188, 255, 0.06);
  color: #cbc3d7;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.icon-btn svg { display: block; }
@media (hover: hover) {
  .icon-btn:hover {
    color: #d0bcff;
    border-color: #d0bcff;
  }
}

/* ---- Mobile section tabs (segmented control in the header) -------------- */
/* Sidebar nav is hidden below md; these tabs replace it on phones. */
.admin-tab {
  flex: 1 1 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.5rem;
  border: 0;
  border-radius: 0.5rem;
  background: transparent;
  color: #cbc3d7;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.admin-tab .material-symbols-outlined { font-size: 1.15rem; }
.admin-tab[aria-current="page"] {
  background: rgba(76, 215, 246, 0.12);
  color: #4cd7f6;
}

/* ---- Import status text -------------------------------------------------- */

.import-status { min-height: 1.2rem; color: #cbc3d7; }
.import-status.ok { color: #4cd7f6; }
.import-status.err { color: #ffb4ab; }

/* ---- Pagination (emitted by renderPagination) --------------------------- */

#tracks-pagination button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 38px;
  padding: 0 0.6rem;
  border-radius: 8px;
  border: 1px solid rgba(73, 68, 84, 0.6);
  background: transparent;
  color: #cbc3d7;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: color 120ms, border-color 120ms, background 120ms;
}
@media (hover: hover) {
  #tracks-pagination button:hover:not(:disabled) {
    color: #d0bcff;
    border-color: #d0bcff;
  }
}
#tracks-pagination .page-nav:disabled { opacity: 0.3; cursor: default; }
#tracks-pagination .page-nav svg { display: block; }
#tracks-pagination .page-btn.active {
  background: #d0bcff;
  color: #3c0091;
  border-color: #d0bcff;
  cursor: default;
}
#tracks-pagination .page-gap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 38px;
  color: #8b8497;
  font-family: "JetBrains Mono", monospace;
  user-select: none;
}

/* ---- Tracks table -> mobile cards --------------------------------------- */
/* The 6-column tracks table cannot fit a phone. Below 768px each <tr> reflows
   into a tappable card: artist (bold), title, "genre · year", with the play
   button pinned top-right. The whole card opens the editor (main-admin wires the
   row tap); the per-row edit pencil and bulk-select checkbox are desktop-only. */
@media (max-width: 767px) {
  #tracks-table thead { display: none; }
  #tracks-table,
  #tracks-table tbody,
  #tracks-body tr,
  #tracks-body td {
    display: block;
  }
  #tracks-body tr {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0 0.4rem;
    padding: 0.85rem 3.5rem 0.85rem 1rem;
    cursor: pointer;
  }
  @media (hover: hover) {
    #tracks-body tr:hover { background: rgba(208, 188, 255, 0.04); }
  }
  #tracks-body td {
    padding: 0 !important;
    border: 0 !important;
    text-align: left !important;
  }
  #tracks-body td[data-col="select"],
  #tracks-body td[data-col="actions"] .icon-btn {
    display: none;
  }
  #tracks-body td[data-col="artist"] {
    order: 1;
    flex: 1 0 100%;
    font-weight: 700;
    font-size: 0.95rem;
    color: #e5e1e4;
  }
  #tracks-body td[data-col="title"] {
    order: 2;
    flex: 1 0 100%;
    color: #cbc3d7;
    font-size: 0.9rem;
  }
  #tracks-body td[data-col="genre"],
  #tracks-body td[data-col="year"] {
    color: #958ea0;
    font-family: "JetBrains Mono", monospace;
    font-size: 0.78rem;
  }
  #tracks-body td[data-col="genre"] { order: 3; }
  #tracks-body td[data-col="year"] { order: 4; }
  #tracks-body td[data-col="year"]::before { content: "· "; }
  #tracks-body td[data-col="actions"] {
    order: 5;
    position: absolute;
    top: 0.85rem;
    right: 1rem;
  }

  /* Genres table -> cards, same as tracks. Name (bold), slug · N tracks, with
     the status badge pinned top-right. Order column and edit pencil are dropped
     (the whole card taps to open the editor, where order is editable). */
  #genres-table thead { display: none; }
  #genres-table,
  #genres-table tbody,
  #genres-body tr,
  #genres-body td {
    display: block;
  }
  #genres-body tr {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0 0.4rem;
    padding: 0.85rem 6rem 0.85rem 1rem;
    cursor: pointer;
  }
  @media (hover: hover) {
    #genres-body tr:hover { background: rgba(208, 188, 255, 0.04); }
  }
  #genres-body td {
    padding: 0 !important;
    border: 0 !important;
    text-align: left !important;
  }
  #genres-body td[data-col="order"],
  #genres-body td[data-col="actions"] {
    display: none;
  }
  #genres-body td[data-col="name"] {
    order: 1;
    flex: 1 0 100%;
    font-weight: 700;
    font-size: 0.95rem;
    color: #e5e1e4;
  }
  #genres-body td[data-col="slug"],
  #genres-body td[data-col="count"] {
    color: #958ea0;
    font-family: "JetBrains Mono", monospace;
    font-size: 0.78rem;
  }
  #genres-body td[data-col="slug"] { order: 2; }
  #genres-body td[data-col="count"] { order: 3; }
  #genres-body td[data-col="count"]::before { content: "· "; }
  #genres-body td[data-col="count"]::after { content: " tracks"; }
  #genres-body td[data-col="status"] {
    position: absolute;
    top: 0.85rem;
    right: 1rem;
  }
}
