/* Основные стили */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8f9fa;
    color: #333;
}

/* Слайдер */
.carousel-item {
    position: relative;
}

.slider-img {
    height: 400px !important;
    object-fit: cover;
    width: 100%;
    display: block;
}

.carousel-caption {
    background: rgba(0, 0, 0, 0.5);
    padding: 25px;
    border-radius: 10px;
    backdrop-filter: blur(5px);
    top: 50%;
    transform: translateY(-50%);
    left: 5%;
    right: 5%;
    text-align: center;
}

.carousel-caption h2 {
    font-size: 1.8rem;
    margin-bottom: 10px;
}

.carousel-caption p {
    font-size: 1.1rem;
}

/* === Совершенно новый блок категорий === */

/* Основной контейнер */
.new-category-section {
    padding: 2rem 0;
    background-color: #f8f9fa;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.category-title {
    font-size: 2rem;
    font-weight: 700;
    color: #212529;
    margin-bottom: 1.5rem;
    position: relative;
    display: inline-block;
    text-align: center;
    width: 100%;
}

.category-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 4px;
    background: linear-gradient(90deg, #0d6efd, #0dcaf0);
    border-radius: 2px;
}

/* Контейнер для скроллинга */
.category-scroll-container {
    overflow-x: auto;
    overflow-y: hidden;
    padding: 1rem 0;
    scrollbar-width: thin;
    scrollbar-color: #0d6efd #f8f9fa;
}

.category-scroll-container::-webkit-scrollbar {
    height: 8px;
}

.category-scroll-container::-webkit-scrollbar-thumb {
    background: #0d6efd;
    border-radius: 10px;
}

.category-scroll-container::-webkit-scrollbar-track {
    background: #f8f9fa;
    border-radius: 10px;
}

/* Обертка для элементов */
.category-scroll-wrapper {
    display: flex;
    gap: 1rem;
    padding: 0 1rem;
    min-width: 100%;
}

/* Элемент категории */
.category-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 0.5rem;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 110px;
    text-align: center;
    text-decoration: none;
    color: inherit;
}

.category-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 5px 12px rgba(0, 0, 0, 0.1);
    background: linear-gradient(135deg, #ffffff, #f8f9fa);
}

/* Иконка в круге */
.category-icon-circle {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #0d6efd, #0dcaf0);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.5rem;
    transition: transform 0.3s ease;
}

.category-item:hover .category-icon-circle {
    transform: scale(1.1) rotate(10deg);
}

.category-icon-circle i {
    font-size: 1rem;
    color: white;
}

/* Название категории */
.category-name {
    font-size: 0.75rem;
    line-height: 1.3;
    font-weight: 600;
    color: #212529;
    text-align: center;
    word-wrap: break-word;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    margin: 0;
    transition: color 0.2s ease;
}

.category-item:hover .category-name {
    color: #0d6efd;
}

/* Адаптивность для нового блока категорий */
@media (max-width: 768px) {
    .category-scroll-wrapper {
        gap: 0.75rem;
        padding: 0 0.5rem;
    }
    
    .category-item {
        padding: 0.6rem 0.3rem;
        min-width: 95px;
    }
    
    .category-icon-circle {
        width: 35px;
        height: 35px;
        margin-bottom: 0.3rem;
    }
    
    .category-icon-circle i {
        font-size: 0.9rem;
    }
    
    .category-name {
        font-size: 0.65rem;
        -webkit-line-clamp: 2;
    }
}

@media (max-width: 576px) {
    .category-scroll-wrapper {
        gap: 0.5rem;
        padding: 0 0.25rem;
    }
    
    .category-item {
        padding: 0.5rem 0.2rem;
        min-width: 80px;
    }
    
    .category-icon-circle {
        width: 30px;
        height: 30px;
        margin-bottom: 0.2rem;
    }
    
    .category-icon-circle i {
        font-size: 0.8rem;
    }
    
    .category-name {
        font-size: 0.6rem;
        -webkit-line-clamp: 2;
    }
}

/* Карточки компаний */
.company-card {
    transition: all 0.3s ease;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    position: relative;
    overflow: hidden;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.company-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.15);
}

/* Счетчик просмотров компании */
.view-counter-company {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 5px;
    z-index: 1;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.view-counter-company i {
    font-size: 0.9rem;
    margin-right: 2px;
}

/* Компактное отображение информации о компании */
.company-info {
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}

.company-info i {
    font-size: 0.8rem;
    margin-right: 4px;
    min-width: 14px; /* Для выравнивания */
    margin-top: 1px; /* Для лучшего вертикального выравнивания */
}

.company-info .text-truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Категория и тариф сбоку */
.company-info .category-tariff-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

.company-info .category-tariff-row .category-text {
    font-size: 0.8rem;
    flex: 1; /* Занимает все доступное пространство слева */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.company-info .category-tariff-row .tariff-view-container {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-shrink: 0; /* Не сжимается */
}

.company-info .category-tariff-row .badge {
    padding: 3px 6px;
    font-size: 0.7rem;
    margin-right: 0.25rem;
}

.company-info .category-tariff-row .view-count {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.7rem;
}

/* Новости */
.news-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    overflow: hidden;
    position: relative;
    border: 1px solid #e9ecef;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.news-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
    border-color: #dee2e6;
}

.news-card .card-img-top {
    width: 100%;
    height: 200px;
    object-fit: cover;
    transition: transform 0.5s ease;
    border-bottom: 1px solid #e9ecef;
}

.news-card:hover .card-img-top {
    transform: scale(1.02);
}

.news-card .card-body {
    padding: 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

/* Счетчик просмотров */
.view-counter {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 5px;
    z-index: 1;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.view-counter i {
    font-size: 0.9rem;
    margin-right: 2px;
}

.news-card .view-counter {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 5px;
    z-index: 1;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.news-card .view-counter i {
    font-size: 0.9rem;
    margin-right: 2px;
}

.news-card .news-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #212529;
    margin-bottom: 10px;
    line-height: 1.3;
    transition: color 0.2s ease;
    flex-grow: 1;
}

.news-card:hover .news-title {
    color: #0d6efd;
}

.news-card .news-excerpt {
    color: #6c757d;
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 15px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-grow: 1;
}

.news-card .news-date {
    font-size: 0.85rem;
    color: #868e96;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.news-card .news-date i {
    font-size: 0.9rem;
}

.news-card .read-more-btn {
    display: inline-block;
    padding: 8px 20px;
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
    border: 2px solid #0d6efd;
    color: #0d6efd;
    margin-top: auto;
    text-align: center;
}

.news-card .read-more-btn:hover {
    background: #0d6efd;
    color: white;
    transform: translateY(-1px);
}

/* Навигация */
.navbar-brand {
    font-weight: bold;
}

/* Футер */
footer {
    margin-top: 50px;
}

/* Эффекты */
.hover-effect {
    transition: all 0.3s ease;
}

.hover-effect:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

/* Кнопки */
.btn {
    border-radius: 50px;
    padding: 10px 20px;
    font-weight: 500;
}

/* Страница компании */
.company-details {
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* Таблицы */
.table th {
    border-top: none;
}

.table-hover tbody tr:hover {
    background-color: rgba(0, 123, 255, 0.075);
}

/* Баджи */
.badge {
    border-radius: 50px;
    padding: 5px 10px;
    font-size: 0.8em;
}

/* Навигация breadcrumb */
.breadcrumb {
    background-color: transparent;
    padding: 0;
    margin-bottom: 20px;
}

.breadcrumb-item a {
    color: #0d6efd;
}

.breadcrumb-item.active {
    color: #6c757d;
}

/* Счетчик просмотров в админке */
.admin-view-counter {
    background: #0d6efd;
    color: white;
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 0.8rem;
    margin-left: 10px;
}

/* Слайдер новостей */
.news-slider-img {
    height: 266px !important; /* Уменьшена высота на 1/3 (400px -> 266px) */
    object-fit: cover;
    width: 100%;
    display: block;
}

/* Адаптивность для слайдера новостей */
@media (max-width: 768px) {
    .news-slider-img {
        height: 200px !important; /* Уменьшена высота на мобильных устройствах */
    }
}

@media (max-width: 576px) {
    .news-slider-img {
        height: 166px !important; /* Уменьшена высота на самых маленьких устройствах */
    }
}

/* Адаптивность */
@media (max-width: 768px) {
    .category-item {
        min-width: 120px;
        max-width: 160px;
        padding: 10px;
        height: 100px;
    }
    
    .category-item i {
        font-size: 1.2rem;
    }
    
    .category-item .category-name {
        font-size: 0.8rem;
        -webkit-line-clamp: 2;
    }
    
    .company-card, .news-card {
        width: 100% !important;
    }
    
    .carousel-caption {
        padding: 15px;
        top: 40%;
        left: 3%;
        right: 3%;
    }
    
    .carousel-caption h2 {
        font-size: 1.3rem;
    }
    
    .carousel-caption p {
        font-size: 0.9rem;
    }
    
    .slider-img {
        height: 300px !important;
    }
    
    .news-card .card-body {
        padding: 15px;
    }
    
    .news-card .news-title {
        font-size: 1.1rem;
    }
    
    .news-card .news-excerpt {
        font-size: 0.9rem;
        -webkit-line-clamp: 2;
    }
    
    .news-card .news-date {
        font-size: 0.8rem;
    }
    
    .news-card .read-more-btn {
        padding: 8px 20px;
        font-size: 0.9rem;
    }
}

@media (max-width: 576px) {
    .category-item {
        min-width: 100px;
        max-width: 140px;
        padding: 8px;
        height: 90px;
    }
    
    .category-item i {
        font-size: 1rem;
    }
    
    .category-item .category-name {
        font-size: 0.7rem;
        -webkit-line-clamp: 2;
    }
    
    .carousel-caption {
        padding: 10px;
        top: 30%;
        left: 2%;
        right: 2%;
    }
    
    .carousel-caption h2 {
        font-size: 1.1rem;
    }
    
    .carousel-caption p {
        font-size: 0.8rem;
    }
    
    .slider-img {
        height: 250px !important;
    }
    
    .news-card {
        border-radius: 10px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
        height: auto;
    }
    
    .news-card .card-img-top {
        height: 140px;
    }
    
    .news-card .card-body {
        padding: 12px;
    }
    
    .news-card .news-title {
        font-size: 1rem;
    }
    
    .news-card .news-excerpt {
        font-size: 0.85rem;
        -webkit-line-clamp: 2;
    }
    
    .news-card .news-date {
        font-size: 0.75rem;
    }
    
    .news-card .read-more-btn {
        padding: 6px 16px;
        font-size: 0.85rem;
    }
}

/* Стили для улучшения отображения ошибок */
.alert {
    border-radius: 10px;
    margin-bottom: 15px;
}

.form-control-file {
    padding: 10px;
    border: 1px solid #ced4da;
    border-radius: 5px;
    background-color: #fff;
}

/* Стили для карточек изображений */
.card-img-top {
    height: 200px;
    object-fit: cover;
    width: 100%;
}

/* Адаптивность для карточек изображений */
@media (max-width: 768px) {
    .card-img-top {
        height: 150px;
    }
}

@media (max-width: 576px) {
    .card-img-top {
        height: 120px;
    }
}