:root {
    --primary-color: #ff5a5f;
    --primary-hover: #ff3f45;
    --secondary-bg: #f8f9fa;
    --text-dark: #222222;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #fff;
    color: var(--text-dark);
}

.hover-link:hover {
    color: var(--primary-color) !important;
    text-decoration: underline !important;
}

/* --- Навигация --- */
.navbar {
    padding: 16px 0;
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.navbar-brand {
    font-weight: 800;
    color: var(--primary-color) !important;
    font-size: 1.6rem;
    letter-spacing: -0.5px;
}

.nav-link {
    font-weight: 600;
    color: #717171 !important;
    font-size: 0.95rem;
    margin: 0 10px;
    transition: color 0.2s;
}

.nav-link:hover,
.nav-link.active {
    color: var(--text-dark) !important;
}

.btn-rounded {
    border-radius: 50px;
    padding: 8px 24px;
    font-weight: 600;
    font-size: 0.9rem;
}

.btn-primary-custom {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white !important;
}

.btn-primary-custom:hover {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
}

/* Главный слайдер */
.hero-slider .carousel-item {
    height: 400px;
    background-color: #333;
    position: relative;
}

.hero-slider img {
    object-fit: cover;
    height: 100%;
    width: 100%;
    opacity: 0.8;
}

.carousel-caption {
    background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.7) 100%);
    bottom: 0;
    left: 0;
    right: 0;
    padding: 40px 20px 60px;
    text-align: left;
}

.carousel-caption h5 {
    font-size: 2.5rem;
    font-weight: 700;
}

/* Категории */
.category-card {
    transition: all 0.2s ease;
    cursor: pointer;
    border: 1px solid #eee;
    text-align: center;
    border-radius: 16px;
    background: white;
}

.category-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.08);
    border-color: transparent;
}

.category-icon {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 8px;
}

/* Секция поиска (Split View) */
.search-section {
    border-top: 1px solid #dee2e6;
    min-height: calc(100vh - 80px);
}

/* Сайдбар фильтров */
.filters-sidebar-content {
    background: #fff;
    padding: 24px 20px;
    padding-bottom: 100px; /* Добавляем отступ снизу, чтобы кнопка не перекрывалась */
}

/* На десктопе делаем сайдбар фиксированным по высоте с прокруткой */
@media (min-width: 992px) {
    .filters-sidebar-content {
        height: calc(100vh - 80px);
        overflow-y: auto;
        position: sticky;
        top: 80px;
        border-right: 1px solid #f0f0f0;
    }
}

/* В режиме offcanvas (мобилки) разрешаем скролл всему телу */
.offcanvas-body {
    overflow-y: auto;
}

.filters-sidebar-content::-webkit-scrollbar {
    width: 4px;
}

.filters-sidebar-content::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 4px;
}

/* Список карточек */
.results-list {
    padding: 20px;
    background: white;
    height: calc(100vh - 80px);
    overflow-y: auto;
    border-right: 1px solid #f0f0f0;
}

.results-list::-webkit-scrollbar {
    width: 6px;
}

.results-list::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 4px;
}

.master-card {
    border: 1px solid #f0f0f0;
    border-radius: 16px;
    /* Основное скругление карточки */
    transition: 0.2s;
    margin-bottom: 16px;
    background: white;
    overflow: hidden;
    /* Обрезаем всё, что выходит за пределы (в т.ч. углы фото) */
    transform: translateZ(0);
    /* Фикс для Safari чтобы overflow:hidden работал с border-radius */
}

.master-card:hover {
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
    border-color: transparent;
}

.master-card .row {
    align-items: center;
}

.master-img {
    height: 140px;
    width: 100%;
    object-fit: cover;
    /* border-radius убран, так как overflow:hidden у родителя обрежет углы ровно */
}

.card-body {
    padding: 12px 16px;
}

/* Карточка мастера: цены на выбранные услуги */
.selected-services-prices {
    border-top: 1px dashed #eee;
    padding-top: 8px;
}

.selected-services-prices .bg-light {
    background-color: #f8f9fa !important;
    transition: background 0.2s;
}

.selected-services-prices .bg-light:hover {
    background-color: #f1f3f5 !important;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 700;
}

.price-tag {
    font-size: 1.1rem;
    color: var(--text-dark);
    font-weight: 800;
}

/* Карта */
#map-container {
    position: sticky;
    top: 0;
    height: calc(100vh - 80px);
    width: 100%;
    z-index: 1;
}

#map {
    height: 100%;
    width: 100%;
}

.map-fullscreen {
    position: fixed !important;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9999 !important;
}

.map-toggle-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 1000;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 8px 12px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* Стили маркеров на карте */
.custom-marker-wrapper {
    background: white;
    border-radius: 24px;
    padding: 6px 14px;
    font-weight: bold;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
    font-size: 14px;
    text-align: center;
    border: 1px solid rgba(0, 0, 0, 0.05);
    width: max-content !important;
    transform: translateX(-50%);
    white-space: nowrap;
    transition: transform 0.2s, background 0.2s;
}

.custom-marker-wrapper:hover {
    transform: translateX(-50%) scale(1.1);
    background: var(--text-dark);
    color: white;
    z-index: 1000 !important;
}

.custom-marker-wrapper:hover .marker-rating i {
    color: #ffd700;
}

.marker-top-badge {
    position: absolute;
    top: -12px;
    right: -8px;
    background: var(--primary-color);
    color: white;
    font-size: 9px;
    padding: 2px 6px;
    border-radius: 6px;
    font-weight: 800;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    z-index: 10;
}

.user-location-marker {
    width: 20px;
    height: 20px;
    background-color: #4285F4;
    border: 3px solid white;
    border-radius: 50%;
    box-shadow: 0 0 0 10px rgba(66, 133, 244, 0.2);
}

/* Автоподсказки (Шторка) */
.search-dropdown-menu {
    position: absolute;
    top: calc(100% + 5px);
    /* Отступ от поля ввода */
    left: 0;
    right: 0;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    display: none;
    /* Скрыто по умолчанию */
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.search-dropdown-item {
    padding: 12px 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    color: var(--text-dark);
    text-decoration: none;
    transition: background 0.2s;
    border-bottom: 1px solid #f8f9fa;
}

.search-dropdown-item:last-child {
    border-bottom: none;
}

.search-dropdown-item:hover {
    background-color: #f8f9fa;
    color: var(--primary-color);
}

.search-dropdown-item i {
    color: #adb5bd;
    margin-right: 12px;
    font-size: 1rem;
}

.search-loader {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    z-index: 50;
    justify-content: center;
    align-items: center;
}

@media (max-width: 991px) {
    .navbar-collapse {
        background: white;
        padding: 15px;
        border-radius: 12px;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
        margin-top: 10px;
    }

    #search-block .row {
        flex-direction: column;
    }

    #map-container {
        height: 300px;
        position: relative;
        border-bottom: 1px solid #ddd;
    }

    .results-list {
        height: auto;
        padding-bottom: 60px;
    }

    .master-img {
        height: 100%;
        min-height: 120px;
    }
}