/* ==========================================================================
   БАЗОВЫЕ НАСТРОЙКИ СТРАНИЦЫ И ШАПКИ
   ========================================================================== */
body {
    margin: 0;
    padding: 0;
    background-color: #f3f4f6;
    font-family: Arial, sans-serif;
}
.site-header {
    width: 100%;
    background: #fff;
}
.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
    box-sizing: border-box;
}

/* 1. Верхний рекламный блок */
.header-top-bar {
    background-color: #8c9ba5;
    color: #ffffff;
    text-align: center;
    padding: 12px 0;
    font-size: 14px;
    font-weight: bold;
    letter-spacing: 1px;
}

/* 2. Средняя панель (Main Bar) */
.header-main-bar {
    padding: 20px 0;
    background-color: #ffffff;
}
.main-bar-flex {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 30px;
}

/* Логотип */
.header-logo img {
    display: block;
    max-height: 85px;
    width: auto;
}

/* Поисковая строка */
.header-search-wrapper {
    flex-grow: 1;
    max-width: 550px;
}
.header-search-form {
    width: 100%;
    margin: 0;
}
.search-input-field {
    position: relative;
    display: flex;
    align-items: center;
}
.search-field {
    width: 100%;
    padding: 12px 45px 12px 15px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 14px;
    color: #333;
    outline: none;
    box-sizing: border-box;
}
.search-submit {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    cursor: pointer;
    color: #444;
    padding: 0;
    display: flex;
    align-items: center;
}
.search-meta {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    font-size: 11px;
    color: #8a8a8a;
}
.search-example a {
    color: #8a8a8a;
    text-decoration: underline;
}
.advanced-search-link {
    color: #dfb50d;
    text-decoration: underline;
    font-weight: bold;
}

/* Действия (Вход / Кнопка) */
.header-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
}
.user-auth-links {
    font-size: 13px;
    color: #333;
    display: flex;
    align-items: center;
    gap: 5px;
}
.user-auth-links a {
    color: #333;
    text-decoration: none;
}
.btn-add-ad {
    display: inline-flex;
    align-items: center;
    background-color: #f1c40f;
    color: #000000;
    padding: 10px 22px;
    border-radius: 4px;
    text-decoration: none;
    font-weight: bold;
    font-size: 14px;
    transition: background 0.2s ease;
}
.btn-add-ad:hover {
    background-color: #dfb50d;
}
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.1);
    border-radius: 50%;
    width: 18px;
    height: 18px;
    margin-right: 8px;
    font-size: 12px;
}

/* 3. Меню навигации */
.header-nav-bar {
    background-color: #8c9ba5;
}
.main-navigation-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: space-between;
}
.main-navigation-menu li a {
    display: block;
    padding: 14px 10px;
    color: #ffffff;
    text-decoration: none;
    font-size: 14px;
    text-align: center;
}
.main-navigation-menu li a:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* ==========================================================================
   ТРЕХКОЛОНОЧНЫЙ СТРУКТУРНЫЙ МАКЕТ
   ========================================================================== */
.main-layout-wrapper {
    display: grid;
    grid-template-columns: 250px 1fr 250px;
    gap: 20px;
    margin-top: 20px;
    margin-bottom: 40px;
}

/* Стили блоков боковых панелей */
.widget-block {
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    padding: 15px;
    margin-bottom: 20px;
    box-sizing: border-box;
}
.widget-block h3 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 16px;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 8px;
    color: #333;
}
.widget-more-link {
    display: block;
    text-align: right;
    font-size: 12px;
    color: #dfb50d;
    text-transform: uppercase;
    text-decoration: underline;
    font-weight: bold;
}

/* Левый блок: Новости и Опрос */
.news-list {
    list-style: none;
    padding: 0;
    margin: 0 0 15px 0;
}
.news-list li {
    margin-bottom: 10px;
    font-size: 13px;
    line-height: 1.4;
}
.news-list li a {
    color: #4b5563;
    text-decoration: none;
}
.news-list li a:hover {
    text-decoration: underline;
}
.poll-question {
    font-size: 13px;
    font-weight: bold;
    margin-bottom: 10px;
}
.poll-form label {
    display: block;
    font-size: 13px;
    margin-bottom: 6px;
    cursor: pointer;
}

/* Центр: Сетка объявлений */
.ads-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}
.ad-card {
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.ad-image-placeholder {
    background: #e5e7eb;
    height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
    font-size: 14px;
}
.ad-card-body {
    padding: 12px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex-grow: 1;
}
.ad-title {
    margin: 0 0 8px 0;
    font-size: 14px;
    line-height: 1.3;
}
.ad-title a {
    color: #1f2937;
    text-decoration: none;
}
.ad-price {
    margin: 0;
    font-weight: bold;
    color: #111827;
    font-size: 15px;
}

/* Пагинация */
.site-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 5px;
    margin-top: 30px;
    padding: 10px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    background: #fff;
}
.page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 6px;
    border-radius: 3px;
    font-size: 14px;
    color: #333;
    text-decoration: none;
    box-sizing: border-box;
}
a.page-numbers:hover {
    background-color: #f3f4f6;
}
.page-numbers.current {
    background: #e5e7eb;
    font-weight: bold;
}
.page-numbers.dots {
    border: none;
    background: none;
}

/* Правый блок: Реклама */
.banner-dynamic {
    min-height: 300px;
    background: #f9fafb;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    border: 2px dashed #9ca3af;
    color: #6b7280;
    font-weight: bold;
}
.counter-block {
    text-align: center;
    color: #6b7280;
}

/* Адаптивный дизайн */
@media (max-width: 1024px) {
    .main-layout-wrapper {
        grid-template-columns: 1fr;
    }
    .sidebar-left, .sidebar-right {
        order: 2;
    }
    .main-content-center {
        order: 1;
    }
}
@media (max-width: 768px) {
    .main-bar-flex {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    .header-actions {
        align-items: center;
    }
}
@media (max-width: 640px) {
    .ads-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (max-width: 480px) {
    .ads-grid {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   БЛОК: ВИДЕО ОТ ПАРТНЕРОВ
   ========================================================================== */
.partners-video-section {
    margin-top: 40px;
    margin-bottom: 60px;
}

.partners-video-section .section-title {
    font-size: 20px;
    font-weight: bold;
    color: #333;
    margin-bottom: 20px;
    padding-bottom: 8px;
    border-bottom: 2px solid #8c9ba5; /* Тот самый серый цвет из шапки */
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Сетка для 3-х видео */
.video-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

/* Карточка видео */
.video-card {
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    overflow: hidden;
    padding: 10px;
    box-sizing: border-box;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

/* Адаптивный контейнер для iframe (сохраняет пропорции 16:9) */
.video-embed-wrapper {
    position: relative;
    padding-bottom: 56.25%; /* Пропорции 16:9 */
    height: 0;
    overflow: hidden;
    background: #000;
    border-radius: 2px;
}

.video-embed-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* Заголовок под видео */
.video-title {
    margin: 12px 0 5px 0;
    font-size: 14px;
    line-height: 1.4;
}

.video-title a {
    color: #1f2937;
    text-decoration: none;
}

.video-title a:hover {
    color: #dfb50d; /* Желтый акцент при наведении */
    text-decoration: underline;
}

/* Адаптивность для планшетов и мобилок */
@media (max-width: 900px) {
    .video-grid {
        grid-template-columns: repeat(2, 1fr); /* По 2 в ряд */
    }
}

@media (max-width: 600px) {
    .video-grid {
        grid-template-columns: 1fr; /* По 1 в ряд на смартфонах */
    }
}

/* ==========================================================================
   ПОДВАЛ САЙТА (FOOTER)
   ========================================================================== */
.site-footer {
    background-color: #8c9ba5; /* Тот самый серый цвет из верхней панели */
    width: 100%;
    padding: 15px 0;
    margin-top: 30px;
    box-sizing: border-box;
}

.footer-links-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    flex-wrap: wrap; /* Чтобы на мобилках ссылки аккуратно переносились */
    gap: 0; /* Управляем отступами через внутренние поля элементов */
}

.footer-links-menu li {
    display: inline-flex;
    align-items: center;
    position: relative;
}

/* Оформление ссылок */
.footer-links-menu li a {
    color: #ffffff;
    text-decoration: none;
    font-size: 14px;
    padding: 5px 15px;
    transition: color 0.2s ease, background-color 0.2s ease;
}

.footer-links-menu li a:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

/* Добавляем разделительные вертикальные палочки (|) между пунктами */
.footer-links-menu li:not(:last-child)::after {
    content: "|";
    color: rgba(255, 255, 255, 0.5); /* Полупрозрачная белая палочка */
    font-size: 14px;
    pointer-events: none;
}

/* Адаптивность для мобильных экранов */
@media (max-width: 768px) {
    .site-footer {
        padding: 20px 0;
    }
    .footer-links-menu {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }
    /* Скрываем вертикальные палочки на мобилках, так как меню станет вертикальным */
    .footer-links-menu li:not(:last-child)::after {
        display: none;
    }
    .footer-links-menu li a {
        padding: 8px 20px;
        text-align: center;
        width: 100%;
    }
}

/* ==========================================================================
   СТРАНИЦА НОВОСТЕЙ
   ========================================================================== */
.page-main-title {
    font-size: 24px;
    color: #333;
    margin-top: 0;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #8c9ba5;
    text-transform: uppercase;
}

.news-loop-container {
    display: flex;
    flex-direction: column;
    gap: 15px; /* Отступы между карточками новостей */
}

/* Прямоугольная карточка новости */
.news-row-card {
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    padding: 20px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: box-shadow 0.2s ease;
}

.news-row-card:hover {
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

/* Дата */
.news-row-date {
    font-size: 12px;
    color: #8a8a8a;
    background: #e5e7eb;
    padding: 3px 8px;
    border-radius: 3px;
    font-weight: bold;
}

/* Заголовок внутри карточки */
.news-row-title {
    margin: 5px 0;
    font-size: 18px;
    line-height: 1.3;
}

.news-row-title a {
    color: #1f2937;
    text-decoration: none;
}

.news-row-title a:hover {
    color: #dfb50d;
}

/* Текст начала новости */
.news-row-excerpt {
    font-size: 14px;
    color: #4b5563;
    line-height: 1.5;
}
.news-row-excerpt p {
    margin: 0;
}

/* ==========================================================================
   ДИНАМИЧЕСКИЕ НОВОСТИ В ЛЕВОМ САЙДБАРЕ
   ========================================================================== */
.sidebar-news-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 15px;
}

/* Карточка отдельной маленькой новости */
.sidebar-news-item {
    border-bottom: 1px dashed #e5e7eb;
    padding-bottom: 12px;
}

.sidebar-news-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

/* Дата новости сверху */
.sidebar-news-date {
    display: inline-block;
    font-size: 11px;
    color: #8a8a8a;
    font-weight: bold;
    margin-bottom: 4px;
}

/* Заголовок новости */
.sidebar-news-title {
    margin: 0 0 6px 0;
    font-size: 14px;
    line-height: 1.3;
}

.sidebar-news-title a {
    color: #1f2937;
    text-decoration: none;
    transition: color 0.2s ease;
}

.sidebar-news-title a:hover {
    color: #dfb50d;
    text-decoration: underline;
}

/* Короткий текст отрывка */
.sidebar-news-excerpt {
    font-size: 12px;
    color: #6b7280;
    line-height: 1.4;
    word-break: break-word; /* Принудительно переносит слишком длинные слова, если они не влезают */
}

.no-news {
    font-size: 13px;
    color: #9ca3af;
    margin: 0;
}

/* ==========================================================================
   СТРАНИЦА ЧТЕНИЯ ОТДЕЛЬНОЙ НОВОСТИ (SINGLE.PHP)
   ========================================================================== */
.single-post-article {
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    padding: 30px;
    box-sizing: border-box;
}

.single-post-meta {
    margin-bottom: 10px;
}

/* Стилизация вывода контента */
.text-styled p {
    font-size: 15px;
    line-height: 1.6;
    color: #333333;
    margin-top: 0;
    margin-bottom: 16px;
}

.text-styled p:last-child {
    margin-bottom: 0;
}

/* ==========================================================================
   ВКЛАДКА СТАТЬИ
   ========================================================================== */

/* Верхняя панель (Заголовок + Поиск) */
.articles-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #8c9ba5;
    padding-bottom: 10px;
    margin-bottom: 20px;
    gap: 20px;
}

.articles-header-bar .articles-title {
    border-bottom: none;
    margin: 0;
}

/* Форма поиска статей */
.articles-search-box {
    width: 100%;
    max-width: 300px;
}

.articles-search-form {
    position: relative;
    display: flex;
    align-items: center;
}

.articles-search-form .search-field {
    padding: 8px 35px 8px 12px;
    font-size: 13px;
}

.articles-search-form .search-submit {
    right: 10px;
}

/* Карточка статьи (Флексбакс для разделения контента и даты) */
.article-row-card {
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    padding: 20px;
    box-sizing: border-box;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 15px;
    transition: box-shadow 0.2s ease;
}

.article-row-card:hover {
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.article-row-main {
    flex-grow: 1;
}

/* Заголовок статьи */
.article-row-title {
    margin: 0 0 8px 0;
    font-size: 18px;
    line-height: 1.3;
}

.article-row-title a {
    color: #1f2937;
    text-decoration: none;
}

.article-row-title a:hover {
    color: #dfb50d;
}

/* Текст статьи */
.article-row-excerpt {
    font-size: 14px;
    color: #4b5563;
    line-content: 1.5;
    word-break: break-word;
}

/* Дата справа */
.article-row-meta {
    flex-shrink: 0;
    text-align: right;
}

.article-row-date {
    font-size: 12px;
    color: #8a8a8a;
    background: #e5e7eb;
    padding: 4px 10px;
    border-radius: 3px;
    font-weight: bold;
    white-space: nowrap;
}

/* Адаптив под мобилки */
@media (max-width: 640px) {
    .articles-header-bar {
        flex-direction: column;
        align-items: flex-start;
    }
    .articles-search-box {
        max-width: 100%;
    }
    .article-row-card {
        flex-direction: column;
    }
    .article-row-meta {
        align-self: flex-start;
        margin-top: 5px;
    }
}

/* ==========================================================================
   СТРАНИЦА "О ПРОЕКТЕ"
   ========================================================================== */
.about-project-card {
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    padding: 30px;
    box-sizing: border-box;
}

.about-project-content p {
    font-size: 15px;
    line-height: 1.6;
    color: #2c3e50;
    margin-top: 0;
    margin-bottom: 18px;
    text-align: justify; /* Делает выравнивание текста по ширине */
}

.about-project-content p:last-child {
    margin-bottom: 0;
    font-size: 16px;
    color: #dfb50d; /* Выделим финальное приветствие фирменным цветом */
}

/* ==========================================================================
   МОДАЛЬНОЕ ОКНО БЕЗ JS (ЧЕКБОКС-ХАК)
   ========================================================================== */

/* Полностью скрываем технические чекбоксы, они нужны только для логики */
.modal-checkbox, 
.form-checkbox {
    display: none !important;
}

/* Стилизация основной кнопки «Вход и регистрация» */
.auth-open-btn {
    background-color: #2e7d32;
    color: #ffffff;
	display: inline-flex;
    align-items: center;
    padding: 10px 22px;
    border-radius: 4px;
    text-decoration: none;
    font-weight: bold;
    font-size: 14px;
    transition: background 0.2s ease;
}

.auth-open-btn:hover {
    background-color: #005177;
}

/* Базовое состояние темного фона модалки — скрыто */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 99999;
    justify-content: center;
    align-items: center;
}

/* ЛОГИКА ОТКРЫТИЯ: если главный чекбокс активен -> показываем оверлей */
.modal-checkbox:checked ~ .modal-overlay {
    display: flex;
}

/* Белое диалоговое окно */
.modal-content {
    background: #ffffff;
    padding: 40px 30px 30px 30px;
    border-radius: 8px;
    width: 100%;
    max-width: 400px;
    position: relative;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.25);
    font-family: Arial, sans-serif;
    box-sizing: border-box;
}

/* Кнопка закрытия (крестик) */
.modal-close {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
    color: #666666;
    transition: color 0.2s ease;
}

.modal-close:hover {
    color: #000000;
}

.modal-title {
    margin: 0 0 20px 0;
    font-size: 24px;
    color: #333333;
    text-align: center;
}

/* Стилизация формы */
.auth-form {
    display: flex;
    flex-direction: column;
}

.form-group {
    margin-bottom: 18px;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-weight: bold;
    font-size: 14px;
    color: #444444;
}

.form-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #cccccc;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
    outline: none;
}

.form-input:focus {
    border-color: #0073aa;
}

/* Главная кнопка отправки формы */
.submit-btn {
    background-color: #dfb50d;
    color: #ffffff;
    padding: 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    margin-top: 10px;
    transition: background 0.2s ease;
}

.submit-btn:hover {
    background-color: #005177;
}

/* Элементы под основной кнопкой */
.auth-actions {
    text-align: center;
    margin-top: 20px;
}

.forgot-pass-link {
    display: inline-block;
    color: #dfb50d;
    text-decoration: none;
    font-size: 14px;
    margin-bottom: 15px;
}

.forgot-pass-link:hover {
    text-decoration: underline;
}

.modal-divider {
    border: 0;
    border-top: 1px solid #eeeeee;
    margin: 15px 0;
}

.switch-text {
    margin: 0;
    font-size: 14px;
    color: #666666;
}

/* Текстовые ссылки-переключатели форм */
.switch-btn {
    color: #dfb50d;
    cursor: pointer;
    font-weight: bold;
    text-decoration: underline;
}

.switch-btn:hover {
    color: #005177;
}

/* ==========================================================================
   ЛОГИКА ПЕРЕКЛЮЧЕНИЯ ФОРМ (ВХОД / РЕГИСТРАЦИЯ)
   ========================================================================== */

/* По умолчанию: Вход активен, Регистрация скрыта */
.login-form-container { display: block; }
.register-form-container { display: none; }

/* Если внутренний чекбокс нажат -> меняем их местами */
.form-checkbox:checked ~ .login-form-container {
    display: none;
}

.form-checkbox:checked ~ .register-form-container {
    display: block;
}

/* Дополнительные стили сообщений для модального окна */
.auth-msg-box {
    padding: 12px;
    border-radius: 4px;
    margin-bottom: 15px;
    font-size: 14px;
    text-align: center;
    font-family: Arial, sans-serif;
    font-weight: 500;
}

/* Красная плашка - для неверного пароля и ошибок */
.auth-msg-box.status-error {
    background-color: #ffebee;
    color: #c62828;
    border: 1px solid #ffcdd2;
}

/* Зеленая плашка - для фразы "Проверьте почту" */
.auth-msg-box.status-success {
    background-color: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
}

/* Серая плашка во время загрузки запроса */
.auth-msg-box.status-loading {
    background-color: #f5f5f5;
    color: #616161;
    border: 1px solid #e0e0e0;
}

/* Ссылки-переключатели вместо прошлых кнопок-лейблов */
.switch-link {
    color: #0073aa;
    text-decoration: underline;
    font-weight: bold;
    cursor: pointer;
}
.switch-link:hover {
    color: #005177;
}

/* Сообщения */
.auth-msg-box {
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 15px;
    font-size: 14px;
    text-align: center;
    font-family: sans-serif;
}
.auth-msg-box.status-error { background: #ffebee; color: #c62828; border: 1px solid #ffcdd2; }
.auth-msg-box.status-success { background: #e8f5e9; color: #2e7d32; border: 1px solid #c8e6c9; }
.auth-msg-box.status-loading { background: #f5f5f5; color: #616161; }

.switch-link { color: #0073aa; text-decoration: underline; font-weight: bold; cursor: pointer; }
.switch-link:hover { color: #005177; }