/*
Theme Name: CongNghe - Tin Công Nghệ Số
Template: congnghe-base
Author: NGÔ
Description: Biến thể giao diện cho tincongngheso.com (Tin Công Nghệ Số). Child theme của CongNghe Base.
Version: 1.1.0
Text Domain: cn-tincongngheso
*/

/* ============================================================
 * TOKEN BIẾN GỐC (màu/font/layout)
 * ============================================================ */
:root {
  --color-primary: #e11d48;
  --color-primary-dark: #be123c;
  --color-accent: #0ea5e9;
  --color-footer-bg: #4c0519;
  --color-header-bg: #0f172a;
  --color-header-text: #ffffff;
  --font-body: "Roboto", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --font-heading: "Roboto", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --radius: 8px;
  --container-width: 1280px;
  /* Token bổ sung cho phong cách tạp chí */
  --color-ticker-bg: #e11d48;
  --color-ticker-text: #ffffff;
  --color-breaking: #dc2626;
  --color-section-border: #e11d48;
}

/* ============================================================
 * BREAKING NEWS TICKER — override màu cho tincongngheso.com
 * Class names xuất bởi parent theme (congnghe_breaking_ticker).
 * ============================================================ */
.cn-ticker {
  background: var(--color-ticker-bg, var(--color-primary));
  color: var(--color-ticker-text, #fff);
}

.cn-ticker-label {
  background: #9f0f2a; /* đỏ đậm hơn primary */
}

.cn-ticker-inner {
  animation-duration: 28s; /* nhanh hơn mặc định 30s */
}

/* ============================================================
 * HEADER — phong cách báo chí
 * ============================================================ */
.site-header {
  background: var(--color-header-bg, #0f172a) !important;
  border-bottom: 3px solid var(--color-primary);
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-branding .site-title a {
  color: #fff;
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: -.02em;
  text-transform: uppercase;
}

/* Masthead logo vùng đỏ nổi bật */
.site-branding .site-title a span.tcs-dot {
  color: var(--color-primary);
}

.site-description {
  color: rgba(255,255,255,.5);
  font-size: .75rem;
}

/* Navigation kiểu báo — tab danh mục */
.main-navigation ul {
  gap: 0;
}

.main-navigation ul li a {
  color: rgba(255,255,255,.85);
  padding: 10px 14px;
  font-size: .875rem;
  font-weight: 600;
  letter-spacing: .02em;
  text-transform: uppercase;
  border-top: 3px solid transparent;
  transition: color .2s, border-color .2s;
}

.main-navigation ul li a:hover,
.main-navigation ul li.current-menu-item > a,
.main-navigation ul li.current-menu-ancestor > a {
  color: #fff;
  border-top-color: var(--color-primary);
  background: rgba(255,255,255,.06);
}

/* ============================================================
 * NAV CHUYÊN MỤC THỨ 2 — override màu cho tincongngheso.com
 * Class names xuất bởi parent theme (congnghe_category_nav).
 * ============================================================ */
.cn-cat-nav {
  background: #1e293b;
}

.cn-cat-nav ul {
  padding-inline: 24px;
}

/* ============================================================
 * HERO — Bài chính magazine kiểu báo
 * ============================================================ */
.hero-featured {
  gap: 4px;
  margin-bottom: 32px;
}

.hero-main {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
}

.hero-main .thumb img {
  width: 100%;
  height: 420px;
  object-fit: cover;
  display: block;
  transition: transform .4s ease;
}

.hero-main:hover .thumb img { transform: scale(1.03); }

.hero-main .card-body {
  position: absolute;
  inset: auto 0 0;
  background: linear-gradient(to top, rgba(0,0,0,.9) 0%, rgba(0,0,0,.5) 60%, transparent 100%);
  padding: 48px 24px 24px;
}

.hero-main .entry-title,
.hero-main h2 {
  font-size: clamp(1.4rem, 3vw, 2rem);
  font-weight: 900;
  color: #fff;
  line-height: 1.25;
  margin: 8px 0;
  text-shadow: 0 2px 8px rgba(0,0,0,.5);
}

.hero-main h2 a { color: inherit; text-decoration: none; }
.hero-main h2 a:hover { color: #fca5a5; }

.hero-main .excerpt {
  color: rgba(255,255,255,.85);
  font-size: .95rem;
  line-height: 1.5;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ============================================================
 * CATEGORY BADGE — kiểu nhãn báo
 * ============================================================ */
.cat-badge {
  background: var(--color-primary);
  color: #fff !important;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 2px;
  text-decoration: none;
  display: inline-block;
  margin-bottom: 6px;
}

.cat-badge:hover { background: var(--color-primary-dark); }

/* Các badge chuyên mục theo màu */
.cat-badge[data-cat="dien-thoai"]    { background: #e11d48; }
.cat-badge[data-cat="may-tinh"]      { background: #2563eb; }
.cat-badge[data-cat="ai"]            { background: #7c3aed; }
.cat-badge[data-cat="thu-thuat"]     { background: #059669; }
.cat-badge[data-cat="tin-tuc"]       { background: #d97706; }

/* ============================================================
 * POST CARDS — kiểu tin tức
 * ============================================================ */
.post-card {
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--color-surface, #1e293b);
  transition: transform .2s, box-shadow .2s;
}

.post-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,.3);
}

.post-card .thumb img {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  display: block;
  transition: transform .35s ease;
}

.post-card:hover .thumb img { transform: scale(1.04); }

.post-card .card-body { padding: 16px; }

.post-card .entry-title,
.post-card h2,
.post-card h3 {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.35;
  margin: 6px 0 8px;
  color: var(--color-text, #f1f5f9);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-card h2 a,
.post-card h3 a { color: inherit; text-decoration: none; }

.post-card h2 a:hover,
.post-card h3 a:hover { color: var(--color-primary); }

/* HOT badge tự động cho bài nhiều lượt xem */
.post-card.has-hot-badge .card-body::before {
  content: "HOT";
  display: inline-block;
  background: #ef4444;
  color: #fff;
  font-size: .65rem;
  font-weight: 800;
  letter-spacing: .1em;
  padding: 2px 6px;
  border-radius: 2px;
  margin-bottom: 4px;
  vertical-align: middle;
}

/* ============================================================
 * SECTION TITLES — đường kẻ đỏ kiểu báo
 * ============================================================ */
.section-title,
h2.section-title {
  font-size: 1.125rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--color-text, #f1f5f9);
  border-left: 4px solid var(--color-section-border);
  padding-left: 12px;
  margin: 28px 0 16px;
  line-height: 1.2;
}

/* ============================================================
 * HERO SIDE CARDS
 * ============================================================ */
.hero-side {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hero-side .post-card {
  flex: 1;
}

.hero-side .post-card .card-body { padding: 12px; }
.hero-side .post-card h2,
.hero-side .post-card h3 {
  font-size: .9rem;
  -webkit-line-clamp: 2;
}

/* ============================================================
 * META BÀI VIẾT
 * ============================================================ */
.post-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: .8rem;
  color: var(--color-muted, #64748b);
}

.meta-date { color: var(--color-muted, #64748b); }

.meta-author {
  font-weight: 600;
  color: var(--color-accent);
}

.meta-reading {
  background: rgba(14,165,233,.1);
  color: var(--color-accent);
  padding: 2px 8px;
  border-radius: 99px;
  font-weight: 500;
}

/* ============================================================
 * BÀI ĐƠN (single.php) — kiểu tin tức
 * ============================================================ */
.single-article .entry-header {
  margin-bottom: 20px;
}

.single-article .entry-title {
  font-size: clamp(1.6rem, 3.5vw, 2.4rem);
  font-weight: 900;
  line-height: 1.2;
  color: var(--color-heading, #f8fafc);
  margin: 10px 0 16px;
}

.single-article .entry-featured {
  margin: 0 0 24px;
  border-radius: var(--radius);
  overflow: hidden;
}

.single-article .entry-featured img {
  width: 100%;
  max-height: 520px;
  object-fit: cover;
  display: block;
}

/* Typography nội dung bài báo */
.single-article .entry-content {
  font-size: 1.0625rem;
  line-height: 1.78;
  color: var(--color-text, #e2e8f0);
}

.single-article .entry-content h2 {
  font-size: 1.4rem;
  font-weight: 800;
  border-left: 4px solid var(--color-primary);
  padding-left: 12px;
  margin: 32px 0 16px;
}

.single-article .entry-content h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 24px 0 12px;
  color: var(--color-heading, #f1f5f9);
}

.single-article .entry-content blockquote {
  border-left: 4px solid var(--color-primary);
  background: rgba(225,29,72,.06);
  padding: 16px 20px;
  margin: 20px 0;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-style: italic;
  color: var(--color-muted, #94a3b8);
}

/* ============================================================
 * NÚT CHIA SẺ — phong cách mạng xã hội
 * ============================================================ */
.share-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 24px 0;
  padding: 16px 0;
  border-top: 1px solid rgba(255,255,255,.08);
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.share-buttons a,
.share-buttons button {
  flex-shrink: 0;
  padding: 7px 18px;
  border-radius: var(--radius);
  font-size: .85rem;
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: opacity .2s;
}

.share-buttons a:hover,
.share-buttons button:hover { opacity: .85; }

.share-fb  { background: #1877f2; color: #fff !important; }
.share-x   { background: #000; color: #fff !important; }
.share-tg  { background: #229ed9; color: #fff !important; }
.share-copy { background: #334155; color: #f1f5f9; }

/* ============================================================
 * SIDEBAR FIX — dark widget bg requires light text
 * Widget background: #1e293b (dark) → text must be light
 * ============================================================ */
.sidebar-1 .widget {
  color: rgba(203, 213, 225, 0.85);
}
/* Widget post titles — must be light on dark bg */
.widget-post .wp-title,
.widget-post a.wp-title {
  color: #cbd5e1 !important;
  text-decoration: none;
}
.widget-post:hover .wp-title,
.widget-post a.wp-title:hover {
  color: var(--color-primary) !important;
}
/* Widget post date */
.widget-post .wp-date {
  color: rgba(148, 163, 184, 0.65) !important;
}
/* Widget list items */
.sidebar-1 .widget ul li,
.sidebar-1 .widget ul li a {
  color: rgba(203, 213, 225, 0.75);
  border-bottom-color: rgba(255,255,255,.06);
}
.sidebar-1 .widget ul li a:hover { color: #fff; }
/* Search form on dark bg */
.sidebar-1 .search-form input[type="search"] {
  background: rgba(255,255,255,.06);
  color: #f1f5f9;
  border-color: rgba(255,255,255,.12);
}
.sidebar-1 .search-form input[type="search"]::placeholder {
  color: rgba(148,163,184,.5);
}
.sidebar-1 .search-form button {
  background: var(--color-primary);
  color: #fff;
}
/* Categories count */
.sidebar-1 .widget_categories .post-count {
  color: rgba(203,213,225,.6) !important;
  background: rgba(255,255,255,.08) !important;
}

/* ============================================================
 * FOOTER — đỏ mận
 * ============================================================ */
.site-footer {
  background: var(--color-footer-bg, #4c0519);
  color: rgba(255,255,255,.75);
  padding: 48px 0 0;
}

.site-footer .widget-title {
  color: #fff;
  font-size: .875rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  border-bottom: 2px solid rgba(255,255,255,.15);
  padding-bottom: 8px;
  margin-bottom: 16px;
}

.site-footer a { color: rgba(255,255,255,.7); }
.site-footer a:hover { color: #fff; }

.footer-bottom {
  background: rgba(0,0,0,.3);
  padding: 14px 0;
  margin-top: 32px;
  font-size: .8rem;
  text-align: center;
  color: rgba(255,255,255,.4);
}

/* ============================================================
 * SIDEBAR
 * ============================================================ */
.widget {
  margin-bottom: 28px;
  background: var(--color-surface, #1e293b);
  border-radius: var(--radius);
  padding: 20px;
}

.widget-title {
  font-size: .875rem;
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--color-heading, #f1f5f9);
  border-left: 3px solid var(--color-primary);
  padding-left: 10px;
  margin-bottom: 16px;
}

/* ============================================================
 * RESPONSIVE
 * ============================================================ */
@media (max-width: 767px) {
  .hero-main .thumb img { height: 240px; }
  .hero-main h2 { font-size: 1.25rem; }
  .single-article .entry-title { font-size: 1.5rem; }
}

/* ============================================================
 * DARK MODE — ưu tiên biến đỏ không đổi
 * ============================================================ */
[data-theme="dark"] {
  --color-primary: #e11d48;
  --color-primary-dark: #be123c;
}
