/* ========================================
   FILTER LAYOUT FIXES
   Fixed positioning and layout for filter controls
   ======================================== */

/* Hide the "Search:" and "Filter:" labels */
.rune-search-label,
.runes-filter-label {
    display: none !important;
}

/* Wrapper setup - FIXED to prevent overlap */
.runes-controls-wrapper {
    position: relative;
    margin-bottom: 24px;
    overflow: visible !important;
    display: flex;
    flex-direction: column;
    align-items: flex-start; /* Align everything to the left */
}

/* Collapse toggle button styling - FIXED */
.filter-collapse-toggle {
    /* Positioning - NO absolute positioning */
    position: relative !important;
    display: block;
    
    /* Styling */
    background: rgba(59, 130, 246, 0.2);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: #60a5fa;
    padding: 8px 16px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.3s ease;
    font-family: 'Lora', serif;
    letter-spacing: 0.02em;
    
    /* Spacing - button appears ABOVE the filter banner */
    margin-bottom: 12px !important;
    margin-left: 0 !important;
    margin-right: auto !important;
    
    width: fit-content;
    align-self: flex-start;
    z-index: 1;
}

.filter-collapse-toggle:hover {
    background: rgba(59, 130, 246, 0.3);
    border-color: rgba(59, 130, 246, 0.5);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.filter-collapse-toggle.collapsed {
    background: rgba(34, 197, 94, 0.2);
    border-color: rgba(34, 197, 94, 0.3);
    color: #4ade80;
}

.filter-collapse-toggle.collapsed:hover {
    background: rgba(34, 197, 94, 0.3);
    border-color: rgba(34, 197, 94, 0.5);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}

/* DESKTOP LAYOUT: Search left, Filters right */
@media (min-width: 769px) {
    .runes-controls {
        display: flex !important;
        flex-direction: row !important;
        justify-content: space-between !important;
        align-items: center !important;
        gap: 24px !important;
        overflow: visible !important;
    }
    
    .rune-search-wrapper {
        order: 1 !important;
        flex: 0 0 auto !important;
        margin-left: 0 !important;
    }
    
    .runes-filters-wrapper {
        order: 2 !important;
        margin-left: auto !important;
        flex: 0 0 auto !important;
    }
    
    .runes-filters-group {
        display: flex !important;
        flex-direction: row !important;
        gap: 10px !important;
    }
}

/* MOBILE LAYOUT: Filters top, Search bottom */
@media (max-width: 768px) {
    .runes-controls {
        display: flex !important;
        flex-direction: column !important;
        gap: 12px !important;
        padding: 18px !important;
        align-items: stretch !important;
    }
    
    /* Filters go FIRST (top) */
    .runes-filters-wrapper {
        order: 1 !important;
        width: 100% !important;
        margin: 0 !important;
    }
    
    .runes-filters-group {
        display: flex !important;
        flex-direction: column !important;
        gap: 10px !important;
        width: 100% !important;
    }
    
    /* Search goes SECOND (bottom) */
    .rune-search-wrapper {
        order: 2 !important;
        width: 100% !important;
        display: flex !important;
        flex-direction: column !important;
    }
    
    .rune-search-input {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
    }
    
    .runes-filter,
    .column-filter-wrapper,
    .column-filter-button {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
    }
}

/* Collapsed state animation */
.runes-controls {
    transition: max-height 0.4s ease, opacity 0.3s ease, padding 0.3s ease, margin 0.3s ease;
    max-height: 500px;
    overflow: visible;
}

.runes-controls.collapsed {
    max-height: 0 !important;
    opacity: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    pointer-events: none;
    overflow: hidden !important;
}

/* Ensure dropdown escapes properly */
.column-filter-wrapper {
    position: relative;
    z-index: 10000 !important;
}

.column-filter-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 200px;
    z-index: 99999 !important;
}

/* Only the table scrolls, not the controls */
.runes-content {
    overflow: visible !important;
}

.runes-table-container {
    overflow: auto;
}

/* Extra small mobile devices */
@media (max-width: 480px) {
    .filter-collapse-toggle {
        padding: 7px 14px !important;
        font-size: 11px !important;
    }
}

@media (max-width: 375px) {
    .filter-collapse-toggle {
        padding: 6px 12px !important;
        font-size: 10px !important;
    }
}
