/* =======================================
 * Article List Enhance - Enhanced Filter Bar & Cards
 * File: static/css/article-list-enhance.css
 * Version: 2026062204
 * ======================================= */

/* =======================================
 * Page Banner
 * ======================================= */
.page-banner {
    background: linear-gradient(135deg, #913500 0%, #b45a1a 50%, #c97a2a 100%);
    color: #ffffff;
    padding: 44px 0 36px;
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
}
.page-banner::before {
    content: '';
    position: absolute;
    top: -60px;
    right: -60px;
    width: 260px;
    height: 260px;
    background: rgba(255,255,255,0.06);
    border-radius: 50%;
    pointer-events: none;
}
.page-banner-inner,
.page-banner .container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 40px;
    position: relative;
    z-index: 1;
}
.page-banner h1 {
    font-size: 34px;
    font-weight: 700;
    margin: 0 0 16px;
    letter-spacing: 1px;
}
.page-banner-stats {
    display: flex;
    align-items: baseline;
    gap: 40px;
}
.stat-item {
    display: flex;
    align-items: baseline;
    gap: 6px;
}
.stat-number {
    font-size: 28px;
    font-weight: 800;
    line-height: 1;
}
.stat-label {
    font-size: 14px;
    opacity: 0.85;
}

/* =======================================
 * Enhanced Filter Bar
 * ======================================= */
.filter-bar-enhanced {
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #eae6e0;
    box-shadow: 0 1px 8px rgba(0,0,0,0.03);
    margin-bottom: 20px;
    overflow: visible;
}

/* Top row: always visible */
.filter-bar-top {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    padding: 14px 18px !important;
    flex-wrap: wrap !important;
}

/* Search input */
.filter-search-enhanced {
    display: flex !important;
    align-items: center !important;
    flex: 1 1 300px !important;
    min-width: 200px !important;
    max-width: 480px !important;
    position: relative !important;
}
.filter-search-enhanced .search-icon {
    position: absolute !important;
    left: 13px !important;
    color: #bbb !important;
    pointer-events: none !important;
    display: flex !important;
    align-items: center !important;
    z-index: 1 !important;
}
.filter-search-enhanced input {
    width: 100% !important;
    padding: 9px 14px 9px 38px !important;
    border: 1.5px solid #e0d8cc !important;
    border-radius: 20px !important;
    font-size: 14px !important;
    background-color: #fafaf6 !important;
    color: #333 !important;
    outline: none !important;
    height: 38px !important;
    box-sizing: border-box !important;
    line-height: 1.4 !important;
    display: block !important;
    overflow: visible !important;
}
.filter-search-enhanced input:focus {
    border-color: #913500 !important;
    box-shadow: 0 0 0 3px rgba(145,53,0,0.08) !important;
    background-color: #fff !important;
}
.filter-search-enhanced input::placeholder {
    color: #bbb !important;
    opacity: 1 !important;
}

/* Sort select - force override global styles */
.filter-sort-select {
    display: inline-block !important;
    padding: 9px 32px 9px 14px !important;
    border: 1.5px solid #e0d8cc !important;
    border-radius: 20px !important;
    font-size: 14px !important;
    font-family: inherit !important;
    background-color: #fafaf6 !important;
    color: #555 !important;
    outline: none !important;
    cursor: pointer !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 10px center !important;
    height: 38px !important;
    line-height: 1.4 !important;
    box-sizing: border-box !important;
    vertical-align: middle !important;
}
.filter-sort-select:focus {
    border-color: #913500;
    box-shadow: 0 0 0 3px rgba(145,53,0,0.08);
}

/* View toggle */
.filter-view-toggle {
    display: inline-flex !important;
    align-items: center !important;
    border: 1.5px solid #e0d8cc !important;
    border-radius: 20px !important;
    overflow: hidden !important;
    margin-left: auto !important;
    height: 38px !important;
    box-sizing: border-box !important;
}
.filter-view-toggle button {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 36px !important;
    height: 36px !important;
    border: none !important;
    background: transparent !important;
    color: #aaa !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    padding: 0 !important;
}
.filter-view-toggle button.active {
    background: #913500 !important;
    color: #fff !important;
}
.filter-view-toggle button:first-child {
    border-right: 1.5px solid #e0d8cc !important;
}
.filter-view-toggle button:hover:not(.active) {
    background: rgba(145,53,0,0.04);
    color: #913500;
}

/* Expand/collapse button */
.filter-expand-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 7px 14px;
    border: 1.5px solid #e0d8cc;
    border-radius: 20px;
    background: #fafaf6;
    color: #666;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}
.filter-expand-btn:hover {
    border-color: #913500;
    color: #913500;
}
.filter-expand-btn .arrow {
    display: inline-block;
    transition: transform 0.3s;
}
.filter-expand-btn.expanded .arrow {
    transform: rotate(180deg);
}

/* Expanded filter panel */
.filter-panel {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease, padding 0.35s ease;
    padding: 0 20px;
    border-top: 1px solid transparent;
}
.filter-panel.open {
    max-height: 600px;
    padding: 16px 20px 20px;
    border-top-color: #eee;
}

/* Filter row */
.filter-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 14px;
}
.filter-row:last-child {
    margin-bottom: 0;
}
.filter-row-label {
    font-size: 13px;
    color: #888;
    white-space: nowrap;
    min-width: 70px;
    padding-top: 7px;
    font-weight: 500;
}

/* Chip buttons (multi-select) */
.filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    flex: 1;
}
.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    border: 1.5px solid #e0d8cc;
    border-radius: 20px;
    background: #fff;
    color: #555;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
    white-space: nowrap;
}
.filter-chip:hover {
    border-color: #913500;
    color: #913500;
    background: rgba(145,53,0,0.04);
}
.filter-chip.active {
    border-color: #913500;
    background: rgba(145,53,0,0.08);
    color: #913500;
    font-weight: 500;
}
.filter-chip input[type="checkbox"] {
    display: none;
}

/* Tag group section */
.filter-tag-group {
    margin-bottom: 12px;
}
.filter-tag-group-title {
    font-size: 12px;
    color: #aaa;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Time range buttons */
.filter-time-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.filter-time-btn {
    padding: 6px 14px;
    border: 1.5px solid #e0d8cc;
    border-radius: 20px;
    background: #fff;
    color: #555;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}
.filter-time-btn:hover {
    border-color: #913500;
    color: #913500;
}
.filter-time-btn.active {
    border-color: #913500;
    background: rgba(145,53,0,0.08);
    color: #913500;
}

/* Active filters bar */
.active-filters-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 10px 20px;
    background: #fafaf6;
    border-top: 1px solid #eee;
    min-height: 44px;
}
.active-filters-bar:empty {
    display: none;
}
.active-filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: rgba(145,53,0,0.08);
    color: #913500;
    border-radius: 14px;
    font-size: 12px;
}
.active-filter-tag .remove-tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.15s;
    font-size: 14px;
    line-height: 1;
}
.active-filter-tag .remove-tag:hover {
    background: rgba(145,53,0,0.15);
}
.active-filters-clear {
    margin-left: auto;
    font-size: 12px;
    color: #999;
    text-decoration: none;
    transition: color 0.15s;
}
.active-filters-clear:hover {
    color: #913500;
}
.filter-result-count {
    font-size: 12px;
    color: #999;
    margin-right: 8px;
}
.filter-result-count strong {
    color: #913500;
}

/* =======================================
 * Enhanced Article Grid (2-column)
 * ======================================= */
.article-grid-enhanced {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

/* Horizontal card */
.article-card-h {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 16px;
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #eae6e0;
    text-decoration: none;
    color: inherit;
    transition: all 0.28s ease;
    position: relative;
    overflow: hidden;
}
.article-card-h::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: linear-gradient(180deg, #913500, #c97a2a);
    transform: scaleY(0);
    transition: transform 0.28s ease;
    transform-origin: bottom;
}
.article-card-h:hover {
    border-color: rgba(145,53,0,0.3);
    box-shadow: 0 6px 24px rgba(145,53,0,0.1);
    transform: translateY(-2px);
    text-decoration: none;
    color: inherit;
}
.article-card-h:hover::before {
    transform: scaleY(1);
}
.article-card-h:hover .article-card-h-cover img {
    transform: scale(1.04);
}

/* Card cover */
.article-card-h-cover {
    width: 180px;
    height: 130px;
    border-radius: 10px;
    overflow: hidden;
    flex-shrink: 0;
    position: relative;
    background: linear-gradient(145deg, #f7f2ed, #ede5db);
}
.article-card-h-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}
.article-card-h-cover .no-cover {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #b8a898;
    font-size: 13px;
    background: linear-gradient(145deg, #f5ede6, #ebe0d4);
}

/* Card badges (corner) */
.article-card-h-cover .card-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
    color: #fff;
    z-index: 2;
}
.card-badge-category {
    background: rgba(145,53,0,0.85);
}
.card-badge-dynasty {
    background: rgba(74,144,226,0.85);
    left: auto;
    right: 8px;
}

/* Card body */
.article-card-h-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 7px;
    min-width: 0;
    padding-top: 2px;
}

/* Tags row */
.article-card-h-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}
.article-card-h-tag {
    display: inline-block;
    padding: 2px 8px;
    background: rgba(145,53,0,0.06);
    color: #913500;
    border-radius: 8px;
    font-size: 11px;
    text-decoration: none;
    transition: background 0.15s;
    line-height: 1.6;
}
.article-card-h-tag:hover {
    background: rgba(145,53,0,0.14);
}

/* Title */
.article-card-h-title {
    font-size: 15px;
    font-weight: 600;
    color: #222;
    line-height: 1.45;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    transition: color 0.2s;
}
.article-card-h:hover .article-card-h-title {
    color: #913500;
}

/* Summary */
.article-card-h-summary {
    font-size: 12.5px;
    color: #999;
    line-height: 1.55;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Meta */
.article-card-h-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: #bbb;
    margin-top: auto;
    padding-top: 6px;
    border-top: 1px solid #f7f5f2;
}
.article-card-h-meta span {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}
.article-card-h-meta svg {
    opacity: 0.5;
    flex-shrink: 0;
}

/* =======================================
 * Pagination Enhancements
 * ======================================= */
.pagination-enhanced {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 36px;
    flex-wrap: wrap;
}
.pagination-enhanced a,
.pagination-enhanced span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 12px;
    border-radius: 8px;
    font-size: 13.5px;
    text-decoration: none;
    transition: all 0.2s;
}
.pagination-enhanced a {
    background: #fff;
    color: #555;
    border: 1.5px solid #eae6e0;
}
.pagination-enhanced a:hover {
    background: #913500;
    color: #fff;
    border-color: #913500;
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(145,53,0,0.18);
}
.pagination-enhanced .active {
    background: #913500;
    color: #fff;
    font-weight: 600;
    border-color: #913500;
}
.pagination-enhanced .disabled {
    color: #ddd;
    pointer-events: none;
}
.page-size-selector {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: 24px;
    font-size: 13px;
    color: #888;
}
.page-size-selector select {
    padding: 4px 8px;
    border: 1.5px solid #e0d8cc;
    border-radius: 8px;
    font-size: 13px;
    color: #555;
    outline: none;
    cursor: pointer;
}
.page-size-selector select:focus {
    border-color: #913500;
}

/* =======================================
 * Sidebar Enhancements (match sidebar.php style)
 * ======================================= */
.sidebar-enhanced {
    width: 300px;
    flex-shrink: 0;
    position: sticky;
    top: 80px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    background: #ffffff;
    border-radius: 14px;
    padding: 20px;
    border: 1px solid #eee;
    box-shadow: 0 2px 12px rgba(0,0,0,0.04);
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.sidebar-enhanced::-webkit-scrollbar {
    display: none;
}

.sidebar-widget {
    margin-bottom: 24px;
}
.sidebar-widget:last-child {
    margin-bottom: 0;
}
.sidebar-widget-title {
    font-size: 15px;
    font-weight: 600;
    color: #333;
    margin: 0 0 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    padding-bottom: 8px;
    border-bottom: 2px solid #f5f0eb;
}
.sidebar-widget-title svg {
    color: #913500;
    flex-shrink: 0;
}

/* Hot article list (sidebar) */
.sidebar-article-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.sidebar-article-list li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid #f9f9f9;
}
.sidebar-article-list li:last-child {
    border-bottom: none;
}
.sidebar-article-rank {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
    margin-top: 1px;
    background: #f5f0eb;
    color: #888;
}
.sidebar-article-rank.top1 { background: #913500; color: #fff; }
.sidebar-article-rank.top2 { background: #b45a1a; color: #fff; }
.sidebar-article-rank.top3 { background: #c97a2a; color: #fff; }
.sidebar-article-link {
    font-size: 13px;
    color: #444;
    text-decoration: none;
    line-height: 1.5;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    transition: color 0.15s;
}
.sidebar-article-link:hover {
    color: #913500;
}

/* Tag cloud (sidebar) */
.sidebar-tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.sidebar-tag {
    display: inline-block;
    padding: 4px 12px;
    background: #fafaf6;
    border: 1px solid #e8e0d5;
    border-radius: 14px;
    color: #666;
    font-size: 12px;
    text-decoration: none;
    transition: all 0.2s;
}
.sidebar-tag:hover {
    background: rgba(145,53,0,0.06);
    border-color: rgba(145,53,0,0.2);
    color: #913500;
}

/* =======================================
 * Grid view (3-column) for toggle
 * ======================================= */
.article-grid-enhanced.grid-view {
    grid-template-columns: repeat(3, 1fr);
}
.article-grid-enhanced.grid-view .article-card-h {
    flex-direction: column;
    gap: 0;
    padding: 0;
}
.article-grid-enhanced.grid-view .article-card-h-cover {
    width: 100%;
    height: 180px;
    border-radius: 14px 14px 0 0;
}
.article-grid-enhanced.grid-view .article-card-h-body {
    padding: 14px 16px 16px;
}

/* =======================================
 * Responsive
 * ======================================= */
@media (max-width: 1200px) {
    .page-with-sidebar {
        flex-direction: column;
    }
    .sidebar-enhanced {
        width: 100%;
        position: static;
        max-height: none;
    }
}
@media (max-width: 992px) {
    .article-grid-enhanced,
    .article-grid-enhanced.grid-view {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (max-width: 768px) {
    .page-banner-inner,
    .page-banner .container {
        padding: 0 20px;
    }
    .page-banner h1 {
        font-size: 26px;
    }
    .stat-number {
        font-size: 22px;
    }
    .filter-bar-top {
        padding: 12px 14px;
    }
    .article-grid-enhanced {
        grid-template-columns: 1fr !important;
    }
    .article-card-h {
        flex-direction: column;
        gap: 0;
        padding: 0;
    }
    .article-card-h-cover {
        width: 100%;
        height: 180px;
        border-radius: 12px 12px 0 0;
    }
    .article-card-h-body {
        padding: 14px 16px 16px;
    }
}
@media (max-width: 480px) {
    .filter-bar-top {
        flex-direction: column;
        align-items: stretch;
    }
    .filter-search-enhanced {
        max-width: none;
    }
    .filter-view-toggle {
        align-self: flex-end;
    }
}
