/* filters.css - Complete Filter System Styles */

/* Filter Toggle Button */
.cat_filter_toggle_btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 14px 20px;
    background-color: #B0000B;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 15px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(176, 0, 11, 0.3);
}

.cat_filter_toggle_btn:hover {
    background-color: #000000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    transform: translateY(-1px);
}

.cat_filter_icon {
    flex-shrink: 0;
}

.cat_filter_btn_text {
    flex-grow: 1;
    text-align: left;
}

.cat_filter_chevron {
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.cat_filter_toggle_btn.active .cat_filter_chevron {
    transform: rotate(180deg);
}

/* Collapsible Container */
.cat_filter_container {
    background-color: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 8px;
    margin-bottom: 20px;
    overflow: hidden;
    transition: max-height 0.4s ease, opacity 0.3s ease;
}

.cat_filter_container.cat_filter_collapsed {
    max-height: 0;
    opacity: 0;
    margin-bottom: 0;
    border: none;
}

.cat_filter_container:not(.cat_filter_collapsed) {
    max-height: 2000px;
    opacity: 1;
}

/* Filter Header */
.cat_filter_header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 5px 20px 5px 20px;
    border-bottom: 2px solid #d4d4d4;
}

.cat_filter_title {
    margin: 0;
    font-size: 24px;
    color: #222;
    display: flex;
    align-items: center;
    gap: 7px;
}

.cat_filter_title_icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    color: #B0000B;
}

.cat_filter_reset_btn {
    background-color: #666;
    color: #fff;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

.cat_filter_reset_btn:hover {
    background-color: #555;
}

/* Filter Form */
.cat_filter_form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    padding: 0 20px 20px 20px;
}

.cat_filter_group {
    display: flex;
    flex-direction: column;
}

.cat_filter_label {
    font-weight: bold;
    margin-bottom: 8px;
    color: #333;
    font-size: 15px;
}

/* Checkbox Filters */
.cat_filter_checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.cat_filter_checkbox_label {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    background: #fff;
    border: 1px solid #d4d4d4;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
    user-select: none;
}

.cat_filter_checkbox_label:hover {
    background: #e8e8e8;
    border-color: #999;
}

.cat_filter_checkbox {
    margin-right: 6px;
    cursor: pointer;
}

.cat_filter_checkbox:checked + span {
    font-weight: bold;
}

.cat_filter_checkbox_label:has(.cat_filter_checkbox:checked) {
    background: #B0000B;
    color: #fff;
    border-color: #B0000B;
}

/* "All" option styling for checkboxes */
.cat_filter_checkbox_label.cat_filter_all_option {
    border: 2px solid #666;
    font-weight: bold;
}

.cat_filter_checkbox_label:has(.cat_filter_age_all:checked) {
    background: #666;
    color: #fff;
    border-color: #666;
}

/* Select Dropdowns */
.cat_filter_select {
    width: 100%;
    padding: 8px;
    border: 1px solid #d4d4d4;
    border-radius: 4px;
    font-size: 14px;
    background-color: #fff;
    cursor: pointer;
    max-height: 150px;
}

.cat_filter_select:focus {
    outline: none;
    border-color: #B0000B;
}

.cat_filter_select[multiple] {
    height: auto;
    min-height: 80px;
}

/* "All" option styling for selects */
.cat_filter_select option.cat_filter_all_option {
    background-color: #f0f0f0;
    font-weight: bold;
    border-bottom: 2px solid #d4d4d4;
    margin-bottom: 4px;
}

.cat_filter_help {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: #666;
    font-style: italic;
}

/* Action Buttons */
.cat_filter_actions {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 10px;
}

.cat_filter_apply_btn {
    background-color: #B0000B;
    color: #fff;
    border: none;
    padding: 12px 30px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: background-color 0.3s;
}

.cat_filter_apply_btn:hover {
    background-color: #8b0009;
}

.cat_filter_apply_btn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

/* Loading Indicator */
.cat_filter_loading {
    display: inline-block;
    color: #666;
    font-style: italic;
}

.cat_filter_spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid #666;
    border-top-color: transparent;
    border-radius: 50%;
    animation: cat_filter_spin 0.8s linear infinite;
}

@keyframes cat_filter_spin {
    to { transform: rotate(360deg); }
}

/* Results Container */
.cat_filter_results {
    width: 100%;
    margin-top: 20px;
}

/* Active Filter Badge */
.cat_filter_active_filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 15px 0;
    padding: 10px;
    background: #fff;
    border: 1px solid #d4d4d4;
    border-radius: 4px;
}

.cat_filter_badge {
    display: inline-flex;
    align-items: center;
    padding: 5px 10px;
    background: #B0000B;
    color: #fff;
    border-radius: 3px;
    font-size: 13px;
}

.cat_filter_badge_remove {
    margin-left: 8px;
    cursor: pointer;
    font-weight: bold;
    font-size: 16px;
    color: #fff;
    text-decoration: none;
}

.cat_filter_badge_remove:hover {
    opacity: 0.8;
}

.cat_filter_clear_all {
    padding: 5px 10px;
    background: #666;
    color: #fff;
    border-radius: 3px;
    font-size: 13px;
    text-decoration: none;
    display: inline-block;
}

.cat_filter_clear_all:hover {
    background: #555;
}

/* ============================================
   Responsive Design
   ============================================ */

@media screen and (max-width: 768px) {
    .cat_filter_container {
        padding: 0;
    }

    .cat_filter_header {
        padding: 5px 15px 5px 15px;
    }

    .cat_filter_form {
        grid-template-columns: 1fr;
        padding: 0 15px 15px 15px;
    }

    .cat_filter_title {
        font-size: 20px;
    }

    .cat_filter_checkboxes {
        gap: 8px;
    }

    .cat_filter_checkbox_label {
        padding: 5px 10px;
        font-size: 14px;
    }
}

/* Stack filter rows to single column on small screens */
@media screen and (max-width: 480px) {
    .cat_filter_apply_btn {
        width: 100%;
        padding: 10px;
    }

    .cf_filter_row {
        grid-template-columns: 1fr;
    }
}

/* Only stack header at 320px and below */
@media screen and (max-width: 320px) {
    .cat_filter_header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}

/* ============================================
   Compact Filter Overrides
   ============================================ */

/* Switch compact form from auto-fit grid to block so
   cf_filter_row divs control the two-per-row layout  */
.cat_filter_compact {
    display: block;
    gap: 0;
    padding: 0 8px 12px 8px;   /* was 0 16px 16px 16px */
}

.cat_filter_compact .cat_filter_group {
    position: static;
}

/* Hide the old label inside compact groups */
.cf_compact_group .cat_filter_label {
    display: none;
}

/* ============================================
   Two-per-row Filter Rows
   ============================================ */

/* Each row holds exactly 2 filter groups side by side */
.cf_filter_row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;                  /* was 8px */
    margin-bottom: 5px;        /* was 8px */
}

/* Prevent groups from overflowing their cell */
.cf_filter_row .cat_filter_group {
    min-width: 0;
}

/* ============================================
   Show All Filters Toggle
   ============================================ */

.cf_show_all_row {
    text-align: center;
    margin: 4px 0 8px 0;
}

.cf_show_all_link {
    font-size: 13px;
    color: #B0000B;
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
}

.cf_show_all_link:hover {
    text-decoration: underline;
}

/* Extra filters panel - shown/hidden via JS */
.cf_extra_filters {
    /* display:none set inline via JS toggle */
}

/* ============================================
   Compact Trigger Row
   ============================================ */

.cf_compact_trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 10px;          /* was 7px 10px — reduces left/right space */
    border: 1px solid #d4d4d4;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    font-size: 13px;          /* tightened from 14px */
    color: #444;
    user-select: none;
    transition: border-color 0.2s;
    min-height: 36px;
}

.cf_compact_trigger:hover {
    border-color: #B0000B;
}

/* Open state */
.cf_compact_trigger.cf_open {
    border-color: #B0000B;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.cf_trigger_text {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Active selection highlight */
.cf_compact_trigger.cf_has_selection .cf_trigger_text {
    color: #B0000B;
    font-weight: 600;
}

.cf_trigger_arrow {
    font-size: 12px;
    color: #888;
    transition: transform 0.25s ease;
    flex-shrink: 0;
    margin-left: 4px;          /* was 6px */
}

.cf_compact_trigger.cf_open .cf_trigger_arrow {
    transform: rotate(180deg);
}

/* ============================================
   Compact Options Panel
   ============================================ */

.cf_compact_options {
    display: none;
    position: static;
    left: unset;
    right: unset;
    top: unset;
    z-index: unset;
    background: #fff;
    border: 1px solid #B0000B;
    border-top: none;
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: 4px;
    max-height: 220px;
    overflow-y: auto;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    transition: max-height 0.25s ease;
}

.cf_compact_options.cf_open {
    display: block;
}

/* ============================================
   Option Labels (checkboxes inside panels)
   ============================================ */

/* Tighter padding and font so options take less horizontal space */
.cf_option_label {
    display: flex;
    align-items: center;
    gap: 0px;                  /* was 6px */
    padding: 4px 6px;          /* was 5px 10px — reduces left/right space */
    cursor: pointer;
    font-size: 13px;        /* reduced from 14px */
    transition: background 0.15s;
}

.cf_option_label:hover {
    background: #f5f5f5;
}

.cf_option_label:has(input:checked) {
    background: #fff0f0;
    color: #B0000B;
    font-weight: 600;
}

/* Slightly smaller checkboxes to save space */
.cf_option_label input[type="checkbox"] {
    accent-color: #B0000B;
    width: 14px;            /* reduced from 15px */
    height: 14px;           /* reduced from 15px */
    flex-shrink: 0;
    cursor: pointer;
}

/* ============================================
   Native Single-Select (compact dropdowns)
   ============================================ */

.cf_single_select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23888'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;  /* was right 10px */
    padding-right: 24px;                    /* was 28px */
	padding-left: 6px;                      /* explicit left padding */
    height: 36px;
    min-height: unset;
    font-size: 13px;                        /* was 14px */
    color: #444;
    cursor: pointer;
}

.cf_single_select:focus {
    border-color: #B0000B;
    outline: none;
}

/* Remove multi-select sizing in compact layout */
.cat_filter_compact .cat_filter_select[multiple] {
    min-height: unset;
    height: auto;
}