/* Умный фильтр офисов - стили */
.office-filter-wrapper {
    /* max-width: 1200px;
    margin: 0 auto; */
    /* padding: 20px; */
}

/* Ошибки */
.filter-errors {
    background: #ffebee;
    border: 1px solid #f44336;
    color: #c62828;
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 4px;
}

.filter-errors .error {
    margin-bottom: 10px;
}

.filter-errors .error:last-child {
    margin-bottom: 0;
}

/* Отладочная информация */
.debug-info {
    background: #f5f5f5;
    border: 1px solid #ddd;
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 12px;
}

.debug-info details {
    margin-top: 10px;
}

.debug-info summary {
    cursor: pointer;
    font-weight: bold;
}

/* Табы */
.filter-tabs {
    display: flex;
    margin-bottom: 20px;
}

.filter-tab {
    background: #DAD8D8;
    border: 1px solid #DAD8D8;
    border-bottom: none;
    padding: 12px 24px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    border-radius: 10px;
    min-width: 200px;
    margin: 0 10px 0 0;
    font-weight: 600;
    color: #B3B1B1;
}

.filter-tab:hover {
    background: #138ECD;
    color: white;
    border-color: #138ECD;
    text-transform: uppercase;
}

.filter-tab.active {
    background: #138ECD;
    color: white;
    border-color: #138ECD;
    text-transform: uppercase;
}

/* Форма фильтра */
.office-filter-form {
    /* background: white;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); */
}

/* Группы фильтров */
.filter-group {
    margin-bottom: 15px;
    border-radius: 8px;
    position: relative;
    display: flex;
    flex-wrap: wrap;
    width: 100%;
}

.filter-group:last-of-type {
    margin-bottom: 0;
}

.filter-group-title {
    font-size: 16px;
    font-weight: 600;
    color: #495057;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #007bff;
    position: relative;
    width: 100%;
}

.filter-group-title::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 50px;
    height: 2px;
    background: #007bff;
}

/* Первая группа - основные параметры */
.filter-group-basic {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr auto;
    gap: 20px;
    align-items: start;
    background: white;
    padding: 15px 70px 15px 15px;
    border: 1px solid #ddd;
    border-radius: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.filter-group-basic .filter-group-title {
    grid-column: 1 / -1;
}

.filter-group-basic .filter-row {
    margin: 0;
}

/* Вторая группа - дополнительные параметры */
.filter-group-advanced {
    display: none !important;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    align-items: start;
    background: white;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.filter-group-advanced.active {
    display: grid !important; /* Показывается при активации */
}

.filter-group-advanced .filter-group-title {
    grid-column: 1 / -1;
}

.filter-group-advanced .filter-row {
    margin: 0;
}

.filter-group .filter-row:last-child {
    margin-bottom: 0;
}

/* Специальная стилизация для блока карты в первой группе */
.map-toggle-section {
    text-align: center;
    flex-direction: column;
    justify-content: center;
    min-height: 80px;
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    height: auto;
    border: none;
    background: #138ecd;
    padding: 10px;
    border-radius: 0 10px 10px 0;
    display: flex;
    align-items: center;
    width: 70px;
}

.map-toggle-section h4 {
    margin: 0 0 10px 0;
    font-size: 12px;
    color: #495057;
}

.map-toggle-btn {
    background: none;
    color: white;
    border: none;
    padding: 8px 11px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: block;
    background-image: url(/local/templates/office/images/maps.svg);
    background-position: center;
    background-repeat: no-repeat;
    transition: none;
}


.map-toggle-btn.active{
    background: none;    
}
.map-toggle-btn.active:before {
    content: "❌";
}

/* Переключатель для полей цены */
.price-switcher {
    position: relative;
}

.price-toggle {
    display: flex;
    /* background: #f8f9fa; */
    border-radius: 4px;
    padding: 2px;
    /* border: 1px solid #dee2e6; */
    height: 30px;
}

.price-toggle button {
    /* flex: 1; */
    padding: 0;
    border: none;
    background: transparent;
    color: #484e53;
    font-size: 11px;
    cursor: pointer;
    border-radius: 2px;
    transition: all 0.3s ease;
    margin: 0 15px 0 0;
    font-size: 14px;
    text-align: left;
}

.price-toggle button.active {
    background: none;
    color: #00b475;
    /* box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2); */
    /* text-align: left; */
    /* font-size: 14px; */
    width: auto;
}

.price-fields {
    position: relative;
}

.price-field {
    display: none;
}

.price-field.active {
    display: block;
}

.filter-row {
    margin-bottom: 20px;
}

.filter-row label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    color: #333;
}
.filter-row label > span {
    line-height: 30px;
    display: block;
    color: #969696;
}

.filter-row input,
.filter-row select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s ease;
    background-color: #f9f9f9;
    border: 1px solid #f9f9f9;
    border-radius: 9px;
    color: #999;
}

.filter-row input:focus,
.filter-row select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0,123,255,0.25);
}

/* Диапазоны */
.range-inputs {
    display: flex;
    align-items: center;
}

.range-inputs input {
    flex: 1;
}

.range-inputs span {
    color: #666;
    font-weight: 500;
}

.filter-row small {
    display: block;
    margin-top: 5px;
    color: #666;
    font-size: 10px;
}

/* Кнопки */
.filter-actions {
    display: flex;
    gap: 15px;
    margin-top: 0px;
    padding-top: 10px;
    border-top: 1px solid #eee;
    justify-content: space-between;
}

.btn-filter,
.btn-reset,
.btn-toggle-advanced {
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-filter {
    color: #ffffff;
    background: #138ECD;
    border-color: #138ECD;
    padding: 12px 30px;
}

.btn-filter:hover {
    background: #0056b3;
}

.btn-reset {
    background: none;
    border-radius: 100px;
    margin: 0;
    font-size: 17px;
    line-height: 1.43;
    text-align: left;
    color: #3C4245;
    padding: 6px 15px;
    position: relative;
    white-space: pre;
}

.btn-reset:hover {
    background: none;
}

.btn-toggle-advanced {
    background: #17a2b8;
    color: white;
    position: relative;
    padding-left: 45px;
}

.btn-toggle-advanced:hover {
    background: #138496;
}

.btn-toggle-advanced.active {
    background: #dc3545;
}

.btn-toggle-advanced.active:hover {
    background: #c82333;
}

.btn-toggle-advanced:before {
    content: "▼";
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    transition: transform 0.3s ease;
}

.btn-toggle-advanced.active:before {
    transform: translateY(-50%) rotate(180deg);
}

/* Результаты */
.filter-results {
    margin-top: 40px;
}

.results-header {
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #007bff;
}

.results-header h3 {
    margin: 0;
    color: #333;
    font-size: 18px;
}

.no-results {
    text-align: center;
    padding: 40px;
    color: #666;
    font-style: italic;
}

/* Элементы результатов */
.results-list {
    display: grid;
    gap: 20px;
}

.building-item,
.office-item {
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 20px;
    transition: box-shadow 0.3s ease;
}

.building-item:hover,
.office-item:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.building-item h4,
.office-item h4 {
    margin: 0 0 15px 0;
    color: #007bff;
    font-size: 16px;
}

.building-details,
.office-details {
    display: grid;
    gap: 8px;
}

.building-details p,
.office-details p {
    margin: 0;
    font-size: 14px;
    color: #555;
}

.building-details strong,
.office-details strong {
    color: #333;
}

/* Пагинация */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 40px;
    padding: 20px;
}

.page-link {
    display: inline-block;
    padding: 8px 12px;
    background: white;
    border: 1px solid #ddd;
    color: #007bff;
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.page-link:hover {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

.page-current {
    display: inline-block;
    padding: 16px 12px;
    background: #007bff;
    color: white;
    border: 1px solid #007bff;
    border-radius: 4px;
    font-weight: 500;
    font-size: 14px;
}

.page-info {
    margin-left: 20px;
    color: #666;
    font-size: 14px;
}

/* Адаптивность */
@media (max-width: 768px) {
    .office-filter-wrapper {
        /* padding: 10px; */
    }
    
    .office-filter-form {
        padding: 20px 0;
    }
    
    .filter-tabs {
        flex-direction: row;
    }
    
    .filter-tab {
        border-radius: 4px;
        border-bottom: 1px solid #ddd;
        margin-bottom: 5px;
        width: 100%;
        min-width: auto;
    }
    
    .filter-tab.active {
        border-bottom: 1px solid #007bff;
    }
    
    .filter-group-basic .filter-row {
        margin: 0;
        width: 100%;
    }

    /* Первая группа на мобильных - вертикально */
    .filter-group-basic {
        display: flex;
        flex-direction: column;
        gap: 5px;
        padding: 15px;
    }
    
    /* Вторая группа на мобильных - по 2 в ряд */
    .filter-group-advanced {
        display: none !important;
        grid-template-columns: 1fr 1fr;
        gap: 15px;
    }
    
    .filter-group-advanced.active {
        display: grid !important;
    }
    
    .filter-group-advanced .filter-group-title {
        grid-column: 1 / -1;
    }
    
    .range-inputs {
        gap: 5px;
        width: 100%;
    }
    
    .range-inputs span {
        display: none;
    }
    
    .filter-actions {
        flex-direction: column;
    }
    .filter-actions>div{
        display: flex;
    }
    .btn-filter {
        width: 100%;
    }
    .pagination {
        flex-wrap: wrap;
        gap: 5px;
    }
    .filter-tabs {
        margin-bottom: 0;
    }
    .page-info {
        margin-left: 0;
        margin-top: 10px;
        text-align: center;
        width: 100%;
    }
    
    .map-toggle-section {
        min-height: 50px;
        padding: 10px;
        position: relative;
        width: 100%;
        border-radius: 10px;
    }
    
    .map-toggle-btn {
        padding: 6px 10px;
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    /* На очень маленьких экранах - все поля в одну колонку */
    .filter-group-advanced {
        grid-template-columns: 1fr;
        display: none !important;
    }
    
    .filter-group-advanced.active {
        display: grid !important;
    }
}

/* Select2 стили */
.select2-dropdown{
    border: 1px solid #d1d1d1 !important;
}
.filter-group .select2-container {
    width: 100% !important;
}
.filter-group .select2-container--default .select2-selection--single {
    height: 40px!important;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.filter-group .select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 38px!important;
    padding-left: 10px;
}

.filter-group .select2-container--default .select2-selection--single .select2-selection__clear{
    height: 38px!important;
}

.filter-group .select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 38px!important;
}

.filter-group .select2-container--default .select2-selection--single {
    background-color: #f9f9f9;
    border: 1px solid #f9f9f9;
    border-radius: 9px;
}

.filter-group .select2-container--default.select2-container--focus .select2-selection--single {
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0,123,255,0.25);
}

/* Карта */
.filter-map-section {
    margin-top: 30px;
    background: white;
    /* border: 1px solid #ddd; */
    border-radius: 4px;
    overflow: hidden;
}

.filter-map-header {
    padding: 15px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.filter-map-header h4 {
    margin: 0;
    color: #333;
    font-size: 16px;
}


.filter-map-container {
    position: relative;
    display: none;
}

.filter-map-container.active {
    display: block;
}

#filterMap {
    width: 100%;
    height: 100%;
}

.map-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1000;
    background: white;
    padding: 10px;
    border-radius: 4px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.map-controls button {
    display: block;
    width: 100%;
    margin-bottom: 5px;
    padding: 6px 12px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s ease;
}

.map-controls button:last-child {
    margin-bottom: 0;
}

.map-controls button:hover {
    background: #f8f9fa;
}

.map-controls button.active {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

/* Элементы управления масштабом */
.map-zoom-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    /* margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #eee; */
}

.map-zoom-controls button {
    width: 30px !important;
    height: 30px;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
    border-radius: 50%;
}

.map-zoom-controls #mapZoomLevel {
    font-size: 14px;
    font-weight: bold;
    color: #333;
    min-width: 30px;
    text-align: center;
}

.map-zoom-controls button:hover {
    background: #e9ecef;
    transform: scale(1.05);
}

/* Дополнительные элементы управления рисованием */
.map-draw-controls {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #eee;
}

.map-draw-controls button {
    width: 100% !important;
    margin-bottom: 5px;
    padding: 8px 12px;
    font-size: 11px;
    border-radius: 3px !important;
    text-align: left;
}

.map-draw-controls button:last-child {
    margin-bottom: 0;
}

.map-draw-controls button:disabled {
    background: #f8f9fa !important;
    color: #6c757d !important;
    border-color: #dee2e6 !important;
    cursor: not-allowed !important;
    opacity: 0.6;
}

.map-draw-controls button:disabled:hover {
    background: #f8f9fa !important;
    transform: none !important;
}

.map-selection-info {
    position: absolute;
    bottom: 10px;
    left: 10px;
    right: 10px;
    z-index: 1000;
    background: white;
    padding: 10px;
    border-radius: 4px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    display: none;
    font-size: 12px;
}

.map-selection-info.active {
    display: block;
}

.map-info-details {
    margin: 5px 0;
    color: #666;
    font-size: 12px;
}

.map-info-details small {
    display: block;
}

.map-selection-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.map-selection-actions button {
    flex: 1;
    padding: 8px 12px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s ease;
}

.btn-apply-selection {
    background: #28a745;
    color: white;
}

.btn-apply-selection:hover {
    background: #1e7e34;
}

.btn-clear-selection {
    background: #dc3545;
    color: white;
}

.btn-clear-selection:hover {
    background: #c82333;
}

.map-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 999;
    background: white;
    padding: 20px;
    border-radius: 4px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    text-align: center;
}

.map-loading.hidden {
    display: none;
}

/* Старые стили для совместимости */
.building-list-green {
    background: #e6f9e6;
    border: 2px solid #4caf50;
    border-radius: 8px;
    padding: 18px 20px 10px 20px;
    margin: 20px 0;
    box-shadow: 0 2px 8px #4caf5022;
}

.building-list-green h3 {
    color: #218838;
    margin-top: 0;
}

.building-list-green ul {
    list-style: disc inside;
}

.building-list-green li {
    margin-bottom: 8px;
    color: #155724;
    font-weight: 500;
}


/* Дополнительные стили для улучшения отображения карты */
.filter-map-container {
    position: relative;
    margin-top: 0px!important;
}

.filter-map-container #filterMap {
    width: 100%;
    height: 400px;
    border: 1px solid #ddd;
    border-radius: 8px;
    position: relative;
    z-index: 1;
}

/* Стили для элементов управления Яндекс.Карт */
.filter-map-container .ymaps-2-1-79-controls {
    z-index: 10 !important;
}

.filter-map-container .ymaps-2-1-79-controls__control {
    background: rgba(255, 255, 255, 0.9) !important;
    border: 1px solid #ccc !important;
    border-radius: 4px !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
}

.filter-map-container .ymaps-2-1-79-controls__control:hover {
    background: rgba(255, 255, 255, 1) !important;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15) !important;
}

/* Стили для кнопок масштабирования */
.filter-map-container .ymaps-2-1-79-zoom {
    background: rgba(255, 255, 255, 0.95) !important;
    border: 1px solid #ccc !important;
    border-radius: 6px !important;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1) !important;
}

.filter-map-container .ymaps-2-1-79-zoom__button {
    background: transparent !important;
    border: none !important;
    font-size: 18px !important;
    font-weight: bold !important;
    color: #333 !important;
    width: 30px !important;
    height: 30px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.filter-map-container .ymaps-2-1-79-zoom__button:hover {
    background: rgba(0, 0, 0, 0.1) !important;
    color: #000 !important;
}

/* Стили для контроля полноэкранного режима */
.filter-map-container .ymaps-2-1-79-fullscreen-control {
    background: rgba(255, 255, 255, 0.95) !important;
    border: 1px solid #ccc !important;
    border-radius: 4px !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
}

/* Стили для переключателя типов карты */
.filter-map-container .ymaps-2-1-79-type-selector {
    background: rgba(255, 255, 255, 0.95) !important;
    border: 1px solid #ccc !important;
    border-radius: 4px !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
}

/* Стили для мобильных устройств */
@media (max-width: 768px) {
    .filter-map-container #filterMap {
        height: 300px;
    }
    
    .filter-map-container .ymaps-2-1-79-zoom__button {
        width: 35px !important;
        height: 35px !important;
        font-size: 20px !important;
    }
}

/* Стили для улучшения видимости элементов управления */
.filter-map-container .ymaps-2-1-79-controls__control {
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

/* Стили для заголовка результатов и сортировки */
.results-header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
}

.results-header-content h3 {
    margin: 0;
    color: #333;
    font-size: 1.4em;
    font-weight: 600;
}

.sort-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 200px;
}

.sort-controls label {
    font-weight: 500;
    color: #555;
    white-space: nowrap;
}

.sort-select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: white;
    font-size: 14px;
    color: #333;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 180px;
}

.sort-select:hover {
    border-color: #007bff;
    box-shadow: 0 2px 4px rgba(0,123,255,0.1);
}

.sort-select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0,123,255,0.1);
}

/* Адаптивные стили для мобильных устройств */
@media (max-width: 768px) {
    .results-header-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .sort-controls {
        width: 100%;
        justify-content: space-between;
    }
    
    .sort-select {
        flex: 1;
        min-width: auto;
    }
}