/* ============================================================
   Resources page – table responsiveness + smaller Download button
   ============================================================ */

/* Safety: prevent any horizontal overflow inside the content area */
.members-page__content {
  overflow-x: hidden;
}

/* Table base */
.resources-table {
  width: 100%;
  table-layout: fixed;
}

.resources-table td,
.resources-table th {
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Prevent 1px clipping inside overflow-hidden rounded cards */
.resources-song,
.resources-song * {
  box-sizing: border-box;
}

/* Ensure text never renders flush against the clipped edge */
.resources-table td {
  padding-right: 1rem;
}

.resources-sort-arrow {
  margin-left: 0.35em;
  font-size: 0.85em;
  opacity: 0.5;
}

/* On small screens, allow the main label to wrap (no ellipsis) */
@media (max-width: 560px) {
  .resources-item__label {
    white-space: normal;
  }
}

/* Mobile: hide Modified column, show inline "Modified …" line,
   and shorten sort labels */
@media (max-width: 720px) {
  /* Hide Modified + Download columns */
  .resources-table th:nth-child(2),
  .resources-table td:nth-child(2),
  .resources-table th:nth-child(3),
  .resources-table td:nth-child(3) {
    display: none;
  }

  /* Show Modified inline under the resource text */
  .resources-item__mobile-modified {
    display: block;
  }

  /* resources-sort-btn mobile sizing (avoid clipping) */
  .resources-sortbar__cell .resources-sort-btn {
    width: 100%;
    text-align: center;
    font-size: 0.85rem;
    white-space: normal;
    line-height: 1.15;
  }
}

/* Default: inline mobile-modified hidden unless narrow breakpoint */
.resources-item__mobile-modified {
  display: none;
}

/* Desktop column sizing: keep Resource flexible, make the other two fixed */
@media (min-width: 720px) {
  /* Date column: fixed-ish, no wrapping */
  .resources-table th:nth-child(2),
  .resources-table td:nth-child(2) {
    width: 11ch; /* enough for YYYY-MM-DD */
    white-space: nowrap;
  }

  /* Download column: small and always inside */
  .resources-table th:nth-child(3),
  .resources-table td:nth-child(3) {
    width: 3.5rem;
    white-space: nowrap;
    text-align: right;
  }

  .resources-table__action {
    text-align: right;
  }

  .resources-table__download {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}
/* Make the Download button smaller on this page only
   (global .btn padding is quite generous) */
.resources-table .btn.btn-primary {
  padding: 0.35rem 0.9rem;
  font-size: 0.9rem;
  white-space: nowrap;
}

/* Clickable rows + subtle hover (matches global “pill” hover behaviour) */
.resources-table__row {
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.resources-table__row:hover {
  background: rgba(101, 0, 0, 0.06); /* same tint logic as .btn-ghost:hover */
}

.resources-table__row td {
  padding-top: 0.45rem;
  padding-bottom: 0.45rem;
}

/* Keep icon compact */
.resources-table__action {
  width: 1%;
  white-space: nowrap;
  text-align: right;
}

.resources-table__download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0.55rem;
  border-radius: 999px;
  text-decoration: none;
}

/* Make icon “feel clickable” reminding of nav/social hover */
.resources-table__download:hover,
.resources-table__download:focus-visible {
  background: rgba(101, 0, 0, 0.1);
}

/* Left-align table headings on Resources page */
.resources-table th {
  text-align: left;
}

/* Resource column must always be allowed to wrap (overrides any global nowrap) */
.resources-table td:nth-child(1),
.resources-table th:nth-child(1),
.resources-table td:nth-child(1) .resources-item__label,
.resources-table td:nth-child(1) .resources-item__sublabel {
  white-space: normal;
}

/* Song “cards” (calendar-ish layout, but page-local) */
/* Song card container — match Calendar event card */
.resources-song {
  border-radius: 0.75rem;
  background: #ffffff;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.06);
  overflow: hidden;
  border: 1px solid #e5e5e5;
  margin-bottom: 0.9rem;
}

/* Dark mode — match Calendar event card */
body.theme-dark .resources-song {
  background: var(--bg-card);
  border-color: var(--border-subtle);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.55);
}

.resources-song__summary {
  list-style: none;
  cursor: pointer;
  padding: 0.8rem 1rem 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  position: relative;
}

.resources-song__summary::-webkit-details-marker {
  display: none;
}

/* .resources-song__title {
  font-weight: 700;
} */

.resources-song__meta {
  opacity: 0.75;
  font-size: 0.95em;
  white-space: nowrap;
}

.resources-song[open] .resources-song__summary {
  border-bottom: 1px solid var(--border);
}

.resources-song__body {
  padding: 0.25rem 0.75rem 0.75rem;
}

/* Hover background — match Calendar */
.resources-song__summary:hover {
  background: rgba(101, 0, 0, 0.05);
}

/* Match Calendar meta/title spacing and typography */
.resources-song__summary-left {
  width: 100%;
}

.resources-song__meta-line {
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 0.4rem;
  margin-bottom: 0.1rem;
}

/* Chevron — mirror Calendar behaviour */
.resources-row-chevron {
  font-size: 0.9rem;
  color: var(--text-muted);
  transition:
    transform 0.2s ease,
    color 0.2s ease;
}

.resources-song:hover .resources-row-chevron {
  color: var(--text-main);
}

/* Rotate chevron when open */
.resources-song[open] .resources-row-chevron {
  transform: translateY(4px) rotate(180deg);
}

.resources-song__main-line {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: baseline;
  gap: 0;
  min-width: 0;
}

.resources-song__title {
  margin: 0; /* IMPORTANT: remove default top margin */
  font-weight: 600;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.resources-item__sublabel {
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--text-muted);
  line-height: 1.2;
  margin-top: 0.15rem;
}

/* Top-level sort headers (match inner table header vibe) */
/* .resources-sortbar {
  display: grid;
  grid-template-columns: 1fr auto;
  column-gap: 1.5rem;
  margin: 0 0 0.75rem 0;
} */

/* Make sort headers behave like <th> */
.resources-sortbar__cell {
  padding: 0.45rem 0.25rem;
  cursor: pointer;

  /* inherit table header typography */
  font-weight: inherit;
  font-size: inherit;
  color: inherit;
}

/* Explicitly inherit from resources table headers */
.resources-table th,
.resources-sortbar__cell {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.resources-sortbar__cell:hover {
  text-decoration: underline;
}

body.theme-dark .resources-sortbar__item {
  color: var(--text-muted);
}

/* “(9 files)” — match Calendar (Performance) */
.resources-song__count {
  font-weight: 500;
  margin-left: 0.25rem;
  color: var(--brand-primary);
  white-space: nowrap;
}

/* Resource type / mix badge */
.resources-badge {
  display: inline-block;
  min-width: 2.2em;
  padding: 0.15em 0.45em;
  margin-right: 0.5em;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-align: center;
  vertical-align: middle;

  border: 1px solid currentColor;
  opacity: 0.8;
}

/* Slightly differentiate non-audio types */
.resources-badge--video,
.resources-badge--lyrics,
.resources-badge--score {
  opacity: 0.65;
}

body.theme-dark .resources-song__summary:hover {
  background: rgba(255, 255, 255, 0.06);
}

/* Dark mode overrides at bottom of file */
body.theme-dark .resources-table__row:hover {
  background: rgba(255, 255, 255, 0.06);
}

body.theme-dark .resources-table__download:hover,
body.theme-dark .resources-table__download:focus-visible {
  background: rgba(255, 255, 255, 0.12);
}

.resources-admin-toggle {
  margin-bottom: 0.75rem;
}

/* Force wrapping for Resource text (override any global nowrap) */
.resources-table td:first-child,
.resources-item__label,
.resources-item__sublabel,
.resources-item__mobile-modified {
  white-space: normal !important;
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* If label was ever made flex/inline-flex, block it so it wraps naturally */
.resources-item__label {
  display: block !important;
}

/* =========================================================
   Resources sort bar – authoritative layout
   ========================================================= */

/* Desktop / tablet */
.resources-sortbar {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin: 0 0 0.75rem 0;
  /* padding-top: 1.25rem; */
}

.resources-sortbar__cell {
  flex: 0 0 11rem; /* fixed equal width */
  display: flex;
  justify-content: flex-end; /* keep pill snug to the right edge */
  align-items: center;
}

/* Ensure the pill fills its cell so the two are identical widths */
.resources-sortbar__cell .resources-sort-btn {
  width: 100%;
  text-align: center;
}

/* Mobile */
@media (max-width: 720px) {
  .resources-sortbar {
    justify-content: space-between; /* push one left, one right */
  }

  .resources-sortbar__cell {
    flex: 0 0 calc(50% - 0.25rem); /* two equal halves minus half the gap */
    justify-content: center;
  }
}
