/* ============================================
   Цветомания — Компонент «Магазины»
   Фирменные цвета: #A11826, #FFFFFF, #191817
   Без чёрных фонов/подложек
   ============================================ */

:root {
    --tm-red: #A11826;
    --tm-red-hover: #8a1420;
    --tm-red-light: rgba(161, 24, 38, 0.06);
    --tm-red-border: rgba(161, 24, 38, 0.15);
    --tm-dark: #191817;
    --tm-gray: #888780;
    --tm-gray-light: #B4B2A9;
    --tm-warm-bg: #FAF6F2;
    --tm-warm-bg2: #F5F0EB;
    --tm-warm-bg3: #F0EBE5;
    --tm-radius: 10px;
    --tm-radius-lg: 12px;
}

/* ===================== ОБЩИЕ ===================== */

.tm-stores,
.tm-detail {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--tm-dark);
    line-height: 1.5;
}

/* Хлебные крошки */
.tm-stores__breadcrumbs,
.tm-detail__breadcrumbs {
    font-size: 13px;
    color: var(--tm-gray);
    margin-bottom: 16px;
}
.tm-stores__breadcrumb-link,
.tm-detail__breadcrumb-link {
    color: var(--tm-red);
    text-decoration: none;
}
.tm-stores__breadcrumb-link:hover,
.tm-detail__breadcrumb-link:hover {
    text-decoration: underline;
}
.tm-stores__breadcrumb-sep,
.tm-detail__breadcrumb-sep {
    color: var(--tm-gray-light);
    margin: 0 6px;
}

/* Тег-бейдж */
.tm-stores__tag {
    display: inline-block;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 6px;
    line-height: 1.5;
}
.tm-stores__tag--cond {
    background: #FFF3E8;
    color: #BF6B1A;
}
.tm-stores__tag--24h {
    background: #E8F5E9;
    color: #2E7D32;
}
.tm-stores__tag--pickup {
    background: var(--tm-warm-bg);
    color: var(--tm-red);
}

/* Бейдж метро */
.tm-stores__metro-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--tm-red);
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    margin-right: 4px;
    vertical-align: middle;
}


/* =============== СТРАНИЦА СПИСКА =============== */

.tm-stores__header {
    margin-bottom: 20px;
}
.tm-stores__title {
    font-size: 26px;
    font-weight: 600;
    margin: 0 0 4px;
    color: var(--tm-dark);
}
.tm-stores__subtitle {
    font-size: 14px;
    color: var(--tm-gray);
    margin: 0;
}

/* Контакты внизу */
.tm-stores__contacts {
    margin-top: 24px;
    margin-bottom: 0;
}

/* Фильтр по районам */
.tm-stores__districts {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

/* Мобильный переключатель Карта / Список */
.tm-stores__mobile-toggle {
    display: none;
    gap: 0;
    margin-bottom: 12px;
    border: 1px solid var(--tm-red-border);
    border-radius: 10px;
    overflow: hidden;
}
.tm-stores__toggle-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 11px 16px;
    background: #fff;
    border: none;
    color: var(--tm-gray);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}
.tm-stores__toggle-btn.is-active {
    background: var(--tm-red);
    color: #fff;
}
.tm-stores__toggle-btn + .tm-stores__toggle-btn {
    border-left: 1px solid var(--tm-red-border);
}

@media (max-width: 1024px) {
    .tm-stores__mobile-toggle {
        display: flex;
    }
    /* По умолчанию на мобильном: список виден, карта скрыта */
    .tm-stores__main.view-list .tm-stores__map-wrap {
        display: none;
    }
    .tm-stores__main.view-list .tm-stores__sidebar {
        width: 100%;
        border-right: none;
    }
    .tm-stores__main.view-map .tm-stores__sidebar {
        display: none;
    }
    .tm-stores__main.view-map .tm-stores__map-wrap {
        display: block;
        width: 100%;
    }
}
.tm-stores__district-btn {
    font-size: 13px;
    padding: 7px 16px;
    border-radius: 24px;
    border: 1px solid var(--tm-red-border);
    background: #fff;
    color: var(--tm-gray);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.tm-stores__district-btn.is-active {
    background: var(--tm-red);
    color: #fff;
    border-color: var(--tm-red);
}
.tm-stores__district-btn:hover:not(.is-active) {
    border-color: var(--tm-red);
    color: var(--tm-red);
}

/* Основной блок: сайдбар + карта — в один экран */
.tm-stores__main {
    display: flex;
    border: 1px solid var(--tm-red-border);
    border-radius: var(--tm-radius-lg);
    overflow: hidden;
    margin-bottom: 24px;
    height: calc(100vh - 120px);
    min-height: 400px;
    max-height: 800px;
}

/* Контакты вверху */
.tm-stores__contacts {
    margin-bottom: 20px;
}

/* Сайдбар */
.tm-stores__sidebar {
    width: 380px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--tm-red-border);
    background: #fff;
}

.tm-stores__search {
    padding: 16px;
    border-bottom: 1px solid var(--tm-red-border);
}
.tm-stores__search-input {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid var(--tm-red-border);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}
.tm-stores__search-input:focus {
    border-color: var(--tm-red);
}

.tm-stores__filters {
    display: flex;
    gap: 6px;
    margin-top: 10px;
    flex-wrap: wrap;
}
.tm-stores__filter-btn {
    font-size: 12px;
    padding: 5px 12px;
    border-radius: 20px;
    border: 1px solid var(--tm-red-border);
    background: var(--tm-warm-bg);
    color: var(--tm-gray);
    cursor: pointer;
    transition: all 0.2s;
}
.tm-stores__filter-btn.is-active {
    background: var(--tm-red);
    color: #fff;
    border-color: var(--tm-red);
}
.tm-stores__filter-btn:hover:not(.is-active) {
    border-color: var(--tm-red);
    color: var(--tm-red);
}

/* Список магазинов */
.tm-stores__list {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}
.tm-stores__item {
    display: block;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(161, 24, 38, 0.06);
    color: inherit;
    transition: background 0.15s;
    border-left: 3px solid transparent;
    cursor: default;
}
.tm-stores__item:hover,
.tm-stores__item.is-active {
    background: var(--tm-red-light);
    border-left-color: var(--tm-red);
}
.tm-stores__item.is-hidden {
    display: none;
}
.tm-stores__item-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--tm-dark);
}
.tm-stores__item-address {
    font-size: 12px;
    color: var(--tm-gray);
    margin-top: 3px;
}
.tm-stores__item-tags {
    display: flex;
    gap: 4px;
    margin-top: 6px;
    flex-wrap: wrap;
}
.tm-stores__item-more {
    display: inline-block;
    margin-top: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--tm-red);
    text-decoration: none;
    transition: color 0.15s;
}
.tm-stores__item-more:hover {
    text-decoration: underline;
}

/* Карта */
.tm-stores__map-wrap {
    flex: 1;
    position: relative;
    background: var(--tm-warm-bg2);
}
.tm-stores__map {
    width: 100%;
    height: 100%;
}
.tm-stores__geo-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--tm-red);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    z-index: 10;
    transition: background 0.2s;
}
.tm-stores__geo-btn:hover {
    background: var(--tm-red-hover);
}

/* Контакты */
.tm-stores__contacts {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}
.tm-stores__contact-card {
    background: #fff;
    border: 1px solid var(--tm-red-border);
    border-radius: var(--tm-radius-lg);
    padding: 20px;
}
.tm-stores__contact-title {
    font-size: 16px;
    font-weight: 500;
    color: var(--tm-dark);
    margin-bottom: 10px;
}
.tm-stores__contact-hint {
    font-size: 13px;
    color: var(--tm-gray);
    margin-bottom: 4px;
}
.tm-stores__contact-phone {
    display: block;
    font-size: 20px;
    font-weight: 600;
    color: var(--tm-red);
    text-decoration: none;
    margin-bottom: 10px;
}
.tm-stores__contact-phone:hover {
    text-decoration: underline;
}
.tm-stores__contact-links a {
    display: block;
    font-size: 13px;
    color: var(--tm-red);
    text-decoration: none;
    margin-bottom: 2px;
}
.tm-stores__contact-links a:hover {
    text-decoration: underline;
}
.tm-stores__contact-row {
    font-size: 13px;
    margin-bottom: 8px;
}
.tm-stores__contact-row span {
    color: var(--tm-gray);
}
.tm-stores__contact-row a {
    color: var(--tm-red);
    text-decoration: none;
}

/* Форма обратной связи */
.tm-stores__feedback input,
.tm-stores__feedback textarea {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid var(--tm-red-border);
    border-radius: 8px;
    padding: 9px 12px;
    font-size: 13px;
    margin-bottom: 8px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
    resize: vertical;
}
.tm-stores__feedback input:focus,
.tm-stores__feedback textarea:focus {
    border-color: var(--tm-red);
}
.tm-stores__feedback button {
    width: 100%;
    padding: 10px;
    background: var(--tm-red);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}
.tm-stores__feedback button:hover {
    background: var(--tm-red-hover);
}


/* ============= ДЕТАЛЬНАЯ СТРАНИЦА ============= */

.tm-detail__layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 24px;
    align-items: start;
}

/* Галерея — см. стили внизу файла */

/* Инфо */
.tm-detail__title {
    font-size: 24px;
    font-weight: 600;
    margin: 0 0 6px;
    color: var(--tm-dark);
}
.tm-detail__address {
    font-size: 14px;
    color: var(--tm-gray);
    margin: 0 0 12px;
}
.tm-detail__desc {
    font-size: 14px;
    color: var(--tm-gray);
    line-height: 1.7;
    margin-bottom: 8px;
}

/* Секции */
.tm-detail__section {
    margin-bottom: 28px;
}
.tm-detail__section-title {
    font-size: 18px;
    font-weight: 500;
    margin: 0 0 12px;
    color: var(--tm-dark);
}

/* Карта в детальной */
.tm-detail__map-card {
    border-radius: var(--tm-radius-lg);
    overflow: hidden;
    background: var(--tm-warm-bg);
}
.tm-detail__map {
    height: 285px;
    background: var(--tm-warm-bg2);
}
.tm-detail__directions {
    padding: 14px 16px;
    font-size: 13px;
    color: var(--tm-gray);
    line-height: 1.6;
}
.tm-detail__metro-row {
    margin-bottom: 6px;
}
.tm-detail__how-to-find {
    margin: 6px 0 0;
}

/* Ближайшие */
.tm-detail__nearby {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}
.tm-detail__nearby-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--tm-warm-bg);
    border-radius: var(--tm-radius);
    padding: 14px;
    text-decoration: none;
    color: inherit;
    transition: background 0.15s;
}
.tm-detail__nearby-item:hover {
    background: var(--tm-warm-bg3);
}
.tm-detail__nearby-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--tm-dark);
}
.tm-detail__nearby-meta {
    font-size: 12px;
    color: var(--tm-gray);
    margin-top: 2px;
}
.tm-detail__nearby-dist {
    font-size: 12px;
    color: var(--tm-red);
    white-space: nowrap;
}

/* Правая карточка */
.tm-detail__aside {
    position: relative;
}
.tm-detail__card {
    position: sticky;
    top: 16px;
    background: #fff;
    border: 1px solid var(--tm-red-border);
    border-radius: var(--tm-radius-lg);
    padding: 20px;
}
.tm-detail__card-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}
.tm-detail__card-field {
    margin-bottom: 12px;
}
.tm-detail__card-label {
    display: block;
    font-size: 13px;
    color: var(--tm-gray);
    margin-bottom: 2px;
}
.tm-detail__card-value {
    font-size: 15px;
    color: var(--tm-dark);
}
.tm-detail__card-phone {
    font-size: 16px;
    font-weight: 600;
    color: var(--tm-red);
    text-decoration: none;
}
.tm-detail__card-phone:hover {
    text-decoration: underline;
}
.tm-detail__card-email {
    font-size: 14px;
    color: var(--tm-red);
    text-decoration: none;
}

/* Кнопки */
.tm-detail__card-actions {
    border-top: 1px solid var(--tm-red-border);
    padding-top: 14px;
    margin: 14px 0 12px;
}
.tm-detail__btn-primary {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 12px;
    background: var(--tm-red);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    margin-bottom: 8px;
    transition: background 0.2s;
}
.tm-detail__btn-primary:hover {
    background: var(--tm-red-hover);
    color: #fff;
}
.tm-detail__btn-secondary {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 10px;
    background: #fff;
    color: var(--tm-red);
    border: 1px solid var(--tm-red);
    border-radius: 8px;
    font-size: 13px;
    text-align: center;
    cursor: pointer;
    transition: background 0.2s;
}
.tm-detail__btn-secondary:hover {
    background: var(--tm-red-light);
}

/* Шеринг */
.tm-detail__card-share {
    border-top: 1px solid var(--tm-red-border);
    padding-top: 12px;
}
.tm-detail__share-icons {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}
.tm-detail__share-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--tm-warm-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    color: var(--tm-red);
    text-decoration: none;
    transition: background 0.15s;
}
.tm-detail__share-icon:hover {
    background: var(--tm-warm-bg3);
}


/* =============== МОБИЛЬНАЯ АДАПТАЦИЯ =============== */

@media (max-width: 1024px) {
    .tm-stores__main {
        flex-direction: column;
        min-height: auto;
        height: auto;
        max-height: none;
    }
    .tm-stores__sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--tm-red-border);
    }
    .tm-stores__list {
        max-height: 420px;
    }
    .tm-stores__map-wrap {
        min-height: 520px;
        height: 520px;
    }
    .tm-stores__map {
        height: 520px !important;
    }
    .tm-stores__contacts {
        grid-template-columns: 1fr;
    }
    .tm-detail__layout {
        grid-template-columns: 1fr;
    }
    .tm-detail__aside {
        order: -1;
    }
    .tm-detail__card {
        position: static;
    }
    .tm-detail__nearby {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .tm-stores__title {
        font-size: 20px;
    }
    .tm-stores__list {
        max-height: 340px;
    }
    .tm-stores__map-wrap {
        min-height: 390px;
        height: 390px;
    }
    .tm-stores__map {
        height: 390px !important;
    }
    .tm-detail__gallery-side {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }
    .tm-detail__title {
        font-size: 20px;
    }

    /* Мобильные кнопки «Позвонить / Маршрут» */
    .tm-detail__card-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    .tm-detail__btn-primary,
    .tm-detail__btn-secondary {
        margin-bottom: 0;
    }
}


/* =========== ГАЛЕРЕЯ: главное 16:9 сверху, плитка снизу =========== */

.tm-detail__gallery {
    margin-bottom: 24px;
}
.tm-detail__gallery-main {
    overflow: hidden;
    background: var(--tm-warm-bg2);
    cursor: pointer;
    aspect-ratio: 16 / 9;
    border-radius: var(--tm-radius-lg);
    margin-bottom: 6px;
}
.tm-detail__gallery-main img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    display: block;
    background: var(--tm-warm-bg2);
}
.tm-detail__gallery-side {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 6px;
}
.tm-detail__gallery-thumb {
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: var(--tm-warm-bg);
    position: relative;
    cursor: pointer;
    border-radius: var(--tm-radius-md);
}
.tm-detail__gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.tm-detail__gallery-more {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(161, 24, 38, 0.55);
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--tm-radius-md);
}


/* =========== ТОВАРНЫЕ КАРТОЧКИ =========== */

.tm-detail__products {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
}
.tm-detail__product-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    background: var(--tm-warm-bg);
    border-radius: var(--tm-radius);
    padding: 20px 12px 14px;
    text-decoration: none;
    color: inherit;
    transition: background 0.15s;
}
.tm-detail__product-card:hover {
    background: var(--tm-warm-bg3);
}
.tm-detail__product-icon {
    margin-bottom: 10px;
}
.tm-detail__product-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--tm-dark);
    margin-bottom: 2px;
}
.tm-detail__product-price {
    font-size: 13px;
    color: var(--tm-red);
}


/* =========== ЛАЙТБОКС =========== */

.tm-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10000;
    align-items: center;
    justify-content: center;
}
.tm-lightbox.is-open {
    display: flex;
}
.tm-lightbox__overlay {
    position: absolute;
    inset: 0;
    background: rgba(25, 24, 23, 0.85);
}
.tm-lightbox__content {
    position: relative;
    z-index: 1;
    max-width: 90vw;
    max-height: 85vh;
}
.tm-lightbox__content img {
    max-width: 90vw;
    max-height: 85vh;
    object-fit: contain;
    display: block;
    border-radius: 8px;
}
.tm-lightbox__close {
    position: absolute;
    top: 16px;
    right: 20px;
    z-index: 2;
    background: none;
    border: none;
    color: #fff;
    font-size: 36px;
    cursor: pointer;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.2s;
}
.tm-lightbox__close:hover { opacity: 1; }
.tm-lightbox__prev,
.tm-lightbox__next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    background: rgba(255,255,255,0.15);
    border: none;
    color: #fff;
    font-size: 32px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.tm-lightbox__prev:hover,
.tm-lightbox__next:hover {
    background: rgba(255,255,255,0.3);
}
.tm-lightbox__prev { left: 16px; }
.tm-lightbox__next { right: 16px; }
.tm-lightbox__counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    color: rgba(255,255,255,0.7);
    font-size: 14px;
}

@media (max-width: 640px) {
    .tm-detail__products {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
        gap: 8px;
    }
    .tm-detail__product-card {
        padding: 14px 8px 10px;
    }
}
