
/* Mobile Accordion Styles for Filters - Optimized for Speed and Smoothness */
@media (max-width: 767px) {
    /* Hardware acceleration and performance optimizations */
    .result-right {
        height: 100vh;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1000;
        background: white;
        overflow-y: auto;
        box-sizing: border-box;
        display: none;
        /* Performance optimizations */
        will-change: transform;
        transform: translateZ(0);
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }
    
    /* Show result-right when mobile-active class is added */
    .result-right.mobile-active {
        display: block;
        animation: slideIn 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    }
    
    /* Smooth slide-in animation */
    @keyframes slideIn {
        from {
            transform: translateX(100%);
        }
        to {
            transform: translateX(0);
        }
    }
    
    /* Don't hide result-left - schools should still be visible */
    .result-left {
        display: block;
    }
    
    /* Optimized filter styling */
    .result-filters {
        border: none !important;
        box-shadow: none !important;
        /* Performance optimization */
        will-change: auto;
    }
    
    /* Optimized close button with better touch targets */
    #close_filter2 {
        background: var(--secondary-color) !important;
        color: white !important;
        border: none !important;
        padding: 16px 20px !important; /* Increased touch target */
        font-size: 16px !important;
        font-weight: 600 !important;
        border-radius: 8px !important;
        font-family: 'IBM Plex Sans Arabic', sans-serif !important;
        text-align: center !important;
        width: 100% !important;
        margin-top: 10px !important;
        margin: auto;
        cursor: pointer !important;
        transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94) !important;
        /* Performance optimization */
        will-change: transform;
        transform: translateZ(0);
        /* Better touch feedback */
        -webkit-tap-highlight-color: transparent;
        user-select: none;
    }
    
    #close_filter2:active {
        transform: scale(0.98) translateZ(0);
    }
    
    /* Optimized mobile filter close button */
    .mobile-filter-close {
        position: absolute;
        top: 15px;
        right: 15px;
        background: none;
        border: none;
        font-size: 24px;
        cursor: pointer;
        color: #666;
        z-index: 1001;
        display: none;
        /* Performance optimization */
        will-change: transform;
        transform: translateZ(0);
        /* Better touch target */
        padding: 8px;
        border-radius: 50%;
        transition: all 0.2s ease;
    }
    
    .mobile-filter-close:active {
        transform: scale(0.9) translateZ(0);
        background: rgba(0,0,0,0.1);
    }

    /* Optimized filter sections */
    .filters {
        border-bottom: 1px solid #E6E6E6;
        padding: 16px 0 8px;
        position: relative;
        /* Performance optimization */
        will-change: auto;
    }
    
    /* Remove border for curriculum filter specifically */
    .filters:has(h3:contains("curriculum")),
    .filters:has(h3:contains("المنهاج")) {
        border-bottom: none;
    }
    
    /* Alternative approach for curriculum filter */
    .filters h3:contains("curriculum"),
    .filters h3:contains("المنهاج") {
        border-bottom: none;
    }
    
    /* Remove border from curriculum filter container */
    .filters:has(h3:contains("curriculum")),
    .filters:has(h3:contains("المنهاج")) {
        border-bottom: none !important;
    }
    
    /* Remove border from curriculum filter using ID */
    .filters:has(#curriculum-filter),
    .filters:has(h3:contains("{{ __('app.curriculum') }}")) {
        border-bottom: none !important;
    }
    
    /* Target the curriculum filter container directly */
    .filters:has(h3 + #curriculum-filter) {
        border-bottom: none !important;
    }
    
    /* Simple approach: Remove border from curriculum filter */
    .filters.bd-none {
        border-bottom: none !important;
    }
    
    /* Target only curriculum filter, not price filter */
    .filters.bd-none:has(#curriculum-filter) {
        border-bottom: none !important;
    }
    
    /* Alternative: Target curriculum filter by its content */
    .filters.bd-none:has(h3:contains("curriculum")),
    .filters.bd-none:has(h3:contains("المنهاج")) {
        border-bottom: none !important;
    }
    
    /* Optimized filter headers with better touch targets */
    .filters h3 {
        font-size: 16px;
        font-weight: 600;
        margin-bottom: 0;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 12px 0; /* Increased touch target */
        /* Performance optimization */
        will-change: transform;
        transform: translateZ(0);
        transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
        /* Better touch feedback */
        -webkit-tap-highlight-color: transparent;
        user-select: none;
    }
    
    .filters h3:active {
        transform: scale(0.98) translateZ(0);
    }
    
    /* Optimized arrow with smooth rotation */
    .filters h3::after {
        content: '';
        width: 12px;
        height: 12px;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6,9 12,15 18,9'%3E%3C/polyline%3E%3C/svg%3E");
        background-size: contain;
        background-repeat: no-repeat;
        background-position: center;
        transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
        transform: rotate(0deg) translateZ(0);
        /* Performance optimization */
        will-change: transform;
    }
    
    .filters.active h3::after {
        transform: rotate(180deg) translateZ(0);
    }
    
    /* Optimized filter lists */
    .filters-list {
        flex-direction: column;
        align-items: flex-start;
        margin: 0;
        padding-top: 12px;
        /* Performance optimization */
        will-change: auto;
    }
    
    /* Show all curriculum items on mobile */
    .filters-list label.hidden {
        display: block !important;
    }
    
    /* Handle price filter (range-slider) - Ensure it displays when visible */
    .range-slider {
        padding-top: 12px;
        /* Performance optimization */
        will-change: auto;
        /* Ensure proper styling when visible */
        position: relative;
        width: 100%;
        margin: 0;
        overflow: visible;
        /* Ensure proper display when toggled */
        display: none;
    }
    

    
    /* Price filter accordion - same as other accordions */
    .filters#stages_prices .range-slider {
        display: none;
    }
    

    
    /* Optimized filter labels with better touch targets */
    .filters-list label {
        width: 100%;
        margin: 4px 0;
        padding: 12px 16px; /* Increased touch target */
        border-radius: 6px;
        background: transparent;
        cursor: pointer;
        transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
        /* Performance optimization */
        will-change: transform;
        transform: translateZ(0);
        /* Better touch feedback */
        -webkit-tap-highlight-color: transparent;
        user-select: none;
    }
    
    .filters-list label:hover {
        background: #f8f9fa;
        transform: translateX(2px) translateZ(0);
    }
    
    .filters-list label:active {
        transform: scale(0.98) translateZ(0);
    }
    
    .filters-list label.active {
        color: var(--white-color);
        background: var(--secondary-color);
        border-color: var(--secondary-color);
        transform: translateX(4px) translateZ(0);
    }
    
    /* Hide show-all links on mobile */
    .filters .show-all {
        display: none;
    }
    
    /* More filters section */
    .more-filters {
        border-top: 1px solid #E6E6E6;
        margin-top: 16px;
    }
    
    .more-filters .filters {
        border-bottom: 1px solid #E6E6E6;
    }
    
    .more-filters .filters:last-child {
        border-bottom: none;
    }
    
    /* Handle bd-none class for price filter and curriculum */
    .filters.bd-none {
        border-bottom: 1px solid #E6E6E6;
    }
    
    /* Ensure single border for curriculum section */
    .filters.bd-none:not(:last-child) {
        border-bottom: 1px solid #E6E6E6;
    }
}

/* Tablet Styles (768px to 992px) - Optimized for Speed and Smoothness */
@media (min-width: 768px) and (max-width: 992px) {
    /* Make filter part take full width and work like accordion */
    .result-right {
        display: block !important;
        position: static !important;
        height: auto !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 0 20px 0 !important;
        background: white !important;
        overflow: visible !important;
        z-index: auto !important;
        padding: 20px !important;
        box-sizing: border-box !important;
        border: 1px solid #E6E6E6 !important;
        border-radius: 8px !important;
        /* Performance optimization */
        will-change: auto;
        transform: translateZ(0);
    }
    
    /* Hide mobile-specific elements on tablet */
    .mobile-filter-close,
    #close_filter2 {
        display: none !important;
    }
    
    /* Make filters work like accordion on tablet with smooth animations */
    .filters-list,
    .range-slider {
        /* Let jQuery handle display completely */
        overflow: hidden;
        /* Performance optimization */
        will-change: auto;
        /* Hide by default on tablet */
        display: none;
        /* Ensure proper layout when visible */
        flex-direction: column;
        align-items: flex-start;
        margin: 0;
        padding-top: 12px;
    }
    

    

    

    

    

    

    
    /* Show accordion arrow on tablet */
    .filters h3::after {
        display: block;
        content: '';
        width: 12px;
        height: 12px;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6,9 12,15 18,9'%3E%3C/polyline%3E%3C/svg%3E");
        background-size: contain;
        background-repeat: no-repeat;
        background-position: center;
        transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
        transform: rotate(0deg) translateZ(0);
        /* Performance optimization */
        will-change: transform;
    }
    
    .filters.active h3::after {
        transform: rotate(180deg) translateZ(0);
    }
    
    /* Optimized filter headers */
    .filters h3 {
        cursor: pointer;
        font-size: 16px;
        font-weight: 600;
        margin-bottom: 0;
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 16px 0; /* Increased touch target */
        border-bottom: 1px solid #E6E6E6;
        transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
        /* Performance optimization */
        will-change: transform;
        transform: translateZ(0);
        /* Better touch feedback */
        -webkit-tap-highlight-color: transparent;
        user-select: none;
    }
    
    .filters h3:hover {
        background: #f8f9fa;
        padding-left: 8px;
        padding-right: 8px;
        border-radius: 6px;
        transform: translateZ(0);
    }
    
    .filters h3:active {
        transform: scale(0.98) translateZ(0);
    }
    
    /* Show all curriculum items on tablet */
    .filters-list label.hidden {
        display: block !important;
    }
    
    /* Handle price filter (range-slider) - same as mobile */
    .range-slider {
        padding-top: 12px;
        /* Performance optimization */
        will-change: auto;
        /* Ensure proper styling when visible */
        position: relative;
        width: 100%;
        margin: 0;
        overflow: visible;
        /* Ensure proper display when toggled */
        display: none;
    }
    
    /* Optimized filter labels with smooth animations */
    .filters-list label {
        width: 100%;
        margin: 4px 0;
        padding: 12px 16px; /* Increased touch target */
        border-radius: 6px;
        background: transparent;
        cursor: pointer;
        transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
        transform: translateX(0) translateZ(0);
        /* Performance optimization */
        will-change: transform;
        /* Better touch feedback */
        -webkit-tap-highlight-color: transparent;
        user-select: none;
    }
    
    .filters-list label:hover {
        background: #f8f9fa;
        transform: translateX(5px) translateZ(0);
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }
    
    .filters-list label:active {
        transform: scale(0.98) translateZ(0);
    }
    
    .filters-list label.active {
        color: var(--white-color);
        background: var(--secondary-color);
        border-color: var(--secondary-color);
        transform: translateX(8px) translateZ(0);
        box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    }
    
    /* Hide show-all links on tablet */
    .filters .show-all {
        display: none;
    }
    
    /* More filters section */
    .more-filters {
        border-top: 1px solid #E6E6E6;
        margin-top: 16px;
    }
    
    .more-filters .filters {
        border-bottom: 1px solid #E6E6E6;
    }
    
    .more-filters .filters:last-child {
        border-bottom: none;
    }
    
    /* Handle bd-none class for price filter and curriculum */
    .filters.bd-none {
        border-bottom: 1px solid #E6E6E6;
    }
    
    /* Ensure single border for curriculum section */
    .filters.bd-none:not(:last-child) {
        border-bottom: 1px solid #E6E6E6;
    }
    
    /* Ensure proper layout for tablet */
    .search-result-wrap {
        display: block !important;
    }
    
    .result-left {
        width: 100% !important;
    }
    
    /* Hide city/district search fields on tablet */
    .field-box.city_id,
    .field-box.district_id,
    .discuss-box {
        display: none !important;
    }
}

/* Desktop Styles (993px and above) - Optimized for Performance */
@media (min-width: 993px) {
    /* Performance optimizations for desktop */
    .result-right {
        /* Performance optimization */
        will-change: auto;
        transform: translateZ(0);
    }
    
    .filters h3 {
        /* Performance optimization */
        will-change: auto;
        transform: translateZ(0);
        transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    }
    
    .filters-list label {
        /* Performance optimization */
        will-change: auto;
        transform: translateZ(0);
        transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    }
    
    /* Ensure range-slider is visible on desktop */
    .range-slider {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
    
    /* Ensure range-slider handles are visible on desktop */
    .range-slider .ui-slider-handle {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
    
    /* Ensure range-slider track is visible on desktop */
    .range-slider .ui-widget-content {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
}

/* Force hide big accordion on desktop and mobile - HIGH PRIORITY */
@media (max-width: 767px), (min-width: 993px) {
    .individual-accordions {
        display: block !important;
    }
    
    .big-accordion-container {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        height: 0 !important;
        overflow: hidden !important;
        position: absolute !important;
        left: -9999px !important;
        top: -9999px !important;
        width: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        border: none !important;
        background: transparent !important;
        pointer-events: none !important;
        z-index: -9999 !important;
    }
    
    .big-accordion-content {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        height: 0 !important;
        overflow: hidden !important;
    }
    
    .big-accordion-header {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        height: 0 !important;
        overflow: hidden !important;
    }
}

/* Additional global rule to ensure big accordion is hidden on desktop/mobile */
.big-accordion-container {
    display: none !important;
}

/* Override for tablet only */
@media (min-width: 768px) and (max-width: 992px) {
    .big-accordion-container {
        display: block !important;
    }
}

/* Big Accordion Container for Tablet Mode - Only visible on tablet */
@media (min-width: 768px) and (max-width: 992px) {
    .individual-accordions {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        height: 0 !important;
        overflow: hidden !important;
        position: absolute !important;
        left: -9999px !important;
    }
    
    .big-accordion-container {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        height: auto !important;
        overflow: visible !important;
        position: relative !important;
        left: auto !important;
        border: 1px solid #E6E6E6;
        border-radius: 8px;
        margin-bottom: 20px;
        background: white;
    }

    .big-accordion-header {
        background: #f8f9fa;
        padding: 16px 20px;
        border-bottom: 1px solid #E6E6E6;
        cursor: pointer;
        transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    }

    .big-accordion-header h3 {
        margin: 0;
        font-size: 18px;
        font-weight: 600;
        color: #1F2026;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .big-accordion-header h3::after {
        content: '';
        width: 16px;
        height: 16px;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6,9 12,15 18,9'%3E%3C/polyline%3E%3C/svg%3E");
        background-size: contain;
        background-repeat: no-repeat;
        background-position: center;
        transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
        transform: rotate(0deg) translateZ(0);
    }

    .big-accordion-container.active .big-accordion-header h3::after {
        transform: rotate(180deg) translateZ(0);
    }

    .big-accordion-content {
        padding: 20px;
        background: white;
    }


}