/* ====
   INGREDIENTS CATALOG
   ==== */

.main-content-area {
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    /* Анимируем только opacity — max-height не трогаем чтобы список не обрезался */
    transition: opacity 0.4s ease;
}

.main-content-area.active {
    opacity: 1;
    max-height: none;
    /* clip обрезает горизонтальный выход за край, но НЕ создаёт
       scroll-контейнер — вертикальный overflow остаётся visible */
    overflow-x: clip;
    overflow-y: visible;
    padding: 3rem 0;
}

.ingredients-section {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 0 20px;
    box-sizing: border-box;
}

.ingredients-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.section-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--dark-gray);
    margin-bottom: 1rem;
}

.section-subtitle {
    font-size: 1rem;
    color: var(--medium-gray);
    margin-bottom: 1.5rem;
}

#ing-search {
    width: 100%;
    max-width: 500px;
    padding: 12px 20px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 1rem;
    transition: var(--transition-fast);
    background: var(--white);
}

#ing-search:focus {
    outline: none;
    border-color: var(--emerald);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--emerald) 10%, transparent);
}

/* Сетка ингредиентов */
.ingredients-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    margin-top: 2rem;
}

.ing-card {
    background: var(--white);
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
}

.ing-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.08);
    border-color: var(--emerald);
}

.ing-code {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--emerald);
    min-width: 60px;
}

.ing-name {
    flex: 1;
    font-size: 0.95rem;
    color: var(--dark-gray);
}

.ing-status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.ing-status-dot.halal { background-color: #10b981; }
.ing-status-dot.haram { background-color: #ef4444; }
.ing-status-dot.mushbooh { background-color: #f59e0b; }

/* Закладка на карточке ингредиента / заведения */
.ing-bookmark-btn {
    flex-shrink: 0;
    background: none;
    border: none;
    cursor: pointer;
    color: #bbb;
    padding: 2px 4px;
    margin: 0 4px;
    display: flex;
    align-items: center;
    transition: color 0.2s;
    border-radius: 4px;
}
.ing-bookmark-btn:hover {
    color: var(--gold, #d4a017);
}
.ing-bookmark-btn.active {
    color: var(--gold, #d4a017);
}
.ing-bookmark-btn.active svg {
    fill: var(--gold, #d4a017);
}

/* Бейджи статусов в модалке */
.status-badge {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 1rem;
}

.status-halal { 
    background: #dcfce7; 
    color: #166534; 
}

.status-haram { 
    background: #fee2e2; 
    color: #991b1b; 
}

.status-mushbooh { 
    background: #fef9c3; 
    color: #854d0e; 
}

/* Метаданные ингредиента */
.ingredient-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin: 1.5rem 0;
    padding: 1.2rem;
    background: #f8f9fa;
    border-radius: 10px;
}

.meta-item label {
    display: block;
    font-size: 0.75rem;
    color: var(--medium-gray);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.meta-item span {
    font-weight: 600;
    color: var(--dark-gray);
    font-size: 0.95rem;
}

/* Секции текста в модалке */
.modal-text-section {
    margin: 1.5rem 0;
}

.modal-text-section h4 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--dark-gray);
    margin-bottom: 0.8rem;
}

.modal-text-section p {
    line-height: 1.7;
    color: var(--medium-gray);
}

/* Блок фетвы */
.fatwa-box {
    border-inline-start: 4px solid var(--emerald);
    background: #f0fdf4;
    padding: 1.2rem;
    border-radius: 0 10px 10px 0;
    margin-top: 2rem;
}

.fatwa-box h4 {
    color: var(--emerald);
    font-family: var(--font-arabic);
}

.fatwa-box p {
    font-style: italic;
    color: #166534;
}

/* ── Чипсы-фильтры категорий ─────────────────────────── */
.ing-cat-chips-wrap {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    padding: 12px 0 8px;
    margin-bottom: 4px;
    /* Обязательно: без width:100% контейнер расширяется по содержимому
       и ломает ширину страницы — карточки уходят вправо */
    width: 100%;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    box-sizing: border-box;
}

.ing-cat-chips-wrap::-webkit-scrollbar {
    display: none;
}
.ing-cat-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 13px;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    background: #fff;
    color: #475569;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}
.ing-cat-chip:hover {
    border-color: var(--emerald, #059669);
    color: var(--emerald, #059669);
    background: #f0fdf4;
}
.ing-cat-chip.active {
    background: var(--emerald, #059669);
    border-color: var(--emerald, #059669);
    color: #fff;
}
.ing-cat-chip.active .ing-chip-count {
    background: rgba(255,255,255,0.25);
    color: #fff;
}
.ing-chip-count {
    display: inline-block;
    min-width: 20px;
    padding: 0 5px;
    height: 18px;
    line-height: 18px;
    background: #f1f5f9;
    color: #64748b;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    text-align: center;
}

/* ── Разделитель групп категорий (публичная страница) ──── */
.ing-category-separator {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 20px 0 8px;
}
.ing-cat-sep-line {
    flex: 1;
    height: 1px;
    background: var(--border-gray, #e2e8f0);
}
.ing-cat-sep-name {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: #94a3b8;
    white-space: nowrap;
}
.ing-cat-sep-count {
    font-size: 10px;
    font-weight: 600;
    color: #cbd5e1;
    background: #f1f5f9;
    padding: 1px 7px;
    border-radius: 10px;
}

@media (max-width: 768px) {
    .ingredients-section {
        padding: 0 12px;
    }

    .ingredients-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .ing-card {
        padding: 0.85rem 0.75rem;
    }

    .ing-code {
        font-size: 0.95rem;
        min-width: 50px;
    }

    .ing-name {
        font-size: 0.85rem;
    }

    .ingredient-meta {
        grid-template-columns: 1fr;
        gap: 10px;
    }
}