@import url('normalize.css');

.map-section {
    background-color: #1f1f1f;
    color: #fff;
    font-family: 'Manrope', 'Arial', sans-serif;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Header с заголовком и фильтрами */
.map-header {
    padding: 40px 5% 30px;
    background-color: #1f1f1f;
    text-align: center;
}

.map-header-content {
    max-width: 1400px;
    margin: 0 auto;
}

.map-title {
    font-size: 48px;
    font-weight: bold;
    margin-bottom: 24px;
}

/* Кнопка разворачивания карты (скрыта на десктопе) */
.map-expand-btn {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 50;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    font-family: 'Manrope', sans-serif;
    color: #1f1f1f;
}


.map-locations {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    justify-content: center;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    /* Скрываем скроллбар */
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.map-locations::-webkit-scrollbar {
    display: none;
}

.location-item {
    background-color: #fff;
    color: #000;
    padding: 10px 16px;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    flex-shrink: 0;
}


.location-item:hover {
    background-color: #e0e0e0;
}

.location-item.active {
    background-color: #000;
    color: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transform: translateY(-2px);
}

.location-icon {
    margin-right: 8px;
}

/* Карта на всю ширину */
.map-wrapper {
    position: relative;
    width: 100%;
    height: 600px;
}

#yandex-map {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

/* Grayscale для тайлов карты */
[class*="ymaps-2"][class*="-ground-pane"] {
    filter: grayscale(1);
}

/* Информационная карточка поверх карты */
.map-info-card {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    left: 30px;
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 40px;
    width: 400px;
    height: 400px;
    box-sizing: border-box;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    z-index: 10;
    color: #1f1f1f;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.map-info-card__title {
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 28px 0;
    color: #000;
    position: relative;
    padding-bottom: 20px;
}

.map-info-card__title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background-color: #B29668;
}

.map-info-card__address,
.map-info-card__phone {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 20px;
    font-size: 18px;
    line-height: 1.5;
    color: #333;
}

.map-info-card__address svg,
.map-info-card__phone svg {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    margin-top: 3px;
    color: #B29668;
    /* Gold color */
}

.map-info-card__phone a {
    color: #333;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s;
}

.map-info-card__phone a:hover {
    color: #000;
}

.map-info-card__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 18px 28px;
    margin-top: 28px;
    background-color: #1f1f1f;
    color: #fff;
    font-size: 18px;
    font-weight: 600;
    font-family: 'Manrope', 'Arial', sans-serif;
    text-decoration: none;
    border-radius: 30px;
    transition: color 0.3s ease;
    /* Animate text color only */
    box-sizing: border-box;
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.map-info-card__btn::before {
    content: '';
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #B29668;
    /* Gold toggle color */
    transition: top 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: -1;
}

.map-info-card__btn:hover::before {
    top: 0;
}

.map-info-card__btn:hover {
    background-color: #1f1f1f;
    /* Keep base bg same, implied by pseudo */
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.map-info-card__btn svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
}

/* Планшеты */
@media (max-width: 1100px) {
    .map-header {
        padding: 30px 20px 24px;
    }

    .map-title {
        font-size: 36px;
        margin-bottom: 20px;
    }

    .map-locations {
        gap: 10px;
    }

    .location-item {
        padding: 8px 16px;
        font-size: 13px;
    }

    .map-wrapper {
        height: 500px;
    }

    .map-info-card {
        width: 320px;
        height: 340px;
        padding: 28px;
        left: 20px;
    }

    .map-info-card__title {
        font-size: 22px;
        margin-bottom: 20px;
    }

    .map-info-card__address,
    .map-info-card__phone {
        font-size: 15px;
        margin-bottom: 14px;
        gap: 12px;
    }

    .map-info-card__address svg,
    .map-info-card__phone svg {
        width: 18px;
        height: 18px;
    }

    .map-info-card__btn {
        padding: 14px 24px;
        font-size: 15px;
        margin-top: 20px;
    }
}

/* Мобильная версия */
@media (max-width: 900px) {
    .map-header {
        padding: 30px 20px 20px;
    }

    .map-title {
        font-size: 28px;
        margin-bottom: 16px;
    }

    /* Горизонтальная прокрутка для фильтров */
    .map-locations {
        display: flex;
        flex-wrap: nowrap;
        gap: 10px;
        justify-content: flex-start;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 10px;
        margin-left: -20px;
        margin-right: -20px;
        padding-left: 20px;
        padding-right: 20px;
        -ms-overflow-style: none;
        scrollbar-width: none;
        width: auto;
        /* Позволяем растягиваться на всю ширину с учетом margin */
    }

    .map-locations::-webkit-scrollbar {
        display: none;
    }

    /* Исправление обрезания справа при скролле */
    .map-locations::after {
        content: "";
        display: block;
        min-width: 20px;
        /* Размер правого отступа */
        height: 1px;
    }

    .location-item {
        flex-shrink: 0;
        white-space: nowrap;
    }

    .map-wrapper {
        height: auto;
        display: flex;
        flex-direction: column;
        position: relative;
    }

    #yandex-map {
        position: relative;
        height: 300px;
        /* Компактная высота для мобильных */
        transition: height 0.3s ease;
        border-radius: 20px;
        margin-bottom: 20px;
    }

    .map-wrapper.expanded #yandex-map {
        height: 70vh;
        /* Развернутая высота */
    }

    .map-expand-btn {
        display: none;
        /* Показываем кнопку на мобильных */
    }

    .map-wrapper.expanded .map-expand-btn {
        top: 20px;
        transform: translateX(-50%);
        background: rgba(255, 255, 255, 0.8);
    }

    .map-info-card {
        position: relative;
        top: auto;
        left: auto;
        right: auto;
        bottom: auto;
        transform: none;
        width: 100%;
        max-width: none;
        height: auto;
        border-radius: 20px;
        margin-top: 0;
        background: #fff;
        z-index: 2;
        /* Ensure it stays above map bottom edge if overlapped */
        padding: 24px;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    }

    .map-info-card__title {
        font-size: 18px;
        margin-bottom: 14px;
    }

    .map-info-card__address,
    .map-info-card__phone {
        font-size: 14px;
        margin-bottom: 12px;
        gap: 10px;
    }

    .map-info-card__address svg,
    .map-info-card__phone svg {
        width: 16px;
        height: 16px;
    }

    .map-info-card__btn {
        padding: 12px 20px;
        font-size: 14px;
        margin-top: 16px;
    }
}

/* Маленькие мобильные */
@media (max-width: 480px) {
    .map-header {
        padding: 24px 16px 16px;
    }

    .map-title {
        font-size: 24px;
    }

    .map-locations {
        margin-left: -16px;
        margin-right: -16px;
        padding-left: 16px;
        padding-right: 16px;
    }

    .location-item {
        padding: 8px 14px;
        font-size: 12px;
    }

    .map-wrapper {
        height: 400px;
    }

    .map-info-card {
        width: auto;
        margin: 0 16px 16px;
        padding: 16px;
        border-radius: 12px;
        bottom: auto;
        left: auto;
        right: auto;
    }

    .map-info-card__title {
        font-size: 16px;
        margin-bottom: 12px;
    }

    .map-info-card__address,
    .map-info-card__phone {
        font-size: 13px;
        margin-bottom: 10px;
    }

    .map-info-card__btn {
        padding: 10px 16px;
        font-size: 13px;
        margin-top: 12px;
    }
}