/**
 * Education Center Select2 Custom Styling
 *
 * Dark green theme styling for Select2 dropdowns
 *
 * @package Sylla
 * @since 1.0.0
 */

/* Select2 Container — proportional. Floor 36px (compact narrow), ceiling 50px @ 1920 (slimmed from 55).
   Visibly smaller across narrow desktops: 1280→36px, 1536→40px, 1920→50px. */
.select2-container--default .select2-selection--multiple,
.select2-container--default .select2-selection--single {
    width: 100% !important;
    background: #fff !important;
    border: 1px solid #122F2A !important;
    border-radius: 0.5rem !important;
    min-height: clamp(36px, 2.604vw, 50px) !important;
    padding: clamp(3px, 0.313vw, 6px) clamp(6px, 0.521vw, 10px) !important;
}

.select2.select2-container.select2-container--default{
    height: clamp(36px, 2.604vw, 50px) !important;
}

/* Narrow desktops (1024-1439px): tighter dropdowns to match compact sidebar */
@media (min-width: 1024px) and (max-width: 1439px) {
    .select2-container--default .select2-selection--multiple,
    .select2-container--default .select2-selection--single {
        min-height: 38px;
        padding: 4px 10px;
        font-size: 0.8125rem; /* 13px */
    }
    .select2.select2-container.select2-container--default {
        height: 38px;
    }
    .select2-container--default .select2-selection--single {
        height: 36px;
    }
    .select2-container--default .select2-selection--single .select2-selection__arrow {
        height: 34px !important;
    }
    .select2-container--default .select2-selection--single .select2-selection__arrow b {
        border-width: 8px 5px 0 5px !important;
    }
    .select2-container--default .select2-results__option {
        padding: 7px 10px;
        font-size: 0.8125rem;
    }
    .select2-selection__placeholder {
        font-size: 0.8125rem !important;
    }
    /* Compact dropdowns: reduce 5px offset that centered text in old 48-55px height boxes */
    .select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__rendered {
        top: 1px !important;
        line-height: 28px !important;
    }

    /* EC filter form: tighter rhythm */
    #education-center-filter {
        padding-top: 1.25rem;
        padding-bottom: 1.25rem;
    }
    #education-center-filter > .container > div[class*="mb-"] {
        margin-bottom: 1rem;
    }
    /* Filter question labels — smaller, lighter weight (more elegant than bold) */
    #education-center-filter label {
        font-size: 0.8125rem !important; /* 13px */
        font-weight: 600 !important;
        margin-bottom: 0.5rem !important;
    }

    /* Sidebar search input */
    .sidebar-holder input[type="search"] {
        height: 38px;
        font-size: 0.8125rem;
        padding-right: 2.75rem;
        padding-left: 0.75rem;
    }
    .sidebar-holder input[type="search"] + button svg {
        width: 18px;
        height: 18px;
    }

    /* "סינון" header row — compact icon + label */
    .sidebar-holder .border-b {
        padding: 0.625rem 0.875rem;
    }
    .sidebar-holder .border-b svg {
        width: 22px;
        height: 22px;
    }
    .sidebar-holder .border-b p.whitespace-nowrap {
        font-size: 0.8125rem;
        font-weight: 600;
    }
    .sidebar-holder .border-b button.w-8 {
        width: 1.75rem;
        height: 1.75rem;
    }
    .sidebar-holder .border-b button.w-8 svg.w-8 {
        width: 1.5rem;
        height: 1.5rem;
    }
}

.select2-container--open {
    z-index: 9999 !important;
}

/* === Proportional sidebar elements (anchored 1920, scales down to ~1280 floor) === */
/* Filter labels — override Tailwind text-base xl:text-lg with proportional clamp */
#education-center-filter label {
    font-size: clamp(13px, 0.938vw, 18px) !important;
    font-weight: 600 !important;
    margin-bottom: clamp(0.5rem, 0.521vw, 1rem) !important;
}
/* Form padding (was py-8 xl:py-12 = 32-48px fixed) — proportional */
#education-center-filter {
    padding-top: clamp(1rem, 1.302vw + 0.25rem, 2.5rem) !important;
    padding-bottom: clamp(1rem, 1.302vw + 0.25rem, 2.5rem) !important;
}
/* Margin between filter question groups (was mb-6 xl:mb-8 fixed) — proportional */
#education-center-filter > .container > div[class*="mb-"] {
    margin-bottom: clamp(0.75rem, 0.781vw + 0.25rem, 1.75rem) !important;
}
/* Sidebar search input — proportional height + font */
.sidebar-holder input[type="search"] {
    height: clamp(38px, 2.5vw, 48px);
    font-size: clamp(13px, 0.833vw, 16px);
}
/* "סינון" header label */
.sidebar-holder .border-b p.whitespace-nowrap {
    font-size: clamp(13px, 0.833vw, 16px);
    font-weight: 600;
}
/* Sidebar header svg icons — proportional */
.sidebar-holder .border-b svg {
    width: clamp(22px, 1.667vw, 32px);
    height: clamp(22px, 1.667vw, 32px);
}

.select2-container--default .select2-selection--single {
    height: clamp(34px, 2.292vw, 44px) !important;
    display: flex;
    align-items: center;
}

.select2-container--default .select2-selection--multiple .select2-selection__rendered {
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

/* Placeholder */
.select2-container--default .select2-selection__placeholder {
    color: rgba(255, 255, 255, 0.6);
}

/* Selected items (tags) */
.select2-container--default .select2-selection--multiple .select2-selection__choice {
    background-color: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 4px;
    color: white;
    padding: 4px 8px;
    margin: 0;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
    color: rgba(255, 255, 255, 0.8);
    margin-left: 6px;
    font-size: 16px;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
    color: white;
}

/* Single selection rendered text — proportional line-height matching container height */
.select2-container--default .select2-selection--single .select2-selection__rendered {
    color: white;
    padding: 0;
    line-height: clamp(20px, 1.458vw, 28px) !important;
}

/* Search field - Hidden for inline search in multiple select */
.select2-container--default .select2-search--inline {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
    position: absolute !important;
    pointer-events: none !important;
}

.select2-container--default .select2-search--inline .select2-search__field {
    color: white;
    background: transparent;
    margin: 0;
    padding: 4px 0;
    display: none !important;
    width: 0 !important;
    height: 0 !important;
    pointer-events: none !important;
}

.select2-container--default .select2-search--inline .select2-search__field::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

/* Force remove any input focus */
.select2-container--default .select2-search__field:focus {
    outline: none !important;
    border: none !important;
}

.select2-container--default .select2-search__field {
    pointer-events: none !important;
    user-select: none !important;
    -webkit-user-select: none !important;
}

/* Arrow — proportional sizing */
.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: clamp(32px, 2.188vw, 42px)!important;
    font-size: clamp(14px, 1.042vw, 20px)!important;
}

.select2-container--default .select2-selection--single .select2-selection__arrow b{
    border-width: clamp(7px, 0.573vw, 11px) clamp(5px, 0.365vw, 7px) 0 clamp(5px, 0.365vw, 7px)!important;
    border-color: #122F2A transparent transparent transparent!important;
    margin-left: clamp(5px, 0.417vw, 8px)!important;
}

.select2-container--default .select2-selection--single .select2-selection__arrow b {
    border-color: white transparent transparent transparent;
}

.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b {
    border-color: transparent transparent white transparent;
}

/* Dropdown — visually attached to the select (no gap, shared border, flat
   corners on the joining edge). Below/above variants handle either direction. */
.select2-container--default .select2-dropdown {
    background: #fff !important;
    border: 1px solid #122F2A !important;
    border-radius: 0.5rem !important;
    margin-top: 0 !important;
    z-index: 9999 !important;
}
.select2-container--default .select2-dropdown--below {
    border-top: 0 !important;
    border-top-left-radius: 0 !important;
    border-top-right-radius: 0 !important;
}
.select2-container--default .select2-dropdown--above {
    border-bottom: 0 !important;
    border-bottom-left-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
}
/* When open, drop the matching radius on the select so the seam disappears. */
.select2-container--default.select2-container--open.select2-container--below .select2-selection--single,
.select2-container--default.select2-container--open.select2-container--below .select2-selection--multiple {
    border-bottom-left-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
}
.select2-container--default.select2-container--open.select2-container--above .select2-selection--single,
.select2-container--default.select2-container--open.select2-container--above .select2-selection--multiple {
    border-top-left-radius: 0 !important;
    border-top-right-radius: 0 !important;
}
.select2-container--default .select2-results>.select2-results__options{
    width: 100% !important;
    background: #fff;
    max-height: 200px !important;
    overflow-y: auto !important;
}
/* Inner options list paints over the dropdown's rounded corners on the
   side opposite to the select; round those corners so they show through. */
.select2-container--default .select2-dropdown--below .select2-results>.select2-results__options {
    border-bottom-left-radius: 0.5rem !important;
    border-bottom-right-radius: 0.5rem !important;
}
.select2-container--default .select2-dropdown--above .select2-results>.select2-results__options {
    border-top-left-radius: 0.5rem !important;
    border-top-right-radius: 0.5rem !important;
}

/* Search in dropdown - Hidden */
.select2-container--default .select2-search--dropdown {
    display: none !important;
}

.select2-container--default .select2-search--dropdown .select2-search__field {
    background-color: #0e2521;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    color: white;
    padding: 8px 12px;
    display: none !important;
}

.select2-container--default .select2-search--dropdown .select2-search__field::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

/* Results — proportional dropdown options */
.select2-container--default .select2-results__option {
    color: #122F2A !important;
    padding: clamp(7px, 0.521vw, 10px) clamp(8px, 0.625vw, 12px);
    font-size: clamp(13px, 0.833vw, 16px);
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: #f7d016 !important;
    color: #0e2521 !important;
}

.select2-container--default .select2-results__option[aria-selected=true] {
    background-color: rgba(255, 255, 255, 0.15) !important;
}

.select2-container--default .select2-results__option:hover {
    background-color: #f7d016 !important;
    color: #0e2521 !important;
}

/* Hierarchical options (indented sub-items) */
.select2-results__option[data-level="1"] {
    padding-right: 32px;
    font-size: 0.9em;
    color: rgba(255, 255, 255, 0.9);
}

/* No results */
.select2-container--default .select2-results__option--no-results {
    color: rgba(255, 255, 255, 0.7);
}

/* Focus state */
.select2-container--default.select2-container--focus .select2-selection--multiple,
.select2-container--default.select2-container--focus .select2-selection--single {
    border-color: rgba(255, 255, 255, 0.6);
    outline: none;
}

/* RTL Support */
.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__rendered {
    text-align: right;
    position: relative;
    top: 5px;
    color: #122F2A;
}

.select2-selection__placeholder{
    color: #0E2521!important;
    font-size: clamp(13px, 0.833vw, 16px);
}

.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice {
    margin-right: 0;
    margin-left: 6px;
}

.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove {
    margin-left: 0;
    margin-right: 6px;
}

/* Clear button */
.select2-container--default .select2-selection__clear {
    color: rgba(255, 255, 255, 0.8);
    font-size: 18px;
    margin-left: 8px;
}

.select2-container--default .select2-selection__clear:hover {
    color: white;
}

/* Loading state */
.select2-container--default .select2-results__option--loading {
    color: rgba(255, 255, 255, 0.7);
}

/* Disabled state */
.select2-container--default .select2-selection--multiple[aria-disabled=true],
.select2-container--default .select2-selection--single[aria-disabled=true] {
    background-color: rgba(255, 255, 255, 0.05);
    opacity: 0.6;
    cursor: not-allowed;
}

.sidebar-holder{
    top: 100px;
}
.education-center-header{
    min-height: 546px;
}
@media (min-width: 768px) {
    .sidebar-holder{
        top: 0;
    }
}

/* ===== Results Overlay ===== */

.results-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    min-height: 100%;
    z-index: 20;
    background: #fff;
    opacity: 0;
    transform: translateY(40px);
    pointer-events: none;
    visibility: hidden;
    transition:
        opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1),
        transform 0.5s cubic-bezier(0.4, 0, 0.2, 1),
        visibility 0s linear 0.5s;
}

.results-overlay.is-visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
    visibility: visible;
    transition:
        opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1),
        transform 0.5s cubic-bezier(0.4, 0, 0.2, 1),
        visibility 0s linear 0s;
}

/* Searching state */

.results-searching-state {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    padding: 2rem;
    transition: opacity 0.3s ease;
}

.results-searching-state.is-hidden {
    opacity: 0;
    pointer-events: none;
    position: absolute;
    inset: 0;
}

.searching-content {
    text-align: center;
}

.searching-icon {
    display: inline-flex;
    color: var(--color-highlight, #00715d);
    margin-bottom: 1rem;
    animation: searchPulse 1.5s ease-in-out infinite;
}

@keyframes searchPulse {
    0%, 100% { transform: scale(1); opacity: 0.6; }
    50% { transform: scale(1.15); opacity: 1; }
}

.searching-text {
    color: var(--color-highlight, #00715d);
    font-size: 1.25rem;
    font-weight: 500;
    margin-bottom: 1rem;
}

.searching-dots {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.searching-dots span {
    width: 10px;
    height: 10px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    animation: dotBounce 1.4s ease-in-out infinite;
}

.searching-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.searching-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes dotBounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1.2); opacity: 1; }
}

/* Results content wrapper */

.results-content-wrapper {
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 0.4s ease 0.1s, transform 0.4s ease 0.1s;
}

.results-content-wrapper.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Filter-active mode: collapse the original page sections so the overlay
   sizes to its actual content instead of stretching across the full
   height set by the stripes. */
#education-center-main.is-filter-active > .education-center-header,
#education-center-main.is-filter-active > .education-center-filters,
#education-center-main.is-filter-active > .education-center-stripe,
#education-center-main.is-filter-active > .education-center-series {
    display: none;
}

#education-center-main.is-filter-active .results-overlay {
    position: relative;
    min-height: auto;
}

