/* =========================================================
   0. DESIGN TOKENS / GLOBAL VARIABLES
   Centralized visual constants (colors, spacing, widths)
========================================================= */
:root {
  --bg: #f7f8fa;
  --card: #ffffff;
  --muted: #71767a;
  --accent: #2a6b9a;
  --pill-bg: #f0f4f7;

  /* Layout */
  --max-width: 1100px;

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-pill: 999px;
}

/* =========================================================
   1. BASE / RESET
========================================================= */
html,
body {
  height: 100%;
  margin: 0;
  background: var(--bg);
  font-family: Inter, system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  color: #222;
}

/* Page-level width containers */
.container,
.wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 12px;
  box-sizing: border-box;
}

/* Main content vertical rhythm */
.content {
  padding: 8px 0 40px;
}

/* =========================================================
   2. APP HEADER (GLOBAL / CANONICAL)
========================================================= */
.app-header {
  background: #fff;
  border-bottom: 1px solid #e6e9ee;
}

/* Header top row */
.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;

  flex-wrap: nowrap;   /* 🔴 THIS IS THE KEY */
}

.segmented {
  flex-shrink: 0;      /* do not collapse into 2 lines */
  white-space: nowrap;
}

/* ---- Brand / Logo ---- */
.logo {
  display: flex;
  align-items: center;
}

.logo img {
  height: 26px;
  width: auto;
}

.logo {
  flex-shrink: 1;
}

.logo img {
  max-width: 28px;     /* hard upper bound */
  height: auto;
}


/* ---- Daily / Weekly Segmented Toggle ---- */
.segmented {
  display: flex;
  background: #f1f3f6;
  border-radius: var(--radius-pill);
  padding: 4px;
}

.segmented a {
  padding: 6px 16px;
  font-size: 14px;
  text-decoration: none;
  color: #444;
  border-radius: var(--radius-pill);
}

.segmented a.active {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

/* ---- Filters (country / category) ---- */
.header-filters {
  margin-left: auto;
  display: flex;
  gap: 8px;
}

.header-filters select {
  height: 34px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid #d0d6dc;
  font-size: 14px;
  background: #fff;
}

/* ---- Auth / Profile Links ---- */
.header-nav {
  display: flex;
  gap: 14px;
  margin-left: 12px;
  font-size: 14px;
}

.header-nav a {
  text-decoration: none;
  color: var(--accent);
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 10px 12px;

  display: flex;
  align-items: center;
  gap: 16px;
}

/* =========================================================
   2.5 HERO / LANDING SECTION
========================================================= */
.hero {
  background: #fff;
  padding: 28px;
  border-radius: var(--radius-md);
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);

  display: flex;
  gap: 28px;
  align-items: center;
}

.hero-left {
  flex: 1;
}

.hero-right img {
  width: 100%;
  max-width: 300px;
  border-radius: var(--radius-sm);
}

.cta {
  margin-top: 18px;
}

/* =========================================================
   3. FEED LAYOUT (STRUCTURE, NOT CARD CONTENT)
   Controls how cards are arranged on the page
========================================================= */

/* Desktop & tablet: two-column feed */
.feed {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

/* =========================================================
   3.1 FEED ITEM FALLBACK (ENSURE CARD LOOK)
   Ensures feed items look like cards even if .card is missing
========================================================= */
.feed > * {
  background: var(--card);
  border-radius: var(--radius-md);
  padding: 18px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

.feed > .card {
  box-shadow: none; /* card already defines its own look */
  padding: 0;       /* avoid double padding */
  background: none;
}


/* =========================================================
   4. CARD (STORY UNIT)
========================================================= */
.card {
  display: flex;
  gap: 16px;

  padding: 18px;
  border-radius: var(--radius-md);
  background: var(--card);

  /* Only vertical spacing inside grid fallback cases */
  margin-bottom: 18px;
}

/* ---- Avatar / Source Initial ---- */
.avatar {
  width: 58px;
  height: 58px;
  flex: 0 0 58px;

  border-radius: var(--radius-sm);
  background: #efefef;

  display: flex;
  align-items: center;
  justify-content: center;

  font-weight: 700;
  font-size: 22px;
  color: #555;
}

/* ---- Main text column ---- */
.card-main {
  flex: 1;
  min-width: 0; /* prevents text overflow in flex layouts */
}

/* ---- Metadata ---- */
.meta {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 6px;
}

/* ---- Title ---- */
.title {
  font-size: 18px;
  margin: 4px 0;
}

.title a {
  color: #0c3aa6;
  text-decoration: underline;
}

/* ---- Summary ---- */
.summary {
  font-size: 15px;
  line-height: 1.45;
  color: #444;
}

/* ---- Thumbnail ---- */
.thumb-wrap {
  width: 160px;
  height: 96px;
  flex: 0 0 160px;

  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #f6f6f6;
}

.thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ---- Footer (bias, reactions, etc.) ---- */
.card-footer {
  margin-top: 10px;
  display: flex;
  gap: 10px;
  align-items: center;
}

.bias-pill {
  background: var(--pill-bg);
  color: var(--accent);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 13px;
}

/* Utility text helpers */
.small { font-size: 13px; }
.muted { color: var(--muted); }

/* =========================================================
   4.1 MINI CARD (HOME PREVIEW)
========================================================= */
.card-mini {
  background: #fff;
  border-radius: var(--radius-sm);
  padding: 14px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.03);
}


/* =========================================================
   5. BUTTONS & INTERACTIONS
========================================================= */
.btn {
  background: var(--accent);
  color: #fff;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 0;
  cursor: pointer;
}

.react-btn:active {
  transform: scale(0.92);
}

.react-btn {
  background: transparent;
  border: 1px solid #e3e6e8;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
}

.react-btn.like { color: #0b7a4f; }
.react-btn.dislike { color: #b33a3a; }

.react-btn.active {
  background: #f0f7fb;
  box-shadow: 0 0 0 2px rgba(42, 107, 154, 0.08);
}

/* =========================================================
   6. RESPONSIVE BREAKPOINTS
========================================================= */

/* ---------- Tablet & small laptops ---------- */
@media (max-width: 1024px) {
  .thumb-wrap {
    width: 120px;
    height: 80px;
    flex-basis: 120px;
  }
}

/* ---------- Mobile (single-column, dense) ---------- */
@media (max-width: 768px) {
    
     /* Header stacks cleanly */
  .header-inner {
    flex-direction: row;          /* 🔴 override column */
    align-items: center;
    gap: 12px;
    flex-wrap: nowrap;            /* 🔴 prevent stacking */
    overflow-x: auto;             /* allow horizontal scroll */
    -webkit-overflow-scrolling: touch;
  }

  /* Top row: logo + toggle */
.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;

  flex-wrap: nowrap;   /* 🔴 THIS IS THE KEY */
}
  .logo img {
    height: 22px;
  }

  /* Filters: full width */
  .header-filters {
    flex-shrink: 0;
  }

  .header-filters select {
    min-width: 120px;
  }

  /* Account links: secondary row */
  .header-nav {
    font-size: 13px;
    gap: 12px;
    flex-shrink: 0;
    white-space: nowrap;
  }
  
  .segmented {
    flex-shrink: 0;
  }
  
  /* Feed becomes single column */
  .feed {
    grid-template-columns: 1fr;
  }

  /* Feed item fallback spacing (mobile) */
  .feed > * {
    padding: 14px;
    border-radius: var(--radius-md);
  }

  /* Canonical cards */
  .card {
    flex-direction: column;
    padding: 14px;
    margin-bottom: 14px;
  }

  .thumb-wrap {
    width: 100%;
    height: 200px;
    flex: none;
  }

  .avatar {
    width: 48px;
    height: 48px;
    font-size: 18px;
  }

  .title {
    font-size: 17px;
  }

  /* Hero polish */
  .hero {
    flex-direction: column;
    padding: 20px;
    gap: 16px;
  }

  .hero-right img {
    max-width: 220px;
    margin: 0 auto;
    display: block;
  }
}

/* =========================================================
   4.2 FEED AI & BIAS (COMPACT, NON-INTRUSIVE)
   Used ONLY inside .card
========================================================= */

/* AI summary block inside feed card */
.ai-snippet {
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: #f7f9fb;
  border: 1px solid #e3e7ec;

  font-size: 14px;
  line-height: 1.45;
  color: #222;
}

/* Small uppercase label (AI Analysis) */
.ai-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}

/* Bias pill refinement for feed */
.bias-pill {
  background: var(--pill-bg);
  color: var(--accent);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
}

/* Footer alignment fix when bias is present */
.card-footer {
  flex-wrap: wrap;
}

/* AI analysis block (already exists conceptually) */
.ai-snippet {
  margin-top:10px;
  padding:12px 14px;
  border-radius:8px;
  background:#f7f9fb;
  border:1px solid #e3e7ec;
}

.ai-label {
  font-size:11px;
  font-weight:700;
  color:#6b7280;
  margin-bottom:4px;
}

/* News summary (for Weekly / For You) */
.news-snippet {
  margin-top:10px;
  font-size:15px;
  line-height:1.45;
  color:#444;
}

/* Allow card footer to wrap on dense feeds */
.card-footer {
  flex-wrap:wrap;
}

/* Infinite-scroll friendliness */
.card {
  scroll-margin-top:72px;
}

/* ===============================
   COUNTRY ACCORDION – DARK MODE
================================ */

.country-feed {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* whole block */
.country-block {
  border-radius: 14px;
  overflow: hidden;
  background: #111827; /* deep slate */
  color: #f8fafc;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.04),
    0 8px 24px rgba(0,0,0,0.35);
}

.country-panel .card {
  background: #f8fafc; /* off-white */
}

/* header */
.country-header {
  width: 100%;
  background: linear-gradient(
    135deg,
    #020617,
    #1e293b  /* slate-800 */
  );
  color: #fff;
  border: none;
  padding: 16px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
}

.country-header:hover {
  background: linear-gradient(135deg, #020617, #1e293b);
}

/* title */
.country-name {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.2px;
}


.country-block.open .country-caret {
  transform: rotate(180deg);
}

/* panel */
.country-panel {
  display: none;
  background: #0b1220; /* softer navy-black */
  padding: 14px;
}

.country-block.open .country-panel {
  display: block;
}

/* loader */
.country-loader {
  color: #94a3b8;
  font-size: 14px;
  padding: 10px 0;
}

.country-header {
  user-select: none;
}
.country-header:active {
  transform: scale(0.995);
}


/* drag feedback */
.country-block.dragging {
  opacity: 0.5;
  transform: scale(0.98);
}

/* preview window inside open panel */
.country-preview {
  max-height: 220px;              /* HALF-OPEN HEIGHT */
  overflow: hidden;
  position: relative;
  transition: max-height 0.25s ease;
}

.country-preview::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 48px;
  background: linear-gradient(
    to bottom,
    rgba(11,18,32,0),
    rgba(11,18,32,1)
  );
  pointer-events: none;
}

/* FULL OPEN STATE */
.country-block.open.full .country-preview {
  max-height: none;
}

.country-block.open.full .country-preview::after {
  display: none;
}

.country-actions {
  text-align: center;
  margin: 10px 0 6px;
}

.country-open-btn {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.25);
  color: #e5e7eb;
  padding: 6px 18px;
  border-radius: 999px;
  font-size: 14px;
  cursor: pointer;
}

.country-block.open.full .country-actions {
  display: none;
}

.country-block[data-country="USA"] .country-header {
  background: linear-gradient(
    90deg,
    #3C3B6E 0%,
    #FFFFFF 55%,
    #B22234 100%
  );
}

.country-block[data-country="Japan"] .country-header {
  background: linear-gradient(
    90deg,
    #FFFFFF 0%,
    #F5F5F5 75%
  );
}

.country-block[data-country="India"] .country-header {
  background: linear-gradient(
    90deg,
    #FF9933 0%,
    #FFFFFF 55%,
    #138808 100%
  );
}

.country-block[data-country="Hong Kong"] .country-header {
  background: linear-gradient(
    90deg,
    #DE2910 0%,
    #B71C1C 100%
  );
}
.country-block[data-country="Thailand"] .country-header {
  background: linear-gradient(
    90deg,
    #A51931 0%,
    #FFFFFF 30%,
    #2D2A4A 65%,
    #A51931 100%
  );
}

.country-block[data-country="Germany"] .country-header {
  background: linear-gradient(
    90deg,
    #000000 0%,
    #DD0000 50%,
    #FFCE00 100%
  );
}

.country-block[data-country="France"] .country-header {
  background: linear-gradient(
    90deg,
    #0055A4 0%,
    #FFFFFF 50%,
    #EF4135 100%
  );
}

.country-block[data-country="Spain"] .country-header {
  background: linear-gradient(
    90deg,
    #AA151B 0%,
    #F1BF00 50%,
    #AA151B 100%
  );
}

.country-block[data-country="Finland"] .country-header {
  background: linear-gradient(
    90deg,
    #FFFFFF 0%,
    #003580 70%
  );
}

.country-block[data-country="Sweden"] .country-header {
  background: linear-gradient(
    90deg,
    #006AA7 0%,
    #FECC00 100%
  );
}

.country-block[data-country="South Korea"] .country-header {
  background: linear-gradient(
    90deg,
    #FFFFFF 0%,
    #C60C30 50%,
    #003478 100%
  );
}

.country-block[data-country="Singapore"] .country-header {
  background: linear-gradient(
    90deg,
    #EF3340 0%,
    #FFFFFF 100%
  );
}

.country-block[data-country="Mongolia"] .country-header {
  background: linear-gradient(
    135deg,
    #C4272F,
    #015197,
    #FFD900
  );
}

.country-block[data-country="Israel"] .country-header {
  background: linear-gradient(
    90deg,
    #0038B8 0%,
    #FFFFFF 70%
  );
}


.country-block[data-country="Qatar"] .country-header {
  background: linear-gradient(
    135deg,
    #8A1538,
    #FFFFFF
  );
}

.country-block[data-country="Italy"] .country-header {
  background: linear-gradient(
    135deg,
    #009246,
    #FFFFFF,
    #CE2B37
  );
}

.country-block[data-country="Philippines"] .country-header {
  background: linear-gradient(
    135deg,
    #0038A8,
    #FFFFFF,
    #CE1126,
    #FCD116
  );
}

.country-block[data-country="Mexico"] .country-header {
  background: linear-gradient(
    135deg,
    #006847,
    #FFFFFF,
    #CE1126
  );
}

.country-block[data-country="UK"] .country-header {
  background: linear-gradient(
    135deg,
    #012169,
    #FFFFFF,
    #C8102E
  );
}

.country-block[data-country="Kenya"] .country-header {
  background: linear-gradient(
    135deg,
    #000000,
    #BB0000,
    #006600,
    #FFFFFF
  );
}

.country-block[data-country="Russia"] .country-header {
  background: linear-gradient(
    90deg,
    #FFFFFF 0%,
    #0039A6 55%,
    #D52B1E 100%
  );
}


.country-block[data-country="Greece"] .country-header {
  background: linear-gradient(
    135deg,
    #0D5EAF,
    #FFFFFF
  );
}

.country-block[data-country="South Africa"] .country-header {
  background: linear-gradient(
    135deg,
    #007A4D 0%,
    #FFB612 35%,
    #000000 70%,
    #DE3831 100%
  );
}


.country-block[data-country="Ghana"] .country-header {
  background: linear-gradient(
    90deg,
    #CE1126 0%,
    #FCD116 50%,
    #006B3F 100%
  );
}


/* =========================
   RUSSIA – FORCE DARK TEXT
========================= */

.country-block[data-country="Russia"] .country-header {
  color: #111827; /* near-black */
}

.country-block[data-country="Russia"] .country-meta {
  color: #111827;
  opacity: 0.8;
}

.country-block[data-country="Russia"] .country-caret {
  color: #111827;
}

/* =========================================================
   LIGHT FLAGS → BLACK TEXT
========================================================= */

.country-block[data-country="Japan"] .country-header,
.country-block[data-country="Finland"] .country-header,
.country-block[data-country="France"] .country-header,
.country-block[data-country="Italy"] .country-header,
.country-block[data-country="Philippines"] .country-header,
.country-block[data-country="Mexico"] .country-header,
.country-block[data-country="Greece"] .country-header,
.country-block[data-country="Sweden"] .country-header,
.country-block[data-country="South Korea"] .country-header,
.country-block[data-country="Spain"] .country-header {
  color: #111827; /* near-black, not harsh */
}

.country-block[data-country="Japan"] .country-meta,
.country-block[data-country="Finland"] .country-meta,
.country-block[data-country="France"] .country-meta,
.country-block[data-country="Italy"] .country-meta,
.country-block[data-country="Philippines"] .country-meta,
.country-block[data-country="Mexico"] .country-meta,
.country-block[data-country="Greece"] .country-meta,
.country-block[data-country="Sweden"] .country-meta,
.country-block[data-country="South Korea"] .country-meta,
.country-block[data-country="Spain"] .country-meta {
  opacity: 0.75;
}

.country-block[data-country="Germany"] .country-header {
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
}

.country-block[data-country="South Africa"] .country-header {
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
}

.country-header {
  text-shadow: 0 1px 1px rgba(0,0,0,0.35);
}

.country-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.country-meta {
  font-size: 13px;
  font-weight: 600;          /* stronger */
  padding: 4px 8px;          /* creates contrast island */
  border-radius: 999px;
  background: rgba(0,0,0,0.35); /* dark pill */
  color: #ffffff;
  line-height: 1;
}

.country-caret {
  font-size: 12px;
  padding: 4px 6px;
  border-radius: 6px;
  background: rgba(0,0,0,0.35);
  color: #ffffff;
}

/* =========================================================
   DAILY + WEEKLY FEED CARD UNIFICATION
   (No avatars, stronger outlet identity)
========================================================= */

/* Emphasize outlet name */
.outlet-name {
  font-size: 15px;
  font-weight: 700;
  color: #1f4fd8;           /* stronger than --accent */
  letter-spacing: 0.2px;
}

/* Slightly de-emphasize rest of meta */
.meta {
  font-size: 13px;
}

/* DAILY FEED: remove avatar spacing entirely */
.daily-feed .avatar {
  display: none !important;
}

.daily-feed .card {
  gap: 12px;
}

/* WEEKLY FEED: avatar already removed in markup, but safe */
.weekly-feed .avatar {
  display: none;
}

/* Better hierarchy between outlet and rest */
.meta .outlet-name + * {
  margin-left: 4px;
}

/* =========================================================
   CATEGORY PILL (MATCH WEEKLY / DAILY)
========================================================= */

.pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

/* Base category pill */
.category-pill {
  background: #eef2f7;
  color: #334155;
}

/* Semantic colors */
.category-pill[data-cat="Politics"] {
  background: #fdecea;
  color: #b91c1c;
}

.category-pill[data-cat="World"] {
  background: #e0f2fe;
  color: #075985;
}

.category-pill[data-cat="General"] {
  background: #f1f5f9;
  color: #334155;
}

.category-pill[data-cat="Business"] {
  background: #ecfeff;
  color: #0f766e;
}

.category-pill[data-cat="Economy"] {
  background: #ecfeff;
  color: #0f766e;
}

.category-pill[data-cat="Technology"] {
  background: #ede9fe;
  color: #5b21b6;
}

.category-pill[data-cat="Science"] {
  background: #ede9fe;
  color: #5b21b6;
}

.category-pill[data-cat="Sports"] {
  background: #fff7ed;
  color: #c2410c;
}

.category-pill[data-cat="Defense"],
.category-pill[data-cat="Security"] {
  background: #111827;
  color: #f9fafb;
}

.category-pill[data-cat="Health"] {
  background: #dcfce7;
  color: #166534;
}

/* =========================================================
   COUNTRY-AWARE CATEGORY EMPHASIS (VISUAL ONLY)
========================================================= */

/* India */
.country-block[data-country="India"] .category-pill[data-cat="Politics"],
.country-block[data-country="India"] .category-pill[data-cat="Defense"] {
  box-shadow: 0 0 0 2px rgba(185,28,28,0.15);
}

/* USA */
.country-block[data-country="USA"] .category-pill[data-cat="Politics"],
.country-block[data-country="USA"] .category-pill[data-cat="Economy"],
.country-block[data-country="USA"] .category-pill[data-cat="Technology"] {
  box-shadow: 0 0 0 2px rgba(7,89,133,0.15);
}

/* Philippines */
.country-block[data-country="Philippines"] .category-pill[data-cat="World"],
.country-block[data-country="Philippines"] .category-pill[data-cat="Security"] {
  box-shadow: 0 0 0 2px rgba(15,118,110,0.15);
}

/* Japan */
.country-block[data-country="Japan"] .category-pill[data-cat="Economy"],
.country-block[data-country="Japan"] .category-pill[data-cat="Defense"] {
  box-shadow: 0 0 0 2px rgba(91,33,182,0.15);
}

/* ===============================
   COUNTRY LOAD MORE (POLISHED)
================================ */

.country-load-more {
  margin: 14px auto 6px;
  display: block;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.35);
  color: #e5e7eb;
  padding: 8px 22px;
  border-radius: 999px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.country-load-more:hover {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.55);
}

.country-load-more:active {
  transform: scale(0.97);
}

/* never show in preview */
.country-block:not(.full) .country-load-more {
  display: none;
}

.pill-muted {
  display: inline-block;
  padding: 2px 8px;
  font-size: 11px;
  border-radius: 999px;
  background: #eef1f4;
  color: #6b7280;
  margin-left: 6px;
}

/* ===============================
   COUNTRY OPEN LAYOUT
================================ */

.country-inner {
  display: none;
  gap: 16px;
  margin-top: 12px;
}

/* when opened */
.country-block.open .country-inner {
  display: flex;
}

/* ===============================
   OUTLET OVERLAY (GLOBAL)
================================ */

#outlet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2,6,23,0.65);
  backdrop-filter: blur(2px);
  display: none;
  z-index: 9999;
}

#outlet-overlay.active {
  display: block;
}

.outlet-drawer {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 280px;
  background: #0b1220;
  box-shadow: 4px 0 24px rgba(0,0,0,0.6);
  padding: 16px;
  transform: translateX(-100%);
  transition: transform 0.25s ease;
}

#outlet-overlay.active .outlet-drawer {
  transform: translateX(0);
}

.outlet-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 16px;
  font-weight: 700;
  color: #e5e7eb;
  margin-bottom: 12px;
}

#outlet-close {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 18px;
  cursor: pointer;
}

#outlet-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.outlet-item {
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  color: #e5e7eb;
}

.outlet-item:hover {
  background: rgba(255,255,255,0.08);
}

.outlet-item.active {
  background: var(--accent);
  color: #fff;
}

/* ===============================
   OUTLET FAB (FLOATING TRIGGER)
================================ */

.outlet-fab {
  position: fixed;
  left: 14px;
  bottom: 18px;
  z-index: 10000;

  background: rgba(15, 23, 42, 0.85);
  color: #e5e7eb;
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;

  backdrop-filter: blur(6px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.outlet-fab.hidden {
  display: none;
}

/* ===============================
   OUTLET HINT MODE
================================ */

#outlet-overlay.hint {
  background: rgba(2,6,23,0.25);
}

#outlet-overlay.hint .outlet-drawer {
  opacity: 0.65;
  pointer-events: none;
}

/* Scrollable outlet list */
#outlet-list {
  max-height: calc(100vh - 80px);
  overflow-y: auto;
  padding-right: 6px;
}

/* ===============================
   PLOTLINE LIST (INDEX PAGE)
   — DARK / ANALYTICAL
================================ */

.plotline-row {
  display: block;
  background: #0b1220;               /* same as timeline cards */
  border-radius: 14px;
  padding: 16px 18px;
  margin-bottom: 12px;

  text-decoration: none;
  color: #e5e7eb;

  box-shadow:
    0 1px 0 rgba(255,255,255,0.04),
    0 10px 28px rgba(0,0,0,0.45);

  transition:
    transform 0.12s ease,
    box-shadow 0.12s ease,
    background 0.12s ease;
}

.plotline-row:hover {
  background: #020617;
  transform: translateY(-1px);
  box-shadow:
    0 2px 0 rgba(255,255,255,0.06),
    0 14px 36px rgba(0,0,0,0.55);
}

/* Title line */
.plotline-title {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #f8fafc;
}

/* Role pill */
.plotline-role {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;

  background: rgba(255,255,255,0.08);
  color: #cbd5f5;
  border: 1px solid rgba(255,255,255,0.12);
}

/* Metadata line */
.plotline-meta {
  font-size: 13px;
  color: #94a3b8;
  margin-bottom: 4px;
}

/* Vector metrics */
.plotline-vectors {
  font-size: 13px;
  color: #cbd5e1;
  margin-top: 2px;
}

/* CTA */
.plotline-cta {
  margin-top: 8px;
  font-size: 14px;
  font-weight: 600;
  color: #93c5fd;
}
/* ===============================
   PLOTLINE PAGE — DARK THEME
================================ */

/* Force dark canvas even inside .wrap */
.plotline-page {
  background: #020617;           /* deep slate-black */
  padding: 10px 0 24px;
}

/* Ensure inner wrap does NOT turn white */
.plotline-page.wrap {
  background: transparent;
}

/* Back button */
.plotline-back {
  display: inline-block;
  margin: 4px 0 8px;
  font-size: 14px;
  font-weight: 600;
  color: #93c5fd;
  text-decoration: none;
}

.plotline-back:hover {
  text-decoration: underline;
}

/* ===============================
   PLOTLINES PAGE – INTRO SPACING
================================ */

.plotlines-intro {
  margin: 6px 0 18px;        /* adds breathing room */
  font-size: 15px;
  color: #475569;
}

/* ===============================
   PLOTLINE HEADER STRIP
================================ */

.plotline-page .plotline-header {
  display: block;
  background: linear-gradient(
    180deg,
    #020617,
    #020617
  );
  padding: 12px 16px 10px;
  border-radius: 12px;
  color: #f8fafc;
}

.plotline-page .plotline-subtitle {
  padding-left: 16px;
  color: #94a3b8;
  margin-bottom: 14px;
  font-size: 14px;
}



/* ===============================
   TIMELINE CARDS
================================ */

.plotline-page .timeline-card {
  background: #0b1220;           /* soft black */
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 12px;
  width: 100%;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.04),
    0 8px 24px rgba(0,0,0,0.45);
}

/* Meta text */
.plotline-page .timeline-meta {
  color: #94a3b8;
  margin-bottom: 4px;
}

/* Title */
.plotline-page .timeline-title {
  margin-bottom: 6px;
  line-height: 1.3;
}

.plotline-page .timeline-title a {
  color: #e5e7eb;
  text-decoration: underline;
}

.plotline-page .timeline-title a:hover {
  color: #ffffff;
}

/* AI snippet */
.plotline-page .ai-snippet {
  margin-top: 8px;
  padding: 10px 12px;
  line-height: 1.45;
  background: #020617;
  border: 1px solid rgba(255,255,255,0.08);
  color: #e5e7eb;
}

/* Plotline engagement grouping */
.timeline-engagement {
  margin-bottom: 22px;
  padding-left: 12px;
}

/* Slight indent so it feels attached to the card */
.plotline-page .story-reactions {
  margin-top: 8px;
}

.plotline-page .feed-comment textarea {
  min-height: 64px;
}

/* ===============================
   PLOTLINE FILTERS (LOCAL)
================================ */

.plotlines-filters {
  margin: 0 0 16px;
}

.plotlines-filters select {
  background: #0b1220;
  color: #e5e7eb;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 14px;
}

/* ===============================
   STORY PAGE CARD OVERRIDE
================================ */

/* Story card is NOT a feed card */
.story-card {
  display: block;           /* 🔴 kill feed flex */
  max-width: 100%;
}

/* Prevent flex inheritance damage */
.story-card > * {
  max-width: 100%;
}

/* Title hierarchy */
.story-title {
  font-size: 28px;
  line-height: 1.25;
  margin: 6px 0 14px;
}

/* Story image should be block-level */
.story-image {
  display: block;
  width: 100%;
  max-height: 520px;
  object-fit: cover;
  border-radius: var(--radius-md);
  margin: 16px 0;
}

/* Article body */
.story-content {
  font-size: 17px;
  line-height: 1.65;
  color: #111;
}

/* AI block spacing */
.story-ai {
  margin: 16px 0;
}

/* Source CTA */
.story-source-cta {
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px dashed #e5e7eb;
  font-size: 14px;
}

/* ===============================
   STORY CLICK HANDLING (FINAL)
   No pointer-event hacks
================================ */

/* Story card looks clickable */
.story-card {
  position: relative;
  cursor: pointer;
}

/* Overlay is ONLY a data holder, never captures clicks */
.story-card .card-overlay-link {
  pointer-events: none;
}

.comment-box textarea {
  width: 100%;
  min-height: 120px;
  padding: 12px;
  font-size: 14px;
}

/* Feed comments (compact) */
.feed-comment textarea {
  width: 100%;
  min-height: 60px;
  margin-top: 8px;
  font-size: 14px;
}

.feed-comment {
  margin-top: 10px;
}

/* Engagement bar spacing */
.story-reactions {
  margin-top: 8px;
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
}

/* --- Plotline mobile width fix (minimal) --- */
@media (max-width: 768px) {

  .plotline-page .timeline-card {
    width: auto;              /* 🔑 stop forcing 100% */
    max-width: 100%;
    box-sizing: border-box;
  }

}

/* ===============================
   VISIBILITY HELPERS
================================ */

/* Generic hide utility (used by comment toggle JS) */
.hidden {
  display: none !important;
}
.summary {
  white-space: normal !important;
  overflow: visible !important;
  display: block !important;
  -webkit-line-clamp: unset !important;
  -webkit-box-orient: unset !important;
  max-height: none !important;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.admin-badge {
  color: #2a6b9a;
  background: #eef4f8;
}

#conversation {
  max-height: 60vh;
  overflow-y: auto;
  padding: 10px;
}

.msg {
  margin-bottom: 14px;
  padding: 10px 12px;
  border-radius: 8px;
  max-width: 85%;
}

.msg.user {
  background: #f0f4f7;
  margin-left: auto;
}

.msg.assistant {
  background: #ffffff;
  border: 1px solid #e4e6ea;
}

/* ---------- foreign cards ---------- */
.foreign-card {
  background: linear-gradient(180deg, #0c1220, #070b14);
  color: #e6ebf2;
}

.foreign-card .title a {
  color: #8ab4ff;
}

.foreign-footer {
  padding: 12px;
  border-top: 1px solid rgba(255,255,255,0.08);
  text-align: right;
}

/* ---------- modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
}

.modal.hidden { display: none; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.6);
}

.modal-panel {
  position: relative;
  margin: 5vh auto;
  width: 90%;
  max-width: 600px;
  background: #fff;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  max-height: 90vh;
}

.modal-header {
  padding: 12px 16px;
  font-weight: 600;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
}

.modal-comments {
  padding: 12px 16px;
  overflow-y: auto;
  flex: 1;
}

.modal-comments .comment-item {
  padding: 10px 0;
  border-bottom: 1px solid #f0f0f0;
}

/* COMMENTS */
.comment-item {
  padding: 8px 0;
}

.comment-header {
  font-size: 13px;
  margin-bottom: 4px;
}

.comment-user {
  font-weight: 600;
  color: #222;
}

.comment-text {
  font-size: 14px;
  margin-bottom: 6px;
}

.comment-actions {
  display: flex;
  gap: 12px;
}

.comment-react {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-size: 13px;
  color: #555;
}

.comment-react:hover {
  color: #000;
}

/* ===============================
   AUTH / REGISTER PAGE LAYOUT
   (Standalone – no card dependency)
================================ */

/* Full-page app background (matches chat) */
.app-bg {
  min-height: 100vh;
  background: radial-gradient(
    1200px 600px at 50% -200px,
    #0b1b34 0%,
    #050a18 60%,
    #02040b 100%
  );
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Form container (replaces card usage entirely) */
.form-shell {
  background: #ffffff;
  border-radius: 12px;
  padding: 22px 24px;
  max-width: 460px;
  width: 100%;
  box-shadow: 0 12px 36px rgba(0,0,0,0.25);
}

/* ===============================
   FORM VERTICAL RHYTHM
================================ */

.form-vertical {
  display: block;
}

/* Labels */
.form-vertical label {
  display: block;
  margin-top: 18px;
  font-weight: 600;
  font-size: 14px;
}

/* Inputs */
.form-vertical input {
  width: 100%;
  height: 42px;
  padding: 10px 12px;
  margin-top: 6px;
  border: 1px solid #d0d6dc;
  border-radius: 8px;
  font-size: 14px;
}

/* Date input spacing fix */
.form-vertical input[type="date"] {
  padding-right: 12px;
}

/* Checkbox rows */
.form-vertical .checkbox {
  margin-top: 14px;
  font-weight: 400;
}

/* ===============================
   PRIMARY ACTION
================================ */

.form-vertical .btn {
  margin-top: 22px;
  padding: 10px 16px;
  font-size: 15px;
}

/* ===============================
   FOOTER / HELPER TEXT
================================ */

.form-footer {
  margin-top: 16px;
  text-align: center;
  line-height: 1.4;
  font-size: 13px;
  color: #71767a;
}

body .app-bg {
  padding-top: 64px; /* pushes form below header */
}

/* ===============================
   CARD TAG HEADER (SEMANTIC)
================================ */

.card-tagbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;

  padding: 6px 10px;
  margin-bottom: 6px;

  border-radius: 8px;
  background: linear-gradient(
    90deg,
    rgba(42,107,154,0.12),
    rgba(42,107,154,0.02)
  );

  box-shadow:
    inset 0 0 0 1px rgba(42,107,154,0.25),
    0 0 12px rgba(42,107,154,0.15);
}

/* Base tag */
.card-tagbar .tag {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  line-height: 1;
  white-space: nowrap;
}

/* Primary category (strong anchor) */
.tag-primary {
  background: #1f4fd8;
  color: #fff;
}

/* Secondary descriptors */
.tag-secondary {
  background: #eef2f7;
  color: #334155;
}

/* Foreign signal */
.tag-foreign {
  background: #111827;
  color: #f9fafb;
}

/* AI presence */
.tag-ai {
  background: #ede9fe;
  color: #5b21b6;
}

/* Country context */
.tag-country {
  background: #dcfce7;
  color: #166534;
}

/* =========================================
   FEED WEEKLY – SPACING OVERRIDES (FINAL)
   MUST BE LAST IN FILE
========================================= */

.card {
  padding: 14px 16px !important;
  margin-bottom: 12px !important;
  gap: 12px;
}

.meta {
  margin-bottom: 2px !important;
  line-height: 1.15;
}

.title {
  margin: 2px 0 6px !important;
  line-height: 1.25;
}

.news-snippet {
  margin: 4px 0 6px !important;
}

.ai-snippet {
  margin: 6px 0 6px !important;
  padding: 8px 10px !important;
}

.ai-label {
  margin-bottom: 2px !important;
  font-size: 11px;
}

.engagement-bar {
  margin-top: 4px !important;
}

/* ===============================
   COMMENT SECTION LABEL
================================ */
.comment-user-label {
  font-weight: 600;
  font-size: 13px;
  color: #444;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 14px;
  margin-bottom: 8px;
  padding-top: 10px;
  border-top: 1px solid #e6e9ee;
}

/* Locked tabs (unauthenticated) */
.segmented .locked-tab {
  padding: 6px 16px;
  font-size: 14px;
  border-radius: 999px;
  color: #9aa0a6;
  background: transparent;
  cursor: not-allowed;
  user-select: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* ===============================
   ACTIVE FILTER CHIPS
=============================== */

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  font-size: 13px;
  border-radius: 999px;
  background: #eef4f8;
  color: #2a6b9a;
  text-decoration: none;
  border: 1px solid rgba(42,107,154,0.25);
}

.chip:hover {
  background: #e3edf5;
}

.chip-x {
  font-weight: 700;
  opacity: 0.7;
}

/* =========================================
   FIX: PLOTLINE PAGE (USING EXISTING CLASSES)
========================================= */

/* Restore vertical rhythm for timeline cards */
.plotline-page .timeline-card {
  display: block;                 /* override feed flex */
  padding: 18px 20px !important;
  margin-bottom: 18px !important;
  border-radius: 14px;
  background: #0b1220;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.04),
    0 10px 28px rgba(0,0,0,0.45);
}

/* Timeline meta: clearer + date-like */
.plotline-page .timeline-meta {
  font-size: 13px;
  color: #9aa4b2;
  letter-spacing: 0.2px;
  margin-bottom: 6px;
}

/* Emphasize title hierarchy */
.plotline-page .timeline-title {
  margin: 6px 0 8px;
  line-height: 1.35;
}

.plotline-page .timeline-title a {
  font-size: 1.05rem;
  font-weight: 600;
  color: #f8fafc;
  text-decoration: none;
}

.plotline-page .timeline-title a:hover {
  text-decoration: underline;
}

/* AI summary: darker inset block */
.plotline-page .ai-snippet {
  background: #020617;
  border: 1px solid rgba(255,255,255,0.08);
  color: #d0d6e1;
  border-radius: 10px;
}

/* Engagement row: subtle, not feed-like */
.plotline-page .timeline-engagement {
  margin-top: -10px;
  margin-bottom: 18px;
  padding-left: 16px;
  font-size: 12.5px;
  color: #94a3b8;
}

/* Fix muted text on dark background */
.plotline-page .muted {
  color: #94a3b8;
}

/* Small text readability */
.plotline-page .small {
  font-size: 12.5px;
}

/* Header right-side alignment fix */
.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Make notification button behave like a nav link */
.header-btn {
  font: inherit;
  line-height: 1;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid #d1d5db;
  background: #fff;
  cursor: pointer;
  white-space: nowrap;
}

.header-btn:hover {
  background: #f3f4f6;
}

/* ===============================
   STORY SCROLL HINT
================================ */
.scroll-hint {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  background: rgba(15,23,42,0.9);
  color: #e5e7eb;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
  z-index: 9999;
}
.scroll-hint.show { opacity: 1; }
.scroll-hint.bottom { bottom: 16px; }
.scroll-hint.top { top: 72px; }

