/* --- Загальні стилі --- */
body {
    font-family: 'Montserrat', sans-serif;
    margin: 0;
    color: #333;
    line-height: 1.6;
    overflow-x: hidden;
    background-color: #f9f9f9; /* Додано легкий фон для всієї сторінки */
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

h1, h2 {
    text-align: center;
    color: #003366;
}

h1 {
    font-size: 2.5em;
    margin-bottom: 40px;
}

h2 {
    font-size: 2.2em;
    margin-bottom: 40px;
}

.content-section {
    padding: 60px 0;
}

.bg-light {
    background-color: #fff; /* Змінено на білий для кращого контрасту */
}

/* ВИРІШЕННЯ ПРОБЛЕМИ З ЯКІРНИМИ ПОСИЛАННЯМИ */
section[id] {
    scroll-margin-top: 100px; /* Відступ зверху при прокрутці */
}

/* --- Хедер --- */
.header {
    background-color: #fff;
    border-bottom: 1px solid #ddd;
    padding: 20px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: padding 0.3s ease;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: nowrap;
}

.logo-container {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: #003366;
    flex-shrink: 0;
}

.logo-img {
    height: 60px;
    width: auto;
    margin-right: 15px;
    transition: height 0.3s ease;
}

.logo-text-wrapper {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.logo-text-line1 {
    font-size: 1.2em;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
}

.logo-text-line2 {
    font-size: 1.0em;
    line-height: 1.2;
    white-space: nowrap;
}

.main-nav ul {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
}

.main-nav li {
    margin-left: 25px;
}

.main-nav a {
    text-decoration: none;
    color: #003366;
    font-weight: 700;
    padding: 5px 0;
    font-size: 1.1em;
    transition: color 0.3s;
}

.main-nav a:hover {
    color: #FFD700;
}

/* --- Гамбургер меню та мобільна навігація --- */
.hamburger-menu {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    z-index: 1001;
    position: relative;
}

.hamburger-menu span {
    display: block;
    width: 28px;
    height: 3px;
    background-color: #003366;
    margin: 6px 0;
    transition: all 0.3s;
}

.mobile-nav {
    position: fixed;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100vh;
    background-color: rgba(0, 51, 102, 0.98);
    z-index: 1002;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: left 0.4s ease-in-out;
}

.mobile-nav.active {
    left: 0;
}

.mobile-nav-list {
    list-style: none;
    padding: 0;
    text-align: center;
    width: 80%;
    max-width: 400px;
}

.mobile-nav-list li {
    margin: 20px 0;
}

.mobile-nav-list a {
    color: #fff;
    text-decoration: none;
    font-size: 1.8em;
    font-weight: 700;
    display: block;
    padding: 10px;
    transition: color 0.3s, background-color 0.3s;
}

.mobile-nav-list a:hover {
    color: #FFD700;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
}

.close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    color: #fff;
    font-size: 3em;
    cursor: pointer;
    line-height: 1;
}

/* --- Слайдер (ОНОВЛЕНО) --- */
.slider-section {
    padding-top: 40px; /* Відступ від хедера */
    padding-bottom: 60px; /* Відступ від наступного блоку */
    background-color: transparent; /* Фон тепер прозорий */
}

.slider-container-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 12px; /* Заокруглені кути */
    overflow: hidden; /* Обрізає все, що виходить за межі заокруглення */
    box-shadow: 0 8px 25px rgba(0,0,0,0.1); /* Додано тінь */
}

.slider {
    display: flex;
    height: 100%;
    transition: transform 0.8s ease-in-out;
    will-change: transform;
}

.slide {
    min-width: 100%;
    height: 100%;
    position: relative;
}

.slide img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Повертаємо cover, бо тепер слайдер має правильні пропорції */
    object-position: center;
    aspect-ratio: 16 / 9; /* Пропорції 16:9, можна змінити на 3/2 або інші */
}

.slider-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(0, 51, 102, 0.6);
    color: #fff;
    border: none;
    font-size: 2.2rem;
    padding: 12px 18px;
    cursor: pointer;
    border-radius: 5px;
    transition: background-color 0.3s, transform 0.3s;
}

.slider-btn:hover {
    background-color: #003366;
    transform: translateY(-50%) scale(1.05);
}

.prev-btn { left: 15px; }
.next-btn { right: 15px; }


/* --- Новини --- */
.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
}

.news-card-link {
    text-decoration: none;
    color: inherit;
}

.news-card {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    transition: transform 0.3s, box-shadow 0.3s;
}

.news-card-link:hover .news-card {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0,0,0,0.15);
}

.news-card img {
    width: 100%;
    height: 400px;
    object-fit: cover;
    object-position: center;
}

.news-content {
    padding: 20px;
}

.news-date {
    display: block;
    font-size: 0.8em;
    color: #777;
    margin-bottom: 10px;
}

.news-content h3 {
    margin-top: 0;
    color: #003366;
}

/* --- Секція архіву новин --- */
.news-archive-section {
    padding-bottom: 60px; /* Відступ від наступного блоку */
    text-align: center; /* Розміщуємо кнопку по центру */
    background-color: transparent; /* Робимо фон прозорим, як у блоку новин */
}

.archive-button {
    display: inline-block;
    background-color: #003366; /* Основний синій колір */
    color: #fff;
    padding: 12px 30px;
    border-radius: 5px;
    text-decoration: none;
    font-weight: bold;
    font-size: 1.1em;
    border: 2px solid #003366; /* Рамка того ж кольору */
    transition: all 0.3s ease;
}

.archive-button:hover {
    background-color: #fff; /* Фон стає прозорим при наведенні */
    color: #003366; /* Текст стає синім */
    transform: translateY(-2px);
}


/* --- ОНОВЛЕННЯ: Випадаюче меню --- */
.dropdown {
    position: relative;
    display: inline-block;
}
.dropdown-content {
    display: none;
    position: absolute;
    background-color: #f9f9f9;
    min-width: 160px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 1;
    border-radius: 5px;
}
.dropdown-content a {
    color: #003366;
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    font-size: 1em !important; /* Важливо для перезапису стилів */
}
.dropdown-content a:hover {
    background-color: #f1f1f1;
}
.dropdown:hover .dropdown-content {
    display: block;
}

.mobile-nav .dropdown .dropbtn {
    position: relative;
    /* ВИРІШЕННЯ ПРОБЛЕМИ 1: Додаємо відступ для іконки */
    padding-right: 50px !important;
}

.mobile-nav .dropdown .dropbtn::after {
    content: '+';
    position: absolute;
    right: 15px; /* Розміщуємо іконку у новому вільному просторі */
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2em;
    font-weight: bold;
    transition: transform 0.3s ease;
}

.mobile-nav .dropdown.active .dropbtn::after {
    transform: translateY(-50%) rotate(45deg);
}

.mobile-nav .dropdown-content {
    /* ВИРІШЕННЯ ПРОБЛЕМИ 2: Робимо фон контрастним */
    background-color: #004080; /* Темніший синій для кращої читабельності */
    border-radius: 5px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out;
    padding: 0 15px;
}

.mobile-nav .dropdown-content a {
    font-size: 0.8em;
    padding: 12px 10px;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.2); /* Робимо лінію розділювача помітнішою */
    color: #fff; /* Явно вказуємо білий колір */
}

/* --- Секція Про філію (ОНОВЛЕНО) --- */
#about .container > p {
    text-align: center;
    max-width: 900px;
    margin: 0 auto 50px auto;
    font-size: 1.1em;
}

#about a:not(.archive-button) {
  text-decoration: underline;
  color: #003366;
}

.director-flex {
    display: flex;
    align-items: center;
    gap: 40px;
    flex-wrap: wrap;
    justify-content: center;
    text-align: center;
}

.director-photo {
    flex-shrink: 0;
}

.director-photo img {
    max-width: 250px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    margin: 0 auto;
}

.director-text {
    flex: 1;
    min-width: 280px;
    max-width: 600px;
    text-align: left;
}

.director-text h2 {
    text-align: left;
    margin-top: 0;
    margin-bottom: 20px;
}

/* --- Кнопка Фотогалереї --- */
.gallery-button-section {
    padding-bottom: 60px;
    text-align: center;
    background-color: #fff; /* Фон як у секції "Про філію" */
}

/* Використовуємо той самий стиль, що й для кнопки архіву новин */
.archive-button {
    display: inline-block;
    background-color: #003366;
    color: #fff;
    padding: 12px 30px;
    border-radius: 5px;
    text-decoration: none;
    font-weight: bold;
    font-size: 1.1em;
    border: 2px solid #003366;
    transition: all 0.3s ease;
}

.archive-button:hover {
    background-color: #fff;
    color: #003366;
    transform: translateY(-2px);
}

/* --- Сітка Фотогалереї (на сторінці gallery.html) --- */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.gallery-item {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    overflow: hidden; /* Щоб заокруглення працювало */
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}

.gallery-item img {
    width: 100%;
    height: 220px;
    object-fit: cover;
    border-bottom: 1px solid #eee;
}

.gallery-item p {
    text-align: center;
    padding: 15px;
    font-weight: bold;
    color: #003366;
    margin: 0;
}
/* --- Лайтбокс --- */
.lightbox {
    display: none; /* Прихований за замовчуванням */
    position: fixed; /* Фіксований на весь екран */
    z-index: 2000; /* Перекриває все */
    padding-top: 60px; /* Відступ зверху */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto; /* Дозволяє прокручувати, якщо зображення велике */
    background-color: rgba(0,0,0,0.9); /* Чорний напівпрозорий фон */
}

/* Контент лайтбокса (збільшене зображення) */
.lightbox-content {
    margin: auto;
    display: block;
    width: 80%;
    max-width: 900px; /* Максимальна ширина */
    max-height: 85vh; /* Максимальна висота, щоб поміщався на екран */
    object-fit: contain; /* Зберігає пропорції, не обрізає */
}

/* Підпис до зображення */
.lightbox-caption {
    margin: 15px auto;
    display: block;
    width: 80%;
    max-width: 900px;
    text-align: center;
    color: #ccc;
    padding: 10px 0;
    font-size: 1.2em;
}

/* Кнопка закриття */
.close-lightbox {
    position: absolute;
    top: 15px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
    cursor: pointer;
}

.close-lightbox:hover,
.close-lightbox:focus {
    color: #bbb;
    text-decoration: none;
    cursor: pointer;
}

/* Анімація збільшення */
.lightbox-content, .lightbox-caption {
    animation-name: zoom;
    animation-duration: 0.6s;
}

@keyframes zoom {
    from {transform:scale(0.1)} 
    to {transform:scale(1)}
}
/* --- Секція Структури --- */
.structure-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.structure-block {
    background-color: #fff;
    padding: 30px;
    border-left: 5px solid #003366;
    border-radius: 5px;
    text-decoration: none;
    color: #333;
    display: block;
    transition: transform 0.3s, box-shadow 0.3s;
}

.structure-block:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
}

.structure-block h3 {
    margin-top: 0;
    color: #003366;
}

/* --- Центрування контенту --- */
.content-centered {
    text-align: center;
}

.content-centered ul {
    display: inline-block;
    text-align: left;
    margin: 0;
    padding: 0;
}

/* --- Оголошення та Документи --- */
.announcements-list, .documents-list {
    list-style: none;
    padding-left: 0;
}

.announcements-list li, .documents-list li {
    background: #fff;
    padding: 15px;
    border-bottom: 1px solid #eee;
    margin-bottom: 10px;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.announcements-list .date {
    font-weight: 700;
    color: #003366;
    margin-right: 15px;
}

.documents-list a {
    text-decoration: none;
    color: #003366;
    font-weight: bold;
    display: block;
}

.documents-list a:hover {
    text-decoration: underline;
}

/* --- Секція корисних посилань --- */
.links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
}

.link-card {
    display: block;
    background-color: #fff;
    border-radius: 8px;
    padding: 25px;
    text-decoration: none;
    color: #333;
    box-shadow: 0 4px 10px rgba(0,0,0,0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border-left: 5px solid #FFD700; /* Жовтий акцент, як у блоці структури */
}

.link-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0,0,0,0.12);
}

.link-card h3 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #003366;
    font-size: 1.2em;
}

.link-card p {
    margin-bottom: 0;
    font-size: 0.9em;
    line-height: 1.5;
}

/* --- Стилі для акордеона (Нормативні документи) --- */
.accordion {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    overflow: hidden; /* Важливо для анімації */
}

.accordion-button {
    background-color: #fff;
    color: #003366;
    cursor: pointer;
    padding: 15px 25px;
    width: 100%;
    border: none;
    text-align: left;
    outline: none;
    font-size: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.3s;
}

.accordion-button:hover {
    background-color: #f9f9f9;
}

.accordion-button h2 {
    margin: 0;
    font-size: 1.8em; /* Розмір заголовка */
}

.accordion-icon {
    font-size: 2em;
    font-weight: bold;
    transition: transform 0.3s ease;
}

/* Стиль для активної кнопки */
.accordion-button.active .accordion-icon {
    transform: rotate(45deg); /* Повертаємо "+" у "х" */
}

.accordion-content {
    max-height: 0; /* Початково контент прихований */
    overflow: hidden;
    transition: max-height 0.4s ease-out; /* Плавна анімація */
    padding: 0 25px;
}

.accordion-content .documents-list {
    padding: 20px 0;
}

/* --- Стилі для сторінки вчителів --- */
.back-link {
    display: inline-block;
    margin-bottom: 40px;
    color: #003366;
    text-decoration: none;
    font-weight: bold;
}

.back-link:hover {
    text-decoration: underline;
}

.teacher-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
}

.teacher-card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    text-align: center;
    padding: 20px;
}

.teacher-card img {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    object-fit: cover;
    object-position: top;
    margin: 0 auto 20px auto;
    border: 4px solid #f4f4f4;
}

.teacher-card h3 {
    color: #003366;
    margin-top: 0;
    margin-bottom: 10px;
}

.teacher-card p {
    font-size: 0.9em;
}

/* --- Сторінка керівництва --- */
.leadership-card {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    background-color: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    margin-bottom: 40px;
    scroll-margin-top: 120px;
}
.leadership-card img {
    width: 250px;
    height: 250px;
    object-fit: cover;
    border-radius: 8px;
}
.leadership-info {
    flex: 1;
    min-width: 300px;
}
.leadership-info h2 {
    text-align: left;
    margin-top: 0;
}
.leadership-info h3 {
    text-align: left;
    color: #555;
    margin-top: -10px;
}
.back-link {
    display: inline-block;
    margin-bottom: 40px;
    color: #003366;
    text-decoration: none;
    font-weight: bold;
}
.back-link:hover {
    text-decoration: underline;
}

/* --- Підвал --- */
.footer {
    background-color: #003366;
    color: #fff;
    text-align: center;
    padding: 20px 0;
    font-size: 0.9em;
}

.footer a {
    color: #fff;
    text-decoration: underline;
}

/* --- Кнопка "Нагору" --- */
.scroll-to-top {
    position: fixed; /* Фіксує кнопку на екрані */
    bottom: 25px;
    right: 25px;
    background-color: #003366; /* Основний колір сайту */
    color: #fff;
    width: 45px;
    height: 45px;
    border-radius: 5px;
    text-align: center;
    font-size: 24px;
    line-height: 45px;
    text-decoration: none;
    z-index: 999;
    
    /* Робимо її невидимою */
    opacity: 0;
    visibility: hidden;
    
    transition: opacity 0.3s ease, visibility 0.3s ease, background-color 0.3s ease;
}

.scroll-to-top:hover {
    background-color: #FFD700; /* Колір при наведенні */
    color: #003366;
}

/* Клас, який робить кнопку видимою */
.scroll-to-top.active {
    opacity: 1;
    visibility: visible;
}

/* --- Адаптивність: Медіа-запити --- */
@media (max-width: 1100px) {
    .main-nav li {
        margin-left: 15px;
    }
    .main-nav a {
        font-size: 1em;
    }
}

@media (max-width: 992px) {
    .header {
        padding: 10px 0;
    }
    .logo-img {
        height: 45px;
    }
    .logo-text-wrapper {
        display: flex;
    }
    .logo-text-line1 {
        font-size: 0.9em;
    }
    .logo-text-line2 {
        font-size: 0.8em;
    }
    .main-nav {
        display: none;
    }
    .hamburger-menu {
        display: block;
    }
}

@media (max-width: 768px) {
    .logo-img {
        height: 40px;
    }
    h1 { font-size: 2em; }
    h2 { font-size: 1.8em; }
    .director-flex {
        flex-direction: column;
        gap: 20px;
    }
    .director-photo {
        order: -1;
    }
    .director-text {
        text-align: center;
    }
    .director-text h2 {
        text-align: center;
    }
    .structure-grid {
        grid-template-columns: 1fr;
    }
    .slider-section {
        padding-top: 30px;
        padding-bottom: 40px;
    }
}

@media (max-width: 480px) {
    .logo-text-line2 {
        display: none;
    }
    .logo-text-line1 {
        font-size: 0.8em;
    }
    .logo-img {
        height: 35px;
        margin-right: 8px;
    }
    .slider-btn {
        font-size: 1.8rem;
        padding: 8px 12px;
    }
    .prev-btn { left: 8px; }
    .next-btn { right: 8px; }
    .mobile-nav-list a {
        font-size: 1.5em;
    }
    .close-btn {
        font-size: 2.5em;
    }
}