/* ============================================================
   Article List Page — Vertical blog-style layout
   Self-contained: includes all filter sidebar, pagination,
   and loader styles needed by the Article page.
   ============================================================ */

/* ── Page container ────────────────────────────────────────── */
.article-page {
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 20px;
    color: var(--text-main);
    font-family: inherit;
}

.article-page-header {
    text-align: center;
    margin-bottom: 32px;
}
.article-page-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 5px;
    color: var(--text-main);
    border-bottom: none;
    padding-bottom: 0;
}
.article-page-header p {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin-bottom: 0;
}

/* ── Toolbar (search + filter button) ──────────────────────── */
.article-toolbar {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 24px;
}

.article-search-container {
    flex: 1;
    position: relative;
}
.article-search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1rem;
    pointer-events: none;
}
#articleSearch {
    width: 100%;
    padding: 12px 40px 12px 44px;
    border-radius: 40px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-search, var(--bg-card));
    color: var(--text-search, var(--text-main));
    font-size: 1rem;
    outline: none;
    transition: border-color 0.25s, box-shadow 0.25s;
}
#articleSearch::placeholder { color: var(--text-muted); opacity: .65; }
#articleSearch:focus {
    border-color: var(--bg-btn-active);
    box-shadow: 0 0 0 3px rgba(63, 81, 181, .15);
}

/* ── Search clear button ───────────────────────────────────── */
.article-page .search-clear-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%) scale(0.5);
    background: none;
    border: none;
    outline: none;
    box-shadow: none;
    color: var(--text-muted);
    font-size: 0.9rem;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
    border-radius: 50%;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease, color 0.2s, background 0.2s;
}
.article-page .search-clear-btn.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(-50%) scale(1);
}
.article-page .search-clear-btn:hover {
    color: var(--text-main);
    background: none;
    border: none;
    outline: none;
    box-shadow: none;
}

/* ── Filter toggle button ──────────────────────────────────── */
.article-filter-btn {
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 40px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-main);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: none !important;
    letter-spacing: normal !important;
}
.article-filter-btn:hover {
    border-color: var(--text-main);
}

/* ── Active filter chips ───────────────────────────────────── */
.article-active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}
.article-page .active-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 20px;
    background: var(--bg-btn-active);
    color: var(--text-btn-active);
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: none;
    letter-spacing: normal;
}
.article-page .active-chip .chip-remove {
    cursor: pointer;
    font-size: 0.7rem;
    opacity: 0.8;
}
.article-page .active-chip .chip-remove:hover { opacity: 1; }

/* ── Filter Sidebar ────────────────────────────────────────── */
.article-filter-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 380px;
    height: 100vh;
    background: var(--bg-body, var(--bg-card));
    border-right: 1px solid var(--border-color);
    z-index: 99999;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    text-transform: none !important;
    letter-spacing: normal !important;
}
.article-filter-sidebar.open {
    transform: translateX(0);
}
.article-filter-sidebar,
.article-filter-sidebar *,
.article-filter-sidebar h3,
.article-filter-sidebar h4,
.article-filter-sidebar span,
.article-filter-sidebar label,
.article-filter-sidebar button {
    text-transform: none !important;
    letter-spacing: normal !important;
}

/* ── Sidebar Header ────────────────────────────────────────── */
.article-filter-sidebar .filter-sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 28px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}
.article-filter-sidebar .filter-sidebar-header h3 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
    border-bottom: none;
    padding-bottom: 0;
}
.article-filter-sidebar .filter-close-btn {
    background: none;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px;
    line-height: 1;
    transition: color 0.2s, background 0.2s;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}
.article-filter-sidebar .filter-close-btn:hover {
    color: var(--text-main);
    background: var(--bg-btn-transparent, rgba(0,0,0,0.05));
}

/* ── Sidebar Body ──────────────────────────────────────────── */
.article-filter-sidebar .filter-sidebar-body {
    flex: 1;
    overflow-y: auto;
    padding: 8px 28px 16px;
}

/* ── Filter Groups ─────────────────────────────────────────── */
.article-filter-sidebar .filter-group {
    padding: 20px 0;
    border-bottom: 1px solid var(--border-color);
}
.article-filter-sidebar .filter-group:last-child {
    border-bottom: none;
}
.article-filter-sidebar .filter-group-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 14px;
    margin-top: 0;
    color: var(--text-main);
    border-bottom: none;
    padding-bottom: 0;
}

/* Items wrapper — show/hide logic */
.article-filter-sidebar .filter-items-wrapper {
    overflow: hidden;
}
.article-filter-sidebar .filter-items-wrapper.collapsed .filter-checkbox-label:nth-child(n+5) {
    display: none !important;
}

.article-filter-sidebar .filter-checkbox-label {
    display: flex !important;
    align-items: center;
    gap: 12px;
    padding: 9px 8px 9px 12px;
    cursor: pointer;
    font-size: 0.95rem !important;
    color: var(--text-main);
    border-radius: 4px;
    transition: background 0.15s;
    user-select: none;
    overflow: visible;
    margin: 0 !important;
    letter-spacing: normal !important;
    text-transform: none !important;
}
.article-filter-sidebar .filter-checkbox-label span {
    flex: 1;
    overflow: visible;
    padding-left: 0;
    white-space: nowrap;
}
.article-filter-sidebar .filter-checkbox-label:hover {
    background: var(--bg-btn-transparent, rgba(0,0,0,0.04));
}

.article-filter-sidebar .filter-checkbox {
    -webkit-appearance: checkbox !important;
    -moz-appearance: checkbox !important;
    appearance: checkbox !important;
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: 20px !important;
    height: 20px !important;
    min-width: 20px;
    min-height: 20px;
    accent-color: var(--bg-btn-active);
    cursor: pointer;
    flex-shrink: 0;
    margin: 0 !important;
    margin-right: 0 !important;
    padding: 0;
    position: relative !important;
    z-index: 1 !important;
    float: none !important;
}

/* Show more / Show less button */
.article-filter-sidebar .filter-show-more-btn {
    background: none !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    color: var(--text-main);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    padding: 10px 0 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: opacity 0.2s;
    width: 100%;
    height: auto !important;
    line-height: normal !important;
    letter-spacing: normal !important;
    text-transform: none !important;
}
.article-filter-sidebar .filter-show-more-btn:hover,
.article-filter-sidebar .filter-show-more-btn:active,
.article-filter-sidebar .filter-show-more-btn:focus {
    opacity: 0.8;
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
    color: var(--text-main);
}
.article-filter-sidebar .filter-show-more-btn i {
    font-size: 0.7rem;
    transition: transform 0.2s;
}
.article-filter-sidebar .filter-show-more-btn.expanded i {
    transform: rotate(180deg);
}

/* ── Sidebar Footer ────────────────────────────────────────── */
.article-filter-sidebar .filter-sidebar-footer {
    padding: 16px 28px;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
    display: flex;
    justify-content: center;
}
.article-filter-sidebar .filter-apply-btn {
    width: 100%;
    padding: 14px;
    border: 2px solid var(--bg-btn-active);
    border-radius: 6px;
    background: transparent;
    color: var(--bg-btn-active);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.article-filter-sidebar .filter-apply-btn:hover {
    background: var(--bg-btn-active);
    color: var(--text-btn-active);
}

/* ── Filter Overlay ────────────────────────────────────────── */
.article-page .filter-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.4);
    z-index: 99998;
}
.article-page .filter-overlay.show { display: block; }

/* ── Article List (Vertical) ───────────────────────────────── */
.article-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-bottom: 32px;
}

/* ── Article Item ──────────────────────────────────────────── */
.article-item {
    display: flex;
    gap: 24px;
    text-decoration: none;
    color: inherit;
    padding: 28px 0;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s;
}
.article-item-thumbnail {
    flex-shrink: 0;
    width: 220px;
    height: 140px;
    border-radius: 12px;
    overflow: hidden;
    background: var(--bg-card-muted, #f8f9fa);
    border: 1px solid var(--border-color);
}
.article-item-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}
.article-item:hover .article-item-thumbnail img {
    transform: scale(1.05);
}
.article-item-content {
    flex: 1;
    min-width: 0;
}
.article-item:first-child {
    border-top: 1px solid var(--border-color);
}
.article-item:hover {
    text-decoration: none;
    color: inherit;
}

.article-item-title {
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.3;
    margin: 0 0 8px 0;
    color: var(--text-main);
    border-bottom: none;
    padding-bottom: 0;
    text-transform: none !important;
    letter-spacing: normal !important;
    transition: color 0.2s;
}
.article-item:hover .article-item-title {
    color: var(--link-color, #007bff);
}

.article-item-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
    margin-bottom: 10px;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: none !important;
    letter-spacing: normal !important;
}

.article-item-meta i {
    margin-right: 4px;
    font-size: 0.8rem;
}

.article-item-excerpt {
    font-size: 0.95rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin: 0 0 12px 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-transform: none !important;
    letter-spacing: normal !important;
}

.article-item-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.article-tag {
    font-size: 0.72rem;
    padding: 3px 10px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    text-transform: none !important;
    letter-spacing: normal !important;
    transition: all 0.2s;
}
.article-item:hover .article-tag {
    border-color: var(--link-color, #007bff);
    color: var(--link-color, #007bff);
}

/* ── Pagination & Count ────────────────────────────────────── */
.article-pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
}
.article-count {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-top: 10px;
    margin-bottom: 20px;
    font-weight: 500;
    text-transform: none !important;
    letter-spacing: normal !important;
}

/* ── Page Buttons ──────────────────────────────────────────── */
.article-page .page-btn {
    background-color: var(--bg-card);
    color: var(--text-btn, var(--text-main));
    border: 1px solid var(--border-color);
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}
.article-page .page-btn:hover:not(:disabled) {
    background-color: var(--bg-btn-hover);
    border-color: var(--bg-btn-hover);
    color: var(--text-btn-hover, var(--text-main));
}
.article-page .page-btn.active {
    background-color: var(--bg-btn-active);
    color: var(--text-btn-active);
    border-color: var(--bg-btn-active);
    font-weight: bold;
    cursor: default;
}
.article-page .page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ── Modern Circular Loader ────────────────────────────────── */
.article-page .loading-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    min-height: 200px;
    padding: 3rem 0;
}

.article-page .loader-circle {
    width: 48px;
    height: 48px;
    border: 3px solid rgba(155, 241, 255, 0.2);
    border-radius: 50%;
    border-top-color: #9bf1ff;
    animation: article-spin 1s ease-in-out infinite;
    position: relative;
    box-shadow: 0 0 15px rgba(155, 241, 255, 0.1);
}

.article-page .loader-circle::before {
    content: '';
    position: absolute;
    top: -3px; left: -3px; right: -3px; bottom: -3px;
    border-radius: 50%;
    border: 3px solid transparent;
    border-top-color: rgba(155, 241, 255, 0.4);
    animation: article-spin 2s linear infinite;
}

@keyframes article-spin {
    to { transform: rotate(360deg); }
}

/* Light theme adjustments */
body.light-theme .article-page .loader-circle {
    border-color: rgba(63, 81, 181, 0.1);
    border-top-color: var(--bg-btn-active);
    box-shadow: none;
}
body.light-theme .article-page .loader-circle::before {
    border-top-color: rgba(63, 81, 181, 0.2);
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 768px) {
    .article-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    .article-filter-btn {
        width: auto;
        justify-content: center;
        align-self: center;
    }
    .article-filter-sidebar {
        width: 380px;
        max-width: 100vw;
    }
    .article-item {
        flex-direction: column;
        gap: 16px;
    }
    .article-item-thumbnail {
        width: 100%;
        height: 200px;
    }
    .article-item-title {
        font-size: 1.15rem;
    }
}
