/**
 * Visual Filter State Indicators
 * Shows active filters with visual feedback
 */

/* ========================================
   FILTER ACTIVE STATES
   ======================================== */

/* Active filter highlighting */
.filter-active {
    border-color: #667eea !important;
    background-color: #f0f4ff !important;
    font-weight: 600 !important;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1) !important;
}

/* Filter active badge */
.filter-active-badge {
    display: inline-block;
    padding: 10px 20px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-radius: 25px;
    font-size: 0.875rem;
    font-weight: 600;
    margin: 12px 0;
    text-align: center;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    animation: fadeInScale 0.3s ease-out;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Filter indicator in search container */
#filter-indicator,
#mobile-filter-badge {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
    margin: 8px 0;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

#filter-indicator::before,
#mobile-filter-badge::before {
    content: '🔍';
    font-size: 1rem;
}

/* Filter summary panel */
.filter-summary {
    background: #f0f4ff;
    border-left: 4px solid #667eea;
    padding: 12px 16px;
    margin: 12px 0;
    border-radius: 4px;
    font-size: 0.875rem;
    color: #333;
}

.filter-summary strong {
    color: #667eea;
    font-weight: 700;
}

/* Clear filters button enhancement */
.clear-btn {
    position: relative;
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.clear-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.clear-btn:active {
    transform: translateY(0);
}

/* Pulse animation for filter changes */
@keyframes filterPulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(102, 126, 234, 0.4);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(102, 126, 234, 0);
    }
}

.filter-changed {
    animation: filterPulse 0.6s ease-out;
}

/* ========================================
   MOBILE FILTER INTERFACE INDICATORS
   ======================================== */

/* Mobile filter toggle with badge */
.mobile-filter-toggle {
    position: relative;
}

.mobile-filter-toggle .filter-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #ef4444;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.4);
}

/* Filter panel header */
.filter-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid #e5e7eb;
}

.filter-panel-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: #333;
}

.active-filters-count {
    background: #667eea;
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
}

/* Filter chips (active filters display) */
.active-filters-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 0;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #f0f4ff;
    color: #667eea;
    border: 1px solid #667eea;
    border-radius: 16px;
    font-size: 0.8125rem;
    font-weight: 600;
}

.filter-chip .remove-filter {
    cursor: pointer;
    font-weight: 700;
    margin-left: 4px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.filter-chip .remove-filter:hover {
    opacity: 1;
}

/* ========================================
   PERIOD FILTER VISUAL ENHANCEMENTS
   ======================================== */

/* Enhanced period filter display */
.period-filter-wrapper {
    background: linear-gradient(135deg, #f0f4ff, #ffffff);
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 16px;
    margin: 12px 0;
}

.period-filter-wrapper.has-active-filters {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.period-label {
    font-size: 0.875rem;
    font-weight: 700;
    color: #667eea;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.period-label::before {
    content: '📅';
    font-size: 1.125rem;
}

/* Period range display */
.period-range-display {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    padding: 12px;
    margin-top: 8px;
    font-size: 0.875rem;
    color: #666;
}

.period-range-display.active {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-color: #667eea;
    font-weight: 600;
}

/* ========================================
   SUBJECT FILTER VISUAL ENHANCEMENTS
   ======================================== */

.subject-filter-wrapper {
    position: relative;
}

.subject-filter-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.25rem;
    pointer-events: none;
}

#subject-filter {
    padding-left: 44px;
}

/* ========================================
   RESPONSIVE FILTER INDICATORS
   ======================================== */

/* Mobile (320px+) */
@media (max-width: 480px) {
    .filter-active-badge {
        width: 100%;
        text-align: center;
        display: block;
    }

    .active-filters-chips {
        justify-content: center;
    }

    .filter-summary {
        font-size: 0.8125rem;
    }
}

/* Tablet+ (768px+) */
@media (min-width: 768px) {
    #filter-indicator,
    #mobile-filter-badge {
        position: absolute;
        top: -12px;
        right: 16px;
        z-index: 10;
    }

    .filter-active-badge {
        position: sticky;
        top: 80px;
        z-index: 10;
        margin: 0 0 16px 0;
    }
}

/* Desktop (1024px+) */
@media (min-width: 1024px) {
    .filter-summary {
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .active-filters-chips {
        margin: 0;
    }
}

/* ========================================
   ACCESSIBILITY
   ======================================== */

/* Screen reader only text for filter status */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Focus indicators for filter controls */
.filter-select:focus,
#year-start-filter:focus,
#year-end-filter:focus,
#subject-filter:focus {
    outline: 3px solid #667eea;
    outline-offset: 2px;
    box-shadow: 0 0 0 5px rgba(102, 126, 234, 0.1);
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .filter-active {
        border-width: 3px !important;
    }

    .filter-active-badge,
    #filter-indicator,
    #mobile-filter-badge {
        border: 2px solid currentColor;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .filter-active-badge,
    .filter-chip,
    .clear-btn {
        animation: none;
        transition: none;
    }
}
