/* =====================================================
   NEWS PORTAL — Main Stylesheet
   Colors come from PHP-injected :root vars in header.php
   Layout/structure only here.
   ===================================================== */

@import url('https://fonts.googleapis.com/css2?family=Sarabun:wght@300;400;500;600;700;800&display=swap');

/* ---- Fallback vars (overridden by PHP inline style) ---- */
:root {
  --primary:       #0a84d0;
  --primary-dark:  #0066aa;
  --primary-light: #38a8e8;
  --secondary:     #ff8c42;
  --accent:        #ff8c42;
  --header-bg:     #0a84d0;
  --header-text:   #ffffff;
  --nav-bg:        #0066aa;
  --nav-text:      #ffffff;
  --nav-hover:     rgba(255,255,255,0.15);
  --breaking-bg:   #ff8c42;
  --breaking-text: #ffffff;
  --radius:        6px;
  --footer-bg:     #0a3d62;
  --tag-bg:        #e8f4fd;
  --tag-text:      #0a84d0;
  --section-title-color: #0a84d0;
  --section-border:      #0a84d0;
  --badge-bg:      #0a84d0;
  --badge-text:    #fff;
  --scrollbar:     #0a84d0;
  /* Neutral */
  --bg:          #f0f2f5;
  --bg2:         #e4e8ee;
  --card:        #ffffff;
  --card-hover:  #fafbff;
  --text:        #1a1a1a;
  --text2:       #444;
  --text-muted:  #777;
  --border:      #dde1e7;
  --border-light:#eef0f4;
  --shadow:      0 2px 8px rgba(0,0,0,0.08);
  --shadow-lg:   0 8px 32px rgba(0,0,0,0.13);
  --input-bg:    #ffffff;
  --hero-overlay:linear-gradient(to top, rgba(0,0,0,0.88) 0%, rgba(0,0,0,0.3) 60%, transparent 100%);
}

/* =====================
   RESET & BASE
   ===================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html  { scroll-behavior: smooth; }
body  { font-family: 'Sarabun', sans-serif; background: var(--bg); color: var(--text);
        font-size: 16px; line-height: 1.6; }
a     { color: inherit; text-decoration: none; }
a:hover { color: var(--primary); }
img   { max-width: 100%; display: block; }
button { cursor: pointer; font-family: inherit; }
::-webkit-scrollbar       { width: 6px; }
::-webkit-scrollbar-track  { background: var(--bg); }
::-webkit-scrollbar-thumb  { background: var(--scrollbar); border-radius: 3px; }
.container { max-width: 1240px; margin: 0 auto; padding: 0 16px; }

/* =====================
   HEADER
   ===================== */
.site-header {
  background: var(--header-bg);
  color: var(--header-text);
  box-shadow: var(--shadow);
  position: sticky; top: 0; z-index: 1000;
}
.header-top {
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,0.12);
}
/* Light header variant (newsallgens.com - sharp) */
[data-variant="sharp"] .header-top {
  border-bottom-color: var(--border);
}
.header-top .container {
  display: flex; align-items: center;
  justify-content: space-between; gap: 16px;
}

/* Logo */
.site-logo { display: flex; align-items: center; gap: 10px; }
.logo-svg  { flex-shrink: 0; }
.logo-text { font-size: 20px; font-weight: 800; color: var(--header-text); line-height: 1.1; }
.logo-sub  { font-size: 11px; font-weight: 400; opacity: 0.7; }

/* Search */
.header-center  { flex: 1; max-width: 480px; }
.search-box     {
  display: flex;
  background: rgba(255,255,255,0.14);
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: 24px; overflow: hidden;
}
[data-variant="sharp"] .search-box {
  background: var(--bg); border-color: var(--border);
}
.search-box input {
  flex: 1; background: none; border: none; outline: none;
  padding: 8px 16px; color: var(--header-text);
  font-family: inherit; font-size: 14px;
}
[data-variant="sharp"] .search-box input { color: var(--text); }
.search-box input::placeholder { opacity: 0.65; }
.search-box button {
  background: var(--primary); border: none; color: #fff;
  padding: 8px 16px; font-size: 16px;
  transition: background 0.2s;
}
[data-variant="sharp"] .search-box button { background: var(--primary); }
.search-box button:hover { background: var(--primary-dark); }

/* Admin btn */
.header-right { display: flex; align-items: center; gap: 8px; }
.admin-btn {
  background: rgba(0,0,0,0.18); color: var(--header-text);
  padding: 7px 14px; border-radius: 20px;
  font-size: 13px; font-weight: 600;
  display: flex; align-items: center; gap: 6px;
  border: 1px solid rgba(255,255,255,0.25);
  white-space: nowrap; transition: background 0.2s;
}
[data-variant="sharp"] .admin-btn {
  background: var(--primary); color: #fff; border-color: var(--primary);
}
.admin-btn:hover { background: rgba(0,0,0,0.3); color: var(--header-text); }
[data-variant="sharp"] .admin-btn:hover { background: var(--primary-dark); color: #fff; }

/* Nav */
.header-nav  { background: var(--nav-bg); }
.nav-list    { display: flex; list-style: none; overflow-x: auto; scrollbar-width: none; }
.nav-list::-webkit-scrollbar { display: none; }
.nav-list li a {
  display: flex; align-items: center; gap: 5px;
  padding: 10px 16px; color: var(--nav-text);
  font-size: 14px; font-weight: 600;
  white-space: nowrap; transition: background 0.2s;
}
.nav-list li a:hover, .nav-list li a.active {
  background: var(--nav-hover); color: var(--nav-text);
}
.nav-list li a .nav-icon { font-size: 14px; }

/* =====================
   BREAKING TICKER
   ===================== */
.breaking-bar  { background: var(--breaking-bg); color: var(--breaking-text); padding: 6px 0; overflow: hidden; }
.breaking-inner { display: flex; align-items: center; }
.breaking-label {
  background: rgba(0,0,0,0.22); padding: 2px 14px;
  font-size: 13px; font-weight: 700; white-space: nowrap;
  border-radius: 3px; margin-right: 14px; flex-shrink: 0;
}
.ticker-wrap  { overflow: hidden; flex: 1; }
.ticker-text  {
  display: flex; gap: 60px;
  animation: ticker 45s linear infinite;
  white-space: nowrap; font-size: 13px; font-weight: 500;
}
.ticker-text span::before { content: "◆ "; font-size: 10px; margin-right: 4px; }
@keyframes ticker {
  0%   { transform: translateX(100%); }
  100% { transform: translateX(-100%); }
}

/* =====================
   MAIN LAYOUT
   ===================== */
.main-wrap { padding: 20px 0 40px; }
.two-col   { display: grid; grid-template-columns: 1fr 320px; gap: 24px; }

/* =====================
   HERO
   ===================== */
.hero-section  { margin-bottom: 28px; }
.hero-card     {
  position: relative; border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow-lg); display: block;
}
.hero-card img {
  width: 100%; height: 460px;
  object-fit: cover; display: block;
}
.hero-overlay  { position: absolute; inset: 0; background: var(--hero-overlay); }
.hero-content  { position: absolute; bottom: 0; left: 0; right: 0; padding: 32px 28px 24px; color: #fff; }
.hero-badge    {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--primary); color: #fff;
  padding: 3px 12px; border-radius: 4px;
  font-size: 12px; font-weight: 700; margin-bottom: 10px;
}
.pin-badge     { background: var(--accent); }
.hero-title    { font-size: 26px; font-weight: 800; line-height: 1.35; margin-bottom: 10px; text-shadow: 0 2px 4px rgba(0,0,0,0.5); }
.hero-excerpt  { font-size: 14px; opacity: 0.88; line-height: 1.5;
                 display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 6px; }
.hero-meta     { display: flex; align-items: center; gap: 16px; font-size: 13px; opacity: 0.9; margin-top: 10px; }
.hero-meta span { display: flex; align-items: center; gap: 5px; }

/* =====================
   SECTION HEADERS
   ===================== */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; padding-bottom: 10px;
  border-bottom: 2px solid var(--section-border);
}
.section-title {
  font-size: 18px; font-weight: 800; color: var(--section-title-color);
  display: flex; align-items: center; gap: 8px;
}
.see-all {
  font-size: 13px; color: var(--primary); font-weight: 600;
  padding: 4px 10px; border: 1px solid var(--primary);
  border-radius: 20px; transition: all 0.2s;
}
.see-all:hover { background: var(--primary); color: #fff; }

/* =====================
   NEWS GRID
   ===================== */
.news-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; }

.news-card {
  background: var(--card); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex; flex-direction: column;
}
.news-card:hover {
  transform: translateY(-3px); box-shadow: var(--shadow-lg);
  background: var(--card-hover);
}
/* Round variant — more pronounced hover */
[data-variant="round"] .news-card:hover { transform: translateY(-5px); }

.card-img  { width: 100%; height: 160px; object-fit: cover; }
.card-body { padding: 12px; flex: 1; display: flex; flex-direction: column; }
.card-category {
  display: inline-block; padding: 2px 8px;
  border-radius: 3px; font-size: 11px; font-weight: 700; margin-bottom: 8px;
  background: var(--badge-bg); color: #fff;
}
[data-variant="round"] .card-category { border-radius: 20px; }

.card-title {
  font-size: 14px; font-weight: 700; line-height: 1.4; color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden; flex: 1; margin-bottom: 10px;
}
.card-title:hover { color: var(--primary); }
.card-meta {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; color: var(--text-muted); gap: 8px;
}
.card-meta-left { display: flex; align-items: center; gap: 10px; }
.card-meta span { display: flex; align-items: center; gap: 4px; }

/* =====================
   LIST ITEMS (sidebar)
   ===================== */
.news-list-item {
  display: flex; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--border-light);
  transition: transform 0.2s;
}
.news-list-item:last-child { border-bottom: none; }
.news-list-item:hover       { transform: translateX(3px); }
.news-list-item img {
  width: 90px; height: 62px; object-fit: cover;
  border-radius: var(--radius); flex-shrink: 0;
}
.news-list-body            { flex: 1; }
.news-list-body .card-title {
  font-size: 13px; -webkit-line-clamp: 2; margin-bottom: 4px;
}

/* =====================
   SIDEBAR
   ===================== */
.sidebar-widget  { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 20px; overflow: hidden; }
.widget-header   { background: var(--primary); color: #fff; padding: 10px 16px; font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.widget-body     { padding: 12px; }

.trending-item   { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--border-light); }
.trending-item:last-child { border-bottom: none; }
.trending-num    { width: 24px; height: 24px; background: var(--primary); color: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; flex-shrink: 0; margin-top: 2px; }
.trending-num.top3 { background: var(--accent); }
.trending-title  { font-size: 13px; font-weight: 600; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--text); }
.trending-title:hover { color: var(--primary); }

.cat-chips       { display: flex; flex-wrap: wrap; gap: 8px; }
.cat-chip        { display: flex; align-items: center; gap: 5px; padding: 5px 12px; border-radius: 20px; font-size: 13px; font-weight: 600; color: #fff; transition: opacity 0.2s, transform 0.2s; }
.cat-chip:hover  { opacity: 0.85; transform: scale(1.05); color: #fff; }

/* =====================
   CATEGORY HERO
   ===================== */
.cat-hero        { padding: 28px 0; background: var(--nav-bg); color: var(--nav-text); }
.cat-hero-inner  { display: flex; align-items: center; gap: 16px; }
.cat-hero-icon   { font-size: 52px; line-height: 1; }
.cat-hero-text h1 { font-size: 28px; font-weight: 800; margin-bottom: 4px; }
.cat-hero-text p  { font-size: 15px; opacity: 0.8; }

/* =====================
   ARTICLE PAGE
   ===================== */
.article-container { display: grid; grid-template-columns: 1fr 300px; gap: 28px; padding: 8px 0 28px; }
.article-cat-badge {
  display: inline-block; padding: 3px 12px; border-radius: var(--radius);
  font-size: 12px; font-weight: 700; margin-bottom: 14px;
}
.article-title { font-size: 28px; font-weight: 800; line-height: 1.4; margin-bottom: 12px; }
.article-meta  {
  display: flex; align-items: center; flex-wrap: wrap;
  gap: 16px; font-size: 13px; color: var(--text-muted);
  padding: 12px 0; border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border); margin-bottom: 20px;
}
.article-meta span { display: flex; align-items: center; gap: 5px; }
.article-cover { width: 100%; border-radius: var(--radius); margin-bottom: 24px; max-height: 480px; object-fit: cover; }
.article-body  { font-size: 16px; line-height: 1.85; color: var(--text2); }
.article-body h2 { font-size: 20px; font-weight: 800; color: var(--text); margin: 24px 0 10px; padding-left: 12px; border-left: 4px solid var(--primary); }
.article-body h3 { font-size: 17px; font-weight: 700; color: var(--text); margin: 18px 0 8px; }
.article-body p  { margin-bottom: 16px; }
.article-body blockquote {
  border-left: 4px solid var(--primary); padding: 12px 20px;
  background: var(--bg2); border-radius: 0 var(--radius) var(--radius) 0;
  margin: 20px 0; font-style: italic; color: var(--text2);
}
.article-body ul, .article-body ol { margin: 12px 0 16px 24px; }
.article-body li { margin-bottom: 6px; }
.article-body img { border-radius: var(--radius); margin: 16px 0; width: 100%; }

.article-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); }
.tag-pill     { padding: 4px 12px; border-radius: 20px; background: var(--tag-bg); color: var(--tag-text); font-size: 12px; font-weight: 600; transition: opacity 0.2s; }
.tag-pill:hover { opacity: 0.8; color: var(--tag-text); }

.share-bar   { display: flex; align-items: center; gap: 10px; margin: 20px 0; padding: 14px 0; border-top: 1px solid var(--border); flex-wrap: wrap; }
.share-label { font-size: 13px; font-weight: 700; color: var(--text-muted); }
.share-btn   { display: flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 6px; border: none; font-size: 13px; font-weight: 600; color: #fff; cursor: pointer; transition: opacity 0.2s; }
.share-btn:hover { opacity: 0.85; }
.share-btn.fb { background: #1877f2; }
.share-btn.tw { background: #1da1f2; }
.share-btn.lk { background: #555; }

/* =====================
   FOOTER
   ===================== */
.site-footer    { background: var(--footer-bg); color: rgba(255,255,255,0.75); padding: 40px 0 20px; margin-top: 40px; }
.footer-grid    { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 32px; margin-bottom: 32px; }
.footer-logo    { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 800; color: #fff; margin-bottom: 10px; }
.footer-desc    { font-size: 13px; line-height: 1.7; }
.footer-col h4  { font-size: 14px; font-weight: 700; color: #fff; margin-bottom: 12px; }
.footer-col ul  { list-style: none; }
.footer-col ul li { margin-bottom: 7px; }
.footer-col ul li a { font-size: 13px; color: rgba(255,255,255,0.65); transition: color 0.2s; }
.footer-col ul li a:hover { color: #fff; }
.footer-bottom  { border-top: 1px solid rgba(255,255,255,0.1); padding-top: 20px; display: flex; justify-content: space-between; align-items: center; font-size: 12px; }

/* =====================
   BUTTONS
   ===================== */
.btn         { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: var(--radius); font-size: 14px; font-weight: 600; font-family: inherit; border: none; cursor: pointer; transition: all 0.2s; text-decoration: none; white-space: nowrap; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-sm      { padding: 5px 12px; font-size: 13px; }

/* =====================
   PAGINATION
   ===================== */
.pagination { display: flex; justify-content: center; gap: 6px; margin-top: 28px; flex-wrap: wrap; }
.page-btn   {
  min-width: 36px; height: 36px; border: 1.5px solid var(--border);
  background: var(--card); color: var(--text); border-radius: var(--radius);
  font-size: 14px; cursor: pointer; display: flex;
  align-items: center; justify-content: center;
  transition: all 0.2s; font-family: inherit; padding: 0 8px;
  text-decoration: none;
}
.page-btn:hover, .page-btn.active {
  background: var(--primary); border-color: var(--primary); color: #fff;
}
.page-btn.wide { padding: 0 14px; }

/* =====================
   MISC UTILS
   ===================== */
.hidden    { display: none !important; }
.text-muted{ color: var(--text-muted); }
.fw-700    { font-weight: 700; }

/* =====================
   RESPONSIVE
   ===================== */
@media (max-width: 1024px) {
  .two-col          { grid-template-columns: 1fr; }
  .footer-grid      { grid-template-columns: 1fr 1fr; }
  .article-container{ grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .news-grid        { grid-template-columns: repeat(2,1fr); }
  .hero-card img    { height: 300px; }
  .hero-title       { font-size: 18px; }
  .header-center    { display: none; }
  .footer-grid      { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .news-grid        { grid-template-columns: 1fr; }
  .hero-card img    { height: 240px; }
}
