/* --- Category Page Custom Styles --- */

/* 1. จัดระเบียบ Layer ให้มุดใต้ Fixed Header */
.category-header-v2, 
.filter-section, 
main.container {
    position: relative;
    z-index: 1; /* ต่ำกว่า Header.php (9999) */
}

/* ดันเนื้อหาลงมาเพื่อไม่ให้โดน Fixed Header ทับตอนเริ่มหน้า */
.category-header-v2 {
    background: #fff;
    padding: 80px 0 50px; /* เพิ่ม Padding บนให้พ้นระยะ Header */
    text-align: center;
    border-bottom: 1px solid #f1f5f9;
}

.kategorie-label {
    display: block;
    color: var(--at-red);
    text-transform: uppercase;
    letter-spacing: 3px;
    font-weight: 700;
    font-size: 0.85rem;
    margin-bottom: 10px;
}

.category-header-v2 h1 {
    font-size: clamp(2.2rem, 5vw, 3.5rem);
    color: #0f172a;
    margin: 0 0 15px;
    font-weight: 800;
}

.category-description {
    max-width: 750px;
    margin: 0 auto 20px;
    color: #64748b;
    line-height: 1.7;
    font-size: 1.1rem;
}
/* คุม Layout ของ Footer ในการ์ด */
.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 15px;
    margin-top: 15px;
    border-top: 1px solid #f0f0f0; /* เส้นคั่นบางๆ ให้ดูสะอาดตา */
}

/* ปรับแต่งลิงก์ "อ่านต่อ" */
.card-footer .read-more {
    color: var(--at-red, #e01e37); /* ใช้สีแดงออสเตรียที่เราตั้งไว้ */
    font-weight: 700;
    text-decoration: none;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    transition: all 0.3s ease;
    position: relative;
}

/* เอฟเฟกต์ตอน Hover ลิงก์ */
.card-footer .read-more:hover {
    color: #000; /* เปลี่ยนเป็นสีดำเมื่อชี้ */
    transform: translateX(5px); /* ขยับไปทางขวานิดๆ ให้ดูมี Interactive */
}

/* ปรับแต่งส่วนตัวเลขยอดวิว */
.card-footer .views-count {
    font-size: 0.85rem;
    color: #94a3b8; /* สีเทาอ่อนแบบ Slate */
    display: flex;
    align-items: center;
    gap: 5px;
}

.card-footer .views-count i {
    font-size: 0.9rem;
}

/* เพิ่มเติม: สำหรับการเข้าถึง (Accessibility) */
.card-footer .read-more:focus {
    outline: 2px solid var(--at-red);
    outline-offset: 4px;
    border-radius: 4px;
}
/* 2. Filter Section (แถบปุ่มเลือกหมวดหมู่ย่อย) */
.filter-section {
    background: #f8fafc;
    padding: 20px 0;
    border-bottom: 1px solid #e2e8f0;
    position: sticky; /* ตัวนี้ทำให้ค้างได้ แต่ต้องต่ำกว่า Header หลัก */
    top: 80px; /* ระยะที่ต่อลงมาจาก Fixed Header */
    z-index: 10; 
}

.filter-container {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
}

.filter-btn {
    padding: 10px 24px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 50px;
    color: #475569;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.filter-btn:hover {
    border-color: var(--at-red);
    color: var(--at-red);
}

.filter-btn.active {
    background: var(--at-red) !important;
    color: white !important;
    border-color: var(--at-red) !important;
    box-shadow: 0 4px 12px rgba(237, 27, 47, 0.2);
}

/* 3. Article Grid & Cards (การแสดงผลบทความ) */
.breadcrumb-nav {
    padding: 25px 0;
}

.article-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 35px;
    margin-bottom: 80px;
}

.article-card {
    background: #fff;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    border: 1px solid #f1f5f9;
}

.article-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 40px rgba(0,0,0,0.1);
}

.card-img-link {
    position: relative;
    display: block;
    height: 240px;
    overflow: hidden;
}

.card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.article-card:hover .card-img {
    transform: scale(1.1);
}

.card-badge {
    position: absolute;
    top: 20px;
    left: 20px;
    background: var(--at-red);
    color: white;
    padding: 6px 16px;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 700;
    z-index: 2;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.card-content {
    padding: 30px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.card-content h3 {
    font-size: 1.4rem;
    margin: 0 0 15px;
    color: #1e293b;
    line-height: 1.3;
}

.card-content p {
    color: #64748b;
    font-size: 1rem;
    margin-bottom: 25px;
    line-height: 1.6;
}

.btn-read {
    margin-top: auto;
    color: var(--at-red);
    text-decoration: none;
    font-weight: 700;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Responsive */
@media (max-width: 768px) {
    .category-header-v2 { padding: 60px 15px 30px; }
    .filter-container { justify-content: flex-start; overflow-x: auto; padding-bottom: 10px; }
    /* --- Pagination Style --- */
.pagination {
    margin: 50px 0;
    display: flex;
    justify-content: center;
}

.pagination-list {
    display: flex;
    list-style: none;
    padding: 0;
    gap: 8px;
    align-items: center;
}

.page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 45px;
    height: 45px;
    padding: 0 15px;
    text-decoration: none;
    color: #475569;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.page-link:hover {
    border-color: var(--at-red);
    color: var(--at-red);
    background: #fff5f5;
}

.page-link.active {
    background: var(--at-red);
    color: #fff;
    border-color: var(--at-red);
    box-shadow: 0 4px 12px rgba(237, 27, 47, 0.2);
}

/* สำหรับ Accessibility: ขยายพื้นที่กดบนมือถือ */
@media (max-width: 480px) {
    .page-link {
        min-width: 40px;
        height: 40px;
        padding: 0 10px;
        font-size: 0.85rem;
    }
}
}