/* WP Immo Search - Modal Styles für Filter & Sortierung */

/* ==========================================================================
   DESKTOP - Icons verstecken, Modals deaktivieren
   ========================================================================== */

@media (min-width: 1025px) {
    .results-icons,
    .filter-modal-overlay,
    .filter-modal-container,
    .sorting-modal-overlay,
    .sorting-modal-container {
        display: none !important;
    }
}

/* ==========================================================================
   MOBILE - Icons anzeigen, Dropdown verstecken, Sticky Header
   ========================================================================== */

@media (max-width: 1024px) {
    /* Hide desktop controls */
    .wp-immo-search-results .results-controls {
        display: none !important;
    }

    /* Sticky header */
    .wp-immo-search-results .results-header {
        position: sticky;
        top: 0;
        z-index: 998;
        background: white;
        padding: 16px 0;
        margin-bottom: 24px;
        border-bottom: 1px solid #eee;
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        justify-content: space-between !important;
        align-items: center !important;
    }

    /* Results info - left aligned */
    .wp-immo-search-results .results-info {
        flex: 0 1 auto;
        text-align: left;
        white-space: nowrap;
    }

    /* Icon container - right aligned */
    .wp-immo-search-results .results-icons {
        flex: 0 0 auto;
        display: flex !important;
        flex-direction: row !important;
        gap: 16px !important;
        align-items: center !important;
    }

    /* Icon buttons - no background, no border */
    .wp-immo-search-results .results-icon-button {
        background: none !important;
        border: none !important;
        padding: 0 !important;
        margin: 0 !important;
        cursor: pointer !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        transition: opacity 0.2s ease !important;
    }

    .wp-immo-search-results .results-icon-button:active {
        opacity: 0.7;
    }

    /* Font Awesome Icons - larger and in CI color */
    .wp-immo-search-results .results-icon-button i {
        font-family: "Font Awesome 6 Free";
        font-weight: 900;
        font-size: 22px;
        color: var(--wp-immo-ci-color);
        display: block;
        line-height: 1;
    }
}

/* ==========================================================================
   MODAL OVERLAY
   ========================================================================== */

.filter-modal-overlay,
.sorting-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1001;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.filter-modal-overlay.active,
.sorting-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ==========================================================================
   MODAL CONTAINER - Slide-In von links
   ========================================================================== */

.filter-modal-container,
.sorting-modal-container {
    position: fixed;
    top: 0;
    left: -85%;
    width: 85%;
    max-width: 500px;
    height: 100%;
    background: white;
    z-index: 1002;
    overflow-y: auto;
    transition: left 0.3s ease;
    padding: 60px 20px 20px;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.2);
}

.filter-modal-container.active,
.sorting-modal-container.active {
    left: 0;
}

/* ==========================================================================
   MODAL HEADER
   ========================================================================== */

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: transparent;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: #333;
}

.modal-title {
    position: absolute;
    top: 20px;
    left: 20px;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

/* ==========================================================================
   SORTING MODAL CONTENT
   ========================================================================== */

.sorting-options {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.sorting-option {
    display: flex;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background 0.2s ease;
}

.sorting-option:hover {
    background: #f8f9fa;
}

.sorting-option input[type="radio"] {
    margin: 0 12px 0 0;
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.sorting-option span {
    font-size: 15px;
    color: #333;
    cursor: pointer;
}

.sorting-option input[type="radio"]:checked + span {
    font-weight: 600;
    color: var(--wp-immo-ci-color);
}

/* ==========================================================================
   FILTER MODAL CONTENT
   ========================================================================== */

#filter-modal-content {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#filter-modal-content .filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

#filter-modal-content .filter-group {
    width: 100%;
    flex-basis: 100%;
}

/* Von/Bis Felder nebeneinander (50/50) */
#filter-modal-content .filter-group[data-filter="price"],
#filter-modal-content .filter-group[data-filter="rooms"],
#filter-modal-content .filter-group[data-filter="area"] {
    width: calc(50% - 7.5px);
    flex-basis: calc(50% - 7.5px);
}

#filter-modal-content .search-button-group {
    margin-top: 5px;
    width: 100%;
    flex-basis: 100%;
}

#filter-modal-content .search-button {
    width: 100%;
    height: 50px;
    font-size: 16px;
    background: var(--wp-immo-ci-color) !important;
    border: 1px solid var(--wp-immo-ci-color) !important;
    border-radius: 0;
    color: white !important;
    font-weight: 700;
    letter-spacing: 0.5px;
    cursor: pointer;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ==========================================================================
   RESPONSIVE PADDING FÜR SEARCH RESULTS
   ========================================================================== */

/* Tablet & kleine Desktops: 50px padding */
@media (min-width: 769px) and (max-width: 1300px) {
    .wp-immo-search-filter-container,
    .wp-immo-search-results {
        padding-left: 50px;
        padding-right: 50px;
    }
}

/* Mobile: 20px padding */
@media (max-width: 768px) {
    .wp-immo-search-filter-container,
    .wp-immo-search-results {
        padding-left: 20px;
        padding-right: 20px;
    }

    .results-container,
    .results-pagination {
        padding-left: 0;
        padding-right: 0;
    }

    .filter-modal-container,
    .sorting-modal-container {
        width: 90%;
        left: -90%;
    }
}
