/*
 * Destination pages: AI Movies & Videos · Music · Books · My Library · News · Elia Chat.
 * Every page reuses the Games composition — breadcrumb, page header, featured
 * banner, category pills and the 6-up pax-card grid — so the whole app reads as
 * one product. Only collection-specific tools and states live here.
 */

/* ── Shared frame ─────────────────────────────────────────────────────── */
.destinations[hidden],
.dest-view[hidden] {
  display: none !important;
}

.destinations {
  width: 100%;
}

.dest-view.games-view-container {
  min-width: 0;
}

.dest-spotlight:empty {
  display: none;
}

.dest-body {
  display: flex;
  flex-direction: column;
  gap: clamp(0.9rem, 0.7rem + 0.7vw, 1.25rem);
  min-width: 0;
  max-width: 100%;
}

/* ── Toolbar: pills, search and result count ──────────────────────────── */
.dest-toolbar {
  display: flex;
  flex-direction: column;
  gap: clamp(0.65rem, 0.5rem + 0.5vw, 0.9rem);
  min-width: 0;
}

.media-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
}

.media-tools input,
.media-tools select {
  min-height: 42px;
  min-width: 0;
  padding: 0 16px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  background: var(--bg-card);
  color: var(--text-main);
  font: inherit;
  font-size: 13px;
  box-shadow: var(--shadow-subtle);
}

.media-tools input {
  flex: 1 1 220px;
  max-width: 420px;
}

.media-tools select {
  flex: 0 1 210px;
  max-width: 210px;
}

.media-tools input::placeholder {
  color: var(--text-subtle);
}

.media-tools input:focus-visible,
.media-tools select:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

.media-result-count {
  margin: 0 0 0 auto;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ── Collections ──────────────────────────────────────────────────────── */
.dest-body .content-grid-6 {
  align-items: stretch;
}

.dest-body .empty-msg,
.library-shelves > .empty-msg {
  grid-column: 1 / -1;
  margin: 0;
}

/* ── Media cards: same anatomy as a Games card ────────────────────────── */
.pax-card[data-media-id]:focus-visible,
.pax-card[data-saved-game]:focus-visible,
a.pax-card:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 3px;
}

.media-thumb-glyph {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #1e3a8a, #0b2a6b);
  color: rgba(255, 255, 255, 0.9);
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.media-progress {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 4px;
  max-width: 100%;
  background: var(--primary);
}

.pax-bookmark-btn[aria-pressed="true"] {
  color: #ef4444;
}

.pax-bookmark-btn[aria-pressed="true"] svg path {
  fill: currentColor;
}

.pax-bookmark-btn svg {
  display: block;
}

/* ── Featured banner (reuses the Games markup) ────────────────────────── */
.dest-spotlight-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(120% 140% at 85% 15%, rgba(0, 194, 255, 0.22), transparent 60%),
    linear-gradient(135deg, #1e3a8a, #0b2a6b);
}

.dest-spotlight-fallback span {
  font-size: clamp(64px, 9vw, 132px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.04em;
  color: rgba(255, 255, 255, 0.16);
}

.games-featured-title a {
  color: inherit;
  text-decoration: none;
}

.games-featured-title a:hover {
  text-decoration: underline;
}

/* ── My Library shelves ───────────────────────────────────────────────── */
.library-shelves {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.library-block {
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
}

.library-block > .ui-section-header {
  margin: 0 0 14px;
  padding: 0;
}

.library-block > .ui-section-header .ui-section-title {
  font-size: 16px;
}

.library-block .empty-msg {
  padding: 24px;
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--bg-muted);
  font-size: 12px;
  color: var(--text-muted);
}

/* ── News ─────────────────────────────────────────────────────────────── */
.dest-news-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dest-news-status {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.dest-refresh {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 8px 18px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  background: var(--bg-card);
  color: var(--text-main);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-subtle);
  transition: var(--transition-smooth);
}

.dest-refresh:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.dest-refresh:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

.dest-news-band {
  margin: 0;
}

.dest-news-results {
  display: grid;
  gap: 18px;
}

.dest-news-band .games-featured-actions {
  margin-top: 4px;
}

.dest-news-band .games-featured-actions .btn-play-featured {
  text-decoration: none;
}

.pax-card.news-card {
  padding: 0;
  color: inherit;
}

.news-card .pax-card-info {
  gap: 6px;
  flex: 1;
}

.news-card-title {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
  color: var(--text-main);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.news-card .pax-card-footer {
  flex-wrap: wrap;
  gap: 4px 8px;
}

.news-card .pax-tag-pill {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.news-card-date {
  margin-left: auto;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-subtle);
  white-space: nowrap;
}

.dest-skeleton {
  display: grid;
  gap: 12px;
  padding: 24px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
}

.dest-skeleton span {
  display: block;
  height: 14px;
  border-radius: 999px;
  background: var(--bg-muted);
  animation: destPulse 1.4s ease-in-out infinite;
}

.dest-skeleton span:first-child {
  width: 42%;
  height: 22px;
}

.dest-skeleton span:nth-child(2) {
  width: 88%;
}

.dest-skeleton span:nth-child(3) {
  width: 64%;
}

@keyframes destPulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

/* ── Elia Chat: the page header replaces the in-panel heading ─────────── */
.dest-view[data-dest="settings"] .elia-heading {
  display: none;
}

.dest-view[data-dest="settings"] .elia {
  width: 100%;
}

.dest-view[data-dest="settings"] .elia-workspace {
  gap: 18px;
}

.dest-view[data-dest="settings"] .elia-chat,
.dest-view[data-dest="settings"] .elia-local-card {
  border-radius: var(--radius-lg);
}

.dest-view[data-dest="settings"] .elia-footer {
  padding-bottom: 0;
}

/* ── Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .media-result-count {
    margin-left: 0;
  }
}

@media (max-width: 600px) {
  .media-tools {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
  }

  .media-tools input,
  .media-tools select {
    width: 100%;
    max-width: 100%;
    flex: 0 0 auto;
  }

  .dest-news-bar {
    align-items: flex-start;
  }

  .dest-view[data-dest="settings"] .elia-chat-top {
    flex-wrap: wrap;
    gap: 12px;
    padding: 16px 18px;
  }

  .dest-view[data-dest="settings"] .elia-chat-controls {
    width: 100%;
    justify-content: space-between;
  }

  .dest-view[data-dest="settings"] .elia-chat {
    height: 64dvh;
    min-height: 420px;
  }

  .dest-view[data-dest="settings"] .elia-log {
    padding: 16px 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dest-skeleton span {
    animation: none;
  }
}
