/* ================================================================
   NEWS PORTAL — site.css
   Full responsive, no horizontal scroll, Bootstrap 5 compatible
   ================================================================ */

/* ── Variables ────────────────────────────────────────────── */
:root {
  --accent:       #e63946;
  --accent-dark:  #c1121f;
  --topbar-bg:    #1d2330;
  --nav-bg:       #1d2330;
  --footer-bg:    #1d2330;
  --card-radius:  .6rem;
  --card-shadow:  0 2px 12px rgba(0,0,0,.07);
  --brand-font:   'Playfair Display', Georgia, serif;
}

/* ── FIX 2: Prevent horizontal scroll globally ───────────────── */
html, body {
  overflow-x: hidden;
  max-width: 100%;
}
*, *::before, *::after {
  box-sizing: border-box;
}

/* ── Base ─────────────────────────────────────────────────── */
body {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: .97rem;
}

/* ── Top bar ──────────────────────────────────────────────── */
.top-bar {
  background: var(--topbar-bg);
  color: rgba(255,255,255,.65);
}
.top-bar a {
  color: rgba(255,255,255,.65);
  text-decoration: none;
}
.top-bar a:hover { color: #fff; }

/* ── Site header ──────────────────────────────────────────── */
.site-header {
  background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
}
.site-brand { display: block; }
.brand-text {
  font-family: var(--brand-font);
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--accent);
  letter-spacing: -.02em;
  line-height: 1;
}

/* FIX 2: search form responsive */
.search-form {
  width: 100%;
  max-width: 300px;
}
@media (max-width: 576px) {
  .search-form { max-width: 100%; }
}

/* ── Main nav ─────────────────────────────────────────────── */
.main-nav { background: var(--nav-bg); }
.main-nav .nav-link {
  color: rgba(255,255,255,.75) !important;
  font-weight: 500;
  font-size: .84rem;
  letter-spacing: .03em;
  text-transform: uppercase;
  padding: .6rem .8rem !important;
  white-space: nowrap;
}
.main-nav .nav-link:hover,
.main-nav .nav-link.active {
  color: #fff !important;
  border-bottom: 2px solid var(--accent);
}
.navbar-toggler-icon { filter: invert(1); }

/* ── FIX 2: Breaking ticker — no overflow ─────────────────── */
.breaking-bar {
  background: var(--accent);
  color: #fff;
  overflow: hidden;         /* CRITICAL — stops horizontal scroll */
  padding: .4rem 0;
  width: 100%;
}
.breaking-label {
  font-weight: 700;
  font-size: .75rem;
  letter-spacing: .08em;
  white-space: nowrap;
  flex-shrink: 0;
  padding: 0 .5rem;
}
.ticker-wrap {
  overflow: hidden;
  flex: 1;
  min-width: 0;             /* CRITICAL — flex child won't expand beyond parent */
}
.ticker-content {
  display: inline-flex;
  gap: 3rem;
  animation: ticker 35s linear infinite;
  white-space: nowrap;
  will-change: transform;
}
.ticker-content:hover { animation-play-state: paused; }
.ticker-item {
  color: #fff;
  text-decoration: none;
  font-size: .85rem;
  flex-shrink: 0;
}
.ticker-item:hover { text-decoration: underline; }
@keyframes ticker {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* ── Cards ────────────────────────────────────────────────── */
.news-card {
  border: none;
  border-radius: var(--card-radius);
  box-shadow: var(--card-shadow);
  transition: transform .18s ease, box-shadow .18s ease;
  overflow: hidden;
}
.news-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
}
.news-card .card-img-top {
  height: 200px;
  object-fit: cover;
  width: 100%;
}
.news-card .card-body { padding: 1rem; }

/* ── Hero / featured image ────────────────────────────────── */
.hero-image {
  position: relative;
  border-radius: var(--card-radius);
  overflow: hidden;
  display: block;
}
.hero-image img {
  width: 100%;
  height: 420px;
  object-fit: cover;
  display: block;
}
.hero-overlay {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 1.25rem;
  background: linear-gradient(transparent, rgba(0,0,0,.82));
}
.hero-overlay h2 {
  font-family: var(--brand-font);
  color: #fff;
  font-size: 1.4rem;
  margin: 0;
}
@media (max-width: 768px) {
  .hero-image img { height: 240px; }
  .hero-overlay h2 { font-size: 1.1rem; }
}
@media (max-width: 480px) {
  .hero-image img { height: 200px; }
}

/* ── Category badge ───────────────────────────────────────── */
.cat-badge {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 700;
  padding: .25rem .65rem;
  border-radius: 2rem;
  display: inline-block;
  line-height: 1.4;
}

/* ── AI badge ─────────────────────────────────────────────── */
.ai-badge {
  background: linear-gradient(90deg, #6366f1, #ec4899);
  color: #fff;
  font-size: .68rem;
  padding: .2rem .55rem;
  border-radius: 1rem;
  font-weight: 600;
  display: inline-block;
  line-height: 1.4;
}

/* ── Trending sidebar ─────────────────────────────────────── */
.trending-item {
  border-left: 3px solid var(--accent);
  padding-left: .8rem;
  margin-bottom: .9rem;
}
.trending-item:last-child { margin-bottom: 0; }
.trending-rank {
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--accent);
  line-height: 1;
  min-width: 24px;
}

/* ── AI summary box ───────────────────────────────────────── */
.ai-summary-box {
  background: linear-gradient(135deg, #f0f1ff 0%, #fff0f8 100%);
  border: 1px solid #ddd6fe;
  border-radius: var(--card-radius);
  padding: 1rem 1.2rem;
}

/* ── Article body ─────────────────────────────────────────── */
.article-body {
  line-height: 1.85;
  font-size: 1.02rem;
}
.article-body p { margin-bottom: 1.2rem; }
.article-body img {
  max-width: 100%;
  height: auto;
  border-radius: var(--card-radius);
  margin: 1rem 0;
}
.article-body h2,
.article-body h3 {
  font-family: var(--brand-font);
  margin-top: 2rem;
}
/* FIX 2: Quill-generated content should never overflow */
.article-body .ql-editor,
.article-body * {
  max-width: 100%;
}

/* ── Footer ───────────────────────────────────────────────── */
.site-footer {
  background: var(--footer-bg);
  color: rgba(255,255,255,.65);
}
.site-footer a { color: rgba(255,255,255,.65); }
.site-footer a:hover { color: #fff; }
.footer-brand {
  font-family: var(--brand-font);
  color: #fff;
  font-size: 1.4rem;
}
.site-footer hr { border-color: rgba(255,255,255,.1); }

/* ── Bootstrap 5 Pagination ───────────────────────────────── */
.pagination { margin: 0; gap: .2rem; flex-wrap: wrap; }
.pagination .page-link {
  border-radius: .4rem !important;
  border: 1px solid #e5e7eb;
  color: #374151;
  padding: .4rem .7rem;
  font-size: .875rem;
  transition: .15s;
  line-height: 1.4;
}
.pagination .page-link:hover {
  background: #f9fafb;
  border-color: #d1d5db;
  color: #111827;
}
.pagination .page-item.active .page-link {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}
.pagination .page-item.disabled .page-link {
  color: #9ca3af;
  background: #f9fafb;
  border-color: #e5e7eb;
}

/* ── Dark mode ────────────────────────────────────────────── */
[data-bs-theme="dark"] body               { background: #121218; color: #e2e2e2; }
[data-bs-theme="dark"] .site-header       { background: #1a1a2e !important; border-color: #2d2d4e; }
[data-bs-theme="dark"] .brand-text        { color: #ff6b6b; }
[data-bs-theme="dark"] .news-card         { background: #1e1e30; border-color: #2d2d4e; }
[data-bs-theme="dark"] .card             { background: #1e1e30; border-color: #2d2d4e; }
[data-bs-theme="dark"] .list-group-item  { background: #1e1e30; border-color: #2d2d4e; color: #e2e2e2; }
[data-bs-theme="dark"] .ai-summary-box   { background: #1e1e35; border-color: #4c4c8a; }
[data-bs-theme="dark"] .pagination .page-link {
  background: #1e1e30;
  border-color: #2d2d4e;
  color: #d1d5db;
}
[data-bs-theme="dark"] .pagination .page-link:hover {
  background: #2d2d4e;
  color: #fff;
}
[data-bs-theme="dark"] .pagination .page-item.active .page-link {
  background: var(--accent);
  border-color: var(--accent);
}

/* ── Responsive utilities ─────────────────────────────────── */
@media (max-width: 768px) {
  /* FIX 2: site header stacks vertically on mobile */
  .site-header .container {
    flex-direction: column;
    align-items: flex-start !important;
    gap: .75rem;
  }
  .search-form { max-width: 100%; width: 100%; }

  /* Smaller brand text on mobile */
  .brand-text { font-size: 1.5rem; }

  /* Article hero grid: full-width on mobile */
  .hero-image img { height: 220px; }

  /* Cards full-width on small screens */
  .news-card .card-img-top { height: 180px; }
}

@media (max-width: 480px) {
  .brand-text { font-size: 1.3rem; }
  .main-nav .nav-link { font-size: .8rem; padding: .5rem .6rem !important; }
}

/* ── Admin panel pagination ───────────────────────────────── */
.content .pagination .page-link {
  border-radius: .35rem !important;
  border-color: #e5e7eb;
  color: #374151;
  font-size: .82rem;
  padding: .3rem .6rem;
}
.content .pagination .page-item.active .page-link {
  background: var(--accent);
  border-color: var(--accent);
}

/* ── Responsive sticky sidebar ────────────────────────────── */
@media (min-width: 992px) {
  .position-lg-sticky {
    position: sticky !important;
    top: 80px;
  }
}
@media (max-width: 991px) {
  .position-lg-sticky {
    position: relative !important;
  }
}

/* ── Prevent Quill editor / iframes overflowing ───────────── */
.article-body iframe,
.article-body embed,
.article-body object,
.article-body table {
  max-width: 100%;
}
.article-body table {
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* ── Scrollable Nav (Fix 2) ────────────────────────────────── */
.main-nav-wrapper {
  background: #1d2330;
  position: relative;
  display: flex;
  align-items: stretch;
}

/* Arrow scroll buttons */
.nav-scroll-btn {
  background: rgba(255,255,255,.08);
  border: none;
  color: rgba(255,255,255,.7);
  width: 36px;
  flex-shrink: 0;
  cursor: pointer;
  transition: background .15s, color .15s;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .8rem;
  z-index: 2;
}
.nav-scroll-btn:hover {
  background: rgba(255,255,255,.18);
  color: #fff;
}
.nav-scroll-btn:disabled {
  opacity: .25;
  cursor: default;
}

/* Scrollable track */
.nav-scroll-track {
  overflow-x: auto;
  overflow-y: hidden;
  flex: 1;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  /* Hide scrollbar — functional but invisible */
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.nav-scroll-track::-webkit-scrollbar {
  display: none;
}

/* Nav item list — single row, no wrap */
.nav-menu-list {
  display: flex;
  align-items: stretch;
  list-style: none;
  margin: 0;
  padding: 0;
  white-space: nowrap;
  min-width: max-content;
}
.nav-menu-list li {
  display: flex;
  align-items: stretch;
}

/* Nav link */
.nav-menu-item {
  display: flex;
  align-items: center;
  color: rgba(255,255,255,.7);
  text-decoration: none;
  font-size: .83rem;
  font-weight: 500;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: .7rem .9rem;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: color .15s, border-color .15s;
}
.nav-menu-item:hover {
  color: #fff;
  border-bottom-color: var(--accent);
}
.nav-menu-item.active {
  color: #fff;
  border-bottom-color: var(--accent);
  font-weight: 600;
}

/* Fade edges to hint scrollability */
.main-nav-wrapper::before,
.main-nav-wrapper::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 30px;
  z-index: 1;
  pointer-events: none;
  transition: opacity .2s;
}
.main-nav-wrapper::before {
  left: 36px;
  background: linear-gradient(to right, #1d2330, transparent);
}
.main-nav-wrapper::after {
  right: 36px;
  background: linear-gradient(to left, #1d2330, transparent);
}
