/* ============================================================
   COLLECTIONS.CSS — тематические подборки
   Подключается после catalog.css (см. $additional_css)
   ============================================================ */

/* ------------------------------------------------------------
   1. Ряд кнопок-подборок ВНУТРИ панели фильтров (.filters)
   .filters — это flex с flex-wrap, поэтому flex-basis:100%
   переносит полосу на отдельную строку под селектами.
   ------------------------------------------------------------ */
.collection-bar {
    width: 100%;
    flex-basis: 100%;
    margin: 4px 0 0;
    padding-top: 22px;
    border-top: 1px solid var(--border-light, #E8E8E8);
}

/* Запасной вариант: блок вне .filters (например, на главной) */
.collection-bar.is-standalone {
    margin: -20px 0 40px;
    padding-top: 0;
    border-top: none;
}

.collection-bar-title {
    display: block;
    text-align: center;
    font-size: .85rem;
    font-weight: 600;
    color: var(--text-light, #6B6B6B);
    margin-bottom: 14px;
}

.collection-bar-inner {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

/* ------------------------------------------------------------
   2. Сам чип. Цвета приходят из БД через CSS-переменные,
   чтобы :hover и .is-active могли их переопределять.
   ------------------------------------------------------------ */
.collection-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 17px;
    border-radius: 22px;
    background: var(--chip-bg, #0b3d2e);
    color: var(--chip-fg, #fff);
    font-size: .92rem;
    font-weight: 600;
    text-decoration: none;
    border: 2px solid transparent;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .12);
    transition: transform .2s ease, box-shadow .2s ease, filter .2s ease;
    white-space: nowrap;
}

.collection-chip:hover,
.collection-chip:focus {
    transform: translateY(-2px);
    filter: brightness(1.12);
    box-shadow: 0 6px 16px rgba(0, 0, 0, .2);
    color: var(--chip-fg, #fff);
    text-decoration: none;
}

.collection-chip:active {
    transform: translateY(0);
}

.collection-chip.is-active {
    border-color: rgba(255, 255, 255, .7);
    filter: brightness(1.1);
    box-shadow: 0 4px 14px rgba(0, 0, 0, .22);
}

.collection-chip-ico {
    font-size: 1.1rem;
    line-height: 1;
}

.collection-chip-name {
    line-height: 1.2;
}

.collection-chip-count {
    font-size: .76rem;
    font-weight: 700;
    opacity: .85;
    background: rgba(255, 255, 255, .22);
    border-radius: 10px;
    padding: 1px 7px;
    line-height: 1.4;
}

/* ------------------------------------------------------------
   3. Страница подборки: вводный и SEO-текст
   ------------------------------------------------------------ */
.collection-intro {
    max-width: 900px;
    margin: 0 auto 32px;
    text-align: center;
    color: #555;
    line-height: 1.7;
    font-size: 1.05rem;
}

.collection-intro p {
    margin: 0 0 12px;
}

.collection-intro p:last-child {
    margin-bottom: 0;
}

/* ------------------------------------------------------------
   4. Плитка всех подборок (/raskraski/podborka без slug)
   ------------------------------------------------------------ */
.collection-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.collection-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 34px 18px;
    border-radius: 16px;
    text-decoration: none;
    font-weight: 700;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .12);
    transition: transform .25s ease, box-shadow .25s ease;
}

.collection-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 26px rgba(0, 0, 0, .2);
    text-decoration: none;
}

.collection-card-ico   { font-size: 2.4rem; line-height: 1; }
.collection-card-name  { font-size: 1.2rem; }
.collection-card-count { font-size: .85rem; opacity: .85; font-weight: 500; }

/* ------------------------------------------------------------
   5. Мобильные: чипы прокручиваются вбок, не ломая панель.
   .filters на 768px получает padding: 20px — компенсируем
   отрицательными margin, чтобы полоса шла от края до края.
   ------------------------------------------------------------ */
@media (max-width: 768px) {
    .collection-bar {
        margin-top: 2px;
        padding-top: 18px;
    }

    .collection-bar.is-standalone {
        margin: -10px 0 30px;
        padding-top: 0;
    }

    .collection-bar-title {
        margin-bottom: 12px;
    }

    .collection-bar-inner {
        flex-wrap: nowrap;
        overflow-x: auto;
        justify-content: flex-start;
        margin: 0 -20px;
        padding: 2px 20px 10px;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

    .collection-bar-inner::-webkit-scrollbar {
        display: none;
    }

    .collection-chip {
        padding: 8px 14px;
        font-size: .86rem;
    }

    .collection-intro {
        font-size: 1rem;
        text-align: left;
    }

    .collection-cards {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 14px;
    }

    .collection-card {
        padding: 24px 12px;
    }

    .collection-card-ico  { font-size: 2rem; }
    .collection-card-name { font-size: 1.02rem; }
}

/* Совсем узкие экраны */
@media (max-width: 480px) {
    .collection-cards {
        grid-template-columns: repeat(2, 1fr);
    }
}
