
/* Контейнер для новостей */
.news-container {
    display: flex;
    flex-wrap: wrap; /* Разрешаем перенос блоков на новую строку */
    gap: 20px;       /* Расстояние между новостями */
    margin-top: 20px;
}

/* Стили отдельной карточки новости */
.post {
    flex: 1 1 calc(33.333% - 20px); /* 3 колонки в ряд с учетом gap */
    min-width: 280px;               /* Минимальная ширина, после которой блок перенесется */
    background: #ffffff;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid #eaeaea;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.03);
    display: flex;
    flex-direction: column;
    justify-content: space-between; /* Ссылка всегда будет внизу */
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.post:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

/* Заголовок внутри новости */
.post h3 {
    font-size: 18px;
    color: #2c3e50;
    margin-top: 0;
    margin-bottom: 10px;
}

/* Ограничение текста (обрезка) */
.post-content p {
    font-size: 14px;
    color: #555;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 4; /* Показываем только 4 строки */
    -webkit-box-orient: vertical;
    overflow: hidden; /* Скрываем остальное */
}

/* Ссылка "Читать полностью" */
.read-more {
    display: inline-block;
    margin-top: 15px;
    color: #2ecc71;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: color 0.2s ease;
}

.read-more:hover {
    color: #27ae60;
    text-decoration: underline;
}

/* Базовый контейнер модалки на весь экран */
.custom-modal {
    display: none;
    position: fixed; /* Фиксируем относительно экрана, а не страницы */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7); /* Темный фон */
    z-index: 9999; /* Поверх футера и всего контента */
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px); /* Размытие заднего фона */
}

/* Белое окошко с контентом */
.modal-content {
    background-color: #fff;
    padding: 30px;
    border-radius: 15px;
    width: 90%;
    max-width: 700px;
    max-height: 85vh; /* Чтобы не вылезало за экран по вертикале */
    overflow-y: auto; /* Если текст очень длинный, появится прокрутка внутри модалки */
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    position: relative;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

#closeReadModal {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
    color: #333;
    transition: 0.2s;
}

#closeReadModal:hover {
    color: #ff4757;
}

.read-more-btn {
    background-color: #2ecc71; /* Основной синий цвет сайта */
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.3s ease, transform 0.2s ease;
    display: inline-block;
    margin-top: 10px;
    text-decoration: none;
}

.read-more-btn:hover {
    background-color: #2980b9; /* Цвет чуть темнее при наведении */
    transform: translateY(-2px); /* Легкий подъем */
}

.read-more-btn:active {
    transform: translateY(0);
}

.post-image {
    float: right;
    width: 200px; /* Оптимальный размер */
    height: 150px;
    object-fit: cover; /* Обрезает картинку под размер без искажения */
    margin-left: 20px;
    margin-bottom: 10px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* Очистка обтекания, чтобы кнопки не уплывали */
.post::after {
    content: "";
    display: table;
    clear: both;
}

/* Картинка в ленте новостей */
.post-image-preview {
    float: right;
    width: 220px;
    height: 160px;
    object-fit: cover;
    margin-left: 20px;
    margin-bottom: 10px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* Очистка обтекания (чтобы кнопка "Читать" не уехала вверх) */
.post::after {
    content: "";
    display: table;
    clear: both;
}

/* Картинка внутри модального окна */
.modal-full-image {
    width: 100%;
    max-height: 400px;
    object-fit: contain;
    margin-bottom: 20px;
    border-radius: 12px;
    display: block;
}

/* Дополнительно к вашим стилям */
.custom-modal input[type="text"] {
    box-sizing: border-box; /* Чтобы padding не раздувал ширину */
}

/* Центрирование при открытии */
#adModal {
    display: none; /* Скрыто по умолчанию */
}

/* Компактное превью картинки для рекламы */
.ad-preview-container {
    width: 100%;
    max-width: 300px; /* Ограничиваем максимальную ширину */
    height: 120px;    /* Фиксированная высота для аккуратности */
    margin: 10px auto;
    border: 2px dashed #ddd;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background-color: #f8f9fa;
}

.ad-preview-container img {
    width: 100%;
    height: 100%;
    object-fit: contain; /* Картинка впишется в блок без обрезки */
}

/* Стиль для картинок в самой таблице админки */
.table-ad-img {
    width: 80px;
    height: 50px;
    object-fit: cover;
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

