/* ============================================================
   news.css — Tab Phân tích › Tin tức (danh sách + bài viết)
   Dùng chung cho trang công khai và khung soạn thảo trong /admin
   (các biến có giá trị dự phòng để chạy được cả ngoài giao diện chính)
   ============================================================ */

/* ===== Menu con: Báo cáo | Tin tức ===== */
.an-subnav { display: inline-flex; gap: 4px; margin: 0 0 18px; padding: 4px; background: var(--bg-card, #fff); border: 1px solid var(--border, #E2E5EA); border-radius: 10px; max-width: 100%; }
.an-subtab { display: inline-flex; align-items: center; gap: 6px; padding: 7px 18px; font-size: 13px; font-weight: 600; color: var(--text-secondary, #6B7280); border-radius: 7px; text-decoration: none; white-space: nowrap; transition: background .15s, color .15s; }
.an-subtab:hover { color: var(--text, #1A1D23); background: var(--bg, #F7F8FA); }
.an-subtab.active, .an-subtab.active:hover { background: var(--green, #1D9E75); color: #fff; }

/* ===== Danh sách bài viết ===== */
.news-head { margin: 2px 0 18px; }
.news-head h1 { font-size: 22px; line-height: 1.3; font-weight: 700; letter-spacing: -.01em; color: var(--text, #1A1D23); }
.news-head p { font-size: 13px; color: var(--text-secondary, #6B7280); margin-top: 4px; }

.news-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.news-card { background: var(--bg-card, #fff); border: 1px solid var(--border, #E2E5EA); border-radius: 12px; overflow: hidden; transition: box-shadow .2s, transform .2s, border-color .2s; }
.news-card:hover { box-shadow: 0 10px 28px rgba(16, 24, 40, .09); transform: translateY(-2px); border-color: #cfd5dc; }
.news-link { display: flex; flex-direction: column; height: 100%; color: inherit; text-decoration: none; }
.news-link:focus-visible { outline: 2px solid var(--green, #1D9E75); outline-offset: -2px; }
.news-thumb { position: relative; aspect-ratio: 16 / 9; background: #EEF1F4; overflow: hidden; flex-shrink: 0; }
.news-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .35s ease; }
.news-card:hover .news-thumb img { transform: scale(1.035); }
.news-thumb.empty { display: flex; align-items: center; justify-content: center; font-size: 34px; background: linear-gradient(135deg, var(--green-light, #E1F5EE), #F7F8FA); }
.news-body { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px 16px; flex: 1; min-width: 0; }
.news-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; font-size: 11.5px; color: var(--text-secondary, #6B7280); }
.news-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: currentColor; opacity: .55; }
.news-title { font-size: 16px; line-height: 1.4; font-weight: 700; color: var(--text, #1A1D23); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.news-link:hover .news-title { color: var(--green-strong, #0A5940); }
.news-excerpt { font-size: 13px; line-height: 1.6; color: var(--text-secondary, #6B7280); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* Bài nổi bật (trang 1): nằm ngang, chiếm cả hàng */
.news-card.featured { grid-column: 1 / -1; }
.news-card.featured .news-link { flex-direction: row; }
.news-card.featured .news-thumb { width: 58%; aspect-ratio: auto; min-height: 320px; }
.news-card.featured .news-body { padding: 28px 32px; justify-content: center; gap: 12px; }
.news-card.featured .news-title { font-size: 26px; line-height: 1.3; -webkit-line-clamp: 4; }
.news-card.featured .news-excerpt { font-size: 14.5px; -webkit-line-clamp: 5; }
.news-badge { display: inline-block; align-self: flex-start; font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--green-strong, #0A5940); background: var(--green-light, #E1F5EE); padding: 3px 9px; border-radius: 20px; }

.news-grid .ad-slot { grid-column: 1 / -1; margin: 0; }

.news-empty { text-align: center; padding: 64px 20px; background: var(--bg-card, #fff); border: 1px dashed var(--border, #E2E5EA); border-radius: 12px; color: var(--text-secondary, #6B7280); }
.news-empty .ico { font-size: 42px; margin-bottom: 8px; }
.news-empty b { display: block; font-size: 16px; color: var(--text, #1A1D23); margin-bottom: 4px; }

/* Phân trang */
.news-pager { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px; margin: 28px 0 8px; }
.news-pager a, .news-pager span { min-width: 36px; height: 36px; padding: 0 12px; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; border-radius: 8px; border: 1px solid var(--border, #E2E5EA); background: var(--bg-card, #fff); color: var(--text, #1A1D23); text-decoration: none; }
.news-pager a:hover { border-color: var(--green, #1D9E75); color: var(--green, #1D9E75); }
.news-pager .cur { background: var(--green, #1D9E75); border-color: var(--green, #1D9E75); color: #fff; }
.news-pager .gap { border: none; background: none; min-width: 20px; padding: 0; color: var(--text-secondary, #6B7280); }
.news-pager .off { opacity: .45; }

/* ===== Trang bài viết ===== */
/* Cột bài (đọc thoải mái ~700px) + cột phải 300px dành cho quảng cáo 300×250 / 300×600 */
.news-article-wrap { display: grid; grid-template-columns: minmax(0, 780px) 300px; gap: 36px; justify-content: center; align-items: start; }
.news-article { min-width: 0; background: var(--bg-card, #fff); border: 1px solid var(--border, #E2E5EA); border-radius: 14px; padding: 30px 40px 34px; }
.news-crumb { display: flex; flex-wrap: wrap; gap: 6px; font-size: 12px; color: var(--text-secondary, #6B7280); margin-bottom: 14px; }
.news-crumb a { color: inherit; text-decoration: none; }
.news-crumb a:hover { color: var(--green, #1D9E75); }
.news-article h1.article-title { font-size: 32px; line-height: 1.28; font-weight: 800; letter-spacing: -.015em; color: var(--text, #1A1D23); margin: 0 0 14px; }
.article-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; font-size: 13px; color: var(--text-secondary, #6B7280); margin-bottom: 22px; padding-bottom: 18px; border-bottom: 1px solid var(--border-light, #EEF0F3); }
.article-meta .av { width: 30px; height: 30px; border-radius: 50%; background: var(--green-light, #E1F5EE); color: var(--green-strong, #0A5940); font-weight: 700; font-size: 13px; display: inline-flex; align-items: center; justify-content: center; }
.article-meta b { color: var(--text, #1A1D23); font-weight: 600; }
.article-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: currentColor; opacity: .55; }
.article-cover { margin: 0 0 26px; }
.article-cover img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; display: block; border-radius: 10px; background: #EEF1F4; }
.article-note { margin-top: 28px; padding: 12px 14px; font-size: 12px; line-height: 1.6; color: var(--text-secondary, #6B7280); background: var(--bg, #F7F8FA); border-radius: 8px; }
.article-note .note-link { background: none; border: none; padding: 0; font: inherit; color: var(--green, #1D9E75); cursor: pointer; text-decoration: underline; }
.article-back { display: inline-flex; margin-top: 22px; font-size: 13px; font-weight: 600; color: var(--green, #1D9E75); text-decoration: none; }
.article-back:hover { text-decoration: underline; }

/* Cột phải */
.news-side { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.side-card { background: var(--bg-card, #fff); border: 1px solid var(--border, #E2E5EA); border-radius: 12px; padding: 16px; }
.side-title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text, #1A1D23); margin-bottom: 12px; }
.side-item { display: flex; gap: 12px; padding: 10px 0; text-decoration: none; color: inherit; border-top: 1px solid var(--border-light, #EEF0F3); }
.side-item:first-of-type { border-top: none; padding-top: 0; }
.side-item:last-child { padding-bottom: 0; }
.side-item .st { width: 78px; height: 52px; border-radius: 7px; object-fit: cover; flex-shrink: 0; background: #EEF1F4; }
.side-item .st.empty { display: flex; align-items: center; justify-content: center; font-size: 18px; background: var(--green-light, #E1F5EE); }
.side-item .tt { font-size: 13px; line-height: 1.45; font-weight: 600; color: var(--text, #1A1D23); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.side-item:hover .tt { color: var(--green-strong, #0A5940); }
.side-item .dd { font-size: 11px; color: var(--text-secondary, #6B7280); margin-top: 3px; }

/* ===== Nội dung bài viết (cũng dùng làm giao diện soạn thảo trong admin) ===== */
.article-body { font-size: 17px; line-height: 1.8; color: #1F2937; overflow-wrap: anywhere; word-break: normal; }
.article-body > *:first-child { margin-top: 0; }
.article-body p { margin: 0 0 1.15em; }
.article-body h2 { font-size: 1.55em; line-height: 1.3; font-weight: 800; letter-spacing: -.01em; color: #111827; margin: 1.9em 0 .6em; }
.article-body h3 { font-size: 1.25em; line-height: 1.35; font-weight: 700; color: #111827; margin: 1.6em 0 .5em; }
.article-body h4 { font-size: 1.08em; font-weight: 700; margin: 1.4em 0 .4em; }
.article-body a { color: var(--green-strong, #0A5940); text-decoration: underline; text-underline-offset: 2px; text-decoration-color: rgba(29, 158, 117, .5); }
.article-body a:hover { text-decoration-color: currentColor; }
.article-body strong { font-weight: 700; color: #111827; }
.article-body ul, .article-body ol { margin: 0 0 1.15em; padding-left: 1.5em; }
.article-body li { margin: .35em 0; }
.article-body li > ul, .article-body li > ol { margin: .35em 0 0; }
.article-body blockquote { margin: 1.5em 0; padding: .9em 1.2em; border-left: 4px solid var(--green, #1D9E75); background: var(--green-light, #E1F5EE); border-radius: 0 8px 8px 0; color: #374151; }
.article-body blockquote p:last-child { margin-bottom: 0; }
.article-body img { display: block; max-width: 100%; height: auto; margin: 1.6em auto; border-radius: 8px; }
.article-body hr { border: none; border-top: 1px solid #E5E7EB; margin: 2em 0; }
.article-body pre { margin: 1.3em 0; padding: 14px 16px; background: #111827; color: #E5E7EB; border-radius: 8px; overflow-x: auto; font-size: 14px; line-height: 1.6; }
.article-body code { font-family: Consolas, 'Courier New', monospace; font-size: .9em; background: #F3F4F6; padding: .1em .35em; border-radius: 4px; }
.article-body pre code { background: none; padding: 0; }
.article-body .ql-align-center { text-align: center; }
.article-body .ql-align-right { text-align: right; }
.article-body .ql-align-justify { text-align: justify; }
.article-body .ql-indent-1 { padding-left: 3em; } .article-body .ql-indent-2 { padding-left: 6em; } .article-body .ql-indent-3 { padding-left: 9em; }
.article-body .ql-indent-4 { padding-left: 12em; } .article-body .ql-indent-5 { padding-left: 15em; } .article-body .ql-indent-6 { padding-left: 18em; }
.article-body .ql-indent-7 { padding-left: 21em; } .article-body .ql-indent-8 { padding-left: 24em; }

/* ===== Quảng cáo Google (chỉ xuất hiện khi bật trong includes/news.php) ===== */
.ad-slot { display: block; margin: 28px 0; text-align: center; min-height: 100px; }
.ad-slot .ad-label { display: block; margin-bottom: 4px; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: #9AA1AB; }
.ad-slot.ad-sidebar { margin: 0; min-height: 250px; }   /* giữ chỗ → không bị nhảy layout khi quảng cáo tải xong */
.ad-slot.ad-in_article, .ad-slot.ad-after_article { min-height: 250px; }

/* ===== Responsive ===== */
@media (max-width: 1100px) {
  .news-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .news-article-wrap { grid-template-columns: minmax(0, 780px); }
  .news-side { position: static; }
}
@media (max-width: 760px) {
  .news-card.featured .news-link { flex-direction: column; }
  .news-card.featured .news-thumb { width: 100%; min-height: 0; aspect-ratio: 16 / 9; }
  .news-card.featured .news-body { padding: 16px; }
  .news-card.featured .news-title { font-size: 20px; }
}
@media (max-width: 640px) {
  .news-grid { grid-template-columns: 1fr; gap: 16px; }
  .news-head h1 { font-size: 19px; }
  .news-article { padding: 20px 16px 24px; border-radius: 12px; }
  .news-article h1.article-title { font-size: 24px; }
  .article-body { font-size: 16px; line-height: 1.75; }
  .article-body .ql-indent-1, .article-body .ql-indent-2 { padding-left: 1.5em; }
  .an-subtab { padding: 7px 14px; }
}
@media (prefers-reduced-motion: reduce) { .news-card, .news-thumb img { transition: none; } .news-card:hover { transform: none; } }
