/* public/assets/css/filters.css
   Phase 5: filter form, active chips, mobile bottom-sheet drawer. */

.filter-form {
    padding: 1.1rem;
    border-radius: var(--border-radius-lg);
}

.filter-form-header {
    display: none;
    justify-content: space-between;
    align-items: center;
    margin-bottom: .75rem;
}

#filter-toggle {
    display: none;
}

.filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    background: #eef3fb;
    border: 1px solid #c9d8ef;
    color: #1d4ed8;
    border-radius: 20px;
    padding: .3rem .75rem;
    font-size: .82rem;
    font-weight: var(--font-weight-medium);
    text-decoration: none;
    transition: background .15s, border-color .15s;
}

.chip:hover {
    background: #e0eaf9;
    color: #1e40af;
    border-color: #9db9e8;
}

.chip .chip-close {
    font-weight: 700;
    font-size: .9rem;
    line-height: 1;
    opacity: .7;
}

.chip:hover .chip-close { opacity: 1; }

.chip.chip-clear {
    background: #f1f5f9;
    border-color: #d3dbe6;
    color: #475569;
}

.chip.chip-clear:hover {
    background: #e2e8f0;
    color: #1e293b;
}

/* Filter controls: group labels + evenly spaced, comfortable inputs. */
#filter-form .form-group { margin-bottom: .9rem; }
#filter-form .form-control {
    padding: .55rem .75rem;
    background: #f8fbff;
}
#filter-form .form-control:focus {
    background: var(--surface);
    border-color: var(--primary-color);
    box-shadow: var(--focus-ring);
}
#filter-form .form-group label {
    font-size: .8rem;
    letter-spacing: .01em;
    color: var(--text-light);
}

/* Apply bar: actions pinned lower with visible separation. */
#filter-form .filter-actions {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
    margin-top: .35rem;
    padding-top: .9rem;
    border-top: 1px solid var(--border-color);
}
#filter-form .filter-actions .btn { flex: 1 1 auto; min-height: 44px; }

.sort-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.results-count {
    color: var(--text-light);
    font-size: .9rem;
    margin: 0;
}

/* Pagination polish */
.pagination {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin-top: 1.5rem;
    list-style: none;
    padding: 0;
}

.pagination a,
.pagination span {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    text-decoration: none;
    color: var(--text-color);
    background: #fff;
    display: inline-block;
    transition: border-color .15s, background .15s;
}

.pagination a:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.pagination span.active {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
    font-weight: 600;
}

.pagination span.dots {
    border: none;
    background: none;
    color: var(--text-light);
}

/* Mobile bottom-sheet drawer */
@media (max-width: 600px) {
    #filter-toggle {
        display: inline-flex;
        align-items: center;
        gap: .4rem;
        min-height: 44px;
    }

    .filter-form {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1060;
        max-height: 82vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        border-radius: 16px 16px 0 0;
        padding: 1.1rem 1.1rem calc(1.5rem + env(safe-area-inset-bottom));
        margin: 0;
        background: #fff;
        box-shadow: 0 -8px 30px rgba(17, 24, 39, .22);
        transform: translateY(105%);
        transition: transform .22s ease;
    }

    /* Numeric filters stack full-width for a usable mobile sheet. */
    #filter-form .row { margin: 0; }
    #filter-form [class*="col-"] { flex: 0 0 100%; max-width: 100%; padding: 0; }

    .filter-form.filter-open {
        transform: translateY(0);
    }

    .filter-form-header {
        display: flex;
    }

    .filter-overlay {
        position: fixed;
        inset: 0;
        z-index: 1050;
        background: rgba(17, 24, 39, .45);
    }

    [data-theme="dark"] .filter-form {
        background: #1a2030;
    }
}
