/**
 * Article List CSS
 * 
 * ไฟล์ CSS สำหรับการแสดงผล Article List ในธีมสีแดง Rosso Corsa
 */

/* สีหลักที่ใช้ (Rosso Corsa - สีแดง) */
:root {
    --primary-color: #d40000; /* Rosso Corsa - สีแดงหลัก */
    --primary-dark: #a70000;  /* สีแดงเข้ม สำหรับ hover */
    --primary-light: #ff3333; /* สีแดงอ่อน */
    --text-color: #333333;    /* สีข้อความหลัก */
    --text-light: #444444;    /* สีข้อความรอง - ปรับให้เข้มขึ้น */
    --bg-color: #ffffff;      /* สีพื้นหลัง */
    --bg-gray: #f5f5f5;       /* สีพื้นหลังเทา */
    --border-color: #e0e0e0;  /* สีเส้นขอบ */
}

/* Container หลัก */
.article-list-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: 'Prompt', sans-serif;
}

/* ส่วนฟิลเตอร์และค้นหา */
.article-list-filters {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
}

.article-list-search {
    position: relative;
    flex: 1;
    max-width: 500px;
}

.article-list-search input {
    width: 100%;
    padding: 12px 20px 12px 50px;
    border: 1px solid #d1d5db;
    border-radius: 25px;
    font-size: 14px;
    outline: none;
    background-color: #f8f9fa;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.article-list-search input:focus {
    border-color: #9ca3af;
    background-color: #ffffff;
    box-shadow: 0 0 0 3px rgba(156, 163, 175, 0.1);
}

.article-list-search input::placeholder {
    color: #6b7280;
    font-weight: 400;
}

.article-list-search::before {
    content: '';
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236b7280'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    pointer-events: none;
    z-index: 1;
}

.article-list-categories select {
    padding: 10px 15px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
    outline: none;
    min-width: 180px;
    cursor: pointer;
    transition: border-color 0.3s;
    background-color: var(--bg-color);
}

.article-list-categories select:focus {
    border-color: var(--primary-color);
}

/* ซ่อนปุ่มค้นหาเนื่องจากใช้ Enter key แทน */
#article-list-search-button {
    display: none;
}

/* ปุ่มทั่วไป */
.article-list-button {
    padding: 10px 20px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 0 4px 4px 0;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.article-list-button:hover {
    background-color: var(--primary-dark);
}

#article-list-load-more {
    display: block;
    margin: 0 auto;
    padding: 12px 30px;
    border-radius: 4px;
    font-size: 16px;
}

/* Grid Container */
.article-list-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    margin-bottom: 40px;
}

/* Card รายการบทความ */
.article-card {
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s, box-shadow 0.3s;
    background-color: var(--bg-color);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.article-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
}

.article-card-image {
    width: 100%;
    height: 180px;
    background-size: cover;
    background-position: center;
    position: relative;
}

.article-card-image::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 40%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.6), transparent);
    opacity: 0;
    transition: opacity 0.3s;
}

.article-card:hover .article-card-image::after {
    opacity: 1;
}

.article-card-content {
    padding: 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.article-card-category {
    color: var(--primary-color);
    font-weight: 500;
    font-size: 13px;
    margin-bottom: 8px;
    display: block;
}

.article-card-title {
    margin-top: 0;
    margin-bottom: 12px;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.4;
    max-height: 2.8em;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.article-card-title a {
    color: var(--text-color);
    text-decoration: none;
    transition: color 0.3s;
}

.article-card-title a:hover {
    color: var(--primary-color);
}

.article-card-meta {
    margin-bottom: 12px;
    font-size: 13px;
    color: var(--text-light);
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.article-card-reading-time,
.article-card-date {
    position: relative;
    padding-left: 18px;
}

.article-card-reading-time:before,
.article-card-date:before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    background-size: contain;
    background-repeat: no-repeat;
}

.article-card-reading-time:before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23666666'%3E%3Cpath d='M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10 10-4.5 10-10S17.5 2 12 2zm0 18c-4.4 0-8-3.6-8-8s3.6-8 8-8 8 3.6 8 8-3.6 8-8 8zm.5-13H11v6l5.2 3.2.8-1.3-4.5-2.7V7z'/%3E%3C/svg%3E");
}

.article-card-date:before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23666666'%3E%3Cpath d='M19 3h-1V1h-2v2H8V1H6v2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V8h14v11zM5 5v1h14V5H5z'/%3E%3C/svg%3E");
}

.article-card-excerpt {
    font-size: 14px;
    line-height: 1.6;
    color: #333333; /* เปลี่ยนจาก text-light เป็นสีเข้มเพื่อให้มองเห็นชัดเจน */
    font-weight: 400; /* เพิ่มความหนาของตัวอักษรเล็กน้อย */
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    max-height: 6.4em;
}

/* Pagination */
.article-list-pagination {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    margin-top: 40px;
    text-align: center;
}

.article-list-pagination-count {
    font-size: 14px;
    color: var(--text-light);
}

.article-list-pagination-count span {
    font-weight: 600;
    color: var(--primary-color);
}

/* Pagination Numbers */
.article-list-pagination-numbers {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.article-list-page-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #ffffff;
    border: 1px solid var(--border-color);
    color: var(--text-color);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.article-list-page-number:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(212, 0, 0, 0.3);
}

.article-list-page-number.current {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
    cursor: default;
}

.article-list-page-number.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.article-list-pagination-dots {
    color: var(--text-light);
    font-weight: bold;
    padding: 0 5px;
    font-size: 16px;
}

/* Load More Button - ซ่อนไว้เพื่อใช้เป็น fallback */
#article-list-load-more {
    display: none;
}

/* ปุ่มเลื่อนขึ้นด้านบน */
.article-list-scroll-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 45px;
    height: 45px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s;
    z-index: 999;
}

.article-list-scroll-top:hover {
    background-color: var(--primary-dark);
}

.article-list-scroll-top .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
}

/* ข้อความเมื่อไม่พบบทความ */
.article-list-no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 50px 0;
    color: var(--text-light);
    font-size: 16px;
}

/* Responsive Design */
@media screen and (max-width: 992px) {
    .article-list-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media screen and (max-width: 768px) {
    .article-list-filters {
        flex-direction: column;
        align-items: stretch;
        gap: 20px;
    }
    
    .article-list-search,
    .article-list-categories {
        max-width: 100%;
        width: 100%;
    }
    
    .article-list-search input {
        padding: 14px 20px 14px 50px;
        font-size: 16px; /* ป้องกัน zoom ใน iOS */
    }
}

@media screen and (max-width: 576px) {
    .article-list-grid {
        grid-template-columns: 1fr;
    }
    
    .article-card-image {
        height: 200px;
    }
    
    /* Pagination responsive */
    .article-list-pagination-numbers {
        gap: 4px;
    }
    
    .article-list-page-number {
        width: 35px;
        height: 35px;
        font-size: 13px;
    }
    
    .article-list-pagination-count {
        font-size: 13px;
        margin-bottom: 10px;
    }
}