/**
 * Filter Panel Styles
 * Reusable left sidebar filter component
 */

/* ============================================
   MAIN LAYOUT WITH FILTER
   ============================================ */
.main-layout {
    position: relative;
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

.main-layout .content-area {
    flex: 1;
    min-width: 0; /* Prevent flex overflow */
    padding: 0 1rem 2rem 1rem;
}

/* When filter panel is visible on desktop */
.main-layout.with-filter .content-area {
    padding-left: 1.5rem;
}

/* ============================================
   FILTER PANEL (Left Sidebar)
   ============================================ */
.filter-panel {
    position: sticky;
    top: 80px; /* Below navbar with some space */
    width: 280px;
    max-height: calc(100vh - 100px);
    background-color: white;
    box-shadow: 2px 0 12px rgba(0,0,0,0.08);
    border-radius: 12px;
    padding: 1.5rem;
    overflow-y: auto;
    transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
    z-index: 100;
    flex-shrink: 0;
    align-self: flex-start;
}

.filter-panel-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.filter-panel-header h2 {
    font-size: 1.3rem;
    color: #2c3e50;
    font-weight: 700;
    margin: 0;
    border-bottom: none;
}

.filter-panel-header p {
    font-size: 0.82rem;
    color: #7f8c8d;
    margin-top: 2px;
    margin-bottom: 0;
}

.clear-all-btn {
    font-size: 0.78rem;
    color: #e74c3c;
    background: none;
    border: 1px solid #e74c3c;
    border-radius: 6px;
    padding: 3px 8px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.clear-all-btn:hover {
    background: #e74c3c;
    color: white;
}

/* ============================================
   FILTER SECTIONS
   ============================================ */
.filter-section {
    margin-bottom: 1.75rem;
}

.filter-section-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #34495e;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    user-select: none;
    border-bottom: none;
}

.filter-section-title .arrow {
    margin-left: auto;
    font-size: 0.7rem;
    transition: transform 0.25s;
}

.filter-section.collapsed .arrow {
    transform: rotate(-90deg);
}

.filter-section.collapsed .filter-section-body {
    display: none;
}

/* ============================================
   FILTER SEARCH BOX
   ============================================ */
.filter-search-box {
    margin-bottom: 0.6rem;
}

.filter-search-input {
    width: 100%;
    padding: 0.4rem 0.65rem;
    border: 1.5px solid #e0e0e0;
    border-radius: 6px;
    font-size: 0.78rem;
    color: #444;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #fafafa;
}

.filter-search-input:focus {
    border-color: #3498db;
    background: white;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.1);
}

.filter-search-input::placeholder {
    color: #aaa;
}

/* ============================================
   FILTER CHIPS GRID (Categories & Pricing)
   ============================================ */
.filter-chips-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    max-height: 280px;
    overflow-y: auto;
    padding-right: 2px;
}

.filter-chips-grid.pricing-chips {
    max-height: none;
    overflow: visible;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.22rem 0.55rem;
    border: 1.5px solid #e2e8f0;
    border-radius: 16px;
    font-size: 0.72rem;
    cursor: pointer;
    transition: all 0.15s ease;
    background: #fafbfc;
    color: #555;
    user-select: none;
    white-space: nowrap;
}

.filter-chip:hover {
    border-color: #3498db;
    background: #f0f8ff;
    color: #2980b9;
}

.filter-chip input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.filter-chip:has(input:checked),
.filter-chip.checked {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    border-color: #2980b9;
    color: white;
    box-shadow: 0 2px 6px rgba(52, 152, 219, 0.25);
}

.filter-chip:has(input:checked) .chip-count,
.filter-chip.checked .chip-count {
    background: rgba(255, 255, 255, 0.25);
    color: white;
}

.chip-label {
    font-weight: 500;
    line-height: 1.2;
}

.chip-count {
    font-size: 0.65rem;
    background: #e8ecef;
    color: #777;
    padding: 0.1rem 0.35rem;
    border-radius: 10px;
    font-weight: 600;
    min-width: 18px;
    text-align: center;
}

/* Hidden chips (show more/less) */
.hidden-chip {
    display: none !important;
}

.filter-chips-grid.expanded .hidden-chip,
.filter-tags-grid.expanded .hidden-chip {
    display: inline-flex !important;
}

/* ============================================
   SHOW MORE BUTTON
   ============================================ */
.show-more-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0.45rem 0.75rem;
    margin-top: 0.5rem;
    background: #f8f9fa;
    border: 1px dashed #d0d5dd;
    border-radius: 8px;
    font-size: 0.72rem;
    font-weight: 600;
    color: #667085;
    cursor: pointer;
    transition: all 0.2s ease;
}

.show-more-btn:hover {
    background: #e8f4fd;
    border-color: #3498db;
    color: #3498db;
}

.show-more-btn.expanded .show-more-text {
    display: none;
}

.show-more-btn.expanded .show-less-text {
    display: inline !important;
}

/* ============================================
   FILTER OPTIONS (Legacy - keeping for compatibility)
   ============================================ */
.filter-option {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.35rem 0.4rem;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s;
    margin-bottom: 2px;
}

.filter-option:hover {
    background: #f0f4ff;
}

.filter-option input[type="checkbox"] {
    accent-color: #3498db;
    width: 15px;
    height: 15px;
    cursor: pointer;
    flex-shrink: 0;
}

.filter-option .filter-label {
    font-size: 0.88rem;
    cursor: pointer;
    color: #444;
    flex: 1;
}

.filter-option .count {
    font-size: 0.75rem;
    color: #aaa;
}

/* ============================================
   TAG CHIPS IN FILTER
   ============================================ */
.filter-tags-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    max-height: 240px;
    overflow-y: auto;
    padding-right: 2px;
}

.filter-tag-chip {
    padding: 0.22rem 0.55rem;
    border-radius: 16px;
    border: 1.5px solid #e2e8f0;
    font-size: 0.72rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    color: #555;
    background: #fafbfc;
    user-select: none;
    text-decoration: none;
    white-space: nowrap;
}

.filter-tag-chip:hover {
    border-color: #3498db;
    color: #2980b9;
    background: #f0f8ff;
    text-decoration: none;
}

.filter-tag-chip.active {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    border-color: #2980b9;
    color: white;
    box-shadow: 0 2px 6px rgba(52, 152, 219, 0.25);
}

/* ============================================
   FILTER APPLY SECTION (Mobile)
   ============================================ */
.filter-apply-section {
    display: none;
    padding: 1rem 0;
    border-top: 1px solid #e0e0e0;
    margin-top: 1rem;
}

.filter-apply-btn {
    width: 100%;
    padding: 0.85rem 1.5rem;
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.3);
}

.filter-apply-btn:hover {
    background: linear-gradient(135deg, #2980b9 0%, #1a5276 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.4);
}

.filter-apply-btn:active {
    transform: translateY(0);
}

/* ============================================
   FILTER PANEL SCROLLBAR
   ============================================ */
.filter-panel::-webkit-scrollbar {
    width: 5px;
}

.filter-panel::-webkit-scrollbar-track {
    background: #f8f8f8;
}

.filter-panel::-webkit-scrollbar-thumb {
    background: #d0d0d0;
    border-radius: 10px;
}

/* ============================================
   MOBILE FILTER TOGGLE
   ============================================ */
.filter-toggle {
    position: fixed;
    top: 80px;
    left: 0;
    z-index: 1100;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 0 8px 8px 0;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    display: none;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 2px 2px 8px rgba(0,0,0,0.15);
    transition: all 0.3s ease;
}

.filter-toggle:hover {
    background-color: #2980b9;
}

.filter-toggle:active {
    transform: scale(0.98);
}

.filter-toggle-icon {
    width: 20px;
    height: 16px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.filter-toggle-icon span {
    display: block;
    height: 2px;
    background-color: white;
    border-radius: 2px;
}

.close-icon {
    width: 20px;
    height: 20px;
    position: relative;
    display: none;
}

.close-icon span {
    position: absolute;
    height: 2px;
    width: 100%;
    background-color: white;
    border-radius: 2px;
    top: 50%;
    left: 0;
}

.close-icon span:first-child {
    transform: translateY(-50%) rotate(45deg);
}

.close-icon span:last-child {
    transform: translateY(-50%) rotate(-45deg);
}

.filter-toggle.panel-open .filter-toggle-icon {
    display: none;
}

.filter-toggle.panel-open .close-icon {
    display: block;
}

.filter-toggle.panel-open {
    background-color: #e74c3c;
}

.filter-toggle.panel-open:hover {
    background-color: #c0392b;
}

/* ============================================
   FILTER OVERLAY (Mobile)
   ============================================ */
.filter-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background-color: rgba(0,0,0,0.5);
    z-index: 850;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.filter-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* ============================================
   CONTROLS BAR (Search + Sort + View Toggle)
   ============================================ */
.controls-bar {
    background: white;
    border-radius: 12px;
    padding: 1.1rem 1.25rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
    margin-bottom: 0.75rem;
}

.search-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.search-wrap {
    flex: 1;
    position: relative;
}

.search-wrap input {
    width: 100%;
    padding: 0.65rem 1rem 0.65rem 2.6rem;
    border: 1.8px solid #e0e0e0;
    border-radius: 10px;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
    color: #333;
}

.search-wrap input:focus {
    border-color: #3498db;
}

.search-icon {
    position: absolute;
    left: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    color: #aaa;
    font-size: 1rem;
    pointer-events: none;
}

.search-clear {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #bbb;
    cursor: pointer;
    font-size: 1rem;
    display: none;
    background: none;
    border: none;
    padding: 0;
    line-height: 1;
}

.search-clear.visible {
    display: block;
}

.search-clear:hover {
    color: #888;
}

/* ============================================
   SORT DROPDOWN
   ============================================ */
.sort-select {
    padding: 0.65rem 0.9rem;
    border: 1.8px solid #e0e0e0;
    border-radius: 10px;
    font-size: 0.88rem;
    color: #555;
    outline: none;
    cursor: pointer;
    background: white;
    transition: border-color 0.2s;
    min-width: 150px;
}

.sort-select:focus {
    border-color: #3498db;
}

/* ============================================
   VIEW TOGGLE BUTTON
   ============================================ */
.view-toggle {
    width: 40px;
    height: 40px;
    border: 1.8px solid #e0e0e0;
    border-radius: 10px;
    background: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: #555;
    transition: all 0.2s;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}

.view-toggle:hover {
    border-color: #3498db;
    color: #3498db;
}

.view-toggle .icon {
    position: absolute;
    transition: all 0.25s cubic-bezier(0.4,0,0.2,1);
}

.view-toggle .icon-grid {
    opacity: 1;
    transform: scale(1) rotate(0deg);
}

.view-toggle .icon-list {
    opacity: 0;
    transform: scale(0.5) rotate(90deg);
}

.view-toggle.list-mode .icon-grid {
    opacity: 0;
    transform: scale(0.5) rotate(-90deg);
}

.view-toggle.list-mode .icon-list {
    opacity: 1;
    transform: scale(1) rotate(0deg);
}

/* ============================================
   RESULTS META
   ============================================ */
.results-meta {
    font-size: 0.82rem;
    color: #888;
    margin-top: 0.6rem;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.results-meta strong {
    color: #555;
}

/* ============================================
   ACTIVE FILTERS BAR
   ============================================ */
.active-filters-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    padding: 0.65rem 1.25rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    margin-bottom: 1rem;
}

.active-filters-bar.hidden {
    display: none;
}

.active-filters-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-right: 0.2rem;
}

.filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: #e8f4fd;
    color: #1a6fa8;
    border: 1px solid #b8d9f5;
    border-radius: 20px;
    padding: 0.22rem 0.65rem;
    font-size: 0.8rem;
    font-weight: 500;
}

.filter-tag .remove {
    cursor: pointer;
    font-size: 0.8rem;
    color: #5b9ec9;
    line-height: 1;
    background: none;
    border: none;
    padding: 0;
    margin-left: 1px;
    transition: color 0.15s;
}

.filter-tag .remove:hover {
    color: #e74c3c;
}

.clear-filters-link {
    margin-left: auto;
    font-size: 0.8rem;
    color: #e74c3c;
    cursor: pointer;
    background: none;
    border: none;
    text-decoration: underline;
    padding: 0;
}

.clear-filters-link:hover {
    color: #c0392b;
}

/* ============================================
   CARDS GRID (with Filter Layout)
   ============================================ */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
    transition: all 0.3s ease;
}

.cards-grid.list-view {
    grid-template-columns: 1fr;
}

/* No Results */
.no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
    color: #666;
    background: #f8f9fa;
    border-radius: 12px;
}

.no-results .icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
}

.no-results p {
    margin: 0.5rem 0;
    font-size: 1rem;
}

.no-results .hint {
    font-size: 0.9rem;
    color: #999;
}

/* Loading State */
.cards-grid.loading {
    position: relative;
    pointer-events: none;
}

.cards-grid.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 3px solid #e0e0e0;
    border-top-color: #3498db;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   PAGINATION STYLES
   ============================================ */
.pagination-wrapper {
    width: 100%;
    display: flex;
    justify-content: center;
    padding: 2rem 0;
    clear: both;
    margin-top: 1.5rem;
    background: transparent;
}

.pagination-container {
    width: 100%;
    max-width: 100%;
    display: flex;
    justify-content: center;
    box-sizing: border-box;
    overflow: visible;
}

.pagination {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.35rem;
    padding: 0;
    margin: 0;
    list-style: none;
}

.pagination .page-item .page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 0.75rem;
    border: 1.5px solid #e0e0e0;
    border-radius: 8px;
    background: white;
    color: #555;
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
}

.pagination .page-item .page-link:hover {
    border-color: #3498db;
    color: #3498db;
    background: #f0f7ff;
}

.pagination .page-item.active .page-link {
    background: #3498db;
    border-color: #3498db;
    color: white;
}

.pagination .page-item.disabled .page-link {
    color: #ccc;
    pointer-events: none;
    background: #f8f8f8;
}

.pagination .pagination-text {
    margin: 0 0.25rem;
}

/* ============================================
   RESPONSIVE STYLES
   ============================================ */
@media (max-width: 1400px) {
    .cards-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 1024px) {
    .filter-panel {
        width: 240px;
    }
    
    .cards-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .filter-toggle {
        display: flex;
    }
    
    .filter-panel {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        max-height: 100vh;
        transform: translateX(-100%);
        border-radius: 0 12px 12px 0;
        width: 85%;
        max-width: 320px;
        z-index: 1000;
        padding-top: 80px;
        align-self: stretch;
    }
    
    .filter-panel.open {
        transform: translateX(0);
    }
    
    .filter-overlay {
        display: block;
    }
    
    .filter-apply-section {
        display: block;
    }
    
    .main-layout {
        flex-direction: column;
    }
    
    .main-layout .content-area,
    .main-layout.with-filter .content-area {
        padding-left: 1rem;
        padding-right: 1rem;
        width: 100%;
    }
    
    .cards-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .sort-select {
        display: none;
    }
}

@media (max-width: 540px) {
    .cards-grid:not(.list-view) {
        grid-template-columns: 1fr;
    }
    
    .main-layout .content-area,
    .main-layout.with-filter .content-area {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
}

/* ============================================
   PAGINATION STYLING
   ============================================ */
.pagination-container {
    margin-top: 1.5rem;
}

.pagination-container nav {
    display: flex;
    justify-content: center;
}

.pagination {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.25rem;
    padding: 0;
    margin: 0;
    list-style: none;
}

.pagination .page-item .page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 0.75rem;
    border: 1.5px solid #e0e0e0;
    border-radius: 8px;
    background: white;
    color: #555;
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
}

.pagination .page-item .page-link:hover {
    border-color: #3498db;
    color: #3498db;
    background: #f0f7ff;
}

.pagination .page-item.active .page-link {
    background: #3498db;
    border-color: #3498db;
    color: white;
}

.pagination .page-item.disabled .page-link {
    color: #ccc;
    cursor: not-allowed;
    pointer-events: none;
}

.pagination .page-link .pagination-text {
    margin: 0 0.25rem;
}

.pagination .page-link.ellipsis {
    border: none;
    background: transparent;
    cursor: default;
}

@media (max-width: 540px) {
    .pagination .page-link .pagination-text {
        display: none;
    }
    
    .pagination .page-item .page-link {
        min-width: 36px;
        height: 36px;
        padding: 0 0.5rem;
        font-size: 0.85rem;
    }
}

/* ============================================
   DARK MODE OVERRIDES
   ============================================ */
body.dark-mode .filter-panel {
    background-color: #1e1e2e;
    box-shadow: 2px 0 12px rgba(0,0,0,0.3);
}

body.dark-mode .filter-panel-header {
    border-bottom-color: #3a3a4a;
}

body.dark-mode .filter-panel-header h2 {
    color: #e0e0e0;
}

body.dark-mode .filter-panel-header p {
    color: #8a8a9a;
}

body.dark-mode .filter-section-title {
    color: #d0d0e0;
}

body.dark-mode .filter-search-input {
    background: #2a2a3a;
    border-color: #4a4a5a;
    color: #e0e0e0;
}

body.dark-mode .filter-search-input:focus {
    border-color: #3498db;
    background: #2a2a3a;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.15);
}

body.dark-mode .filter-search-input::placeholder {
    color: #777;
}

body.dark-mode .filter-chip {
    background: #2a2a3a;
    border-color: #4a4a5a;
    color: #b0b0c0;
}

body.dark-mode .filter-chip:hover {
    border-color: #3498db;
    background: rgba(52, 152, 219, 0.15);
    color: #6bb5e8;
}

body.dark-mode .filter-chip:has(input:checked),
body.dark-mode .filter-chip.checked {
    background: linear-gradient(135deg, #3498db 0%, #2574a9 100%);
    border-color: #2574a9;
    color: white;
}

body.dark-mode .chip-count {
    background: #3a3a4a;
    color: #999;
}

body.dark-mode .show-more-btn {
    background: #2a2a3a;
    border-color: #4a4a5a;
    color: #8a8a9a;
}

body.dark-mode .show-more-btn:hover {
    background: rgba(52, 152, 219, 0.15);
    border-color: #3498db;
    color: #6bb5e8;
}

body.dark-mode .filter-option:hover {
    background: rgba(52, 152, 219, 0.1);
}

body.dark-mode .filter-option .filter-label {
    color: #c0c0d0;
}

body.dark-mode .filter-tag-chip {
    background: #2a2a3a;
    border-color: #4a4a5a;
    color: #b0b0c0;
}

body.dark-mode .filter-tag-chip:hover {
    border-color: #3498db;
    color: #6bb5e8;
    background: rgba(52, 152, 219, 0.15);
}

body.dark-mode .filter-tag-chip.active {
    background: linear-gradient(135deg, #3498db 0%, #2574a9 100%);
    border-color: #2574a9;
    color: white;
}

body.dark-mode .controls-bar {
    background: #1e1e2e;
}

body.dark-mode .search-wrap input {
    background: #2a2a3a;
    border-color: #4a4a5a;
    color: #e0e0e0;
}

body.dark-mode .sort-select {
    background: #2a2a3a;
    border-color: #4a4a5a;
    color: #e0e0e0;
}

body.dark-mode .view-toggle {
    background: #2a2a3a;
    border-color: #4a4a5a;
    color: #c0c0d0;
}

body.dark-mode .active-filters-bar {
    background: #1e1e2e;
}

body.dark-mode .filter-tag {
    background: rgba(52, 152, 219, 0.2);
    border-color: rgba(52, 152, 219, 0.4);
    color: #6bb5e8;
}

body.dark-mode .results-meta {
    color: #8a8a9a;
}

body.dark-mode .results-meta strong {
    color: #c0c0d0;
}

body.dark-mode .no-results {
    background: #2a2a3a;
    color: #b0b0c0;
}

body.dark-mode .no-results .hint {
    color: #777;
}

body.dark-mode .pagination .page-item .page-link {
    background: #2a2a3a;
    border-color: #4a4a5a;
    color: #b0b0c0;
}

body.dark-mode .pagination .page-item .page-link:hover {
    border-color: #3498db;
    color: #3498db;
    background: rgba(52, 152, 219, 0.1);
}

body.dark-mode .pagination .page-item.active .page-link {
    background: #3498db;
    border-color: #3498db;
    color: white;
}

body.dark-mode .pagination .page-item.disabled .page-link {
    color: #555;
}

body.dark-mode .filter-apply-btn {
    background: linear-gradient(135deg, #3498db 0%, #2574a9 100%);
}

/* ============================================
   CONTENT CONTAINMENT & LAYOUT FIXES
   ============================================ */

/* Ensure content area properly contains all children */
.content-area {
    display: flex;
    flex-direction: column;
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
}

/* Ensure tools grid doesn't overflow */
.cards-grid,
.tools-grid,
#toolsGrid {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    contain: layout style;
}

/* Ensure pagination stays within content bounds */
.pagination-wrapper {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: visible;
    contain: layout;
}

/* Extra scrollbar customization for filter grids */
.filter-chips-grid::-webkit-scrollbar,
.filter-tags-grid::-webkit-scrollbar {
    width: 4px;
}

.filter-chips-grid::-webkit-scrollbar-track,
.filter-tags-grid::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 4px;
}

.filter-chips-grid::-webkit-scrollbar-thumb,
.filter-tags-grid::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

.filter-chips-grid::-webkit-scrollbar-thumb:hover,
.filter-tags-grid::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}

body.dark-mode .filter-chips-grid::-webkit-scrollbar-track,
body.dark-mode .filter-tags-grid::-webkit-scrollbar-track {
    background: #2a2a3a;
}

body.dark-mode .filter-chips-grid::-webkit-scrollbar-thumb,
body.dark-mode .filter-tags-grid::-webkit-scrollbar-thumb {
    background: #4a4a5a;
}

/* Tools list section containment */
.tools-list-section {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* Prevent flex items from overflowing */
.main-layout > * {
    min-width: 0;
}

/* Active filters bar sizing */
.active-filters-bar {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* Controls bar sizing */
.controls-bar {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* ============================================
   MOBILE TITLE BAR WITH FILTER TOGGLE
   ============================================ */
.mobile-title-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.mobile-title-bar .section-title {
    text-align: left;
    font-size: 1.8rem;
    font-weight: 800;
    margin: 0;
}

.mobile-filter-btn {
    display: none;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.3);
    transition: all 0.2s ease;
}

.mobile-filter-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.4);
}

.mobile-filter-btn:active {
    transform: scale(0.98);
}

.mobile-filter-btn svg {
    width: 18px;
    height: 18px;
}

/* Desktop: center the title, hide mobile filter button */
@media (min-width: 769px) {
    .mobile-title-bar {
        justify-content: center;
    }
    
    .mobile-title-bar .section-title {
        text-align: center;
    }
    
    .mobile-filter-btn {
        display: none !important;
    }
}

/* Mobile: show the filter button next to title */
@media (max-width: 768px) {
    .mobile-filter-btn {
        display: flex;
    }
    
    /* Hide the fixed filter toggle when we have the inline one */
    .filter-toggle {
        display: none !important;
    }
}
