/* ==========================================================================
   1. СЕТКА НОВОСТЕЙ НА ГЛАВНОЙ (3 колонки)
   ========================================================================== */
.news-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    margin-bottom: 20px;
}

/* Стили карточки ТОЛЬКО для главной (внутри .news-grid) */
.news-grid .news-card {
    background: #ffffff;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column; /* Картинка сверху, текст снизу */
    height: 100%;
    text-decoration: none;
    border: 1px solid #f0f0f0;
}

.news-grid .news-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    text-decoration: none;
    border-color: #1e6091;
}

.news-grid .news-card-img-wrapper {
    width: 100%;
    height: 180px; /* Было 220px, стало 180px (компактнее) */
    overflow: hidden;
    background-color: #f8f9fa;
}

.news-grid .news-card-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.news-grid .news-card:hover .news-card-img-wrapper img {
    transform: scale(1.08);
}

.news-grid .news-card-body {
    padding: 25px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.news-grid .news-card-date {
    font-size: 0.85rem;
    color: #888;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.news-grid .news-card-date i {
    color: #1e6091;
}

.news-grid .news-card-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 15px;
    line-height: 1.4;
    transition: color 0.3s ease;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.news-grid .news-card:hover .news-card-title {
    color: #1e6091;
}

.news-grid .news-card-link {
    display: inline-flex;
    align-items: center;
    font-size: 0.9rem;
    font-weight: 600;
    color: #0056b3;
    text-decoration: none;
    transition: color 0.3s ease;
    margin-top: auto;
}

.news-grid .news-card-link:hover {
    color: #0d1f2d;
}

.news-grid .news-card-link::after {
    content: "\F138";
    font-family: "bootstrap-icons";
    margin-left: 5px;
    font-size: 0.8rem;
    transition: transform 0.3s ease;
}

.news-grid .news-card-link:hover::after {
    transform: translateX(5px);
}

.btn-view-all-news {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: #1e6091;
    color: #ffffff !important;
    padding: 12px 35px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 1rem;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(30, 96, 145, 0.3);
    margin-top: 20px;
}

.btn-view-all-news:hover {
    background-color: #0d1f2d;
    color: #ffffff !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(13, 31, 45, 0.4);
    text-decoration: none;
}

/* ==========================================================================
   2. ПАГИНАЦИЯ (Круглые кнопки)
   ========================================================================== */
body:not(.page-admin) .pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    list-style: none;
    padding: 0;
    margin: 0;
    flex-wrap: wrap;
}

body:not(.page-admin) .pagination .page-item .page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 45px;
    height: 45px;
    padding: 0;
    border-radius: 50%;
    border: 1px solid #e9ecef;
    color: #1e6091;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    background: #fff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.03);
}

body:not(.page-admin) .pagination .page-item .page-link:hover {
    background: #f0f4f8;
    border-color: #1e6091;
    color: #0d1f2d;
    transform: translateY(-2px);
}

body:not(.page-admin) .pagination .page-item.active .page-link {
    background: #1e6091;
    border-color: #1e6091;
    color: #fff;
    box-shadow: 0 4px 10px rgba(30, 96, 145, 0.3);
}

body:not(.page-admin) .pagination .page-item.disabled .page-link {
    color: #ccc;
    background: #f8f9fa;
    border-color: #e9ecef;
    cursor: not-allowed;
    box-shadow: none;
}

/* ==========================================================================
   3. СТРАНИЦА ПРОСМОТРА НОВОСТИ (view.php)
   ========================================================================== */
.news-article-card {
    background: #fff;
    padding: 35px;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
    margin-bottom: 30px;
    border-top: 5px solid #1e6091;
}

.news-article-title {
    font-size: 2rem;
    font-weight: 800;
    color: #1a2b4c;
    margin-bottom: 15px;
    line-height: 1.3;
}

.news-article-meta {
    font-size: 0.9rem;
    color: #7a8899;
    display: flex;
    align-items: center;
    gap: 20px;
    padding-bottom: 20px;
    margin-bottom: 30px;
    border-bottom: 1px dashed #dee2e6;
}

.news-article-meta i {
    color: #1b7bf2;
    margin-right: 5px;
}

.news-article-image {
    margin-bottom: 25px;
    text-align: center;
}

.news-article-image img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.news-article-content {
    font-size: 1.05rem;
    line-height: 1.8;
    color: #333;
}

.news-article-content p {
    margin-bottom: 15px;
    text-align: justify;
}

.news-article-content ul,
.news-article-content ol {
    margin-bottom: 15px;
    padding-left: 25px;
}

.news-article-content li {
    margin-bottom: 5px;
}

/* Таблицы внутри статьи */
.news-article-content table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 25px 0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    border: 1px solid #edf0f5;
}

.news-article-content table th {
    background-color: #f4f7f9;
    color: #1a2b4c;
    font-weight: 700;
    padding: 15px 20px;
    border-bottom: 2px solid #e1e8ed;
    text-align: left;
}

.news-article-content table td {
    padding: 15px 20px;
    border-bottom: 1px solid #edf0f5;
    color: #334155;
    background-color: #ffffff;
}

.news-article-content table tr:nth-child(even) td {
    background-color: #fafbfc;
}

.news-article-content table tr:last-child td {
    border-bottom: none;
}

/* Ссылки и кнопки скачивания внутри статьи */
.news-article-content a[href*="download"],
.news-article-content a[href*="getdoc"] {
    display: inline-flex;
    align-items: center;
    background-color: #1b7bf2;
    color: #ffffff !important;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none !important;
    margin: 10px 0;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(27, 123, 242, 0.2);
}

.news-article-content a[href*="download"]:hover,
.news-article-content a[href*="getdoc"]:hover {
    background-color: #155cb5;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(27, 123, 242, 0.3);
}

.news-article-content a[href*="download"]::before,
.news-article-content a[href*="getdoc"]::before {
    content: "\F30A";
    font-family: "bootstrap-icons";
    margin-right: 8px;
    font-size: 1rem;
}

.news-article-content a:not([href*="download"]):not([href*="getdoc"]) {
    color: #1e6091;
    text-decoration: underline;
    transition: color 0.3s ease;
}

.news-article-content a:not([href*="download"]):not([href*="getdoc"]):hover {
    color: #0d1f2d;
}

/* ==========================================================================
   4. САЙДБАР "ІНШІ НОВИНИ"
   ========================================================================== */
.news-sidebar {
    background: #ffffff;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.04);
    border: 1px solid #edf0f5;
    position: sticky;
    top: 120px;
}

.news-sidebar-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: #1a2b4c;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f4f8;
    position: relative;
}

.news-sidebar-title::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 60px;
    height: 2px;
    background: #1b7bf2;
}

.sidebar-news-item {
    display: flex;
    gap: 15px;
    padding: 15px 0;
    border-bottom: 1px solid #f0f4f8;
    text-decoration: none;
    transition: all 0.3s ease;
}

.sidebar-news-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.sidebar-news-img {
    width: 70px;
    height: 70px;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    background: #f8f9fa;
}

.sidebar-news-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.sidebar-news-item:hover .sidebar-news-img img {
    transform: scale(1.1);
}

.sidebar-news-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #334155;
    margin-bottom: 6px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.3s ease;
}

.sidebar-news-item:hover .sidebar-news-title {
    color: #1b7bf2;
}

.sidebar-news-date {
    font-size: 0.8rem;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Кнопка "Всі новини" */
.btn-all-news {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 12px;
    background-color: #f1f5f9;
    color: #1b7bf2 !important;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none !important;
    transition: all 0.3s ease;
    margin-top: 20px;
    border: 1px solid #e2e8f0;
}

.btn-all-news:hover {
    background-color: #1b7bf2;
    color: #ffffff !important;
    border-color: #1b7bf2;
    box-shadow: 0 4px 12px rgba(27, 123, 242, 0.25);
    transform: translateY(-2px);
}

/* ==========================================================================
   5. ЛЕНТА НОВОСТЕЙ СПИСКОМ (views/site/news.php)
   ========================================================================== */
.news-list {
    display: flex;
    flex-direction: column;
    gap: 30px;
    margin-bottom: 40px;
}

/* Стили карточки ТОЛЬКО для ленты (внутри .news-list) */
.news-list .news-card {
    display: flex;
    flex-direction: row; /* Картинка слева, текст справа */
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid #edf0f5;
    text-decoration: none;
}

.news-list .news-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
}

.news-list .news-card-img-wrapper {
    flex-shrink: 0;
    width: 320px;
    min-width: 320px;
    height: auto;
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f8f9fa;
}

.news-list .news-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.news-list .news-card:hover .news-card-img {
    transform: scale(1.06);
}

.news-list .news-card-body {
    padding: 25px 35px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    justify-content: space-between;
    min-width: 0;
}

.news-list .news-card-meta {
    font-size: 0.85rem;
    color: #7a8899;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.news-list .news-date {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.news-list .news-card-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 12px;
    line-height: 1.3;
}

.news-list .news-card-title a {
    color: #1a2b4c;
    text-decoration: none;
    transition: color 0.2s;
}

.news-list .news-card-title a:hover {
    color: #1b7bf2;
}

.news-list .news-card-desc {
    color: #5a6b7c;
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 20px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.news-list .news-card-desc p {
    margin-bottom: 0;
}

.news-list .news-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #f0f4f8;
    padding-top: 15px;
    margin-top: auto;
    width: 100%;
    flex-wrap: wrap;
    gap: 10px;
}

.news-list .news-views {
    font-size: 0.85rem;
    color: #8b9aab;
    display: flex;
    align-items: center;
    gap: 5px;
}

.news-list .news-read-more {
    font-weight: 600;
    font-size: 0.9rem;
    color: #1b7bf2;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: gap 0.2s;
}

.news-list .news-read-more:hover {
    gap: 12px;
}

/* ==========================================================================
   6. АДМИНКА (Превью картинки)
   ========================================================================== */
.news-image-container {
    max-width: 600px;
    width: 100%;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 10px;
    background-color: #f8f9fa;
    display: flex;
    justify-content: center;
}

.news-image-preview {
    max-width: 100%;
    max-height: 350px;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 4px;
}

/* ==========================================================================
   7. АДАПТИВНОСТЬ
   ========================================================================== */
@media (max-width: 992px) {
    .news-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .news-list .news-card-img-wrapper {
        width: 280px;
        min-width: 280px;
    }
    .news-list .news-card-body {
        padding: 20px 25px;
    }
    .news-list .news-card-title {
        font-size: 1.15rem;
    }
}

@media (max-width: 768px) {
    .news-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    .news-list .news-card {
        flex-direction: column;
    }
    .news-list .news-card-img-wrapper {
        width: 100%;
        min-width: 100%;
        height: 200px;
    }
    .news-list .news-card-body {
        padding: 20px;
    }
    .news-list .news-card-title {
        font-size: 1.15rem;
    }
    .news-article-card {
        padding: 20px;
    }
    .news-article-title {
        font-size: 1.5rem;
    }
    .news-article-content table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
}