/* assets/css/style.css */

/* --- 1. Base & Reset --- */
body { margin: 0; font-family: 'Kanit', sans-serif; background-color: #f4f6f9; color: #343a40; line-height: 1.7; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 15px; }
a { text-decoration: none; color: #007bff; transition: color 0.3s ease; }
a:hover { color: #0056b3; }

/* --- 2. Header & Navigation --- */
.main-header { background-color: #ffffff; padding: 15px 0; border-bottom: 1px solid #e9ecef; box-shadow: 0 2px 4px rgba(0,0,0,0.05); position: sticky; top: 0; z-index: 1020; }
.logo { font-size: 24px; font-weight: 700; color: #343a40; }
.logo:hover { text-decoration: none; color: #343a40; }
.navbar-toggler { border: none; }
.navbar-toggler:focus { box-shadow: none; }
.navbar-nav .nav-link { font-size: 16px; font-weight: 500; color: #495057; padding: 0.5rem 1rem; }
.navbar-nav .dropdown-menu { border-radius: 10px; box-shadow: 0 4px 15px rgba(0,0,0,0.1); border: 1px solid #e9ecef; }
.dropdown-item { font-family: 'Kanit', sans-serif; }

/* --- 3. Homepage & Archive Styles --- */
/* (โค้ดส่วนนี้เหมือนเดิม) */

/* ✅✅✅ 4. ARTICLE PAGE - NEW LAYOUT & STICKY SIDEBAR ✅✅✅ */
.article-layout {
    display: grid;
    grid-template-columns: 1fr 320px; /* เนื้อหาหลัก | Sidebar */
    gap: 40px;
    align-items: flex-start;
    padding: 40px 0;
}
.article-main-content {
    background-color: #fff;
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}
.article-header { text-align: center; margin-bottom: 30px; border-bottom: 1px solid #e9ecef; padding-bottom: 20px; }
.article-title { font-size: 32px; font-weight: 700; margin: 0 0 15px; line-height: 1.4; color: #1a1a1a; }
.article-meta { color: #6c757d; font-size: 14px; }
.article-meta span { display: block; margin-bottom: 5px; }
.article-meta i { margin-right: 5px; }
.article-meta a { color: #007bff; font-weight: 500; }
.article-cover-image { width: 100%; height: auto; border-radius: 15px; margin-bottom: 30px; }
.article-content { font-size: 17px; line-height: 1.9; color: #333; }
/* ... (สไตล์ .article-content อื่นๆ เหมือนเดิม) ... */
.article-full-width-section {
    background-color: #fff;
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    margin-top: 40px;
}
.related-title { font-size: 22px; font-weight: 700; margin-top: 0; margin-bottom: 20px; border-bottom: 2px solid #e9ecef; padding-bottom: 10px; }
.product-list { list-style: none; padding: 0; }
.product-list-item { display: flex; align-items: center; background-color: #f8f9fa; border-radius: 10px; padding: 15px; margin-bottom: 10px; border: 1px solid #e9ecef; }
.product-list-item i.bi-bag-check-fill { font-size: 24px; color: #28a745; margin-right: 15px; }
.product-info { flex-grow: 1; }
.product-info span { display: block; font-weight: 500; }
.product-link { font-size: 14px; }
.tag-list { display: flex; flex-wrap: wrap; gap: 10px; }
.tag-badge { background-color: #e9ecef; color: #495057; padding: 5px 15px; border-radius: 50px; font-size: 14px; font-weight: 500; }

/* --- Sidebar Styles --- */
.article-sidebar {
    position: sticky;
    top: 100px; /* ระยะห่างจากขอบบน (เผื่อ Header) */
    opacity: 0; /* ซ่อนไว้ก่อน */
    visibility: hidden;
    transform: translateY(20px);
    transition: opacity 0.5s ease, visibility 0.5s ease, transform 0.5s ease;
}
.article-sidebar.is-visible {
    opacity: 1; /* แสดงผลเมื่อเลื่อนลงมา */
    visibility: visible;
    transform: translateY(0);
}
.sticky-box {
    background-color: #fff;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}
.sticky-box .related-title { margin-top: 0; }

/* ✅✅✅ MOBILE STICKY HEADER ✅✅✅ */
.mobile-sticky-header {
    background-color: #ffffff;
    padding: 10px 0;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1010;
    display: none; /* ซ่อนบน Desktop */
    transform: translateY(-100%);
    transition: transform 0.4s ease;
}
.mobile-sticky-header.is-visible {
    transform: translateY(0);
}
.mobile-sticky-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.mobile-sticky-header span {
    font-weight: 500;
}
.mobile-sticky-header select {
    border: 1px solid #ced4da;
    border-radius: 5px;
    padding: 5px 10px;
}


/* --- 5. Footer --- */
.main-footer { background-color: #343a40; color: #adb5bd; text-align: center; padding: 30px 0; margin-top: 50px; }
.main-footer a { color: #fff; }

/* ✅✅✅ 6. RESPONSIVE STYLES (ปรับปรุงใหม่) ✅✅✅ */
@media (max-width: 992px) {
    /* --- General Layout --- */
    .article-layout {
        grid-template-columns: 1fr; /* เปลี่ยนเป็น 1 คอลัมน์ */
    }
    .article-sidebar {
        display: none; /* ซ่อน Sidebar บนแท็บเล็ตและมือถือ */
    }
    .mobile-sticky-header {
        display: block; /* แสดงแถบสำหรับมือถือ */
    }
    .article-main-content, .article-full-width-section {
        padding: 30px;
    }
    /* --- Navbar on tablet --- */
    .navbar-collapse { background-color: #fff; margin-top: 15px; padding: 15px; border-radius: 10px; box-shadow: 0 4px 15px rgba(0,0,0,0.1); }
}

@media (max-width: 768px) {
    /* (โค้ดสำหรับมือถืออื่นๆ เหมือนเดิม) */
    .hero-section h1 { font-size: 28px; }
    .hero-section p { font-size: 15px; }
    .section-title, .page-main-title { font-size: 24px; }
    .article-grid { grid-template-columns: 1fr; gap: 20px; }
    .article-main-content, .article-full-width-section { padding: 20px; }
    .article-title { font-size: 26px; }
    .article-meta span { margin: 0 5px; display: block; }
    .article-content { font-size: 16px; line-height: 1.8; }
    .related-title { font-size: 20px; }
}