/* static/css/book_card.css */

/* ========== 篩選側邊欄 ========== */
.filter-sidebar {
    background: white;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
    position: sticky;
    top: 20px;
}

.filter-sidebar-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid #f0f0f0;
}

.filter-section {
    margin-bottom: 24px;
}

.filter-section:last-child {
    margin-bottom: 0;
}

.filter-section-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #555;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
}

.filter-section-title i {
    color: #667eea;
    font-size: 0.9rem;
}

/* 可滾動的選項列表 */
.filter-options.scrollable {
    max-height: 200px;
    overflow-y: auto;
    padding-right: 4px;
}

.filter-options.scrollable::-webkit-scrollbar {
    width: 4px;
}

.filter-options.scrollable::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 4px;
}

.filter-options.scrollable::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

.filter-options.scrollable::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}

/* 篩選選項 */
.filter-options {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.filter-option {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 8px;
    color: #666;
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.filter-option i {
    width: 20px;
    color: #999;
    font-size: 0.85rem;
    transition: color 0.2s;
}

.filter-option:hover {
    background: #f5f7fa;
    color: #333;
}

.filter-option:hover i {
    color: #667eea;
}

.filter-option.active {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.filter-option.active i {
    color: white;
}

/* ========== 排序標籤 ========== */
.sort-tabs {
    margin-bottom: 20px;
}

.sort-tabs-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    background: white;
    padding: 8px;
    border-radius: 40px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.sort-tab {
    display: inline-flex;
    align-items: center;
    padding: 10px 20px;
    border-radius: 30px;
    color: #666;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.sort-tab:hover {
    background: #f5f7fa;
    color: #333;
}

.sort-tab.active {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.sort-tab i {
    margin-right: 6px;
}

/* ========== 書籍卡片 ========== */
.book-card {
    display: flex;
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
    height: 100%;
    min-height: 180px;
}

.book-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.book-card-cover {
    position: relative;
    width: 160px;
    flex-shrink: 0;
}

.book-card-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    aspect-ratio: 3/4;
}

.book-card-info {
    flex: 1;
    padding: 16px;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.book-card-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.book-card-title a {
    color: #333;
    text-decoration: none;
}

.book-card-title a:hover {
    color: #667eea;
}

.book-card-author {
    font-size: 0.85rem;
    color: #888;
    margin-bottom: 4px;
}

.book-card-author i {
    color: #667eea;
    width: 18px;
}

.book-card-category {
    font-size: 0.8rem;
    color: #999;
    margin-bottom: 8px;
}

.book-card-desc {
    font-size: 0.85rem;
    color: #666;
    line-height: 1.5;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}

/* 統計數據 */
.book-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 8px;
}

.book-stats span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8rem;
    color: #888;
}

.book-stats i.fa-fire { color: #e74c3c; }
.book-stats i.fa-star { color: #f39c12; }
.book-stats i.fa-bookmark { color: #667eea; }

/* 標籤 */
.book-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tag {
    display: inline-block;
    padding: 4px 10px;
    font-size: 0.7rem;
    border-radius: 20px;
    font-weight: 500;
}

.tag-category { background: #f0f0f0; color: #666; }
.tag-ongoing { background: #e3f2fd; color: #1976d2; }
.tag-finished { background: #e8f5e9; color: #388e3c; }
.tag-paid { background: #fef3c7; color: #d97706; }
.tag-free { background: #d1fae5; color: #059669; }

/* ========== 空狀態 ========== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.empty-state i {
    opacity: 0.3;
    margin-bottom: 20px;
}

/* ========== 分頁 ========== */
.pagination-nav .page-link {
    border-radius: 8px;
    margin: 0 4px;
    color: #666;
    border: none;
    padding: 10px 16px;
}

.pagination-nav .page-item.active .page-link {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.filter-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.9rem;
    color: #333;
    background: white;
    transition: all 0.2s;
}

.filter-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.filter-input::placeholder {
    color: #aaa;
    font-size: 0.85rem;
}

/* ========== 付費專區橫幅 ========== */
.paid-banner {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px;
    padding: 24px 30px;
    color: white;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.3);
}

.paid-banner-content {
    display: flex;
    align-items: center;
    gap: 24px;
}

.paid-banner-icon {
    flex-shrink: 0;
    width: 70px;
    height: 70px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.paid-banner-icon i {
    color: #ffd700;
}

.paid-banner-text h3 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.paid-banner-text p {
    margin-bottom: 4px;
    opacity: 0.95;
}

.paid-banner-text small {
    opacity: 0.75;
}

@media (max-width: 768px) {
    .paid-banner {
        padding: 20px;
    }
    
    .paid-banner-content {
        flex-direction: column;
        text-align: center;
    }
    
    .paid-banner-icon {
        width: 60px;
        height: 60px;
    }
}

/* ========== 免費專區橫幅 ========== */
.free-banner {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    border-radius: 16px;
    padding: 24px 30px;
    color: white;
    box-shadow: 0 4px 20px rgba(40, 167, 69, 0.3);
}

.free-banner-content {
    display: flex;
    align-items: center;
    gap: 24px;
}

.free-banner-icon {
    flex-shrink: 0;
    width: 70px;
    height: 70px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.free-banner-icon i {
    color: #ffd700;
}

.free-banner-text h3 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.free-banner-text p {
    margin-bottom: 4px;
    opacity: 0.95;
}

.free-banner-text small {
    opacity: 0.75;
}

/* 廣告預留位置 */
.ad-placeholder-banner {
    background: #f8f9fa;
    border: 2px dashed #dee2e6;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    color: #6c757d;
    font-size: 0.95rem;
}

@media (max-width: 768px) {
    .free-banner {
        padding: 20px;
    }
    
    .free-banner-content {
        flex-direction: column;
        text-align: center;
    }
    
    .free-banner-icon {
        width: 60px;
        height: 60px;
    }
}

/* ========== 響應式 ========== */
@media (max-width: 992px) {
    .filter-sidebar {
        position: static;
        margin-bottom: 20px;
    }
}

@media (max-width: 768px) {
    .book-card-cover {
        width: 100px;
    }
    
    .book-card-info {
        padding: 12px;
    }
    
    .book-card-title {
        font-size: 1rem;
    }
    
    .book-card-desc {
        -webkit-line-clamp: 1;
    }
    
    .sort-tabs-wrapper {
        flex-wrap: wrap;
    }
    
    .sort-tab {
        padding: 8px 16px;
        font-size: 0.85rem;
    }
}

@media (max-width: 576px) {
    .book-card-cover {
        width: 85px;
    }
    
    .book-stats {
        gap: 8px;
    }
}

/* 男生圖標顏色 */
.gender-tab .fa-mars {
    color: #3a86ff;
}

.gender-tab.active .fa-mars {
    color: white;
}

/* 女生圖標顏色 */
.gender-tab .fa-venus {
    color: #e83e8c;
}

.gender-tab.active .fa-venus {
    color: white;
}

/* ========== CSS 變數：性別主題色 ========== */
:root {
    --primary: #667eea;
    --primary-light: #764ba2;
    --primary-rgb: 102, 126, 234;
}

/* 女生頻道覆蓋 */
[data-gender="female"] {
    --primary: #e83e8c;
    --primary-light: #ffb6c1;
    --primary-rgb: 232, 62, 140;
}

/* 全部（中性） */
[data-gender="all"] {
    --primary: #667eea;
    --primary-light: #764ba2;
    --primary-rgb: 102, 126, 234;
}

/* ========== 篩選側邊欄 ========== */
.filter-sidebar {
    background: white;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
    position: sticky;
    top: 20px;
}

.filter-sidebar-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid #f0f0f0;
}

.filter-section { margin-bottom: 24px; }
.filter-section:last-child { margin-bottom: 0; }

.filter-section-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #555;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
}

.filter-section-title i {
    color: var(--primary);
    font-size: 0.9rem;
}

.filter-options.scrollable {
    max-height: 200px;
    overflow-y: auto;
    padding-right: 4px;
}

.filter-options.scrollable::-webkit-scrollbar { width: 4px; }
.filter-options.scrollable::-webkit-scrollbar-track { background: #f0f0f0; border-radius: 4px; }
.filter-options.scrollable::-webkit-scrollbar-thumb { background: #ccc; border-radius: 4px; }
.filter-options.scrollable::-webkit-scrollbar-thumb:hover { background: #aaa; }

.filter-options {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.filter-option {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 8px;
    color: #666;
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.filter-option i { width: 20px; color: #999; font-size: 0.85rem; transition: color 0.2s; }

.filter-option:hover { background: #f5f7fa; color: #333; }
.filter-option:hover i { color: var(--primary); }

.filter-option.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
}
.filter-option.active i { color: white; }

/* ========== 排序標籤 ========== */
.sort-tabs { margin-bottom: 20px; }

.sort-tabs-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    background: white;
    padding: 8px;
    border-radius: 40px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.sort-tab {
    display: inline-flex;
    align-items: center;
    padding: 10px 20px;
    border-radius: 30px;
    color: #666;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.sort-tab:hover { background: #f5f7fa; color: #333; }

.sort-tab.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
}

.sort-tab i { margin-right: 6px; }

/* ========== 書籍卡片 ========== */
.book-card {
    display: flex;
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    transition: all 0.3s ease;
    height: 100%;
    min-height: 180px;
}

.book-card:hover { transform: translateY(-4px); box-shadow: 0 8px 24px rgba(0,0,0,0.1); }

.book-card-cover {
    position: relative;
    width: 160px;
    flex-shrink: 0;
}

.book-card-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    aspect-ratio: 3/4;
}

.book-card-info {
    flex: 1;
    padding: 16px;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.book-card-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.book-card-title a { color: #333; text-decoration: none; }
.book-card-title a:hover { color: var(--primary); }

.book-card-author { font-size: 0.85rem; color: #888; margin-bottom: 4px; }
.book-card-author i { color: var(--primary); width: 18px; }

.book-card-category { font-size: 0.8rem; color: #999; margin-bottom: 8px; }

.book-card-desc {
    font-size: 0.85rem;
    color: #666;
    line-height: 1.5;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}

.book-stats { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 8px; }
.book-stats span { display: inline-flex; align-items: center; gap: 4px; font-size: 0.8rem; color: #888; }
.book-stats i.fa-fire { color: #e74c3c; }
.book-stats i.fa-star { color: #f39c12; }
.book-stats i.fa-bookmark { color: var(--primary); }

.book-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { display: inline-block; padding: 4px 10px; font-size: 0.7rem; border-radius: 20px; font-weight: 500; }
.tag-category { background: #f0f0f0; color: #666; }
.tag-ongoing { background: #e3f2fd; color: #1976d2; }
.tag-finished { background: #e8f5e9; color: #388e3c; }
.tag-paid { background: #fef3c7; color: #d97706; }
.tag-free { background: #d1fae5; color: #059669; }

/* ========== 空狀態 ========== */
.empty-state { text-align: center; padding: 60px 20px; color: #999; }
.empty-state i { opacity: 0.3; margin-bottom: 20px; }

/* ========== 分頁 ========== */
.pagination-nav .page-link {
    border-radius: 8px;
    margin: 0 4px;
    color: #666;
    border: none;
    padding: 10px 16px;
}
.pagination-nav .page-item.active .page-link {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
}

/* ========== 付費專區橫幅 ========== */
.paid-banner {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-radius: 16px;
    padding: 24px 30px;
    color: white;
    box-shadow: 0 4px 20px rgba(var(--primary-rgb), 0.3);
}

/* ========== 免費專區橫幅 ========== */
.free-banner {
    background: linear-gradient(135deg, #28a745, #20c997);
    border-radius: 16px;
    padding: 24px 30px;
    color: white;
    box-shadow: 0 4px 20px rgba(40,167,69,0.3);
}

/* 性別圖標 */
.gender-tab .fa-mars { color: #3a86ff; }
.gender-tab.active .fa-mars { color: white; }
.gender-tab .fa-venus { color: #e83e8c; }
.gender-tab.active .fa-venus { color: white; }

/* ========== 響應式 ========== */
@media (max-width: 992px) { .filter-sidebar { position: static; margin-bottom: 20px; } }

@media (max-width: 768px) {
    .book-card-cover { width: 100px; }
    .book-card-info { padding: 12px; }
    .book-card-title { font-size: 1rem; }
    .book-card-desc { -webkit-line-clamp: 1; }
    .sort-tab { padding: 8px 16px; font-size: 0.85rem; }
}

@media (max-width: 576px) { .book-card-cover { width: 85px; } .book-stats { gap: 8px; } }