/* F1 news feed (src/news-feed.js) — desktop drawer and mobile "News" tab.
   Uses the colour tokens both styles.css files define on :root. */

.nf {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.nf-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.nf-select {
  background: var(--panel-soft);
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 6px 8px;
  font: inherit;
  font-size: 0.85rem;
}

.nf-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--muted);
  cursor: pointer;
}

.nf-refresh {
  margin-left: auto;
}

.nf-status-line {
  color: var(--muted);
  font-size: 0.9rem;
  padding: 6px 2px;
}

.nf-status-line.nf-error {
  color: #ff8a80;
}

.nf-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.nf-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 3px solid var(--line-strong);
  border-radius: 10px;
  padding: 10px 12px;
}

.nf-card.nf-level-alta {
  border-left-color: var(--accent);
}

.nf-card.nf-level-media {
  border-left-color: #f39c12;
}

.nf-card.nf-analysis {
  opacity: 0.85;
}

.nf-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.nf-badge,
.nf-tag,
.nf-status {
  border-radius: 999px;
  padding: 2px 8px;
  border: 1px solid var(--line-strong);
  white-space: nowrap;
}

.nf-badge-alta {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: #ff6b66;
}

.nf-badge-media {
  background: rgba(243, 156, 18, 0.15);
  border-color: rgba(243, 156, 18, 0.6);
  color: #f5b041;
}

.nf-status-confirmada {
  color: var(--green);
  border-color: rgba(30, 203, 129, 0.5);
}

.nf-status-desmentida {
  color: #ff8a80;
  border-color: rgba(255, 138, 128, 0.5);
}

.nf-confidence {
  font-variant-numeric: tabular-nums;
}

.nf-when {
  margin-left: auto;
}

.nf-title {
  margin: 0 0 4px;
  font-size: 1rem;
  line-height: 1.3;
  color: var(--text);
}

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

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

.nf-summary {
  margin: 0 0 6px;
  font-size: 0.88rem;
  line-height: 1.45;
  color: #c9d1dc;
}

.nf-sources {
  font-size: 0.75rem;
  color: var(--muted);
}

.nf-sources a {
  color: var(--muted);
}

.nf-sources a:hover {
  color: var(--text);
}

.nf-more {
  align-self: center;
}

/* Compact variant (mobile tab) */
.nf-compact .nf-filters {
  gap: 6px;
}

.nf-compact .nf-select {
  flex: 1 1 calc(50% - 6px);
  min-width: 0;
}

.nf-compact .nf-card {
  padding: 8px 10px;
}

.nf-compact .nf-title {
  font-size: 0.95rem;
}

.nf-compact .nf-when {
  margin-left: 0;
}

/* Desktop drawer */
.nf-drawer {
  position: fixed;
  inset: 0;
  z-index: 1000;
}

.nf-drawer.hidden {
  display: none;
}

.nf-drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}

.nf-drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(560px, 100vw);
  background: var(--panel-strong);
  border-left: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

.nf-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.nf-drawer-head h2 {
  margin: 0;
  font-size: 1.1rem;
}

.nf-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px;
}

/* Desktop header button — centred in the header bar: auto margins on both
   sides split the free space; the auth widget's own margin-left:auto would
   otherwise take it all. */
.hero > .news-open-btn,
.hero > .hero-feeds {
  margin-inline: auto;
  align-self: center;
}

.hero > .news-open-btn ~ .auth-widget,
.hero > .hero-feeds ~ .auth-widget {
  margin-left: 0;
}

/* News + Team radio (src/team-radio.css) side by side */
.hero-feeds {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.news-open-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: linear-gradient(135deg, #e10600 0%, #a30400 100%);
  color: #fff;
  font: inherit;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 6px 22px rgba(225, 6, 0, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  z-index: 1;
}

.news-open-btn:hover,
.news-open-btn:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 8px 28px rgba(225, 6, 0, 0.55);
  outline: none;
}

.news-open-icon {
  font-size: 1.15rem;
  line-height: 1;
}

.news-open-btn.has-unread {
  animation: nf-pulse 2s ease-in-out infinite;
}

@keyframes nf-pulse {
  0%, 100% { box-shadow: 0 6px 22px rgba(225, 6, 0, 0.35); }
  50% { box-shadow: 0 0 0 6px rgba(225, 6, 0, 0.25), 0 6px 28px rgba(225, 6, 0, 0.6); }
}

/* Unread counter (desktop button and mobile tab) */
.nf-badge-count {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: #fff;
  color: #c00500;
  font-size: 0.75rem;
  font-weight: 800;
  line-height: 20px;
  text-align: center;
}

.news-open-btn .nf-badge-count {
  position: absolute;
  top: -7px;
  right: -7px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.window-tab .nf-badge-count {
  display: inline-block;
  margin-left: 6px;
  background: var(--accent);
  color: #fff;
  height: 18px;
  min-width: 18px;
  line-height: 18px;
  font-size: 0.7rem;
}

.nf-badge-count.hidden {
  display: none;
}

.window-tab.news-tab.has-unread {
  color: var(--text);
  border-color: var(--accent);
}

/* New-story toast */
.nf-toast {
  position: fixed;
  top: calc(14px + env(safe-area-inset-top, 0px));
  left: 50%;
  z-index: 1100;
  width: min(460px, calc(100vw - 24px));
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-left: 4px solid #f39c12;
  border-radius: 12px;
  background: var(--panel-strong);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  opacity: 0;
  transform: translate(-50%, -16px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.nf-toast.nf-toast-alta {
  border-left-color: var(--accent);
}

.nf-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.nf-toast-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  color: var(--muted);
}

.nf-toast-label {
  font-weight: 700;
  color: #ff6b66;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.nf-toast-more {
  margin-left: auto;
  font-weight: 700;
}

.nf-toast-title {
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.3;
}

@media (prefers-reduced-motion: reduce) {
  .news-open-btn.has-unread {
    animation: none;
  }

  .nf-toast {
    transition: none;
  }
}

/* Free users: News button/tab with a lock, feed replaced by an upsell. */
.news-open-btn.is-locked {
  background: linear-gradient(135deg, #2a313b 0%, #1a1f26 100%);
  border-color: rgba(225, 6, 0, 0.55);
  box-shadow: none;
  animation: none;
}

.window-tab.news-tab.is-locked {
  opacity: 0.8;
}

.nf-locked-out {
  display: none !important;
}

.nf-locked {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 28px 18px;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
}

.nf-locked.hidden {
  display: none;
}

.nf-locked-icon {
  font-size: 2rem;
}

.nf-locked h3 {
  margin: 0;
  font-size: 1.1rem;
}

.nf-locked p {
  margin: 0;
  max-width: 380px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

/* Telegram link bar (Pro) */
.nf-telegram {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid rgba(41, 168, 235, 0.35);
  border-radius: 10px;
  background: rgba(41, 168, 235, 0.08);
  font-size: 0.85rem;
}

.nf-telegram.hidden,
.nf-telegram .hidden {
  display: none;
}

.nf-telegram-text {
  flex: 1 1 auto;
}

.nf-telegram-open {
  text-decoration: none;
}

.nf-telegram-hint {
  flex-basis: 100%;
  color: var(--muted);
  font-size: 0.75rem;
}

/* FIA stewards' lines (investigation / decision) inside a story card */
.nf-stewards {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0 0 6px;
}

.nf-stewards-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
  padding: 6px 8px;
  border-radius: 8px;
  border-left: 3px solid var(--line-strong);
  background: var(--panel-soft);
  font-size: 0.82rem;
  line-height: 1.4;
}

.nf-stewards-label {
  font-weight: 700;
  white-space: nowrap;
}

.nf-stewards-text {
  color: var(--text);
}

.nf-stewards-time {
  color: var(--muted);
  font-size: 0.75rem;
}

.nf-stewards-investigation {
  border-left-color: #f39c12;
}

.nf-outcome-penalty {
  border-left-color: var(--accent);
}

.nf-outcome-penalty .nf-stewards-text {
  font-weight: 600;
}

.nf-outcome-reprimand {
  border-left-color: #f5b041;
}

.nf-outcome-none {
  border-left-color: var(--green);
}

/* FIA starting grid inside a story card */
.nf-grid {
  margin: 0 0 6px;
  padding: 8px 10px;
  border-radius: 8px;
  border-left: 3px solid var(--line-strong);
  background: var(--panel-soft);
  font-size: 0.82rem;
}

.nf-grid-title {
  font-weight: 700;
  margin-bottom: 6px;
}

.nf-grid-rows {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-flow: column;
  grid-template-rows: repeat(5, auto);
  gap: 2px 14px;
  margin: 0 0 6px;
  padding: 0;
  list-style: none;
}

.nf-grid-rows li {
  display: flex;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nf-grid-rows li.is-penalised .nf-grid-driver::after {
  content: " *";
  color: var(--accent);
}

.nf-grid-pos {
  min-width: 1.4em;
  text-align: right;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.nf-grid-line {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 6px;
  margin-top: 3px;
  line-height: 1.4;
}

.nf-grid-label {
  font-weight: 700;
  white-space: nowrap;
}

.nf-grid-label::after {
  content: ":";
}
