/**
 * Business Directory Controls Fixes
 * 
 * Consolidated fixes for business-directory-controls functionality
 */

/* ===== MAIN CONTROLS CONTAINER ===== */
.business-directory-controls {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    position: relative !important;
    display: block !important;
    overflow: visible !important;
    box-shadow: 
        0 4px 20px rgba(0, 0, 0, 0.08),
        0 1px 3px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

/* ===== CONTROLS WRAPPER ===== */
.bd-controls-wrapper {
    width: 100% !important;
    max-width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 20px !important;
    box-sizing: border-box !important;
    position: relative !important;
}

.bd-controls-wrapper::before {
    content: '' !important;
    position: absolute !important;
    top: -10px !important;
    left: -10px !important;
    right: -10px !important;
    bottom: -10px !important;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05), rgba(118, 75, 162, 0.05)) !important;
    border-radius: 16px !important;
    z-index: -1 !important;
    opacity: 0 !important;
    transition: opacity 0.3s ease !important;
}

.business-directory-controls:hover .bd-controls-wrapper::before {
    opacity: 1 !important;
}

/* ===== FILTERS ROW ===== */
.bd-filters-row {
    width: 100% !important;
    max-width: 100% !important;
    display: grid !important;
    grid-template-columns: 1fr 1fr 1fr 1fr auto !important;
    gap: 20px !important;
    align-items: start !important;
    box-sizing: border-box !important;
}

/* Special alignment for reset button */
.bd-filters-row .bd-reset-filters {
    align-self: center !important;
}

/* ===== FILTER GROUPS ===== */
.bd-filter-group {
    width: 100% !important;
    max-width: 100% !important;
    min-height: 60px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 4px !important;
    box-sizing: border-box !important;
    position: relative !important;
    padding: 8px !important;
    border-radius: 8px !important;
    transition: all 0.3s ease !important;
}

.bd-filter-group:hover {
    background: rgba(255, 255, 255, 0.02) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04) !important;
}

.bd-filter-group.focused {
    background: rgba(102, 126, 234, 0.02) !important;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.08) !important;
}

/* ===== FILTER LABELS ===== */
.bd-filter-label {
    display: block !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    color: #374151 !important;
    margin-bottom: 8px !important;
    margin-top: 0 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    line-height: 1.2 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    width: 100% !important;
}

/* ===== FILTER INPUTS ===== */
.bd-filter-search,
.bd-filter-select {
    width: 100% !important;
    max-width: 100% !important;
    background: rgba(255,255,255,0.95) !important;
    border: 1px solid rgba(255,255,255,0.3) !important;
    border-radius: 12px !important;
    padding: 12px 16px !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    color: #333 !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    appearance: none !important;
    box-sizing: border-box !important;
    min-height: 44px !important;
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.06),
        0 1px 2px rgba(0, 0, 0, 0.04),
        inset 0 1px 0 rgba(255, 255, 255, 0.8) !important;
}

.bd-filter-search {
    background-image: none !important;
}

.bd-filter-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L2 4h8z'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 12px center !important;
    background-size: 12px !important;
}

/* ===== FILTER HOVER STATES ===== */
.bd-filter-select:hover,
.bd-filter-search:hover {
    background: rgba(255,255,255,1) !important;
    border-color: rgba(102,126,234,0.3) !important;
    transform: translateY(-1px) !important;
    box-shadow: 
        0 6px 20px rgba(102, 126, 234, 0.15),
        0 2px 8px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.9) !important;
}

.bd-filter-select:focus,
.bd-filter-search:focus {
    outline: none !important;
    border-color: #667eea !important;
    box-shadow: 
        0 0 0 3px rgba(102,126,234,0.1),
        0 4px 16px rgba(102, 126, 234, 0.2),
        0 2px 8px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.9) !important;
}

/* ===== RESET BUTTON ===== */
.bd-reset-filters {
    background: linear-gradient(135deg, #1059ad, #0d4a8c) !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 12px !important;
    padding: 12px 24px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    min-height: 44px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    box-shadow: 
        0 4px 12px rgba(16, 89, 173, 0.3),
        0 2px 6px rgba(13, 74, 140, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    vertical-align: middle !important;
    line-height: 1 !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
}

.bd-reset-filters:hover {
    transform: translateY(-2px) !important;
    box-shadow: 
        0 8px 25px rgba(16, 89, 173, 0.4),
        0 4px 12px rgba(13, 74, 140, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.3) !important;
}

.bd-reset-filters:active {
    transform: translateY(-1px) !important;
    box-shadow: 
        0 4px 12px rgba(16, 89, 173, 0.3),
        0 2px 6px rgba(13, 74, 140, 0.2),
        inset 0 1px 2px rgba(0, 0, 0, 0.1) !important;
}

/* ===== MOBILE RESPONSIVE ===== */
@media (max-width: 768px) {
    .business-directory-controls {
        padding: 16px !important;
        margin-bottom: 20px !important;
    }
    
    .bd-filters-row {
        display: flex !important;
        flex-direction: column !important;
        gap: 16px !important;
        grid-template-columns: none !important;
    }
    
    .bd-filter-group {
        width: 100% !important;
        min-width: 100% !important;
    }
    
    .bd-filter-search,
    .bd-filter-select {
        width: 100% !important;
        min-height: 48px !important;
        font-size: 16px !important;
        padding: 14px 16px !important;
    }
    
    .bd-reset-filters {
        width: 100% !important;
        min-height: 48px !important;
        font-size: 16px !important;
    }
}

/* ===== TOUCH DEVICE OPTIMIZATIONS ===== */
@media (hover: none) and (pointer: coarse) {
    .bd-filter-search,
    .bd-filter-select,
    .bd-reset-filters {
        min-height: 48px !important;
        font-size: 16px !important;
        -webkit-tap-highlight-color: transparent !important;
        -webkit-touch-callout: none !important;
        -webkit-user-select: none !important;
        -moz-user-select: none !important;
        -ms-user-select: none !important;
        user-select: none !important;
    }
}

/* ===== ACCESSIBILITY IMPROVEMENTS ===== */
.bd-filter-search:focus,
.bd-filter-select:focus,
.bd-reset-filters:focus {
    outline: 2px solid #667eea !important;
    outline-offset: 2px !important;
}

/* ===== ERROR STATES ===== */
.bd-filter-search.error,
.bd-filter-select.error {
    border-color: #ff6b6b !important;
    box-shadow: 
        0 0 0 3px rgba(255,107,107,0.1),
        0 2px 8px rgba(255, 107, 107, 0.15),
        0 1px 2px rgba(255, 107, 107, 0.1) !important;
}

/* ===== LOADING STATES ===== */
.bd-filter-group.loading {
    opacity: 0.6 !important;
    pointer-events: none !important;
}

.bd-filter-group.loading::after {
    content: "" !important;
    position: absolute !important;
    top: 50% !important;
    right: 16px !important;
    transform: translateY(-50%) !important;
    width: 16px !important;
    height: 16px !important;
    border: 2px solid #667eea !important;
    border-top: 2px solid transparent !important;
    border-radius: 50% !important;
    animation: spin 1s linear infinite !important;
}

@keyframes spin {
    0% { transform: translateY(-50%) rotate(0deg); }
    100% { transform: translateY(-50%) rotate(360deg); }
}

/* ===== PRINT STYLES ===== */
@media print {
    .business-directory-controls {
        display: none !important;
    }
}
