/**
 * @file
 * MediaHub listing page styles (light theme, RTL-friendly via logical props).
 */

:root {
  --mh-accent: #16a34a;
  --mh-accent-contrast: #ffffff;
  --mh-bg: #f6f7fb;
  --mh-surface: #ffffff;
  --mh-text: #111827;
  --mh-muted: #6b7280;
  --mh-border: #e5e7eb;
  --mh-hover: #f1f3f7;
  --mh-shadow: 0 1px 2px rgba(17, 24, 39, 0.05), 0 8px 24px rgba(17, 24, 39, 0.06);
  --mh-radius: 14px;
}

.mh-page {
  max-width: 1200px;
  margin-inline: auto;
  padding-block: 24px 64px;
  padding-inline: 16px;
  color: var(--mh-text);
}

/* ---------------------------------------------------------------- *
 * Head + buttons
 * ---------------------------------------------------------------- */

.mh-page__head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-block: 8px 18px;
}

.mh-page__head--collection {
  flex-wrap: wrap;
}

.mh-page__title {
  font-size: 22px;
  font-weight: 700;
  color: var(--mh-text);
  margin: 0;
  margin-inline-end: 6px;
}

.mh-page__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.mh-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--mh-border);
  background: var(--mh-surface);
  color: var(--mh-text);
  border-radius: 999px;
  padding: 9px 18px;
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.mh-btn svg {
  width: 16px;
  height: 16px;
  flex: none;
}

.mh-btn:hover {
  box-shadow: var(--mh-shadow);
  transform: translateY(-1px);
  background: var(--mh-surface);
  color: var(--mh-text);
}

.mh-btn--accent {
  background: var(--mh-accent);
  border-color: var(--mh-accent);
  color: var(--mh-accent-contrast);
}

.mh-btn--accent:hover {
  background: var(--mh-accent);
  color: var(--mh-accent-contrast);
  filter: brightness(1.05);
}

.mh-btn--accent:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.mh-btn--ghost {
  background: transparent;
}

/* ---------------------------------------------------------------- *
 * Filter bar — minimal floating pill controls
 * ---------------------------------------------------------------- */

.mh-filterbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-block-end: 22px;
}

.mh-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding-inline: 14px;
  border: 1px solid var(--mh-border);
  border-radius: 999px;
  background: var(--mh-surface);
  color: var(--mh-text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease,
    background 0.15s ease;
}

.mh-chip:hover {
  border-color: #cbd5e1;
}

.mh-chip:focus-within {
  border-color: var(--mh-accent);
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.14);
}

.mh-chip.is-active {
  border-color: var(--mh-accent);
  background: #f0fdf4;
}

.mh-chip.is-active .mh-chip__label {
  color: var(--mh-accent);
}

.mh-chip__label {
  font-size: 13px;
  font-weight: 600;
  color: var(--mh-muted);
  white-space: nowrap;
}

.mh-chip__sep {
  color: var(--mh-muted);
  font-size: 12px;
  opacity: 0.7;
}

.mh-chip svg {
  width: 15px;
  height: 15px;
  flex: none;
  color: var(--mh-muted);
}

/* Search pill */
.mh-chip--search {
  flex: 1 1 210px;
}

.mh-chip--search input {
  border: 0;
  background: transparent;
  width: 100%;
  min-width: 0;
  min-height: 100%;
  padding: 0;
  font: inherit;
  font-size: 14px;
  color: inherit;
  outline: none;
}

/* Selects inside chips: borderless, custom chevron on the inline-end */
.mh-chip select {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  background-color: transparent;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 4px center;
  background-size: 13px;
  font: inherit;
  font-size: 13.5px;
  color: inherit;
  min-height: 38px;
  max-width: 150px;
  padding-inline: 0 20px;
  cursor: pointer;
  outline: none;
}

[dir='ltr'] .mh-chip select {
  background-position: right 4px center;
}

.mh-chip select option {
  font-size: 14px;
}

/* Text and range inputs inside chips */
.mh-chip--input input,
.mh-chip--range input {
  border: 0;
  background: transparent;
  min-height: 38px;
  padding: 0;
  font: inherit;
  font-size: 13.5px;
  color: inherit;
  outline: none;
}

.mh-chip--input input {
  width: 120px;
}

.mh-chip--range input {
  width: 58px;
  text-align: center;
}

.mh-chip--range input[type='date'] {
  width: 112px;
  text-align: start;
}

.mh-chip--range input::placeholder {
  color: var(--mh-muted);
}

/* Favorites toggle chip */
.mh-chip--toggle {
  cursor: pointer;
}

.mh-chip--toggle input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}

.mh-chip--toggle.is-active svg {
  color: var(--mh-accent);
  fill: rgba(22, 163, 74, 0.2);
}

/* Reset chip (icon-only) */
.mh-chip--reset {
  width: 40px;
  justify-content: center;
  padding-inline: 0;
}

.mh-chip--reset svg {
  transition: transform 0.3s ease, color 0.15s ease;
}

.mh-chip--reset:hover svg {
  color: var(--mh-accent);
  transform: rotate(-180deg);
}

.mh-filterbar__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-inline-start: auto;
}

.mh-filterbar__apply {
  height: 40px;
}

.mediahub-hint,
.mediahub-warning {
  color: var(--mh-muted);
}

.mediahub-warning {
  color: #b45309;
  background: #fef3c7;
  border-radius: 10px;
  padding: 10px 14px;
}

/* ---------------------------------------------------------------- *
 * Listing region + cards
 * ---------------------------------------------------------------- */

.mh-listing {
  min-height: 240px;
}

.mh-listing.mh-loading .mh-grid {
  opacity: 0.45;
  pointer-events: none;
}

.mh-listing__meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-block: 0 14px;
  font-size: 13px;
  color: var(--mh-muted);
}

.mh-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 18px;
}

/* Shipped Views blocks (Related / Same artist): grid for views rows. */
.view-mediahub-blocks .view-content {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 18px;
}

.view-mediahub-blocks .views-row {
  margin: 0;
}

.mh-card {
  background: var(--mh-surface);
  border-radius: var(--mh-radius);
  padding: 10px 10px 14px;
  box-shadow: var(--mh-shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.mh-card:hover {
  transform: translateY(-2px);
}

.mh-card--active {
  outline: 2px solid var(--mh-accent);
  outline-offset: 2px;
}

.mh-card__cover {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  overflow: hidden;
  background: linear-gradient(135deg, #eef1f6, #f7f9fc);
}

.mh-card__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.mh-card__ph {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #b7bfcf;
}

.mh-card__ph svg {
  width: 42%;
  height: 42%;
}

.mh-card__dur {
  position: absolute;
  inset-block-start: 8px;
  inset-inline-end: 8px;
  background: rgba(17, 24, 39, 0.72);
  color: #fff;
  font-size: 11px;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 999px;
  direction: ltr;
}

.mh-card__play {
  position: absolute;
  inset-block-end: 8px;
  inset-inline-end: 8px;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: var(--mh-accent);
  color: var(--mh-accent-contrast);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(17, 24, 39, 0.28);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.mh-card__play svg {
  width: 20px;
  height: 20px;
}

.mh-card:hover .mh-card__play,
.mh-card:focus-within .mh-card__play {
  opacity: 1;
  transform: none;
}

.mh-card__play:focus {
  opacity: 1;
  transform: none;
  outline: 2px solid var(--mh-accent);
  outline-offset: 2px;
}

.mh-card__dl {
  position: absolute;
  inset-block-end: 8px;
  inset-inline-start: 8px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: var(--mh-text);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.18s ease;
  box-shadow: 0 2px 8px rgba(17, 24, 39, 0.18);
}

.mh-card__dl svg {
  width: 15px;
  height: 15px;
}

.mh-card:hover .mh-card__dl,
.mh-card:focus-within .mh-card__dl,
.mh-card__dl:focus {
  opacity: 1;
}

.mh-card__add {
  position: absolute;
  inset-block-end: 8px;
  inset-inline-start: 46px;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: var(--mh-text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.18s ease;
  box-shadow: 0 2px 8px rgba(17, 24, 39, 0.18);
}

.mh-card__add svg {
  width: 15px;
  height: 15px;
}

.mh-card__add:hover {
  color: var(--mh-accent);
}

.mh-card:hover .mh-card__add,
.mh-card:focus-within .mh-card__add,
.mh-card__add:focus {
  opacity: 1;
}

.mh-fav {
  position: absolute;
  inset-block-start: 8px;
  inset-inline-start: 8px;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: var(--mh-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(17, 24, 39, 0.18);
  opacity: 0;
  transition: opacity 0.18s ease;
}

.mh-fav svg {
  width: 16px;
  height: 16px;
}

.mh-fav.is-fav {
  opacity: 1;
  color: var(--mh-accent);
}

.mh-fav.is-fav svg path {
  fill: var(--mh-accent);
}

.mh-card:hover .mh-fav,
.mh-card:focus-within .mh-fav,
.mh-fav:focus,
.mh-fav.is-fav {
  opacity: 1;
}

.mh-card--unplayable .mh-card__cover {
  opacity: 0.85;
}

.mh-card__title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.45;
  margin: 10px 2px 2px;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.mh-card__title a {
  color: inherit;
  text-decoration: none;
}

.mh-card__title a:hover {
  color: var(--mh-accent);
}

.mh-card__sub {
  font-size: 12px;
  color: var(--mh-muted);
  margin: 0 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mh-card__meta {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--mh-muted);
  margin: 8px 2px 0;
}

.mh-card__meta svg {
  width: 12px;
  height: 12px;
  color: var(--mh-accent);
}

/* ---------------------------------------------------------------- *
 * Empty state
 * ---------------------------------------------------------------- */

.mh-empty {
  padding: 56px 20px;
  text-align: center;
  color: var(--mh-muted);
  background: var(--mh-surface);
  border: 1px dashed var(--mh-border);
  border-radius: var(--mh-radius);
}

.mh-empty svg {
  width: 44px;
  height: 44px;
  color: #c3cad8;
  margin-block-end: 10px;
}

.mh-empty p {
  margin: 0;
  font-size: 14px;
}

.mh-empty--config .button {
  margin-block-start: 14px;
}

/* ---------------------------------------------------------------- *
 * Pager
 * ---------------------------------------------------------------- */

.mh-listing .pager {
  margin-block-start: 28px;
}

.mh-listing .pager__items {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  padding: 0;
  margin: 0;
  list-style: none;
}

.mh-listing .pager__item a,
.mh-listing .pager__item.is-active span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid var(--mh-border);
  background: var(--mh-surface);
  font-size: 13px;
  text-decoration: none;
}

.mh-listing .pager__item a:hover {
  border-color: var(--mh-accent);
  color: var(--mh-accent);
}

.mh-listing .pager__item.is-active span {
  background: var(--mh-accent);
  border-color: var(--mh-accent);
  color: var(--mh-accent-contrast);
}

/* ---------------------------------------------------------------- *
 * Node stage (media node full pages, rendered by hook_node_view)
 * ---------------------------------------------------------------- */

.mh-stage {
  display: flex;
  gap: 24px;
  align-items: stretch;
  background: var(--mh-surface);
  border: 1px solid var(--mh-border);
  border-radius: var(--mh-radius);
  box-shadow: var(--mh-shadow);
  padding: 20px;
  margin-block: 8px 24px;
}

.mh-stage__art {
  position: relative;
  flex: none;
  width: 240px;
  align-self: flex-start;
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  overflow: hidden;
  background: linear-gradient(135deg, #eef1f6, #f7f9fc);
}

.mh-stage__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.mh-stage__ph {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #b7bfcf;
}

.mh-stage__ph svg {
  width: 38%;
  height: 38%;
}

.mh-stage__dur {
  position: absolute;
  inset-block-start: 10px;
  inset-inline-end: 10px;
  background: rgba(17, 24, 39, 0.72);
  color: #fff;
  font-size: 12px;
  line-height: 1;
  padding: 5px 10px;
  border-radius: 999px;
  direction: ltr;
}

.mh-stage__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mh-stage__kind {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--mh-muted);
}

.mh-stage__title {
  margin: 0;
  font-size: 26px;
  line-height: 1.3;
  color: var(--mh-text);
}

.mh-stage__sub {
  margin: 0;
  font-size: 15px;
  color: var(--mh-muted);
}

.mh-stage__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-block-start: 4px;
}

/* The favorite heart is absolutely positioned inside cards; here it is an
 * inline action button of the same family as .mh-btn. */
.mh-stage__actions .mh-fav {
  position: static;
  opacity: 1;
  width: 42px;
  height: 42px;
  border: 1px solid var(--mh-border);
  border-radius: 999px;
  background: var(--mh-surface);
  color: var(--mh-muted);
  box-shadow: none;
}

.mh-stage__actions .mh-fav svg {
  width: 18px;
  height: 18px;
}

.mh-stage__actions .mh-fav.is-fav {
  color: var(--mh-accent);
  border-color: var(--mh-accent);
}

.mh-stage__meta {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--mh-muted);
}

.mh-stage__meta svg {
  width: 14px;
  height: 14px;
  color: var(--mh-accent);
}

@media (max-width: 640px) {
  .mh-stage {
    flex-direction: column;
    gap: 16px;
  }

  .mh-stage__art {
    width: 100%;
    max-width: 320px;
    margin-inline: auto;
  }
}

/* ---------------------------------------------------------------- *
 * Utilities + responsive
 * ---------------------------------------------------------------- */

.mh-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

@media (max-width: 640px) {
  .mh-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
  }

  .mh-filterbar__actions {
    margin-inline-start: 0;
  }

  .mh-filterbar {
    gap: 8px;
  }

  .mh-chip {
    height: 38px;
  }

  .mh-chip--search {
    flex: 1 1 100%;
  }

  .mh-chip select {
    max-width: 120px;
  }

  .mh-filterbar__apply {
    flex: 1;
    justify-content: center;
  }

  .mh-card__add {
    inset-inline-start: 44px;
  }
}

.mh-stage__facts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 6px 0 0;
  padding: 0;
  list-style: none;
}

.mh-stage__facts li {
  display: inline-flex;
  gap: 6px;
  padding: 5px 12px;
  border: 1px solid var(--mh-border);
  border-radius: 999px;
  background: var(--mh-surface);
  font-size: 13px;
}

.mh-stage__facts li span {
  color: var(--mh-muted);
}

@media (hover: none) {
  .mh-card__play,
  .mh-card__add,
  .mh-card__dl,
  .mh-fav {
    opacity: 1;
    transform: none;
  }
}
