/* =========================
   CNN STYLE DESIGN SYSTEM
========================= */
:root {
    --cnn-red: #030303 !important;
    --bg: #ffffff;
    --surface: #ffffff;
    --text: #111111;
    --muted: #555555;
    --border: #dddddd;

    /* สำนักข่าวต้องเหลี่ยมคม ไม่มีเงา */
    --radius: 0px !important;
    --shadow: none !important;
}

/* =========================
   DARK MODE VARIABLES
========================= */
body.dark {
    --cnn-red: #f8fafc !important;
    --bg: #0f172a;
    --surface: #0f172a;
    --text: #f8fafc;
    --muted: #cbd5e1;
    --border: rgba(255, 255, 255, 0.16);
}

/* =========================
   BASE
========================= */
* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Prompt', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.4;
    margin: 0;
    padding: 0;
    transition: background 0.25s ease, color 0.25s ease;
}

a {
    text-decoration: none;
    color: inherit;
}

a:hover {
    text-decoration: underline;
    color: var(--cnn-red);
}

img {
    display: block;
    max-width: 100%;
}

/* =========================
   HEADER
========================= */
.main-header {
    background: var(--surface);
    color: var(--text);
    border-bottom: 4px solid var(--cnn-red);
    padding: 15px 0;
    margin-bottom: 30px;
    transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}

.container {
    max-width: 1300px;
    margin: auto;
    padding: 0 20px;
}

.section-title {
    font-size: 2rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: -0.5px;
    color: var(--text);
    margin: 0;
}

.section-title::before {
    content: "NEWS";
    color: var(--cnn-red);
    margin-right: 10px;
}

/* =========================
   LAYOUT GRID
========================= */
.main-layout {
    display: grid;
    grid-template-columns: 2.5fr 1fr;
    gap: 40px;
    padding-bottom: 50px;
    background: var(--bg);
    color: var(--text);
    transition: background 0.25s ease, color 0.25s ease;
}

.main-content {
    background: transparent;
    color: var(--text);
}

/* =========================
   HERO CARD
========================= */
.hero-card {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 25px;
    border-bottom: 2px solid var(--text);
    padding-bottom: 30px;
    margin-bottom: 30px;
    background: transparent;
    color: var(--text);
    transition: color 0.25s ease, border-color 0.25s ease;
}

.hero-image-wrapper {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--surface);
}

.hero-bg {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hero-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    color: var(--text);
}

.category-tag {
    color: var(--cnn-red);
    font-size: 13px;
    font-weight: 900;
    text-transform: uppercase;
    margin-bottom: 10px;
    letter-spacing: 0.5px;
}

.category-tag.small {
    font-size: 11px;
    margin-bottom: 5px;
}

.hero-title {
    font-size: 2.2rem;
    font-weight: 900;
    line-height: 1.15;
    margin: 0 0 15px;
    letter-spacing: -0.5px;
    color: var(--text);
    transition: color 0.25s ease;
}

.hero-excerpt {
    font-size: 1.05rem;
    color: var(--text);
    margin: 0;
    transition: color 0.25s ease;
}

/* =========================
   FEATURED ROW
========================= */
.featured-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 30px;
    margin-bottom: 30px;
    background: transparent;
    color: var(--text);
    transition: border-color 0.25s ease;
}

.featured-card {
    background: transparent;
    color: var(--text);
}

.featured-img {
    width: 100%;
    height: 220px;
    object-fit: cover;
    margin-bottom: 12px;
}

.featured-title {
    font-size: 1.3rem;
    font-weight: 800;
    line-height: 1.3;
    color: var(--text);
    margin: 0;
    transition: color 0.25s ease;
}

/* =========================
   SECTION DIVIDER
========================= */
.section-divider {
    border-top: 4px solid var(--text);
    padding-top: 10px;
    margin-bottom: 25px;
    color: var(--text);
    transition: border-color 0.25s ease, color 0.25s ease;
}

.divider-title {
    font-size: 1.2rem;
    font-weight: 900;
    text-transform: uppercase;
    color: var(--text);
    margin: 0;
}

/* =========================
   LIST LAYOUT
========================= */
.list-layout {
    display: flex;
    flex-direction: column;
    margin-bottom: 35px;
    background: transparent;
    color: var(--text);
}

.list-card {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 20px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 20px;
    margin-bottom: 20px;
    background: transparent;
    color: var(--text);
    transition: border-color 0.25s ease, color 0.25s ease;
}

.list-card:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.list-img-wrapper {
    height: 130px;
}

.list-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.list-info {
    color: var(--text);
}

.list-title {
    font-size: 1.15rem;
    font-weight: 800;
    line-height: 1.3;
    margin: 0 0 8px;
    color: var(--text);
    transition: color 0.25s ease;
}

.list-text {
    font-size: 0.9rem;
    color: var(--muted);
    display: -webkit-box;
    line-clamp: 2;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0;
    transition: color 0.25s ease;
}

/* =========================
   STANDARD GRID
========================= */
.article-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    border-top: 1px solid var(--border);
    padding-top: 30px;
    background: transparent;
    color: var(--text);
    transition: border-color 0.25s ease;
}

.modern-article-card {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    color: var(--text);
    transition: background 0.25s ease, color 0.25s ease;
}

.card-img-wrapper {
    height: 150px;
    margin-bottom: 12px;
}

.card-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-info {
    color: var(--text);
}

.card-title {
    font-size: 1.05rem;
    font-weight: 800;
    line-height: 1.3;
    color: var(--text);
    margin: 0;
    transition: color 0.25s ease;
}

/* =========================
   SIDEBAR & WIDGETS
========================= */
.sidebar-v2 {
    border-left: 1px solid var(--border);
    padding-left: 25px;
    background: transparent;
    color: var(--text);
    transition: border-color 0.25s ease, color 0.25s ease;
}

.widget {
    margin-bottom: 40px;
    color: var(--text);
}

.widget-title {
    font-size: 1.1rem;
    font-weight: 900;
    margin: 0 0 15px;
    text-transform: uppercase;
    border-bottom: 2px solid var(--text);
    padding-bottom: 5px;
    color: var(--text);
    transition: color 0.25s ease, border-color 0.25s ease;
}

.trending-container {
    color: var(--text);
}

.trend-row {
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    transition: border-color 0.25s ease, color 0.25s ease;
}

.trend-row:last-child {
    border-bottom: none;
}

.trend-body {
    color: var(--text);
}

.trend-link {
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.3;
    color: var(--text);
    transition: color 0.25s ease;
}

/* =========================
   NEWSLETTER
========================= */
.newsletter-widget {
    color: var(--text);
}

.newsletter-desc {
    font-size: 0.95rem;
    color: var(--muted);
    margin: 0 0 15px;
    transition: color 0.25s ease;
}

.newsletter-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.newsletter-form input {
    padding: 12px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    outline: none;
    border-radius: 0;
    font-family: inherit;
    transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}

.newsletter-form input::placeholder {
    color: var(--muted);
}

.newsletter-form .btn-submit {
    background: var(--text);
    color: var(--surface);
    border: none;
    padding: 12px;
    font-weight: 800;
    cursor: pointer;
    border-radius: 0;
    font-family: inherit;
    transition: background 0.25s ease, color 0.25s ease;
}

.newsletter-form .btn-submit:hover {
    background: var(--cnn-red);
}

/* =========================
   EMPTY STATE
========================= */
.empty-state-card {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 40px 25px;
    text-align: center;
}

.empty-state-card h2 {
    color: var(--text);
    margin: 10px 0;
}

.empty-state-card p {
    color: var(--muted);
    margin: 0;
}

.empty-icon {
    color: var(--cnn-red);
    font-size: 38px;
}

/* =========================
   DARK MODE FORCE FIX
   แก้ตัวหนังสือดำค้างตอนเปิด Dark Mode
========================= */
body.dark,
body.dark .page-wrapper,
body.dark .main-header,
body.dark .main-layout,
body.dark .main-content,
body.dark .hero-card,
body.dark .hero-content,
body.dark .featured-row,
body.dark .featured-card,
body.dark .section-divider,
body.dark .list-layout,
body.dark .list-card,
body.dark .list-info,
body.dark .article-grid,
body.dark .modern-article-card,
body.dark .card-info,
body.dark .sidebar-v2,
body.dark .widget,
body.dark .trending-container,
body.dark .trend-row,
body.dark .trend-body,
body.dark .newsletter-widget {
    background-color: var(--bg) !important;
    color: var(--text) !important;
}

body.dark h1,
body.dark h2,
body.dark h3,
body.dark h4,
body.dark h5,
body.dark h6,
body.dark p,
body.dark span,
body.dark a,
body.dark label,
body.dark .section-title,
body.dark .section-title::before,
body.dark .category-tag,
body.dark .hero-title,
body.dark .hero-excerpt,
body.dark .featured-title,
body.dark .divider-title,
body.dark .list-title,
body.dark .list-text,
body.dark .card-title,
body.dark .widget-title,
body.dark .trend-link,
body.dark .newsletter-desc {
    color: var(--text) !important;
}

body.dark .list-text,
body.dark .newsletter-desc,
body.dark .empty-state-card p {
    color: var(--muted) !important;
}

body.dark .main-header {
    background: var(--bg) !important;
    border-bottom-color: var(--text) !important;
}

body.dark .hero-card {
    border-bottom-color: var(--text) !important;
}

body.dark .featured-row,
body.dark .list-card,
body.dark .article-grid,
body.dark .sidebar-v2,
body.dark .trend-row,
body.dark .newsletter-form input,
body.dark .empty-state-card {
    border-color: var(--border) !important;
}

body.dark .section-divider {
    border-top-color: var(--text) !important;
}

body.dark .widget-title {
    border-bottom-color: var(--text) !important;
}

body.dark .newsletter-form input {
    background: #111827 !important;
    color: #f8fafc !important;
}

body.dark .newsletter-form input::placeholder {
    color: #94a3b8 !important;
}

body.dark .newsletter-form .btn-submit {
    background: #f8fafc !important;
    color: #0f172a !important;
}

body.dark .newsletter-form .btn-submit:hover {
    background: #10b981 !important;
    color: #ffffff !important;
}

/* =========================
   FOOTER DARK MODE
========================= */
body.dark .footer {
    background: #0f172a !important;
    border-top: 1px solid rgba(255, 255, 255, 0.05) !important;
    color: #f8fafc !important;
}

body.dark .footer-col.brand h2,
body.dark .footer-brand h2 {
    color: #10b981 !important;
}

body.dark .footer-col p,
body.dark .footer p {
    color: #94a3b8 !important;
}

body.dark .footer-col h3,
body.dark .footer h3 {
    color: #f8fafc !important;
}

body.dark .footer-col ul li a,
body.dark .footer a {
    color: #cbd5e1 !important;
}

body.dark .footer-col ul li a:hover,
body.dark .footer a:hover {
    color: #10b981 !important;
}

body.dark .footer-bottom {
    border-top-color: rgba(255, 255, 255, 0.1) !important;
    color: #64748b !important;
}

/* =========================
   RESPONSIVE
========================= */
@media (max-width: 1024px) {
    .main-layout {
        grid-template-columns: 1fr;
    }

    .sidebar-v2 {
        border-left: none;
        border-top: 4px solid var(--text);
        padding-left: 0;
        padding-top: 30px;
    }

    body.dark .sidebar-v2 {
        border-top-color: var(--text) !important;
    }
}

@media (max-width: 768px) {
    .hero-card {
        grid-template-columns: 1fr;
    }

    .featured-row {
        grid-template-columns: 1fr;
    }

    .list-card {
        grid-template-columns: 1fr;
    }

    .list-img-wrapper {
        height: 180px;
    }

    .article-grid {
        grid-template-columns: 1fr;
    }
}