@import url('https://fonts.googleapis.com/css2?family=Sarabun:wght@300;400;500;600;700;800&display=swap');

.article-page-container {
    max-width: 1200px;
    margin: 34px auto 70px;
    padding: 0 24px;
    font-family: 'Sarabun', sans-serif;
    color: #1e293b;
}

/* =========================
   FEATURED IMAGE
========================= */
.featured-media {
    width: 100%;
    margin: 0 0 14px;
}

.image-frame {
    width: 100%;
    height: 560px;
    overflow: hidden;
    background: #f8fafc;
}

.image-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* =========================
   META + BREADCRUMB
========================= */
.article-top-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    padding: 15px 0 15px;
    border-bottom: 1px solid #e5e7eb;
}

.article-meta {
    display: flex;
    align-items: center;
    gap: 14px;
    color: #64748b;
    font-size: 14px;
    flex-wrap: wrap;
}

.article-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #111827;
    font-size: 14px;
    white-space: nowrap;
}

.article-breadcrumb span {
    display: inline-flex;
    align-items: center;
}

.article-breadcrumb a {
    color: inherit;
    text-decoration: none;
}

.article-breadcrumb a:hover {
    text-decoration: underline;
}

/* =========================
   TITLE
========================= */
.article-title-wrap {
    padding: 28px 0 18px;
}

.article-title {
    max-width: 780px;
    margin: 0;
    color: #111827;
    font-size: clamp(30px, 4vw, 44px);
    font-weight: 800;
    line-height: 1.35;
}

/* =========================
   2 COLUMN LAYOUT
========================= */
.article-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 42px;
    align-items: start;
}

.article-main {
    min-width: 0;
}

.article-sidebar {
    min-width: 0;
    position: sticky;
    top: 90px;
}

/* =========================
   ARTICLE CONTENT
========================= */
.article-body {
    margin-top: 0;
    background: transparent;
}

.article-content {
    font-size: 18px;
    line-height: 1.85 !important;
    color: #334155;
    word-break: break-word;
}

.article-content p,
.article-content div {
    margin-top: 0 !important;
    margin-bottom: 20px !important;
    padding: 0 !important;
    text-align: left;
}

.article-content blockquote {
    font-size: 20px;
    font-weight: 500;
    font-style: italic;
    color: #1e293b;
    background: #f8fafc;
    border-left: 5px solid #f59e0b;
    padding: 20px 25px !important;
    margin: 35px 0 !important;
    border-radius: 0 12px 12px 0;
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
}

.article-content h2,
.article-content h3 {
    font-size: 24px;
    margin-top: 45px !important;
    margin-bottom: 20px !important;
    font-weight: 700;
    color: #0f172a;
    padding-bottom: 10px;
    border-bottom: 2px solid #e2e8f0;
    display: inline-block;
}

.article-content ul,
.article-content ol {
    margin: 0 0 25px 20px !important;
    padding: 0 !important;
}

.article-content li {
    margin-bottom: 12px !important;
    line-height: 1.7;
    padding-left: 8px;
}

.article-content li::marker {
    color: #10b981;
}

/* รูปทั่วไปในข่าว */
.article-content img {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    border-radius: 12px;
    margin: 34px auto !important;
    display: block;
    object-fit: contain;
}

/* =========================
   PRODUCT IMAGE IN ARTICLE
========================= */
.product-in-article {
    width: 100%;
    margin: 45px 0 !important;
    padding: 0 !important;
    text-align: center !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

.article-content .product-in-article {
    text-align: center !important;
}

.product-card-inline {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100%;
    padding: 0 !important;
    margin: 0 auto !important;
    border: none !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    overflow: visible !important;
    text-align: center !important;
}

/* ✅ แก้ตรงนี้: บังคับให้รูปสินค้าใหญ่พอดี ไม่อิงขนาดไฟล์จริง */
.product-card-inline img {
    width: 380px !important;
    max-width: 90% !important;
    height: auto !important;
    max-height: 560px !important;
    object-fit: contain !important;
    border-radius: 10px;
    background: transparent !important;
    padding: 0 !important;
    margin: 0 auto 10px !important;
    display: block !important;
    border: none !important;
    box-shadow: none !important;
}

/* ชื่อสินค้าใต้รูป */
.product-name-caption {
    margin-top: 8px !important;
    margin-bottom: 0 !important;
    text-align: center !important;
    font-size: 18px;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.5;
}

.product-info,
.product-label,
.product-actions,
.product-info h4,
.product-info p,
.product-btn {
    display: none !important;
}

/* =========================
   SIDEBAR
========================= */
.sidebar-card {
    margin-bottom: 32px;
}

.sidebar-title {
    font-size: 16px;
    font-weight: 800;
    color: #111827;
    padding-bottom: 8px;
    margin-bottom: 18px;
    border-bottom: 2px solid #111827;
    text-transform: uppercase;
}

.sidebar-empty {
    min-height: 48px;
    color: #94a3b8;
    font-size: 14px;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 14px;
}

.newsletter-text {
    margin: 0 0 14px;
    color: #475569;
    font-size: 14px;
    line-height: 1.7;
}

.newsletter-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.newsletter-form input {
    width: 100%;
    height: 42px;
    border: 1px solid #d1d5db;
    padding: 0 12px;
    font-family: inherit;
    font-size: 14px;
    outline: none;
}

.newsletter-form input:focus {
    border-color: #111827;
}

.newsletter-form button {
    width: 100%;
    height: 44px;
    border: none;
    background: #111111;
    color: #ffffff;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}

/* =========================
   FOOTER / ALERT
========================= */
.article-footer {
    margin-top: 50px;
    padding-top: 30px;
    border-top: 2px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.btn-source {
    background: #eff6ff;
    color: #2563eb;
    padding: 12px 24px;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-source:hover {
    background: #dbeafe;
    transform: translateY(-2px);
}

.btn-back-home {
    color: #64748b;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
    white-space: nowrap;
}

.btn-back-home:hover {
    color: #0f172a;
}

.short-content-alert {
    background: #fffbeb;
    color: #b45309;
    padding: 15px 20px;
    border-radius: 8px;
    margin-top: 30px;
    text-align: center;
    font-size: 16px;
    border: 1px dashed #fcd34d;
}

/* =========================
   DARK MODE
========================= */
body.dark {
    background: #0f172a;
}

body.dark .article-page-container {
    color: #e5e7eb;
}

body.dark .article-title {
    color: #f8fafc;
}

body.dark .article-meta,
body.dark .article-breadcrumb {
    color: #94a3b8;
}

body.dark .article-top-info {
    border-bottom-color: #334155;
}

body.dark .image-frame {
    background: #111827;
}

body.dark .article-content {
    color: #dbeafe;
}

body.dark .article-content p,
body.dark .article-content div,
body.dark .article-content li {
    color: #dbeafe;
}

body.dark .article-content h2,
body.dark .article-content h3 {
    color: #f8fafc;
    border-bottom-color: #334155;
}

body.dark .article-content blockquote {
    color: #f8fafc;
    background: rgba(15, 23, 42, 0.92);
    border-left-color: #f59e0b;
    box-shadow: none;
}

body.dark .sidebar-title {
    color: #f8fafc;
    border-bottom-color: #475569;
}

body.dark .sidebar-empty,
body.dark .newsletter-text {
    color: #94a3b8;
}

body.dark .newsletter-form input {
    background: #111827;
    border-color: #334155;
    color: #f8fafc;
}

body.dark .newsletter-form input::placeholder {
    color: #64748b;
}

body.dark .newsletter-form button {
    background: #f8fafc;
    color: #0f172a;
}

body.dark .article-footer {
    border-top-color: #334155;
}

body.dark .btn-source {
    background: rgba(37, 99, 235, 0.16);
    color: #93c5fd;
}

body.dark .btn-source:hover {
    background: rgba(37, 99, 235, 0.28);
    color: #bfdbfe;
}

body.dark .btn-back-home {
    color: #94a3b8;
}

body.dark .btn-back-home:hover {
    color: #f8fafc;
}

body.dark .short-content-alert {
    background: rgba(245, 158, 11, 0.12);
    color: #fbbf24;
    border-color: rgba(245, 158, 11, 0.35);
}

body.dark .product-name-caption {
    color: #f8fafc;
}

/* =========================
   RESPONSIVE
========================= */
@media (max-width: 992px) {
    .article-layout {
        grid-template-columns: 1fr;
        gap: 36px;
    }

    .article-sidebar {
        position: static;
    }
}

@media (max-width: 768px) {
    .article-page-container {
        max-width: 100%;
        margin: 24px auto 50px;
        padding: 0 18px;
    }

    .image-frame {
        height: 300px;
    }

    .article-top-info {
        align-items: flex-start;
        flex-direction: column;
        gap: 10px;
        padding: 13px 0;
    }

    .article-breadcrumb {
        white-space: normal;
        flex-wrap: wrap;
    }

    .article-title-wrap {
        padding: 22px 0 12px;
    }

    .article-title {
        font-size: clamp(26px, 8vw, 34px);
        line-height: 1.35;
    }

    .article-content {
        font-size: 17px;
        line-height: 1.85 !important;
    }

    .article-content img {
        margin: 28px auto !important;
    }

    .product-in-article {
        margin: 35px 0 !important;
    }

    .product-card-inline img {
        width: 300px !important;
        max-width: 88% !important;
        height: auto !important;
        max-height: 460px !important;
        border-radius: 10px;
    }

    .product-name-caption {
        font-size: 16px;
        margin-top: 8px !important;
    }

    .article-footer {
        flex-direction: column-reverse;
        gap: 20px;
    }

    .btn-source {
        width: 100%;
        justify-content: center;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .image-frame {
        height: 240px;
    }

    .article-title {
        font-size: 25px;
    }

    .product-card-inline img {
        width: 260px !important;
        max-width: 90% !important;
        max-height: 400px !important;
    }

    .product-name-caption {
        font-size: 15px;
    }
}