/**
 * Writer Categories Display Styles
 * สไตล์สำหรับ Widget แสดงหมวดหมู่และโพสต์ของผู้เขียน
 */

/* Container หลัก */
.writer-posts-pagination-container {
    display: contents;

}

.writer-posts-pagination-container a {
    color: #999999;
}

ul.ha-inline-items {
    list-style-type: none;
    margin: 0;
    padding: 0;
}

.writer-categories-container {
    margin: 20px 0;
    position: relative;
}

/* หัวข้อ */
.writer-categories-title {
    margin-bottom: 20px;
    font-size: 24px;
    font-weight: 600;
    color: #333;
    text-align: center;
}

/* Section สำหรับหมวดหมู่ */
.writer-categories-section {
    margin-bottom: 30px;
}

/* Categories List Layout */
.writer-categories-list {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 25px;
    align-items: flex-start;
    align-content: flex-start;
    justify-content: center;
}

/* จำกัดแค่ 3 แถว */
.writer-categories-list:not(.show-all) {
    max-height: calc(3 * (60px + 15px) - 15px);
    overflow: hidden;
}

/* รายการหมวดหมู่ */
.writer-category-item {
    padding: 0px 13px;
    border: 1px solid #000000;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    background: #ffffff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
    opacity: 0;
    /* transform: translateY(20px); */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    min-height: 29px;
    flex-shrink: 0;
}

.writer-category-item.fade-in {
    opacity: 1;
    /* transform: translateY(0); */
}

.writer-category-item:hover {
    border-color: #000000;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    /* transform: translateY(-3px); */
}

/* สถานะเมื่อคลิก/เลือกหมวดหมู่ */
.writer-category-item.selected,
.writer-category-item.clicked {
    background: #000000 !important;
    border-color: #000000 !important;
    color: #ffffff !important;
    /* transform: translateY(-3px); */
}

.writer-category-item.selected:hover,
.writer-category-item.clicked:hover {
    background: #000000 !important;
    border-color: #000000 !important;
    /* transform: translateY(-5px); */
}

/* ชื่อหมวดหมู่ */
.writer-category-name {
    margin: 0;
    font-size: 16px;
    font-weight: 500;
    color: #2c3e50;
    line-height: 1.2;
    transition: color 0.3s ease;
    text-align: center;
}

.writer-category-item:hover .writer-category-name {
    color: #000000;
}

.writer-category-item.selected .writer-category-name,
.writer-category-item.clicked .writer-category-name {
    color: #ffffff !important;
}

/* จำนวนโพสต์ */
.writer-category-count {
    display: none !important;
    /* ซ่อนเสมอ */
}

/* Comment ออกโค้ดเก่า
.writer-category-count {
    font-size: 12px;
    color: #868e96;
    font-weight: 500;
    background: #f8f9fa;
    padding: 4px 8px;
    border-radius: 20px;
    display: inline-block;
    margin-left: 8px;
    transition: all 0.3s ease;
}

.writer-category-item.selected .writer-category-count,
.writer-category-item.clicked .writer-category-count {
    background: #ffffff !important;
    color: #007cba !important;
} */

/* ปุ่มควบคุมหมวดหมู่ */
.writer-categories-controls {
    text-align: center;
    margin-top: 20px;
}

.show-all-writer-categories-btn {
    background-color: #ffffff;
    /* background: linear-gradient(135deg, #007cba 0%, #005a87 100%); */
    /* color: white; */
    border: none;
    /* padding: 12px 24px; */
    /* border-radius: 25px; */
    cursor: pointer;
    /* font-size: 14px; */
    /* font-weight: 500; */
    /* transition: all 0.3s ease; */
    /* box-shadow: 0 4px 15px rgba(0, 124, 186, 0.2); */
    /* display: inline-flex; */
    align-items: center;
    justify-content: center;
    /* gap: 8px; */
    /* min-width: 120px; */
}

/* ไอคอนและรูปภาพในปุ่ม */
.show-all-writer-categories-btn i,
.show-all-writer-categories-btn img {
    font-size: 16px;
    transition: transform 0.3s ease;
    vertical-align: middle;
}

.show-all-writer-categories-btn:hover i,
.show-all-writer-categories-btn:hover img {
    transform: scale(1.1);
}

.show-all-writer-categories-btn:hover {
    /* transform: translateY(-2px); */
    /* box-shadow: 0 6px 20px rgba(0, 124, 186, 0.3);
    background: linear-gradient(135deg, #005a87 0%, #004766 100%); */
    background-color: white;
}

.show-all-writer-categories-btn:active {
    transform: scale(0.98);
}

/* Section สำหรับโพสต์ */
.writer-posts-section {
    margin-top: 40px;
}

/* Posts List */
.writer-posts-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

/* Post Item */
/* 
.writer-post-item {
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    opacity: 0;
    transform: translateY(20px);
}

.writer-post-item.fade-in {
    opacity: 1;
    transform: translateY(0);
}

.writer-post-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
} */

/* Loading States */
.categories-loading,
.posts-loading {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-style: italic;
}

/* Pagination */
.writer-posts-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 30px;
}

.writer-pagination-link {
    padding: 6px 14px;
    ;
    font-size: 14px;
    font-weight: 700;
    /* padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    text-decoration: none;
    color: #333;
    transition: all 0.3s ease;
    background: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center; */
    /* width: 60px;
    height: 30px; */
}

/* ไอคอนใน pagination */
.writer-pagination-link i {
    font-size: 14px;
    transition: transform 0.3s ease;
}

.writer-pagination-link img {
    transition: transform 0.3s ease;
    object-fit: contain;
    width: 60px;
    height: 30px;
}

.writer-pagination-link:hover i,
.writer-pagination-link:hover img {
    transform: scale(1.2);
}

.writer-pagination-link.prev>img {
    transform: rotate(180deg);
}

/* ปุ่ม prev/next เมื่อใช้ไอคอน */
.writer-pagination-link.prev,
.writer-pagination-link.next {
    font-weight: bold;
}

.writer-pagination-link:hover {
    background: #ffffff;
    color: #999999;
    border-color: #007cba;
}

.writer-pagination-link.active {
    background: #ffffff;
    color: #999999;
    border: 1px solid #999999;
    border-radius: 72px;
}

.pagination-dots {
    color: #666;
    font-weight: bold;
}

/* ปุ่ม Load More */
.load-more-posts-btn {
    display: block;
    width: 100%;
    max-width: 130px;
    margin: 20px auto;
    padding: 0px;
    background: #ffffff;
    color: #999999;
    border: 1px solid #999999;
    border-radius: 72px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    min-height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.load-more-posts-btn:hover {
    background: #000000;
    transform: translateY(-1px);
}

.load-more-posts-btn:disabled {
    background: #cccccc;
    cursor: not-allowed;
    transform: none;
}

.load-more-posts-btn:disabled:hover {
    background: #cccccc;
    transform: none;
}

/* ไอคอนใน Load More button */
.load-more-posts-btn i {
    font-size: 18px;
}

/* รูปภาพใน Load More button */
.load-more-posts-btn img {
    display: block;
    max-width: 100%;
    height: auto;
}

/* Responsive Design */
@media (max-width: 768px) {
    .writer-categories-list {
        gap: 10px;
    }

    .writer-category-item {
        padding: 10px 16px;
        font-size: 14px;
        min-height: 36px;
    }

    .writer-categories-list:not(.show-all) {
        max-height: calc(3 * (40px + 10px) - 10px);
    }

    .writer-posts-list {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

@media (max-width: 480px) {
    .writer-categories-list {
        gap: 8px;
    }

    .writer-category-item {
        padding: 8px 12px;
        font-size: 13px;
        min-height: 32px;
    }

    .writer-categories-list:not(.show-all) {
        max-height: calc(3 * (36px + 8px) - 8px);
    }

    .writer-categories-title {
        font-size: 20px;
    }
}

/* Animation delays for staggered effect */
.writer-category-item:nth-child(1) {
    animation-delay: 0.1s;
}

.writer-category-item:nth-child(2) {
    animation-delay: 0.2s;
}

.writer-category-item:nth-child(3) {
    animation-delay: 0.3s;
}

.writer-category-item:nth-child(4) {
    animation-delay: 0.4s;
}

.writer-category-item:nth-child(5) {
    animation-delay: 0.5s;
}

.writer-post-item:nth-child(1) {
    animation-delay: 0.1s;
}

.writer-post-item:nth-child(2) {
    animation-delay: 0.2s;
}

.writer-post-item:nth-child(3) {
    animation-delay: 0.3s;
}

.writer-post-item:nth-child(4) {
    animation-delay: 0.4s;
}

.writer-post-item:nth-child(5) {
    animation-delay: 0.5s;
}

.writer-post-item:nth-child(6) {
    animation-delay: 0.6s;
}