/* ========================================
   Калачинск Онлайн - Страница объявлений
   Файл: assets/css/ads.css
   ======================================== */

/* Breadcrumb & Title */
.ads-breadcrumb {
    display: flex; 
    align-items: center; 
    gap: 0.5rem;
    font-size: 0.9rem; 
    color: var(--text-gray); 
    margin-bottom: 1rem;
}
.ads-breadcrumb a { 
    color: var(--primary-color); 
    text-decoration: none; 
}
.ads-breadcrumb .separator { 
    color: var(--text-light); 
    font-size: 0.8rem; 
}
.ads-page-title {
    font-size: 2rem; 
    font-weight: 800; 
    color: var(--text-dark);
    margin-bottom: 2rem; 
    text-align: center;
}

/* Search Section */
.ads-search-section {
    background: white; 
    border-radius: var(--radius-lg);
    box-shadow: var(--card-shadow); 
    border: 1px solid var(--border-color);
    width: 100%; 
    max-width: 1200px; 
    padding: 1.5rem;
    margin: 1.5rem auto; 
    display: flex; 
    flex-direction: column; 
    justify-content: center;
}
.search-box { 
    display: flex; 
    gap: 0.5rem; 
    margin-bottom: 1rem; 
}
.search-input {
    flex-grow: 1; 
    padding: 0.75rem 1rem; 
    border: 1.5px solid var(--border-color);
    border-radius: 8px; 
    font-size: 1rem;
}
.search-btn {
    background: var(--primary-color); 
    color: white; 
    border: none;
    width: 50px; 
    border-radius: 8px; 
    cursor: pointer;
    display: flex; 
    align-items: center; 
    justify-content: center;
}
.filter-buttons { 
    display: flex; 
    gap: 0.5rem; 
    flex-wrap: wrap; 
}
.filter-btn {
    padding: 0.5rem 1rem; 
    border: 1.5px solid var(--border-color);
    background: white; 
    border-radius: 8px; 
    font-size: 0.9rem;
    color: var(--text-gray); 
    text-decoration: none; 
    display: inline-flex; 
    align-items: center;
}
.filter-btn.active {
    background: var(--primary-color); 
    color: white; 
    border-color: var(--primary-color);
}

/* Layout */
.ads-layout {
    display: grid; 
    grid-template-columns: 678px 320px; /* Жесткая ширина левой колонки под карточку */
    gap: 24px; 
    max-width: 1200px; 
    margin: 0 auto; 
    align-items: start;
}
.ads-main-content { 
    min-width: 0; 
}
.ads-list { 
    display: flex; 
    flex-direction: column; 
    gap: 1rem; 
}

/* Ad Cards (АВТОМАТИЧЕСКАЯ ВЫСОТА БЕЗ ПУСТОТЫ) */
.ad-card {
    background: white; 
    border-radius: var(--radius-lg);
    box-shadow: var(--card-shadow); 
    border: 1px solid var(--border-color);
    overflow: hidden; 
    transition: all 0.3s; 
    display: flex; 
    flex-direction: column;
    
    /* ФИКСИРОВАННАЯ ШИРИНА, АВТО-ВЫСОТА */
    width: 678px !important;
    height: auto !important; /* Убираем жесткую высоту */
    min-height: auto; /* Убираем минимальную высоту, чтобы не было пустоты */
    flex-shrink: 0;
}
.ad-card:hover { 
    transform: translateY(-2px); 
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1); 
}

.ad-image-placeholder {
    /* ЖЕСТКИЕ РАЗМЕРЫ ФОТО ОСТАЮТСЯ */
    width: 657px !important;
    height: 406px !important;
    margin: 11px auto 0; /* Центрируем фото внутри карточки */
    background: linear-gradient(135deg, #E0E7FF 0%, #C7D2FE 100%);
    overflow: hidden; 
    flex-shrink: 0; 
    position: relative; 
    border-radius: 6px;
}
.ad-image-placeholder img { 
    width: 100%; 
    height: 100%; 
    object-fit: cover; 
    display: block; 
}

.ad-content { 
    padding: 1.5rem; 
    flex-grow: 1; /* Позволяет контенту занимать всё доступное пространство */
    display: flex; 
    flex-direction: column; 
}
.ad-title { 
    font-size: 1.25rem; 
    font-weight: 700; 
    margin-bottom: 1rem; 
}
.ad-title a { 
    color: inherit; 
    text-decoration: none; 
}
.ad-title a:hover { 
    color: var(--primary-color); 
}

.ad-description {
    font-size: 0.95rem; 
    color: var(--text-body); 
    line-height: 1.6; 
    margin-bottom: 1.5rem;
    display: -webkit-box; 
    -webkit-line-clamp: 4; /* Ограничиваем описание 4 строками */
    -webkit-box-orient: vertical; 
    overflow: hidden;
}

.ad-meta { 
    margin-top: auto; /* Прижимает мета-данные к низу карточки */
    padding-top: 1rem; 
    border-top: 1px solid var(--border-color); 
    margin-bottom: 1rem; 
}
.ad-contact { 
    display: flex; 
    align-items: center; 
    gap: 0.5rem; 
    font-size: 0.9rem; 
    color: var(--text-gray); 
    margin-bottom: 0.5rem; 
}

.ad-footer { 
    display: flex; 
    justify-content: space-between; 
    font-size: 0.85rem; 
    color: var(--text-light); 
}
.ad-date, .ad-views { 
    display: flex; 
    align-items: center; 
    gap: 0.5rem; 
}

/* Sidebar */
.ads-sidebar { 
    position: sticky; 
    top: 100px; 
    display: flex; 
    flex-direction: column; 
    gap: 16px; 
}
.sidebar-add-block, .sidebar-media-block {
    background: #FFFFFF; 
    border-radius: 12px; 
    padding: 24px;
    border: 0.5px solid #E4E4F0; 
    box-shadow: 0px 2px 10px #DFE8F3;
}
.sidebar-block-title { 
    font-size: 18px; 
    font-weight: 700; 
    margin-bottom: 10px; 
}
.sidebar-block-text { 
    font-size: 14px; 
    color: #6B7280; 
    line-height: 1.5; 
    margin-bottom: 20px; 
}
.sidebar-buttons { 
    display: flex; 
    gap: 10px; 
    flex-wrap: wrap; 
}
.btn-add-ad {
    background: #3B82F6; 
    color: white; 
    border: none; 
    padding: 10px 14px;
    border-radius: 8px; 
    font-weight: 600; 
    font-size: 14px; 
    text-decoration: none;
    display: inline-flex; 
    align-items: center; 
    gap: 6px; 
    flex: 1; 
    justify-content: center;
}
.btn-vk-auth {
    background: white; 
    color: #374151; 
    border: 1px solid #D1D5DB; 
    padding: 10px 14px;
    border-radius: 8px; 
    font-weight: 500; 
    font-size: 14px; 
    cursor: pointer;
    display: inline-flex; 
    align-items: center; 
    gap: 6px; 
    flex: 1; 
    justify-content: center;
}

/* ========================================
   КАТЕГОРИИ И БЛОК РАБОТЫ (ДИЗАЙН КАК НА СКРИНЕ)
   ======================================== */

.categories-section-title {
    font-family: 'Inter Tight', sans-serif;
    font-size: 2.5rem; 
    font-weight: 700;
    color: #1F2937;
    margin-bottom: 2rem;
    text-align: center;
}

.categories-wrapper {
    display: flex !important;
    justify-content: center !important;
    gap: 24px !important;
    margin-bottom: 4rem;
    flex-wrap: wrap;
    width: 100%;
}

/* Сетка категорий: 3 колонки, белый фон */
.categories-grid {
    background: white;
    border-radius: 12px;
    padding: 2rem !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.03);
    border: 1px solid #E4E4F0;
    
    width: 100% !important; 
    max-width: 852px !important;
    flex-shrink: 0;
    
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important; /* Строго 3 колонки */
    column-gap: 2rem;
    row-gap: 0.5rem;
    
    box-sizing: border-box !important;
}

/* Элемент категории */
.category-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0.8rem;
    text-decoration: none;
    color: #313132;
    font-family: 'Inter Tight', sans-serif;
    font-size: 0.95rem;
    transition: all 0.2s;
    border-radius: 6px;
    
    overflow: hidden; 
    white-space: nowrap;
    text-overflow: ellipsis;
    width: 100%;
}

/* Активное состояние (как на скрине "Предприятия") */
.category-item:hover,
.category-item.active {
    background-color: #EFF6FF; /* Светло-голубой фон */
    color: var(--primary-color); /* Синий текст */
}

.category-name {
    font-weight: 400;
    margin-right: 10px;
}

.category-count {
    color: #9CA3AF;
    font-size: 0.9rem;
    font-weight: 400;
    flex-shrink: 0;
}

/* Блок поиска работы */
.work-search-block {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.03);
    border: 1px solid #E4E4F0;
    padding: 2rem;
    
    width: 330px !important; 
    flex-shrink: 0;
    
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.work-search-title {
    font-family: 'Inter Tight', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: #1F2937;
    margin: 0 0 1rem 0;
    line-height: 1.3;
}

.work-search-text {
    font-family: 'Inter Tight', sans-serif;
    font-size: 1rem;
    color: #4B5563;
    margin: 0 0 2rem 0;
    line-height: 1.5;
}

.btn-work-search {
    display: block;
    width: 100%;
    background: white;
    color: var(--primary-color);
    border: 1px solid #BFDBFE; 
    padding: 1rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    text-align: center;
    text-decoration: none;
    transition: all 0.2s;
    box-sizing: border-box;
}

.btn-work-search:hover {
    background: #EFF6FF;
    border-color: var(--primary-color);
}

/* Pagination */
.ads-pagination { 
    margin-top: 2rem; 
    display: flex; 
    justify-content: center; 
}
.pagination { 
    display: flex; 
    gap: 0.5rem; 
    list-style: none; 
    padding: 0; 
}
.page-link {
    padding: 0.5rem 1rem; 
    border: 1px solid var(--border-color);
    background: white; 
    border-radius: 8px; 
    color: var(--text-dark); 
    text-decoration: none;
}
.page-item.active .page-link { 
    background: var(--primary-color); 
    color: white; 
    border-color: var(--primary-color); 
}

/* ========================================
   RESPONSIVE (Адаптивность)
   ======================================== */
@media (max-width: 1250px) {
    .ads-layout { 
        grid-template-columns: 1fr; 
    }
    .ad-card { 
        width: 100% !important; 
        height: auto !important; 
        min-height: auto;
    }
    .ad-image-placeholder { 
        width: 100% !important; 
        height: 250px !important; 
        margin: 0; 
    }
    .ads-sidebar { 
        position: static; 
        flex-direction: row; 
        flex-wrap: wrap; 
        margin-top: 2rem; 
    }
    .sidebar-add-block, .sidebar-media-block { 
        width: 100%; 
        max-width: 488px; 
    }
    
    /* Адаптивность для категорий */
    .categories-wrapper {
        flex-direction: column !important;
        align-items: center !important;
    }
    
    .categories-grid {
        grid-template-columns: repeat(2, 1fr) !important; /* 2 колонки на планшетах */
        padding: 1.5rem !important;
        max-width: 100% !important;
    }
    
    .work-search-block {
        width: 100% !important;
        max-width: 330px;
    }
}

@media (max-width: 768px) {
    .ads-page-title { 
        font-size: 1.5rem; 
    }
    
    .search-box { 
        flex-direction: column; 
    }
    
    .search-btn { 
        width: 100%; 
    }
    
    .filter-buttons { 
        flex-direction: column; 
    }
    
    .filter-btn { 
        width: 100%; 
        text-align: center; 
    }
    
    .categories-grid {
        grid-template-columns: 1fr !important; /* 1 колонка на мобильных */
    }
    
    .ad-footer {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }
    
    .sidebar-buttons { 
        flex-direction: column; 
    }
    
    .btn-add-ad, .btn-vk-auth { 
        width: 100%; 
    }
}