/**
 * Report Filters CSS - Accessibility Checker Pro
 * @version 6.0.0
 * 
 * v6.0.0 - Dark Inside redesign sync
 * v5.2.0 - Synced with homepage-v5 design (pill badges, modern borders)
 * v5.1.0 - Filter button style matched to search bar restyle v3
 * v5.0.0 - WCAG Level filter options (A/AA/AAA) with colored badges
 * v4.0.0 - Full detection filtering support
 */

/* ============================================
   FILTER BUTTON
   ============================================ */

.acp-filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 42px;
    padding: 0 16px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--acc-inner-radius, 6px);
    color: rgba(255, 255, 255, 0.5);
    font-family: var(--acc-font-body, 'DM Sans', sans-serif);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.acp-filter-btn:hover {
    border-color: rgba(255, 255, 255, 0.2);
    color: #fff;
    background: rgba(255, 255, 255, 0.06);
}

.acp-filter-btn:hover svg {
    stroke: #fff;
}

.acp-filter-btn svg {
    flex-shrink: 0;
    stroke: currentColor;
}

/* Badge */
.acp-filter-badge {
    display: inline-block;
    padding: 2px 8px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 100px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.4);
}

.acp-filter-btn:hover .acp-filter-badge {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

/* Active filters indicator */
.acp-filter-dot {
    display: none;
    position: absolute;
    top: -4px;
    right: -4px;
    width: 10px;
    height: 10px;
    background: #ef4444;
    border-radius: 50%;
    border: 2px solid rgba(26, 34, 52, 0.95);
}

.acp-filter-btn.has-active-filters .acp-filter-dot {
    display: block;
}

.acp-filter-btn.has-active-filters {
    border-color: #ef4444;
    color: #ef4444;
}

.acp-filter-btn.has-active-filters:hover {
    background: #fef2f2;
    color: #dc2626;
}

.acp-filter-btn.has-active-filters .acp-filter-badge {
    background: #fef2f2;
    color: #dc2626;
}

.acp-filter-btn.has-active-filters:hover .acp-filter-badge {
    background: #fee2e2;
    color: #dc2626;
}

/* ============================================
   RESULTS BAR
   ============================================ */

.acp-filter-results-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    margin: 16px 0;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--acc-inner-radius, 6px);
}

.acp-filter-hint {
    color: rgba(255, 255, 255, 0.4);
    font-size: 13px;
}

/* ============================================
   OVERLAY
   ============================================ */

.acp-filter-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99998;
}

.acp-filter-overlay[hidden] {
    display: none;
}

/* ============================================
   POPUP
   ============================================ */

.acp-filter-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 99999;
    width: 420px;
    max-width: 95vw;
    max-height: 90vh;
}

.acp-filter-popup[hidden] {
    display: none;
}

.acp-filter-popup-content {
    background: linear-gradient(135deg, rgba(26,34,52,0.98), rgba(15,23,42,0.98));
    border-radius: var(--acc-radius-lg, 14px);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4), 0 4px 12px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    max-height: 85vh;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

/* Header */
.acp-filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
    flex-shrink: 0;
}

.acp-filter-header strong {
    font-family: var(--acc-font-body, 'DM Sans', sans-serif);
    font-size: 15px;
    color: #fff;
}

.acp-filter-close {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    font-size: 20px;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    border-radius: var(--acc-radius-md, 10px);
}

.acp-filter-close:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

/* Body */
.acp-filter-body {
    padding: 16px;
    overflow-y: auto;
    flex: 1;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) rgba(255, 255, 255, 0.03);
}

.acp-filter-body::-webkit-scrollbar {
    width: 6px;
}

.acp-filter-body::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 3px;
}

.acp-filter-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}

.acp-filter-body::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* ============================================
   SECTIONS
   ============================================ */

.acp-filter-section {
    margin-bottom: 20px;
}

.acp-filter-section:last-child {
    margin-bottom: 0;
}

.acp-filter-section-title {
    font-size: 13px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ============================================
   SEVERITY OPTIONS
   ============================================ */

.acp-filter-severity-options {
    display: flex;
    gap: 10px;
}

.acp-filter-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    border-radius: var(--acc-radius-md, 10px);
    border: 1px solid rgba(255, 255, 255, 0.06);
    flex: 1;
    transition: all 0.2s ease;
    background: rgba(255, 255, 255, 0.03);
}

.acp-filter-option:hover {
    background: rgba(255, 255, 255, 0.06);
}

.acp-filter-critical-option {
    border-color: rgba(220, 38, 38, 0.25);
    background: rgba(220, 38, 38, 0.08);
}

.acp-filter-critical-option:hover {
    background: rgba(220, 38, 38, 0.12);
}

.acp-filter-warning-option {
    border-color: rgba(245, 158, 11, 0.25);
    background: rgba(245, 158, 11, 0.08);
}

.acp-filter-warning-option:hover {
    background: rgba(245, 158, 11, 0.12);
}

/* ============================================
   WCAG LEVEL OPTIONS
   ============================================ */

.acp-filter-level-options {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.acp-filter-level-a-option {
    border-color: rgba(239, 68, 68, 0.3);
    background: rgba(239, 68, 68, 0.1);
}

.acp-filter-level-a-option:hover {
    background: rgba(239, 68, 68, 0.15);
}

.acp-filter-level-aa-option {
    border-color: rgba(245, 158, 11, 0.3);
    background: rgba(245, 158, 11, 0.1);
}

.acp-filter-level-aa-option:hover {
    background: rgba(245, 158, 11, 0.15);
}

.acp-filter-level-aaa-option {
    border-color: rgba(59, 130, 246, 0.3);
    background: rgba(59, 130, 246, 0.1);
}

.acp-filter-level-aaa-option:hover {
    background: rgba(59, 130, 246, 0.15);
}

.acp-level-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    margin-left: auto;
}

.acp-level-badge.level-a {
    background: #d32f2f;
}

.acp-level-badge.level-aa {
    background: #f57c00;
}

.acp-level-badge.level-aaa {
    background: #1976d2;
}

.acp-filter-level-hint {
    margin-top: 6px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
    font-style: italic;
}

/* Checkbox */
.acp-filter-option input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.acp-cb-box {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.25);
    border-radius: var(--acc-radius, 4px);
    background: rgba(255, 255, 255, 0.06);
    position: relative;
    flex-shrink: 0;
}

.acp-cb-box::after {
    content: '';
    position: absolute;
    top: 1px;
    left: 5px;
    width: 5px;
    height: 9px;
    border: solid #ffffff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    opacity: 0;
}

.acp-filter-option input:checked + .acp-cb-box {
    background: var(--acc-blue, #1e5f99);
    border-color: var(--acc-blue, #1e5f99);
}

.acp-filter-option input:checked + .acp-cb-box::after {
    opacity: 1;
}

.acp-cb-label {
    font-size: 14px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.85);
}

/* ============================================
   DETECTIONS SECTION
   ============================================ */

.acp-filter-toggle-all {
    padding: 4px 10px;
    font-size: 11px;
    background: rgba(255, 255, 255, 0.08);
    border: none;
    border-radius: 100px;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    margin-left: auto;
}

.acp-filter-toggle-all:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.acp-filter-toggle-all + .acp-filter-toggle-all {
    margin-left: 4px;
}

.acp-filter-detections-scroll {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--acc-radius-md, 10px);
    background: rgba(255, 255, 255, 0.03);
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) rgba(255, 255, 255, 0.03);
}

.acp-filter-detections-scroll::-webkit-scrollbar {
    width: 6px;
}

.acp-filter-detections-scroll::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 3px;
}

.acp-filter-detections-scroll::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}

.acp-filter-detections-scroll::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Category */
.acp-filter-category {
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.acp-filter-category:last-child {
    border-bottom: none;
}

.acp-filter-category-header {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.04);
    cursor: pointer;
    user-select: none;
}

.acp-filter-category-header:hover {
    background: rgba(255, 255, 255, 0.08);
}

.acp-filter-category-name {
    font-size: 13px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.8);
}

.acp-filter-category-count {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.4);
    margin-left: 6px;
}

.acp-filter-category-items {
    padding: 6px 12px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
}

/* Detection item */
.acp-filter-detection {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    cursor: pointer;
    border-radius: 6px;
    font-size: 12px;
}

.acp-filter-detection:hover {
    background: rgba(255, 255, 255, 0.06);
}

.acp-filter-detection input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.acp-det-check {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.25);
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.06);
    position: relative;
    flex-shrink: 0;
}

.acp-det-check::after {
    content: '';
    position: absolute;
    top: 0px;
    left: 3px;
    width: 4px;
    height: 7px;
    border: solid #ffffff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    opacity: 0;
}

.acp-filter-detection input:checked + .acp-det-check {
    background: var(--acc-blue, #1e5f99);
    border-color: var(--acc-blue, #1e5f99);
}

.acp-filter-detection input:checked + .acp-det-check::after {
    opacity: 1;
}

.acp-det-name {
    color: rgba(255, 255, 255, 0.7);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.acp-filter-detection input:not(:checked) + .acp-det-check + .acp-det-name {
    color: rgba(255, 255, 255, 0.3);
    text-decoration: line-through;
}

/* ============================================
   FOOTER
   ============================================ */

.acp-filter-footer {
    padding: 12px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
    text-align: center;
    flex-shrink: 0;
}

.acp-filter-reset-btn {
    padding: 8px 18px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--acc-radius-md, 10px);
    font-family: var(--acc-font-body, 'DM Sans', sans-serif);
    font-size: 13px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.2s ease;
}

.acp-filter-reset-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.2);
}

/* ============================================
   FILTERED ELEMENTS
   ============================================ */

.issue-item.acp-filtered-out {
    display: none !important;
}

.issue-nav-box.acp-nav-hidden {
    display: none !important;
}

.category-section.acp-section-hidden {
    display: none !important;
}

/* ============================================
   MOBILE
   ============================================ */

@media (max-width: 600px) {
    .acp-filter-btn .acp-filter-btn-text {
        display: none;
    }
    
    .acp-filter-popup {
        width: calc(100vw - 20px);
        max-height: 80vh;
    }
    
    .acp-filter-severity-options {
        flex-direction: column;
    }
    
    .acp-filter-level-options {
        flex-direction: column;
    }
    
    .acp-filter-category-items {
        grid-template-columns: 1fr;
    }
    
    .acp-filter-results-bar {
        flex-direction: column;
        text-align: center;
    }
}

/* ============================================
   PRINT
   ============================================ */

@media print {
    .acp-filter-btn,
    .acp-filter-popup,
    .acp-filter-overlay,
    .acp-filter-results-bar {
        display: none !important;
    }
    
    .issue-item.acp-filtered-out {
        display: block !important;
    }
    
    .issue-nav-box.acp-nav-hidden {
        display: inline-flex !important;
    }
}
/* ============================================
   COUNTRIES GREYOUT (Oblast 7 — jurisdiction-context.js)
   Detection items inactive for current Countries
   settings appear dimmed and non-interactive.
   ============================================ */

.acp-filter-detection.acp-det-countries-disabled {
    opacity: 0.35;
    cursor: default;
    pointer-events: none;
}

.acp-filter-detection.acp-det-countries-disabled .acp-det-check {
    border-color: rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.03);
}

.acp-filter-detection.acp-det-countries-disabled .acp-det-name {
    color: rgba(255, 255, 255, 0.3);
}