/* static/css/filters.css */

/* ===== FILTER PANEL ===== */
.filter-panel {
    margin: 15px 15px 10px 15px;
    background: rgba(30, 41, 59, 0.5);
    border-radius: 10px;
    border: 1px solid rgba(99, 102, 241, 0.2);
    overflow: hidden;
    transition: all 0.3s ease;
}

.filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: rgba(30, 41, 59, 0.7);
    cursor: pointer;
    user-select: none;
    transition: all 0.3s ease;
}

.filter-header:hover {
    background: rgba(30, 41, 59, 0.85);
}

.filter-header span {
    color: #00d9ff;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.toggle-icon {
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: bold;
    transition: transform 0.3s ease;
}

.filter-content {
    display: none;
    padding: 20px;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== FILTER GRID ===== */
.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-group label {
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.filter-group select {
    padding: 10px 14px;
    background: rgba(30, 41, 59, 0.8);
    border: 2px solid rgba(99, 102, 241, 0.3);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    outline: none;
}

.filter-group select:hover {
    border-color: rgba(99, 102, 241, 0.5);
    background: rgba(30, 41, 59, 1);
}

.filter-group select:focus {
    border-color: rgba(99, 102, 241, 0.6);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.filter-group select option {
    background: rgba(17, 25, 40, 0.95);
    color: var(--text-primary);
    padding: 8px;
}

.filter-group select option:disabled {
    color: rgba(99, 102, 241, 0.5);
    font-style: italic;
}

.filter-group select optgroup {
    color: #00d9ff;
    font-weight: 600;
    background: rgba(30, 41, 59, 0.95);
}

/* ===== FILTER ACTIONS ===== */
.filter-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    padding-top: 10px;
    border-top: 1px solid rgba(99, 102, 241, 0.2);
}

#apply-filters {
    padding: 12px 32px;
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
    letter-spacing: 0.5px;
}

#apply-filters:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.5);
}

#apply-filters:active {
    transform: translateY(0);
}

#clear-filters {
    padding: 12px 32px;
    background: rgba(248, 113, 113, 0.2);
    border: 2px solid rgba(248, 113, 113, 0.4);
    border-radius: 8px;
    color: #fca5a5;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    letter-spacing: 0.5px;
}

#clear-filters:hover {
    background: rgba(248, 113, 113, 0.3);
    border-color: rgba(248, 113, 113, 0.6);
    color: #fecaca;
    transform: translateY(-2px);
}

#clear-filters:active {
    transform: translateY(0);
}

/* ===== ACTIVE FILTERS DISPLAY ===== */
.active-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin: 10px 15px;
    padding: 15px;
    background: rgba(30, 41, 59, 0.6);
    border-radius: 10px;
    border: 2px solid rgba(99, 102, 241, 0.3);
    border-left: 4px solid rgba(99, 102, 241, 0.6);
}

.active-filters-label {
    color: #00d9ff;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.active-filters-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    flex: 1;
}

.filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(99, 102, 241, 0.2);
    border: 2px solid rgba(99, 102, 241, 0.4);
    border-radius: 8px;
    font-size: 13px;
    transition: all 0.3s ease;
}

.filter-tag:hover {
    background: rgba(99, 102, 241, 0.25);
    border-color: rgba(99, 102, 241, 0.5);
    transform: translateY(-2px);
}

.filter-label {
    color: var(--text-secondary);
    font-weight: 600;
}

.filter-value {
    color: #c7d2fe;
    font-weight: 700;
}

.remove-filter {
    background: rgba(248, 113, 113, 0.3);
    border: none;
    border-radius: 4px;
    color: #fca5a5;
    font-size: 12px;
    font-weight: bold;
    padding: 4px 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.remove-filter:hover {
    background: rgba(248, 113, 113, 0.5);
    color: #fff;
    transform: scale(1.1);
}

.active-filters-count {
    color: #4cff4c;
    font-size: 13px;
    font-weight: 600;
    padding: 6px 12px;
    background: rgba(76, 255, 76, 0.15);
    border-radius: 6px;
    border: 1px solid rgba(76, 255, 76, 0.3);
    white-space: nowrap;
}

/* ===== FILTER BADGES ===== */
.filter-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: rgba(99, 102, 241, 0.15);
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    color: #818cf8;
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.filter-badge.active {
    background: rgba(99, 102, 241, 0.3);
    border-color: rgba(99, 102, 241, 0.5);
    color: #c7d2fe;
}

/* ===== MOBILE ACCORDION STYLE ===== */
@media (max-width: 768px) {
    .filter-panel {
        margin: 10px;
    }

    .filter-header {
        padding: 12px 15px;
    }

    .filter-header span {
        font-size: 14px;
    }

    .filter-content {
        padding: 15px;
    }

    .filter-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .filter-group label {
        font-size: 12px;
    }

    .filter-group select {
        font-size: 12px;
        padding: 9px 12px;
    }

    .filter-actions {
        flex-direction: column;
        gap: 8px;
    }

    #apply-filters,
    #clear-filters {
        width: 100%;
        padding: 10px 20px;
        font-size: 13px;
    }

    .active-filters {
        margin: 10px;
        padding: 12px;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .active-filters-tags {
        width: 100%;
    }

    .filter-tag {
        font-size: 12px;
        padding: 6px 10px;
    }

    .active-filters-count {
        width: 100%;
        text-align: center;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .filter-panel {
        margin: 8px;
    }

    .filter-header {
        padding: 10px 12px;
    }

    .filter-header span {
        font-size: 13px;
    }

    .filter-content {
        padding: 12px;
    }

    .filter-grid {
        gap: 10px;
    }

    .filter-group select {
        font-size: 11px;
        padding: 8px 10px;
    }

    .filter-tag {
        font-size: 11px;
        padding: 5px 8px;
    }

    .remove-filter {
        font-size: 11px;
        padding: 3px 6px;
    }
}

/* ===== FILTER TOOLTIP ===== */
.filter-tooltip {
    position: relative;
    display: inline-block;
}

.filter-tooltip .tooltip-text {
    visibility: hidden;
    width: 200px;
    background: rgba(17, 25, 40, 0.95);
    color: var(--text-primary);
    text-align: center;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 12px;
    position: absolute;
    z-index: 1001;
    bottom: 125%;
    left: 50%;
    margin-left: -100px;
    opacity: 0;
    transition: opacity 0.3s;
    border: 1px solid rgba(99, 102, 241, 0.3);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.filter-tooltip:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

.filter-tooltip .tooltip-text::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: rgba(17, 25, 40, 0.95) transparent transparent transparent;
}

/* ===== FILTER ANIMATIONS ===== */
@keyframes filterPulse {
    0%, 100% {
        border-color: rgba(99, 102, 241, 0.3);
    }
    50% {
        border-color: rgba(99, 102, 241, 0.6);
    }
}

.filter-group select.has-value {
    animation: filterPulse 2s ease-in-out infinite;
}

/* ===== FILTER COUNT BADGE ===== */
.filter-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    border-radius: 10px;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    margin-left: 8px;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.4);
}

/* ===== PRESET FILTERS ===== */
.preset-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px;
    background: rgba(30, 41, 59, 0.4);
    border-radius: 8px;
    margin-bottom: 15px;
}

.preset-filter-btn {
    padding: 6px 14px;
    background: rgba(99, 102, 241, 0.15);
    border: 2px solid rgba(99, 102, 241, 0.3);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.preset-filter-btn:hover {
    background: rgba(99, 102, 241, 0.25);
    border-color: rgba(99, 102, 241, 0.5);
    color: #c7d2fe;
    transform: translateY(-2px);
}

.preset-filter-btn.active {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    border-color: #818cf8;
    color: #fff;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
}

/* ===== FILTER VALIDATION ===== */
.filter-warning {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    background: rgba(251, 191, 36, 0.15);
    border: 2px solid rgba(251, 191, 36, 0.3);
    border-left: 4px solid rgba(251, 191, 36, 0.6);
    border-radius: 8px;
    color: var(--warning-color);
    font-size: 13px;
    margin-top: 10px;
}

.filter-warning::before {
    content: '⚠️';
    font-size: 16px;
}

/* ===== SMOOTH TRANSITIONS ===== */
* {
    transition-property: background, border-color, color, transform, box-shadow;
    transition-duration: 0.3s;
    transition-timing-function: ease;
}