/* ==========================================================================
   Bookmarks Page — Dedicated Saved Reading List Styles
   Inherits ../shared/{tokens,auth,briefing-base}.css
   ========================================================================== */

/* Performance: skip offscreen card layout/paint */
.bookmarks-page .news-card,
.bookmarks-page .positive-card {
  content-visibility: auto;
  contain-intrinsic-size: auto 260px;
}

/* Masthead Sort Select (matches 32px .masthead-btn) */
.bm-sort-select {
  appearance: none;
  height: 32px;
  padding: 0 26px 0 11px;
  background-color: var(--surface-subtle);
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-muted) 50%),
    linear-gradient(135deg, var(--ink-muted) 50%, transparent 50%);
  background-position: calc(100% - 13px) 13px, calc(100% - 8px) 13px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--ink-secondary);
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.bm-sort-select:hover,
.bm-sort-select:focus-visible {
  border-color: var(--border-strong);
  color: var(--ink);
}

/* Sticky Filter Bar */
.bm-filter-bar {
  display: flex;
  align-items: center;
  gap: 18px;
  white-space: nowrap;
}

.bm-filter-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 10px 0;
  color: var(--ink-secondary);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.bm-filter-tab:hover,
.bm-filter-tab.active {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

.bm-filter-tab.active {
  font-weight: 600;
}

.bm-tab-count {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  color: var(--ink-muted);
}

.bm-filter-tab.active .bm-tab-count {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 30%, transparent);
  color: var(--accent);
}

/* Expiry Alert Banner */
.bm-expiry-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 11px 16px;
  margin-bottom: 18px;
  background: var(--warn-soft);
  border: 1px solid color-mix(in srgb, var(--warn) 42%, transparent);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--ink);
}

.bm-expiry-banner-text {
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1.45;
}

.bm-expiry-banner-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.bm-banner-btn {
  height: 28px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  border: 1px solid color-mix(in srgb, var(--warn) 45%, transparent);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.bm-banner-btn:hover {
  border-color: var(--warn);
  background: var(--surface-subtle);
}

/* Card Origin Header Row */
.bm-origin-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2px;
}

.bm-origin-left {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  min-width: 0;
}

.bm-edition-badge {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
}

.bm-edition-badge.is-daily {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 26%, transparent);
}

.bm-edition-badge.is-weekly {
  background: var(--weekly-accent-soft);
  color: var(--weekly-accent);
  border: 1px solid color-mix(in srgb, var(--weekly-accent) 28%, transparent);
}

.bm-origin-link {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-muted);
  transition: color 0.15s ease;
}

.bm-origin-link:hover {
  color: var(--accent);
  text-decoration: underline;
}

/* Inline Bilingual Toggle for China Local News */
.bm-lang-toggle {
  display: inline-flex;
  align-items: center;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  height: 22px;
}

.bm-lang-btn {
  border: 0;
  background: transparent;
  color: var(--ink-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  padding: 0 6px;
  height: 100%;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.bm-lang-btn.active {
  background: var(--ink);
  color: var(--bg);
}

.bm-geo-card {
  border-top: 3px solid var(--geo-pin);
}

.bm-geo-card.is-cuisine {
  border-top-color: var(--cuisine-pin);
}

/* TTL Retention Footer Bar inside Cards */
.bm-ttl-bar {
  margin-top: auto;
  padding-top: 9px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.35;
}

.bm-ttl-text {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.bm-ttl-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.bm-ttl-bar.is-active {
  color: var(--ink-muted);
}

.bm-ttl-bar.is-active .bm-ttl-dot {
  background: var(--pos);
}

.bm-ttl-bar.is-warn {
  color: var(--warn);
}

.bm-ttl-bar.is-warn .bm-ttl-dot {
  background: var(--warn);
}

.bm-ttl-bar.is-expired {
  color: var(--ink-muted);
}

.bm-ttl-bar.is-expired .bm-ttl-dot {
  background: var(--neg);
}

/* Preview Shimmer Skeleton while Archive JSON Hydrates */
.bm-shimmer-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin: 4px 0;
}

.bm-shimmer {
  height: 12px;
  border-radius: 4px;
  background: linear-gradient(
    90deg,
    var(--surface-subtle) 25%,
    color-mix(in srgb, var(--border) 65%, var(--surface-subtle)) 50%,
    var(--surface-subtle) 75%
  );
  background-size: 200% 100%;
  animation: bmShimmer 1.4s ease-in-out infinite;
}

.bm-shimmer.is-short {
  width: 68%;
}

@keyframes bmShimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* Expired Section */
.bm-expired-section {
  margin-top: 40px;
}

.bm-expired-card {
  background: var(--surface-subtle);
  border-style: dashed;
}

.bm-expired-card h3 {
  color: var(--ink-secondary);
}

.bm-fallback-note {
  margin: 0;
  font-size: 13px;
  color: var(--ink-muted);
  line-height: 1.5;
}

/* Empty State */
.bm-empty-state {
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 40px 24px;
  text-align: center;
  max-width: 560px;
  margin: 24px auto;
}

.bm-empty-state h2 {
  font-size: 21px;
  margin-bottom: 8px;
}

.bm-empty-state p {
  margin: 0 0 18px;
  font-size: 14px;
  color: var(--ink-secondary);
  line-height: 1.55;
}

.bm-empty-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.bm-empty-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-subtle);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.bm-empty-link:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Load More */
.bm-load-more-wrap {
  display: flex;
  justify-content: center;
  margin-top: 22px;
}

/* Footer Account Sync Indicator */
.bm-footer-sync {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink-muted);
  line-height: 1.4;
}

.bm-footer-sync-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--ink-muted);
}

.bm-footer-sync.is-synced {
  color: var(--ink-secondary);
}

.bm-footer-sync.is-synced .bm-footer-sync-dot {
  background: var(--pos);
}

.bm-footer-sync.is-syncing .bm-footer-sync-dot,
.bm-footer-sync.is-local .bm-footer-sync-dot {
  background: var(--warn);
}

.bm-footer-sync.is-signed-out .bm-footer-sync-dot {
  background: var(--ink-muted);
  opacity: 0.65;
}

@media (max-width: 680px) {
  .bm-filter-bar {
    gap: 14px;
  }

  .bm-expiry-banner {
    padding: 10px 12px;
  }
}
