:root {
    --primary-text-color: #222;
    --secondary-text-color: white;
    --background-dark: #222;
    --background-light: #f4f4f4;
    --transition-speed: 0.3s ease;
}

body {
    font-family: 'Open Sans', Arial, sans-serif;
    background: url('../images/NewFon.jpg') no-repeat center center fixed; /* Перевірте розширення файлу */
    background-size: cover;
    margin: 0;
    padding: 0;
    color: white;
    overflow-x: hidden;
}

/* --- Navigation Styles --- */
nav {
    background-color: var(--background-dark);
    padding: 10px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between; /* Розносимо елементи по краях */
    flex-wrap: nowrap; /* Запобігаємо перенесенню елементів на великих екранах */
    position: sticky; /* Фіксована навігація */
    top: 0;
    width: 100%;
    box-sizing: border-box;
    z-index: 990;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

/* Кнопка-бургер */
.hamburger-menu {
    display: none; /* Приховуємо за замовчуванням на великих екранах */
    background: none;
    border: none;
    font-size: 24px;
    color: white;
    cursor: pointer;
    padding: 10px;
    order: -1; /* Розміщуємо зліва на мобільних */
}

/* Група посилань навігації */
.nav-links-group {
    display: flex; /* За замовчуванням завжди flex для десктопу */
    gap: 15px;
    flex-wrap: wrap; /* Дозволяємо перенесення на новий рядок, якщо не влазять */
    justify-content: center;
    flex-grow: 1; /* Дозволяє займати доступний простір */
}

nav a {
    color: var(--secondary-text-color);
    text-decoration: none;
    font-weight: bold;
    padding: 8px 12px;
    border-radius: 5px;
    transition: color var(--transition-speed), text-shadow var(--transition-speed), background-color var(--transition-speed), box-shadow var(--transition-speed);
    white-space: nowrap; /* Запобігаємо перенесенню тексту посилання */
}

nav a:hover {
    text-decoration: none;
    color: #ccc;
    text-shadow: 0 0 8px #ccc;
}

nav a.active-link { /* Змінено на active-link для уніфікації */
    background-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 20px 8px rgba(255, 255, 255, 0.4);
    border-radius: 20px;
}

/* --- Language Switcher Styles --- */
.language-switcher {
    display: flex;
    gap: 10px;
}

.language-button {
    background: transparent;
    border: none;
    color: white;
    padding: 8px 12px;
    cursor: pointer;
    border-radius: 5px;
    font-weight: bold;
    text-shadow: none;
    transition: color var(--transition-speed), text-shadow var(--transition-speed), background-color var(--transition-speed), box-shadow var(--transition-speed);
}

.language-button:hover {
    color: #ccc;
    text-shadow: 0 0 8px #ccc;
}

.language-button.active {
    background-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 20px 8px rgba(255, 255, 255, 0.4);
    border-radius: 20px;
}

main {
    padding: 30px 20px;
    max-width: 900px;
    margin: 100px auto 0 auto; /* Збільшено відступ зверху, щоб врахувати фіксовану навігацію */
}

h1 {
    color: white;
    text-align: center;
    margin-bottom: 40px;
}

.news-item {
    margin-bottom: 30px;
}

.news-content {
    display: flex;
    gap: 20px;
    align-items: center;
    background-color: rgba(0, 0, 0, 0.6);
    padding: 20px;
    border-radius: 10px;
    color: white;
    animation: fadeInUp 1s ease-out forwards;
    opacity: 0;
    transform: translateY(30px);
    overflow: hidden;
}

.news-item:nth-child(even) .news-content {
    flex-direction: row-reverse;
}

.news-content img, .news-content video {
    width: 250px;
    height: 250px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.news-content img:hover, .news-content video:hover {
    transform: scale(1.05);
}

.news-content .text {
    flex: 1;
}

.news-content h2 {
    margin-top: 0;
    color: #ffd700;
}

.news-content .date {
    font-size: 14px;
    color: #ccc;
    margin-bottom: 10px;
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Modal styles --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: none; /* Завжди 'none' за замовчуванням, показуємо через JS */
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    position: relative;
    max-width: 90%; /* Збільшено для кращого відображення */
    max-height: 90%; /* Збільшено для кращого відображення */
    background-color: #000; /* Додано фон для вмісту модального вікна */
    padding: 20px; /* Додано відступи всередині */
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.modal-content video, .modal-content img {
    width: 100%;
    height: auto;
    max-height: 80vh;
    display: block; /* Виправлення відображення */
    border-radius: 8px;
}

.close-button {
    position: absolute;
    top: 10px; /* Позиціонуємо всередині модального контенту */
    right: 20px; /* Позиціонуємо всередині модального контенту */
    color: white;
    font-size: 2.5em; /* Збільшений розмір для кращої доступності */
    font-weight: bold;
    cursor: pointer;
    z-index: 1001; /* Переконаємось, що кнопка поверх контенту */
    transition: color 0.3s ease;
}

.close-button:hover,
.close-button:focus {
    color: #999;
}

footer {
    background-color: var(--background-dark);
    color: var(--secondary-text-color);
    text-align: center;
    padding: 20px;
    margin-top: 40px;
}

.footer-small-text {
    font-size: 0.8em;
    color: #bbb;
    margin-top: 10px;
}

.lang-uk, .lang-en {
    display: none;
}
.lang-uk.active, .lang-en.active {
    display: block;
}

/* --- Responsive Styles --- */
@media (max-width: 768px) {
    nav {
        flex-direction: row; /* Залишаємо в рядок, щоб бургер і мови були поруч */
        justify-content: space-between;
        padding: 10px 15px; /* Зменшуємо внутрішній відступ */
        flex-wrap: nowrap; /* Запобігаємо перенесенню елементів навбару */
    }

    .hamburger-menu {
        display: block; /* Показуємо кнопку-бургер */
    }

    .nav-links-group {
        display: none; /* Приховуємо посилання за замовчуванням */
        flex-direction: column; /* Елементи меню один під одним */
        width: 100%; /* Займає всю ширину */
        position: absolute;
        top: 60px; /* Висота навбару */
        left: 0;
        background-color: var(--background-dark);
        box-shadow: 0 5px 10px rgba(0,0,0,0.3);
        padding: 10px 0;
        overflow: hidden;
    }

    .nav-links-group.open {
        display: flex; /* Показуємо як flex-контейнер */
        animation: slideDown 0.3s ease-out forwards;
    }

    .nav-links-group.closing {
        animation: slideUp 0.3s ease-out forwards;
    }

    .nav-links-group a {
        text-align: center;
        padding: 12px 0;
        width: 100%;
        border-radius: 0; /* Прибираємо закруглення, якщо меню повне */
        background-color: transparent; /* Робимо фон прозорим у відкритому меню */
        box-shadow: none;
    }

    .language-switcher {
        position: static; /* Повертаємо в нормальний потік */
        display: flex;
        gap: 10px;
        margin-top: 0;
        order: 1; /* Розміщуємо мови праворуч від бургеру */
    }
    .language-button {
        padding: 6px 10px;
        font-size: 0.9em;
        border-radius: 15px;
        backdrop-filter: none; /* Прибираємо blur, якщо потрібно */
        -webkit-backdrop-filter: none;
    }

    .news-content {
        flex-direction: column;
        text-align: center;
    }

    .news-item:nth-child(even) .news-content {
        flex-direction: column; /* Змінюємо порядок на колонку для парних елементів теж */
    }

    .news-content img, .news-content video {
        width: 100%;
        height: auto;
        max-width: 300px;
    }

    h1 {
        font-size: 28px;
    }

    main {
        margin: 80px auto 40px auto;
        padding: 15px;
    }
}

/* Анімація появи меню */
@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Анімація зникнення меню */
@keyframes slideUp {
    from {
        transform: translateY(0);
        opacity: 1;
    }
    to {
        transform: translateY(-100%);
        opacity: 0;
    }
}

@media (max-width: 480px) {
    nav {
        padding: 8px 10px;
    }
    nav a {
        display: block;
        margin: 5px 0;
    }

    .news-content {
        padding: 15px;
    }

    .news-content h2 {
        font-size: 20px;
    }

    .news-content p {
        font-size: 14px;
    }
    .footer-small-text {
        font-size: 0.7em;
    }
}