/* ===== DNS-style каталог ===== */
.catalog-wrapper {
    position: relative;
}

.catalog-btn {
    background-color: white;
    border: 1px solid var(--border-gray);
    color: var(--text-dark);
    padding: 0.75rem 1rem;
    font-weight: 500;
    transition: all 0.2s;
    width: 100%;
    text-align: left;
    cursor: pointer;
}

.catalog-btn:hover,
.catalog-btn.active {
    background-color: var(--light-gray);
    border-color: var(--primary-blue);
    color: var(--primary-blue);
}

.catalog-chevron {
    transition: transform 0.25s;
}

.catalog-btn.active .catalog-chevron {
    transform: rotate(180deg);
}

.catalog-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    width: 820px;
    max-width: 90vw;
    background: white;
    border: 1px solid var(--border-gray);
    border-radius: 0.5rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    z-index: 1050;
    display: none;
    flex-direction: row;
    overflow: hidden;
}

.catalog-menu.show {
    display: flex;
}

.catalog-sidebar {
    width: 230px;
    min-width: 230px;
    background: #f8f9fa;
    border-right: 1px solid var(--border-gray);
    overflow-y: auto;
    max-height: 480px;
    padding: 0.4rem 0;
}

.catalog-sidebar-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.55rem 1rem;
    cursor: pointer;
    font-size: 0.88rem;
    color: var(--text-dark);
    transition: background 0.15s, color 0.15s;
    border-left: 3px solid transparent;
}

.catalog-sidebar-item:hover,
.catalog-sidebar-item.active {
    background: white;
    color: var(--primary-blue);
    border-left-color: var(--primary-blue);
}

.catalog-sidebar-item .bi-chevron-right {
    font-size: 0.7rem;
    opacity: 0.45;
}

.catalog-content {
    flex: 1;
    overflow-y: auto;
    max-height: 480px;
    padding: 1.25rem 1.5rem;
}

.catalog-subcats {
    display: none;
}

.catalog-subcats.active {
    display: block;
}

.subcat-title {
    font-weight: 600;
    color: var(--text-dark);
    text-decoration: none;
    display: block;
    margin-bottom: 0.45rem;
    font-size: 0.92rem;
    transition: color 0.15s;
}

.subcat-title:hover {
    color: var(--primary-blue);
}

.subcat-link {
    display: block;
    color: #6c757d;
    text-decoration: none;
    font-size: 0.82rem;
    padding: 0.12rem 0;
    transition: color 0.15s;
}

.subcat-link:hover {
    color: var(--primary-blue);
}

.subcat-child {
    padding-left: 0.75rem;
}

.subcat-child .subcat-child {
    padding-left: 0.5rem;
}

.subcat-link--l1 {
    font-weight: 500;
    color: var(--text-dark);
    font-size: 0.85rem;
}

/* Популярные категории */
.popular-category {
    border: 1px solid var(--border-gray);
    border-radius: 0.5rem;
    padding: 1.25rem 0.75rem;
    text-align: center;
    background-color: white;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.popular-category:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0,0,0,.1);
    border-color: var(--primary-blue);
    background-color: rgba(var(--bs-primary-rgb), 0.05);
}

/* Стили для карточек объявлений */
.ad-card {
    border: 1px solid var(--border-gray);
    border-radius: 0.5rem;
    padding: 1.25rem;
    margin-bottom: 1rem;
    background-color: white;
    transition: all 0.2s ease;
    height: 100%;
}

.ad-card:hover {
    box-shadow: 0 5px 15px rgba(0,0,0,.08);
    transform: translateY(-2px);
}

.ad-title {
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
    line-height: 1.4;
}

.ad-price {
    font-weight: 700;
    color: var(--primary-blue);
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
}

.ad-meta {
    color: var(--text-light);
    font-size: 0.9rem;
}

/* Отступы для контента под фиксированным навбаром */
main {
    padding-top: 1rem;
}

/* Стили для секции поиска */
.search-section {
    background-color: var(--light-gray);
    padding: 1.75rem 0;
    border-bottom: 1px solid var(--border-gray);
    margin-bottom: 1.5rem;
}

/* Адаптив каталога */
@media (max-width: 768px) {
    .catalog-menu {
        width: 92vw;
        flex-direction: column;
    }

    .catalog-sidebar {
        width: 100%;
        min-width: 0;
        max-height: 150px;
        border-right: none;
        border-bottom: 1px solid var(--border-gray);
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 0;
    }

    .catalog-sidebar-item {
        white-space: nowrap;
        border-left: none;
        border-bottom: 3px solid transparent;
        padding: 0.5rem 0.75rem;
    }

    .catalog-sidebar-item.active,
    .catalog-sidebar-item:hover {
        border-left-color: transparent;
        border-bottom-color: var(--primary-blue);
    }

    .catalog-content {
        max-height: 280px;
        padding: 1rem;
    }
}
