/* ===================================
   TAC-PHAM.CSS - Trang Tác Phẩm
   =================================== */

/* ========== PAGE HERO ========== */
.page-hero {
    position: relative;
    min-height: 400px;
    background: linear-gradient(135deg, #5C4033 0%, #8B4513 50%, #A0522D 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjAiIGhlaWdodD0iNjAiIHZpZXdCb3g9IjAgMCA2MCA2MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNMzAgMzBMMCA2MGw2MC02MHoiIGZpbGw9IiNmZmYiIG9wYWNpdHk9IjAuMDUiLz48L3N2Zz4=');
    opacity: 0.1;
}

.hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 60px 20px;
    width: 100%;
}

.page-title {
    font-family: 'Playfair Display', serif;
    font-size: 3rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 15px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.page-subtitle {
    font-family: 'Merriweather', serif;
    font-size: 1.2rem;
    color: #FFF8DC;
    margin-bottom: 30px;
}

/* Search Box */
.search-box {
    max-width: 600px;
    margin: 0 auto 20px;
}

.search-container {
    display: flex;
    background: #fff;
    border-radius: 50px;
    padding: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.search-input {
    flex: 1;
    border: none;
    outline: none;
    padding: 12px 20px;
    font-size: 1rem;
    font-family: 'Merriweather', serif;
}

.search-btn {
    background: linear-gradient(135deg, #8B4513, #D2691E);
    color: #fff;
    border: none;
    padding: 12px 30px;
    border-radius: 50px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.search-btn:hover {
    background: linear-gradient(135deg, #6B3410, #B5551E);
    transform: scale(1.05);
}

.hero-stats {
    font-size: 1.1rem;
    color: #FFD700;
    font-weight: 600;
}

/* ========== FILTERS SECTION ========== */
.filters-section {
    background: #fff;
    padding: 30px 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.filters-header {
    text-align: center;
    margin-bottom: 20px;
}

.filters-header h3 {
    font-family: 'Playfair Display', serif;
    color: #8B4513;
    font-size: 1.3rem;
    margin: 0;
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    max-width: 800px;
    margin: 0 auto;
}

.filter-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-label {
    font-weight: 600;
    color: #555;
    font-size: 0.95rem;
}

.filter-select {
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    font-family: 'Merriweather', serif;
    background: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-select:hover {
    border-color: #8B4513;
}

.filter-select:focus {
    outline: none;
    border-color: #8B4513;
    box-shadow: 0 0 0 3px rgba(139, 69, 19, 0.1);
}

/* ========== MAIN CONTENT ========== */
.main-content {
    padding: 60px 20px;
    background: #f8f8f8;
    min-height: 60vh;
}

/* Loading */
.loading-state {
    text-align: center;
    padding: 60px 20px;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #8B4513;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ========== WORKS GRID ========== */
.works-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 30px;
    margin-top: 20px;
}

.work-card {
    background: #fff;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    border-left: 4px solid #D2691E;
    display: flex;
    flex-direction: column;
}

.work-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(139, 69, 19, 0.15);
    border-left-width: 6px;
}

.work-icon {
    font-size: 2.5rem;
    margin-bottom: 15px;
}

.work-title {
    font-family: 'Crimson Text', serif;
    font-size: 1.5rem;
    color: #8B4513;
    margin-bottom: 12px;
    font-weight: 700;
    line-height: 1.3;
}

.work-title a {
    color: #8B4513;
    text-decoration: none;
    transition: color 0.3s ease;
}

.work-title a:hover {
    color: #D2691E;
}

.work-meta {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 15px;
}

.work-meta-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: #666;
}

.work-meta-item strong {
    color: #8B4513;
    min-width: 80px;
}

.work-genre {
    display: inline-block;
    background: #FFF8DC;
    color: #8B4513;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-top: 5px;
}

.work-summary {
    color: #555;
    font-size: 0.9rem;
    line-height: 1.6;
    margin: 15px 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex-grow: 1;
}

.work-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, #8B4513, #D2691E);
    color: #fff;
    text-decoration: none;
    border-radius: 25px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    margin-top: auto;
}

.work-btn:hover {
    background: linear-gradient(135deg, #6B3410, #B5551E);
    transform: translateX(3px);
}

/* ========== SEARCH RESULTS ========== */
.search-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 2px solid #ddd;
}

.search-header h3 {
    font-family: 'Playfair Display', serif;
    color: #8B4513;
    font-size: 1.8rem;
}

.btn-back {
    background: #8B4513;
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-back:hover {
    background: #6B3410;
    transform: translateX(-3px);
}

/* ========== EMPTY STATE ========== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state-text {
    font-size: 1.2rem;
    color: #666;
    margin-bottom: 10px;
}

.empty-state-hint {
    font-size: 0.95rem;
    color: #999;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    .page-title {
        font-size: 2rem;
    }
    
    .page-subtitle {
        font-size: 1rem;
    }
    
    .search-container {
        flex-direction: column;
        border-radius: 15px;
    }
    
    .search-btn {
        width: 100%;
        justify-content: center;
        border-radius: 10px;
    }
    
    .filters-grid {
        grid-template-columns: 1fr;
    }
    
    .works-grid {
        grid-template-columns: 1fr;
    }
    
    .search-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    
    .btn-back {
        width: 100%;
    }
}

/* ========== GENRE ICONS ========== */
.genre-icon {
    display: inline-block;
    margin-right: 5px;
}
/* =========================
   GRID TAC PHAM
========================= */

#worksGrid{
    width:100%;
}

.works-grid-content{
    display:grid;
    grid-template-columns:repeat(3, 1fr);
    gap:24px;
    width:100%;
}

/* CARD */

.work-card{
    background:#fff;
    border-radius:16px;
    overflow:hidden;

    border:1px solid #eee;

    box-shadow:0 4px 12px rgba(0,0,0,.06);

    transition:.3s;

    display:flex;
    flex-direction:column;
}

.work-card:hover{
    transform:translateY(-5px);
    box-shadow:0 10px 24px rgba(0,0,0,.12);
}

/* ẢNH */

/* Tìm và thay thế đoạn liên quan đến work-cover bằng đoạn này: */
.work-cover {
    width: 100%;
    height: 260px;
    display: flex;       /* Thêm flexbox để căn giữa ảnh */
    align-items: center; /* Căn giữa theo chiều dọc */
    justify-content: center; /* Căn giữa theo chiều ngang */
    background-color: transparent; /* Giữ nền trong suốt hoặc chuyển thành màu tối tùy bạn */
    padding: 15px 0;    /* Tạo khoảng trống phía trên/dưới cho ảnh thoáng hơn */
    overflow: hidden;
}

.work-cover img {
    max-width: 100%;    /* Đảm bảo ảnh không vượt quá khung chứa */
    max-height: 100%;   /* Giới hạn chiều cao tối đa bằng khung chứa (260px) */
    width: auto;        /* Giữ nguyên tỉ lệ chiều rộng gốc */
    height: auto;       /* Giữ nguyên tỉ lệ chiều cao gốc */
    object-fit: contain; /* Thay vì 'cover', dùng 'contain' để ảnh thu nhỏ vừa vặn không bị cắt */
    box-shadow: 0 4px 10px rgba(0,0,0,0.15); /* Thêm chút bóng đổ cho giống quyển sách thật */
    transition: .5s;
}

/* Hiệu ứng hover phóng to nhẹ nhàng nhưng vẫn giữ nguyên tỉ lệ */
.work-card:hover img {
    transform: scale(1.05);
}

/* CONTENT */

.work-content{
    padding:16px;
    display:flex;
    flex-direction:column;
    flex:1;
}

/* TITLE */

.work-title{
    font-size:20px;
    color:#5b371d;
    margin-bottom:10px;
    line-height:1.4;
}

.work-title a{
    text-decoration:none;
    color:inherit;
}

/* META */

.work-meta{
    display:flex;
    flex-direction:column;
    gap:6px;
    margin-bottom:12px;
}

.work-meta-item{
    font-size:14px;
    color:#666;
}

/* THỂ LOẠI */

.work-genre{
    display:inline-block;

    background:#f4e8d8;
    color:#8b5e34;

    padding:5px 10px;
    border-radius:999px;

    font-size:12px;
    font-weight:700;
}

/* TÓM TẮT */

.work-summary{
    font-size:14px;
    line-height:1.6;
    color:#555;

    margin-bottom:16px;

    display:-webkit-box;
    -webkit-line-clamp:3;
    -webkit-box-orient:vertical;
    overflow:hidden;

    flex:1;
}

/* BUTTON */

.work-btn{
    background:#8b5e34;
    color:#fff;

    text-decoration:none;
    text-align:center;

    padding:12px;
    border-radius:10px;

    font-size:14px;
    font-weight:700;

    transition:.3s;
}

.work-btn:hover{
    background:#6d4725;
}

/* PAGINATION */

.pagination{
    margin-top:35px;

    display:flex;
    justify-content:center;
    gap:10px;

    grid-column:1/-1;
}

.page-btn{
    width:40px;
    height:40px;

    border:none;
    border-radius:10px;

    background:#f3ede5;
    color:#6d4725;

    cursor:pointer;
    font-weight:700;
}

.page-btn.active{
    background:#5b371d;
    color:#fff;
}

/* RESPONSIVE */

@media(max-width:992px){

    .works-grid-content{
        grid-template-columns:repeat(2,1fr);
    }

}

@media(max-width:768px){

    .works-grid-content{
        grid-template-columns:1fr;
    }

}
#worksGrid{
    width:100%;
    display:block !important;
}

.works-grid-content{
    display:grid;

    grid-template-columns:
        repeat(3, minmax(280px, 320px));

    justify-content:center;

    gap:24px;

    width:100%;
}
.genre-truong-ca::before { content: '📜 '; }
.genre-truyen-ngan::before { content: '📖 '; }
.genre-tieu-thuyet::before { content: '📚 '; }
.genre-tho::before { content: '🎭 '; }
.genre-tan-van::before { content: '✍️ '; }
.genre-truyen-dai::before { content: '📕 '; }