/* ============================================================
   page-network.css — стили страницы сети (templates/network.tpl)
   ============================================================ */

/* ============ HEAD-INFO ============ */
.head-info {
    margin-top: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 32px;
    display: grid;
    grid-template-columns: minmax(0, 7fr) minmax(0, 3fr);
    gap: 32px;
    box-shadow: var(--shadow-card);
}
@media (max-width: 960px) {
    .head-info { grid-template-columns: 1fr; padding: 24px; gap: 24px; }
}

.head-info .net-logo {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 14px;
}
.head-info .net-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-weight: 700;
    font-size: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.head-info h1 { margin: 0; }
.head-info .description {
    color: var(--text-secondary);
    font-size: 16px;
    margin: 14px 0;
    max-width: 720px;
}
.facts {
    color: var(--text-secondary);
    font-size: 15px;
}
.facts .dot {
    display: inline-block;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #CBD5E1;
    margin: 0 10px;
    vertical-align: middle;
}
.head-info .updated-badge { margin-top: 18px; }

.metrics-2x2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
@media (max-width: 640px) {
    .metrics-2x2 {
        grid-template-columns: none;
        grid-auto-flow: column;
        grid-auto-columns: 70%;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        padding-bottom: 4px;
    }
    .metrics-2x2 .metric { scroll-snap-align: start; }
}
.metric {
    padding: 16px;
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: 88px;
}
.metric .label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}
.metric .value {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}
.metric.is-success { background: var(--success-bg); }
.metric.is-success .value { color: #047857; }
.metric.is-warning { background: var(--warning-bg); }
.metric.is-warning .value { color: #B45309; }
.metric.is-info    { background: var(--info-bg); }
.metric.is-info .value { color: #1D4ED8; }
.metric.is-pink    { background: var(--pink-bg); }
.metric.is-pink .value { color: #BE185D; }

/* ============ PROMO STRIP ============ */
.promo-strip { margin-top: 24px; }
.promo-strip-inner {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding-bottom: 4px;
}
.promo-strip-inner::-webkit-scrollbar { height: 6px; }
.promo-strip-inner::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; }

.promo-mini {
    flex: 0 0 auto;
    min-width: 280px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 3px solid var(--warning);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    scroll-snap-align: start;
    transition: border-color 200ms, transform 200ms, box-shadow 200ms;
    cursor: pointer;
}
.promo-mini:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-card-hover);
}
.promo-mini .icon-wrap {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--warning-bg);
    color: var(--warning);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.promo-mini .title {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.3;
}
.promo-mini .deadline {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* ============ MAIN GRID (filters + dishes) ============ */
.main-grid {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 32px;
    margin-top: 32px;
    align-items: start;
}
@media (max-width: 960px) {
    .main-grid { grid-template-columns: 1fr; gap: 16px; }
}

/* ============ FILTERS ============ */
.filters {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    position: sticky;
    top: 80px;
}
.filters-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.filters-head h3 { font-size: 18px; }
.filters-reset {
    font-size: 13px;
    font-weight: 500;
    color: var(--accent);
}
.filters-reset:hover { color: var(--accent-hover); }

.filter-group {
    border-top: 1px solid var(--border);
    padding-top: 14px;
    margin-top: 14px;
}
.filter-group:first-of-type {
    border-top: none;
    padding-top: 0;
    margin-top: 0;
}
.filter-group .uk-accordion-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    padding: 0;
    margin: 0;
}
.filter-group .uk-accordion-title::before {
    background-image: url('data:image/svg+xml;charset=UTF-8,<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 14 14"><polyline fill="none" stroke="%236B7280" stroke-width="1.5" points="2 4 7 9 12 4"/></svg>');
    margin-left: 6px;
}
.filter-group .uk-accordion-content { margin-top: 12px; }

.check-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 0;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-primary);
}
.check-row:hover .check-label { color: var(--accent); }
.check-row .check-count {
    font-size: 13px;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}
.check-row .check-label {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: color 200ms;
}
.check-row input[type="checkbox"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border: 1.5px solid #D1D5DB;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    position: relative;
    transition: background 150ms, border-color 150ms;
    flex-shrink: 0;
}
.check-row input[type="checkbox"]:checked {
    background: var(--accent);
    border-color: var(--accent);
}
.check-row input[type="checkbox"]:checked::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 5px;
    width: 4px;
    height: 8px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}
.check-row input[type="checkbox"]:focus-visible {
    outline: 2px solid rgba(230, 57, 70, 0.35);
    outline-offset: 2px;
}

/* Range double slider (noUiSlider, mFilter) */
.range-wrap { position: relative; padding: 18px 8px 0; }

/* Прячем number-инпуты mFilter: они нужны только для отправки значений в форме */
.range-wrap .range-input {
    position: absolute;
    width: 1px; height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    border: 0; padding: 0; margin: -1px;
    opacity: 0;
    pointer-events: none;
}

/* noUiSlider — трек */
.range-wrap .mfilter-slider.noUi-target {
    background: var(--border);
    border: none;
    border-radius: 999px;
    box-shadow: none;
    height: 4px;
    margin: 22px 0 8px;
}
.range-wrap .noUi-base,
.range-wrap .noUi-connects {
    border-radius: 999px;
}
/* Заполненная часть между ручками — наш .range-fill.
   pointer-events: none отключает фичу noUiSlider «потянуть связку обеих ручек»
   (она путает пользователя курсором ew-resize и движением обеих сразу). */
.range-wrap .noUi-connect {
    background: var(--accent);
    border-radius: 999px;
    box-shadow: none;
    pointer-events: none;
    cursor: default;
}
/* Ручки */
.range-wrap .noUi-handle {
    width: 18px;
    height: 18px;
    top: -7px;
    right: -9px;
    background: #fff;
    border: 2px solid var(--accent);
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
    cursor: pointer;
}
.range-wrap .noUi-handle::before,
.range-wrap .noUi-handle::after {
    display: none;
}
.range-wrap .noUi-handle:focus { outline: none; }
.range-wrap .noUi-handle.noUi-active {
    box-shadow: 0 0 0 4px rgba(230, 57, 70, 0.18);
}

/* Тултипы над ручками — текущие значения слайдера */
.range-wrap .noUi-tooltip {
    background: var(--text-primary);
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.4;
    font-variant-numeric: tabular-nums;
    bottom: 24px;
    white-space: nowrap;
}

/* Подпись с границами диапазона снизу */
.range-bounds {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
    margin-top: 10px;
}

.filters-mobile-toggle {
    display: none;
    width: 100%;
    height: 44px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-primary);
    font-weight: 500;
    border-radius: var(--radius-sm);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
@media (max-width: 960px) {
    .filters { display: none; }
    .filters-mobile-toggle { display: inline-flex; }

    /* Перекрашиваем тёмный по умолчанию uk-offcanvas-bar в светлый фон сайта,
       чтобы не было чёрных полос вокруг .filters */
    #offcanvas-filters .uk-offcanvas-bar {
        background: var(--bg-card);
        color: var(--text-primary);
        width: min(320px, 88vw);
        left: calc(-1 * min(320px, 88vw));
        padding: 20px 16px;
    }
    #offcanvas-filters.uk-open .uk-offcanvas-bar { left: 0; }
    #offcanvas-filters .uk-offcanvas-close {
        color: var(--text-secondary);
        top: 8px;
        right: 8px;
    }
    #offcanvas-filters .uk-offcanvas-close:hover { color: var(--text-primary); }

    .filters-mobile #offcanvas-filters-bar .filters {
        display: block;
        position: static;
        background: transparent;
        border: none;
        border-radius: 0;
        padding: 0;
    }
    .filters-mobile #offcanvas-filters-bar .filters-head {
        padding-right: 32px;
    }
}

/* ============ TOOLBAR + GRID ============ */
.grid-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.grid-toolbar .count {
    font-size: 14px;
    color: var(--text-secondary);
}
.grid-toolbar .count b {
    color: var(--text-primary);
    font-weight: 600;
}
.sort-wrap {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--text-secondary);
}
.sort-wrap select {
    height: 38px;
    padding: 0 32px 0 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    font-size: 14px;
    font-family: inherit;
    color: var(--text-primary);
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    background-image: url('data:image/svg+xml;charset=UTF-8,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 14 14"><polyline fill="none" stroke="%236B7280" stroke-width="1.5" points="2 4 7 9 12 4"/></svg>');
    background-repeat: no-repeat;
    background-position: right 10px center;
}
.sort-wrap select:focus { outline: none; border-color: var(--accent); }

/* На странице сети сетка блюд — 3 колонки */
.network-page .dish-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}
@media (max-width: 1100px) {
    .network-page .dish-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
    .network-page .dish-grid { grid-template-columns: 1fr; }
}

/* ============ GRID BOTTOM (load more + pager) ============ */
.grid-bottom {
    margin-top: 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

/* ============ COMPARE NETWORKS BLOCK ============ */
.compare-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}
@media (max-width: 960px) { .compare-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .compare-grid { grid-template-columns: 1fr; } }
.compare-grid .compare-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: transform 200ms, border-color 200ms, box-shadow 200ms;
}
.compare-grid .compare-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
    box-shadow: var(--shadow-card-hover);
}
.compare-grid .avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    color: #fff;
    font-weight: 700;
    font-size: 17px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
}
.compare-grid h4 { margin: 0 0 4px; font-size: 17px; }
.compare-grid .avg {
    font-size: 14px;
    color: var(--text-secondary);
}
.compare-grid .avg b {
    color: var(--text-primary);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}
.compare-grid .compare-card .btn-outline {
    margin-top: 14px;
    justify-content: center;
    width: 100%;
}

/* ============ FAQ ACCORDION ============ */
.faq-accordion {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}
.faq-accordion .uk-accordion { padding: 0; margin: 0; }
.faq-accordion .uk-accordion > li {
    border-top: 1px solid var(--border);
    margin: 0;
}
.faq-accordion .uk-accordion > li:first-child { border-top: none; }
.faq-accordion .uk-accordion-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    padding: 18px 24px;
    margin: 0;
    transition: color 200ms;
}
.faq-accordion .uk-accordion-title:hover { color: var(--accent); }
.faq-accordion .uk-accordion-title::before {
    background-image: url('data:image/svg+xml;charset=UTF-8,<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 14 14"><polyline fill="none" stroke="%236B7280" stroke-width="1.5" points="2 4 7 9 12 4"/></svg>');
    margin-left: 12px;
}
.faq-accordion .uk-accordion-content {
    padding: 0 24px 22px;
    margin: 0;
    color: #374151;
    line-height: 1.7;
}

/* ============ mFilter overrides ============
   mFilter.css (Bootstrap-based) auto-загружается через системную настройку
   mfilter.frontend_assets. Эти правила нейтрализуют его «бутстрапные» стили
   на .mfilter-block / .mfilter-item / .mfilter-count, чтобы наш UIkit-вид не сломался.
   Если в админке убрать строку [[+cssUrl]]web/mfilter.css из mfilter.frontend_assets,
   этот блок можно тоже удалить.
   ============================================ */
.filter-group.mfilter-block {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}
.check-row.mfilter-item {
    padding: 4px 0;
}
.check-row.mfilter-item:hover {
    background: transparent;
    margin: 0;
    padding-left: 0;
    padding-right: 0;
    border-radius: 0;
}
.check-row .check-label input[type="checkbox"],
.check-row .check-label input[type="radio"] {
    margin: 0;
}
.check-count.mfilter-count {
    margin-left: 0;
    padding-left: 0;
    font-size: 13px;
    color: var(--text-secondary);
}
.check-count.mfilter-count::before,
.check-count.mfilter-count::after {
    content: none;
}
.mfilter-item.mfilter-item-empty,
.check-row.is-disabled {
    opacity: 0.4;
    pointer-events: none;
}
/* range-wrap уже наш, но mfilter.css может прилететь с .mfilter-range — нейтрализуем */
.range-wrap.mfilter-range > .row,
.range-wrap.mfilter-range > .input-group {
    display: none;
}
/* «Сбросить» — мы рендерим ссылкой, mfilter.css делает из неё кнопку. Откатываем. */
.filters-reset.mfilter-reset {
    flex: none;
    padding: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    font-size: 13px;
    font-weight: 500;
    color: var(--accent);
    transition: color 200ms;
}
.filters-reset.mfilter-reset:hover {
    background: transparent;
    color: var(--accent-hover);
}

/* ============ CATALOG HEAD (шаблон networks — все сети) ============ */
.catalog-head {
    margin-top: 20px;
    text-align: center;
}
.catalog-head h1 { margin: 0 0 10px; }
.catalog-head p {
    color: var(--text-secondary);
    font-size: 16px;
    line-height: 1.6;
    max-width: 760px;
    margin: 0 auto;
}
.net-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-top: 18px;
}
.net-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 38px;
    padding: 0 14px 0 7px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    box-shadow: var(--shadow-card);
    transition: border-color 200ms, color 200ms;
}
.net-link:hover { border-color: var(--accent); color: var(--accent); }
.net-link .qa {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-weight: 700;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
