/* ===== КАТАЛОГ – НОВАЯ СТРУКТУРА ДВУХ БЛОКОВ ===== */

/* Главный контейнер – без фона, только отступы */
.catalog-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    height: 100%;
    min-height: 0;
}

/* Блок фильтров (островок) */
.catalog-filters-block {
    background: var(--card-bg);
    border-radius: var(--border-radius-card);
    padding: 12px 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    flex-shrink: 0;
    position: relative; /* для абсолютного позиционирования roll-кнопки */
}

.filters-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
    width: 100%;
}

.filter-item {
    flex: 0 0 auto;
}

.search-item {
    flex: 2;
    min-width: 180px;
}

.category-item {
    flex: 0 0 200px;
}

.amount-item {
    flex: 0 0 130px;
}

.reset-item {
    flex: 0 0 auto;
}

.filter-input,
.filter-select {
    width: 100%;
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    font-family: inherit;
    transition: 0.2s;
    box-sizing: border-box;
}

.filter-input:focus,
.filter-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
}

.reset-filters-btn {
    background: none;
    border: 1px solid var(--border-color);
    padding: 8px 16px;
    border-radius: 30px;
    font-size: 13px;
    cursor: pointer;
    transition: 0.2s;
    color: var(--text-primary);
    white-space: nowrap;
}
.reset-filters-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}
body.dark-theme .reset-filters-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Заголовок + сортировка (без фона) */
.catalog-header-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    padding: 0 4px;
}

.catalog-title {
    font-size: 22px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    text-align: left;
}

.catalog-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.sort-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}
.sort-wrapper label {
    font-size: 13px;
    color: var(--text-secondary);
}
.sort-wrapper select {
    padding: 6px 12px;
    border-radius: 30px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
    outline: none;
}
.sort-wrapper select:focus {
    border-color: var(--accent);
}

.my-projects-btn {
    background: var(--accent);
    color: white;
    border: none;
    padding: 6px 18px;
    border-radius: 30px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: 0.2s;
    white-space: nowrap;
}
.my-projects-btn:hover {
    background: var(--accent-hover);
}

/* Блок с проектами (островок) */
.catalog-projects-block {
    flex: 1;
    min-height: 0;
    background: var(--card-bg);
    border-radius: var(--border-radius-card);
    padding: 16px 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    display: flex;
    flex-direction: column;
}

.catalog-grid {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding-right: 4px;
    min-height: 0;
}

/* Карточка проекта (горизонтальная) */
.project-card {
    display: flex;
    align-items: stretch;
    background: var(--card-bg);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
    min-height: 140px;
    flex-shrink: 0;
}
.project-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}
.project-card-img-wrapper {
    width: 200px;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
    background: #e2e8f0;
}
.project-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.project-status-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    color: white;
    z-index: 1;
}
.project-card-body {
    flex: 1;
    padding: 16px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.project-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
    gap: 16px;
}
.project-card-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    color: var(--text-primary);
    line-height: 1.3;
}
.project-card-award {
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 700;
    color: var(--accent);
    font-size: 16px;
    white-space: nowrap;
}
.project-card-desc {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.project-card-meta {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: auto;
    padding-top: 8px;
}
.project-card-priority {
    background: rgba(0, 0, 0, 0.05);
    padding: 2px 8px;
    border-radius: 20px;
}
body.dark-theme .project-card-priority {
    background: rgba(255, 255, 255, 0.1);
}
.award-icon {
    width: 18px;
    height: 18px;
}

/* Кнопка "Загрузить ещё" */
.load-more-btn {
    display: inline-block;
    width: auto;
    padding: 6px 20px;
    margin: 10px auto 0;
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 40px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: 0.2s;
    color: var(--text-primary);
    text-align: center;
}
.load-more-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}
body.dark-theme .load-more-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Стиль для main-content-block в режиме каталога */
.main-content-block.catalog-mode {
    background: transparent !important;
    box-shadow: none !important;
    padding: 0 !important;
}

/* Адаптация для планшетов */
@media (max-width: 1024px) {
    .filters-row {
        flex-wrap: wrap;
    }
    .search-item {
        flex-basis: 100%;
    }
    .category-item {
        flex: 1;
    }
    .amount-item {
        flex: 1;
    }
    .reset-item {
        flex: 0 0 auto;
    }
    .catalog-header-line {
        flex-direction: column;
        align-items: stretch;
    }
    .catalog-actions {
        justify-content: space-between;
    }
}

/* Адаптация для мобильных */
@media (max-width: 768px) {
    .filters-row {
        flex-direction: column;
        padding-right: 44px;
        position: relative;
    }
    .search-item,
    .category-item,
    .amount-item,
    .reset-item {
        width: 100%;
    }
    .project-card {
        flex-direction: column;
    }
    .project-card-img-wrapper {
        width: 100%;
        height: 160px;
    }
    .catalog-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    .sort-wrapper {
        justify-content: space-between;
    }
    .catalog-projects-block {
        padding: 12px;
    }
    .catalog-filters-block {
        padding: 12px;
    }
    /* Roll-кнопка уже объявлена в styles.css */
}