/**
 * Filter Section Component Styles
 *
 * Provides collapsible accordion (desktop) and drawer (mobile) behavior
 * Requires design-tokens.css to be loaded for CSS variables
 */

/* ==========================================================================
   Collapsible Filter Sections
   ========================================================================== */

.filter-section-collapsible {
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-3);
    overflow: hidden;
    background: var(--bg-secondary);
}

.filter-section-header {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    background: var(--bg-tertiary);
    border: none;
    width: 100%;
    cursor: pointer;
    transition: all var(--transition-base) var(--transition-ease);
    text-align: left;
}

.filter-section-header:hover {
    background: var(--bg-hover);
}

.filter-section-header.active {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-primary);
}

.filter-section-chevron {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    transition: transform var(--transition-base) var(--transition-ease);
    color: var(--text-secondary);
}

.filter-section-header.active .filter-section-chevron {
    transform: rotate(90deg);
}

.filter-section-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    color: var(--text-primary);
}

.filter-section-title {
    font-weight: var(--font-semibold);
    font-size: var(--text-sm);
    color: var(--text-primary);
    flex-shrink: 0;
}

.filter-section-summary {
    flex: 1;
    text-align: right;
    font-size: var(--text-sm);
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.filter-section-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.filter-section-content.active {
    max-height: 2000px;
}

.filter-section-body {
    padding: var(--space-4);
}

/* ==========================================================================
   Filter Drawer (Mobile)
   ========================================================================== */

.filter-drawer-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--backdrop-medium, rgba(0, 0, 0, 0.5));
    z-index: 2000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.filter-drawer-overlay.active {
    display: block;
    opacity: 1;
}

.filter-drawer {
    position: fixed;
    top: 0;
    right: -100%;
    bottom: 0;
    width: 100%;
    height: 100vh;
    background: var(--bg-secondary);
    z-index: 2001;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-mobile-drawer, -4px 0 20px rgba(0, 0, 0, 0.3));
}

.filter-drawer.active {
    right: 0;
}

.filter-drawer-header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: var(--bg-tertiary);
    border-bottom: 2px solid var(--border-primary);
    flex-shrink: 0;
}

.filter-drawer-back {
    background: none;
    border: none;
    padding: var(--space-2);
    cursor: pointer;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
}

.filter-drawer-back svg {
    width: 20px;
    height: 20px;
}

.filter-drawer-title {
    flex: 1;
    font-weight: var(--font-semibold);
    font-size: var(--text-base);
    color: var(--text-primary);
}

.filter-drawer-done {
    background: none;
    border: none;
    padding: var(--space-2) var(--space-4);
    cursor: pointer;
    color: var(--accent-primary);
    font-weight: var(--font-semibold);
    font-size: var(--text-sm);
    min-height: 44px;
}

.filter-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-4);
    /* Smart padding: uses safe-area on iOS, fixed padding otherwise */
    padding-bottom: max(var(--space-4), env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
}

/* Prevent body scroll when drawer is open */
body.drawer-open {
    overflow: hidden;
}

/* ==========================================================================
   Responsive Behavior
   ========================================================================== */

/* Desktop: Hide drawer, show accordion */
@media (min-width: 769px) {
    .filter-drawer-overlay,
    .filter-drawer {
        display: none !important;
    }
}

/* Mobile: Disable accordion expansion (content moves to drawer) */
@media (max-width: 768px) {
    .filter-section-collapsible .filter-section-content {
        max-height: 0 !important;
    }

    /* Ensure the section header still looks clickable */
    .filter-section-header {
        border-bottom: none;
    }

    .filter-section-header.active {
        border-bottom: none;
    }
}

/* ==========================================================================
   VenueFilter Integration
   When VenueFilter is inside a FilterSection, adjust styling
   ========================================================================== */

.filter-section-body .venue-filter {
    /* Remove outer styling when inside FilterSection */
    margin-bottom: 0;
    background: transparent;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
    border: none;
}

/* Make venue list fill the drawer on mobile */
.filter-drawer-body .venue-filter {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.filter-drawer-body .venue-checkbox-list {
    max-height: none !important;
    flex: 1;
    min-height: 0;
}

.filter-section-body .venue-header-top {
    /* Ensure proper flex layout */
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-2);
}

.filter-section-body .venue-count {
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

/* ==========================================================================
   DateRangeFilter Integration
   Styles for date range picker inside FilterSection
   ========================================================================== */

.filter-section-body .date-range-filter {
    padding: 0;
}

.filter-section-body .date-range-filter .form-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.filter-section-body .date-range-filter .form-group label {
    font-weight: var(--font-semibold);
    font-size: var(--text-sm);
    color: var(--text-primary);
}

.filter-section-body .date-range-filter .form-group input[type="text"] {
    padding: var(--space-3);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    width: 100%;
}
