/* Bammat Core — витрина магазинов на главной.
 *
 * Вынесено из part-04-store-listing.php в файл, чтобы браузер его
 * кэшировал: 12 КБ приходили заново с каждой страницей. Число колонок
 * настраивается в админке, поэтому оно стало переменной CSS —
 * значения печатаются отдельной строкой рядом.
 */
:root{--gd-grid-desktop:4;--gd-grid-mobile:2;}
/* ═══ CATEGORY SECTIONS ═══ */
    .grocery-category-section { margin: 60px 0 60px; }
    .grocery-category-section:first-of-type { margin-top: 24px; }
    .grocery-category-title { font-size: 32px; font-weight: 700; margin-bottom: 24px; color: #1a1a1a; display: flex; align-items: center; gap: 12px; }
    .grocery-category-title .category-icon { font-size: 36px; display: inline-block; }

    /* ═══ SHOP GRID ═══ */
    .grocery-shops-grid {
        display: grid;
        grid-template-columns: repeat(var(--gd-grid-desktop), 1fr);
        gap: 24px; margin-bottom: 40px;
    }

    /* ═══ SHOP CARD ═══ */
    .grocery-shop-card { background: white; border-radius: 16px; overflow: hidden; box-shadow: 0 4px 12px rgba(0,0,0,0.08); cursor: pointer; position: relative; transition: box-shadow 0.2s ease, opacity 0.3s ease; }
    .grocery-shop-card:hover { box-shadow: 0 8px 25px rgba(0,0,0,0.15); }
    .grocery-shop-card.inactive-store { opacity: 0.6; cursor: not-allowed; filter: grayscale(30%); background-color: #f0f6ff; }
    .grocery-shop-card.inactive-store:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.08); opacity: 0.6; }
    .grocery-shop-card.inactive-store::after { content: 'COMING SOON'; position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); background: rgba(33,150,243,0.92); color: white; padding: 8px 16px; border-radius: 20px; font-size: 12px; font-weight: 700; z-index: 20; letter-spacing: 1px; white-space: nowrap; }

    .grocery-shop-cover { width: 100%; height: 160px; background: linear-gradient(135deg,#667eea 0%,#764ba2 100%); position: relative; overflow: hidden; border-radius: 16px 16px 0 0; }
    .grocery-shop-rating { position: absolute; top: 15px; right: 15px; display: flex; align-items: center; background: rgba(255,255,255,0.95); backdrop-filter: blur(10px); padding: 3px 6px; border-radius: 12px; font-size: 12px; font-weight: 600; color: #333; white-space: nowrap; z-index: 10; box-shadow: 0 2px 8px rgba(0,0,0,0.1); height: 20px; line-height: 20px; }
    .grocery-stars { color: #ffc107; margin-right: 3px; font-size: 12px; }
    .inactive-store .grocery-stars { color: #dee2e6; }

    .grocery-custom-tags { position: absolute; bottom: 12px; left: 12px; z-index: 10; display: flex; gap: 4px; flex-wrap: wrap; max-width: 45%; }
    .grocery-custom-tag { background: #ffd700; color: #000; padding: 3px 6px; border-radius: 12px; font-size: 12px; font-weight: 600; white-space: nowrap; display: inline-block; height: 20px; line-height: 14px; }
    .inactive-store .grocery-custom-tag { background: #e0e0e0; color: #6c757d; }

    .grocery-shop-distance-container { position: absolute; bottom: 12px; right: 12px; z-index: 10; }
    .grocery-shop-distance-badge { background: rgba(0,123,255,0.9); color: white; padding: 3px 8px; border-radius: 12px; font-size: 12px; font-weight: 600; display: none; white-space: nowrap; height: 20px; line-height: 14px; }

    .grocery-shop-logo { position: absolute; top: 15px; left: 15px; width: 60px; height: 60px; border-radius: 10px; background: white; display: flex; align-items: center; justify-content: center; overflow: hidden; box-shadow: 0 3px 8px rgba(0,0,0,0.2); z-index: 5; }
    .grocery-shop-logo img { width: 100%; height: 100%; object-fit: cover; }
    .grocery-shop-logo .placeholder { font-size: 16px; color: #666; font-weight: 700; }

    .grocery-shop-content { padding: 16px; position: relative; background: white; border-radius: 0 0 16px 16px; }
    .inactive-store .grocery-shop-content { background-color: #f8f9fa; color: #6c757d; }

    .grocery-shop-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; gap: 8px; }
    .grocery-shop-name-container { flex: 1; min-width: 0; overflow: hidden; position: relative; }
    .grocery-shop-name { font-size: 18px; font-weight: 700; color: #1a1a1a; margin: 0; line-height: 1.3; white-space: nowrap; transition: transform 0.3s ease; display: inline-block; width: 100%; text-align: left; }
    .inactive-store .grocery-shop-name { color: #6c757d; }
    .grocery-shop-name.scrolling { animation: nameScroll 4s ease-in-out infinite; animation-delay: 1s; }
    @keyframes nameScroll { 0%,20%{transform:translateX(0)} 45%,55%{transform:translateX(var(--scroll-distance))} 80%,100%{transform:translateX(0)} }

    .grocery-delivery-badge { background: #e3f2fd; color: #0277bd; border: 1px solid #81d4fa; border-radius: 12px; padding: 4px 8px; font-size: 12px; font-weight: 600; line-height: 1.6; white-space: nowrap; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
    .grocery-delivery-badge.store-closed { background: #fff3e0; color: #ef6c00; border-color: #ffcc02; }
    .inactive-store .grocery-delivery-badge { background: #e9ecef; color: #6c757d; border-color: #dee2e6; }

    .grocery-shop-description { font-size: 14px; color: #666; margin-bottom: 6px; line-height: 1.4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .grocery-shop-description:empty { margin-bottom: 0; }
    .inactive-store .grocery-shop-description { color: #adb5bd; }

    .grocery-shop-location { display: flex; align-items: center; gap: 4px; font-size: 13px; color: #999; font-weight: 500; margin-bottom: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .inactive-store .grocery-shop-location { color: #adb5bd; }

    .grocery-shop-separator { border-top: 1px dotted #ddd; margin: 8px 0 6px 0; }
    .inactive-store .grocery-shop-separator { border-color: #e9ecef; }

    .grocery-shop-bottom-section { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
    .grocery-shop-status { font-size: 13px; color: #999; line-height: 1.4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
    .inactive-store .grocery-shop-status { color: #adb5bd; }
    .grocery-shop-delivery-fee-text { font-size: 13px; color: #28a745; font-weight: 600; white-space: nowrap; display: none; align-items: center; gap: 4px; }

    /* ═══ DELIVERY FEE LOADING DOTS ═══ */
    .bm-fee-dots {
        display: inline-block;
        letter-spacing: 2px;
        animation: bmFeePulse 1.2s ease-in-out infinite;
        opacity: 0.5;
    }
    @keyframes bmFeePulse {
        0%, 100% { opacity: 0.3; }
        50%       { opacity: 0.8; }
    }

    /* ═══ PLACEHOLDER ═══ */
    .grocery-placeholder-card { background: linear-gradient(135deg,#f8f9fa 0%,#e9ecef 100%); border: 2px dashed #cbd5e0; border-radius: 16px; padding: 40px 20px; text-align: center; min-height: 320px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; }
    .grocery-placeholder-icon { font-size: 56px; opacity: 0.5; margin-bottom: 8px; }
    .grocery-placeholder-title { font-size: 18px; font-weight: 600; color: #495057; margin: 0 0 8px 0; }
    .grocery-placeholder-message { font-size: 14px; color: #6c757d; line-height: 1.6; max-width: 280px; margin: 0 0 16px 0; }
    .grocery-placeholder-accent { width: 60px; height: 3px; background: linear-gradient(90deg,#a8c5da,#ffa94d); border-radius: 2px; opacity: 0.6; }

    /* ═══ CAROUSEL ═══ */
    .grocery-mobile-filter {
        display: block;
        position: sticky;
        top: 0;
        background: white;
        z-index: 99;
        padding: 55px 0 15px 0;
        margin: 0;
    }
    .grocery-mobile-filter.is-sticky { box-shadow: 0 2px 4px rgba(0,0,0,0.05); }
    .grocery-mobile-filter.is-sticky::before {
        content: '';
        position: fixed;
        top: 0; left: 0; right: 0;
        background: white;
        z-index: 98;
        pointer-events: none;
    }

    .grocery-carousel-container {
        overflow-x: auto;
        overflow-y: hidden;
        scrollbar-width: none;
        -ms-overflow-style: none;
        -webkit-overflow-scrolling: touch;
        text-align: center;
    }
    .grocery-carousel-container::-webkit-scrollbar { display: none; }

    .grocery-category-carousel {
        display: inline-flex;
        gap: 16px;
        padding: 25px 16px 15px;
        cursor: grab;
        touch-action: pan-x pan-y;
    }
    .grocery-category-carousel:active { cursor: grabbing; }

    .grocery-category-item { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: calc((100vw - 80px) / 4); max-width: calc((100vw - 80px) / 4); height: 100px; padding: 12px 8px; border-radius: 16px; cursor: pointer; transition: all 0.3s ease !important; border: 2px solid transparent; background: #f5f5f5; flex-shrink: 0; box-sizing: border-box; position: relative; overflow: hidden; }
    .grocery-category-item.active { border-color: var(--bm-blue); background: #f5f5f5; }
    .grocery-category-icon { font-size: 32px; margin-bottom: 8px; z-index: 2; position: relative; line-height: 1; transition: all 0.3s ease !important; }
    .grocery-category-content { position: relative; z-index: 2; width: 100%; text-align: center; }
    .grocery-category-name { font-size: 12px; font-weight: 600; color: #333; text-align: center; line-height: 1.2; margin: 0; transition: all 0.3s ease !important; }
    .grocery-category-item.active .grocery-category-name { color: var(--bm-blue); font-weight: 700; }

    /* Сетка магазинов видна сразу.
       Раньше здесь стояло `display: none`, и открывал её скрипт — только
       если в браузере уже был сохранён адрес. У поискового робота адреса
       нет и быть не может, поэтому Google видел главную страницу
       продуктового маркетплейса, на которой нет ни одного магазина:
       шапка, ряд категорий, три заголовка и пустота под ними.
       Отсюда «Soft 404» в Search Console. */
    .grocery-shops-container { min-height: 400px; position: relative; }

    /* ═══ RESPONSIVE ═══ */
    @media (max-width: 768px) {
        .grocery-shops-grid { grid-template-columns: repeat(var(--gd-grid-mobile), 1fr); gap: 12px; }
        .grocery-category-title { font-size: 28px; }
        .grocery-shop-cover { height: 120px; }
        .grocery-shop-logo { width: 45px; height: 45px; top: 12px; left: 12px; }
        .grocery-shop-content { padding: 12px; }
        .grocery-shop-name { font-size: 16px; }
        .grocery-delivery-badge { font-size: 11px; padding: 3px 6px; border-radius: 10px; }
        .grocery-shop-description { font-size: 13px; }
        .grocery-shop-location { font-size: 12px; }
        .grocery-shop-status { font-size: 12px; }
        .grocery-shop-rating { font-size: 11px; top: 12px; right: 12px; padding: 2px 5px; height: 18px; line-height: 18px; }
        .grocery-stars { font-size: 11px; margin-right: 2px; }
        .grocery-shop-distance-badge { font-size: 11px; padding: 2px 6px; height: 18px; line-height: 14px; }
        .grocery-custom-tag { font-size: 11px; padding: 2px 5px; height: 18px; line-height: 14px; }
        .grocery-custom-tags { max-width: 48%; }
        .grocery-mobile-filter { padding: 5px 0 12px 0 !important; }
        .grocery-category-carousel { gap: 6px !important; padding: 18px 8px 8px !important; }
        .grocery-category-item { min-width: calc((100vw - 64px) / 4); max-width: calc((100vw - 64px) / 4); }
        .grocery-category-icon { font-size: 24px !important; margin-bottom: 4px !important; }
        .grocery-category-name { font-size: 10px !important; }
        .grocery-placeholder-card { padding: 30px 15px; min-height: 280px; }
        .grocery-placeholder-icon { font-size: 48px; }
        .grocery-placeholder-title { font-size: 16px; }
    }

    @media (max-width: 768px) {
        .grocery-category-item { height: 70px !important; padding: 8px 6px !important; }
    }

    @media (max-width: 480px) {
        .grocery-mobile-filter { padding: 3px 0 10px 0 !important; }
        .grocery-category-carousel { gap: 4px !important; padding: 16px 6px 6px !important; }
        .grocery-category-item { min-width: calc((100vw - 52px) / 4); max-width: calc((100vw - 52px) / 4); }
        .grocery-category-icon { font-size: 20px !important; margin-bottom: 3px !important; }
        .grocery-category-name { font-size: 9px !important; }
        .grocery-shops-grid { gap: 10px; }
        .grocery-shop-name { font-size: 15px; }
    }

    @media (min-width: 1024px) {
        .grocery-mobile-filter { top: 45px; padding: 8px 0 0 0; }
        .grocery-carousel-container { text-align: center; }
        .grocery-category-carousel { display: inline-flex; gap: 12px; padding: 15px 20px; }
        .grocery-category-item {
            flex: 0 0 96px !important; width: 96px !important; height: 80px !important;
            min-width: 96px !important; max-width: 96px !important;
            padding: 8px !important; border-radius: 14px !important; box-sizing: border-box !important;
        }
        .grocery-category-icon { font-size: 24px !important; margin-bottom: 4px !important; }
        .grocery-category-name { font-size: 11px !important; }
    }

    @media (min-width: 769px) and (max-width: 1023px) {
        .grocery-category-carousel { gap: 12px; padding: 15px 20px; }
        .grocery-category-item { min-width: 100px; max-width: 100px; width: 100px; height: 105px; padding: 14px 10px; border-radius: 16px; flex-shrink: 0; }
        .grocery-category-icon { font-size: 34px; margin-bottom: 9px; }
        .grocery-category-name { font-size: 12px; }
    }

    /* Полоса обратного отсчёта внизу карточки.
       Переехала из PART 15 вместе со своим скриптом: там она печаталась
       инлайном в подвал каждой страницы с карточками. */
    .bmce-closing-bar {
        width: 100%; padding: 5px 10px; text-align: center;
        font-size: 11px; font-weight: 700; letter-spacing: .3px;
        border-radius: 0 0 16px 16px; box-sizing: border-box;
        background: #65a30d; color: #fff;
    }
    .bmce-closing-bar.urgent { background: #dc2626; }
