/* ==============================================
   CAISSA Query Engine — Advanced Filters Panel
   ============================================== */

/* Filter Panel Container */
.qe-panel {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    margin: 0.75rem 0;
    overflow: hidden;
}

/* Toggle Header */
.qe-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 10px 14px;
    font-size: 0.82rem;
    font-weight: 600;
    color: #c0bbb5;
    background: none;
    border: none;
    cursor: pointer;
    transition: color 0.15s;
}

.qe-toggle:hover {
    color: #e8e6e3;
}

.qe-toggle-label {
    display: flex;
    align-items: center;
    gap: 6px;
}

.qe-toggle-label i {
    font-size: 0.75rem;
    color: #c9a84c;
}

.qe-toggle-chevron {
    font-size: 0.7rem;
    transition: transform 0.2s;
}

.qe-panel.expanded .qe-toggle-chevron {
    transform: rotate(180deg);
}

.qe-active-badge {
    display: none;
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 10px;
    background: rgba(201, 168, 76, 0.15);
    color: #c9a84c;
    font-weight: 700;
}

.qe-panel.has-filters .qe-active-badge {
    display: inline-block;
}

/* Filters Body (collapsed by default) */
.qe-body {
    display: none;
    padding: 0 14px 14px;
}

.qe-panel.expanded .qe-body {
    display: block;
}

/* Filter Rows */
.qe-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.qe-row:last-child {
    margin-bottom: 0;
}

.qe-label {
    font-size: 0.75rem;
    color: #8a8a8a;
    min-width: 80px;
    flex-shrink: 0;
}

/* Shared Input Styles */
.qe-select,
.qe-input {
    flex: 1;
    padding: 6px 8px;
    font-size: 0.78rem;
    color: #e8e6e3;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 5px;
    outline: none;
    transition: border-color 0.15s;
}

.qe-select:focus,
.qe-input:focus {
    border-color: rgba(201, 168, 76, 0.4);
}

.qe-select {
    appearance: none;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238a8a8a' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 10px;
    padding-right: 24px;
}

.qe-input[type="number"] {
    max-width: 80px;
    text-align: center;
}

.qe-range-sep {
    color: #555;
    font-size: 0.75rem;
}

/* Checkbox */
.qe-checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.qe-checkbox {
    width: 16px;
    height: 16px;
    accent-color: #c9a84c;
    cursor: pointer;
}

.qe-checkbox-label {
    font-size: 0.78rem;
    color: #c0bbb5;
    cursor: pointer;
}

/* Material Row */
.qe-material-grid {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.qe-material-item {
    display: flex;
    align-items: center;
    gap: 2px;
    font-size: 0.75rem;
    color: #c0bbb5;
}

.qe-material-item .piece-symbol {
    font-size: 1rem;
    line-height: 1;
}

.qe-material-item .qe-input {
    width: 38px;
    padding: 4px 2px;
    text-align: center;
}

/* Actions */
.qe-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.qe-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 8px 12px;
    font-size: 0.78rem;
    font-weight: 600;
    border-radius: 6px;
    border: 1px solid;
    cursor: pointer;
    transition: all 0.15s;
}

.qe-btn.primary {
    color: #1a1e2e;
    background: #c9a84c;
    border-color: #c9a84c;
}

.qe-btn.primary:hover {
    background: #dbb856;
}

.qe-btn.secondary {
    color: #c0bbb5;
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.1);
}

.qe-btn.secondary:hover {
    color: #e8e6e3;
    background: rgba(255, 255, 255, 0.12);
}

/* Results count */
.qe-results-count {
    font-size: 0.75rem;
    color: #8a8a8a;
    text-align: center;
    padding: 6px 0;
}

.qe-results-count strong {
    color: #c9a84c;
}

/* Responsive */
@media (max-width: 480px) {
    .qe-row {
        flex-wrap: wrap;
    }

    .qe-label {
        min-width: 100%;
        margin-bottom: 2px;
    }

    .qe-material-grid {
        width: 100%;
    }
}
