/* Custom Filter Styling to match the provided design */

/* Override existing filter styles */
#mtc-filters {
    position: sticky;
    top: 80px; /* Adjust based on your header height */
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: baseline;
    background-color: white;
    padding: 28px;
    padding-top: 56px;
    scrollbar-width: thin;
    border-right: none !important;
}

/* Filter Header */
#mtc-filters h3 {
    font-size: 30px;
    font-weight: bold;
    flex-grow: 1;
    color: #4b241b;
    text-transform: uppercase;
    margin-bottom: 20px;
    border-bottom: none;
    padding-bottom: 0;
}

/* Checkbox styling for "Posledné voľné miesta" */
.mtc-filter.mtc-filter-checkbox {
    display: flex;
    flex-direction: row;
    position: relative;
    align-items: center;
    gap: 8px;
    padding: 12px 0;
}

.mtc-filter-checkbox input[type="checkbox"] {
    position: absolute;
    top: -999px;
    left: -999px;
    opacity: 0;
}

.mtc-filter-checkbox .checkbox-icon {
    width: 20px;
    height: 20px;
    cursor: pointer;
    color: #4b241b;
}

.mtc-filter-checkbox .checkbox-icon svg {
    width: 100%;
    height: 100%;
}

.mtc-filter-checkbox label {
    cursor: pointer;
    font-weight: bold;
    color: #4b241b;
    margin-bottom: 0;
}

/* Collapsible filter sections */
.mtc-filter {
    width: 100%;
    margin-bottom: 16px;
}

/* Select2 arrow hiding - only for Select2 dropdowns */
.select2-container--default .select2-selection--single .select2-selection__arrow {
    display: none !important;
}

.mtc-filter-header {
    display: flex;
    flex-direction: row;
    width: 100%;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
    padding: 2px 0;
}

.mtc-filter-header h5 {
    font-size: 24px;
    flex-grow: 1;
    font-weight: bold;
    color: #4b241b;
    margin: 0;
}

.mtc-filter-header .chevron-icon {
    width: 22px;
    height: 22px;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    color: #4b241b;
    will-change: transform;
    display: block !important;
    flex-shrink: 0;
    opacity: 1 !important;
    visibility: visible !important;
}

.mtc-filter-header .chevron-icon svg {
    width: 100%;
    height: 100%;
    display: block;
    fill: #4b241b !important;
    color: #4b241b !important;
}

.mtc-filter-header .chevron-icon svg path:first-child {
    fill: #4b241b !important;
    stroke: none !important;
}

.mtc-filter-header .chevron-icon svg path:last-child {
    fill: none !important;
    stroke: #4b241b !important;
    stroke-width: 32 !important;
}

.mtc-filter-header.collapsed .chevron-icon {
    transform: rotate(90deg);
}

/* Filter content area */
.mtc-filter-content {
    transition: height 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease;
    background-color: transparent;
    padding-top: 8px;
    overflow: hidden;
    will-change: height;
    transform: translateZ(0);
}

.mtc-filter-content.collapsed {
    height: 0px !important;
    padding-top: 0 !important;
    opacity: 0;
}

.mtc-filter-content.expanded {
    opacity: 1;
    padding-top: 8px;
}

/* Select styling to match React Select */
.mtc-filter select,
.mtc-filter input[type="text"],
.mtc-filter input[type="number"] {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: white;
    color: #4b241b;
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    transition: border-color 0.15s;
    height: 38px;
    line-height: 1.4;
    box-sizing: border-box;
}

.mtc-filter select:focus,
.mtc-filter input[type="text"]:focus,
.mtc-filter input[type="number"]:focus {
    outline: none;
    border-color: #2684ff;
    box-shadow: 0 0 0 1px #2684ff;
}

/* Custom select wrapper for better control */
.mtc-select-wrapper {
    position: relative;
}

.mtc-select-wrapper::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%) rotate(45deg);
    width: 8px;
    height: 8px;
    border-right: 2px solid #4b241b;
    border-bottom: 2px solid #4b241b;
    pointer-events: none;
}

.mtc-select-wrapper select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding-right: 32px;
    background-image: none;
}

/* Hide chevron for Charakteristika select */
.mtc-select-wrapper:has(#mtc-feature-select)::after {
    display: none !important;
}

/* Price range inputs */
.mtc-filter-price-range {
    display: flex;
    gap: 10px;
}

.mtc-filter-price-range > div {
    flex: 1;
}

.mtc-filter-price-range label {
    font-size: 12px;
    color: #4b241b;
    font-weight: normal;
    margin-bottom: 4px;
}

/* Date range filters */
.mtc-filter-date-range {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.mtc-filter-date-range > div {
    display: flex;
    flex-direction: column;
}

.mtc-filter-date-range span {
    font-size: 14px;
    color: #4b241b;
    margin-bottom: 4px;
}

/* Multiple select styling */
select[multiple] {
    min-height: 100px;
    padding: 8px;
}

/* Sort filter - always expanded, not collapsible */
.mtc-filter-header-static {
    display: flex;
    flex-direction: row;
    width: 100%;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    pointer-events: none; /* Disable clicking */
}

.mtc-filter-header-static h5 {
    font-size: 24px;
    flex-grow: 1;
    font-weight: bold;
    color: #4b241b;
    margin: 0;
}

.mtc-filter-header-static .chevron-icon {
    width: 22px;
    height: 22px;
    color: #4b241b;
    transform: rotate(0deg); /* Always pointing down */
}

.mtc-filter-content-static {
    background-color: transparent;
    padding-top: 8px;
    height: auto;
}

/* Mobile responsive */
@media (max-width: 960px) {
    #mtc-filters {
        position: relative;
        top: auto;
        height: auto;
        max-height: none;
        padding: 20px;
        padding-top: 40px;
    }
    
    #mtc-filters h3 {
        font-size: 24px;
    }
    
    .mtc-filter-header h5 {
        font-size: 20px;
    }

    .mtc-filter {
        width: 100% !important;
    }
}

/* Select2 override styles if Select2 is loaded */
.select2-container--default .select2-selection--single {
    height: 38px !important; /* Match regular input height */
    padding: 0 !important;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: white;
    display: flex;
    align-items: center;
}

.select2-selection.select2-selection--single.select2-selection--clearable button.select2-selection__clear {
    display: none;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    color: #4b241b;
    padding: 8px 32px 8px 12px !important; /* Same as regular inputs with space for arrow */
    line-height: 1.4;
    font-size: 14px;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 36px; /* Match container height minus borders */
    right: 8px;
    top: 1px;
}

/* Duplicate rule removed - already handled above */

/* Removed custom Select2 arrow */

.select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: #999;
}

/* Dropdown styling */
.select2-dropdown {
    border: 1px solid #ccc;
    border-radius: 4px;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: #deebff;
    color: #0052cc;
}

/* Error message styling */
.mtc-filter .error-message {
    color: #e74c3c;
    font-size: 12px;
    font-weight: bold;
    margin-top: 4px;
    visibility: hidden;
}

.mtc-filter .error-message.visible {
    visibility: visible;
}

/* Checkbox unchecked icon */
.checkbox-unchecked {
    stroke: currentColor;
    stroke-width: 20px;
    fill: none;
}

/* Checkbox checked icon */
.checkbox-checked {
    fill: #4b241b;
}

/* Search input styling */
#mtc-search-text {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
}

/* Loading state */
.mtc-filter.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Smooth transitions for specific elements */
.mtc-filter input:focus,
.mtc-filter select:focus {
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.mtc-filter.loading {
    transition: opacity 0.3s ease;
}

/* Prevent layout shifts during animation */
.mtc-filter {
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* Ensure Select2 doesn't interfere with animations */
.mtc-filter-content .select2-container {
    display: block !important;
    width: 100% !important;
}

/* Loading Overlay Styles */
.mtc-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.mtc-loading-overlay.active {
    opacity: 1;
    visibility: visible;
}

.mtc-loading-spinner {
    width: 60px;
    height: 60px;
    border: 5px solid rgba(75, 36, 27, 0.1);
    border-top: 5px solid #4b241b;
    border-radius: 50%;
    animation: mtc-spin 1s linear infinite;
}

@keyframes mtc-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.mtc-loading-text {
    position: absolute;
    margin-top: 100px;
    font-size: 16px;
    color: #4b241b;
    font-weight: 500;
}