@import url('https://fonts.googleapis.com/css2?family=Comfortaa:wght@300;400;500;600;700&display=swap');

/* Основные стили */
body {
    font-family: 'Comfortaa', serif;
    line-height: 1.6;
    color: #333;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    background: linear-gradient(90deg, hsla(236, 100%, 8%, 1) 0%, hsla(211, 100%, 28%, 1) 100%);
}


header {
    background-color: #0055a0;
    color: white;
    padding: 20px 0;
    margin-bottom: 30px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    position: relative; /* Добавляем относительное позиционирование */
}

header h1 {
    margin: 0;
    padding: 0 20px;
    font-size: 2.2em;
    text-align: center;
}

.language-switcher {
    position: absolute; /* Абсолютное позиционирование */
    top: 10px; /* Отступ сверху */
    right: 20px; /* Отступ справа, теперь относительно header */
    color: white;
    z-index: 1000; /* Убедимся, что он поверх других элементов */
}

.language-switcher a {
    color: white;
    text-decoration: none;
    font-weight: bold;
    margin: 0 5px;
}

.language-switcher a.active {
    text-decoration: underline;
}

/* Навигация */
nav ul {
    list-style: none;
    padding: 0;
    margin: 20px 0 0;
    display: flex;
    background-color: #004488;
    justify-content: center;
}

nav li {
    margin: 0 15px;
}

nav a {
    display: block;
    padding: 15px 20px;
    color: white;
    text-decoration: none;
    transition: background-color 0.3s;
    border-radius: 3px;
}

nav a:hover {
    background-color: #0066cc;
}

nav a.active {
    background-color: #0077dd;
    font-weight: bold;
}

/* Основной контент */
main {
    background-color: white;
    padding: 30px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
    border-radius: 5px;
    margin-bottom: 30px;
}

section h2 {
    color: #0055a0;
    border-bottom: 2px solid #0077dd;
    padding-bottom: 10px;
    margin-top: 0;
    font-weight: bold;
}

#articles-container {
    display: flex;
    flex-direction: column;
}

.article {
    display: flex;
    align-items: flex-start;
    margin-bottom: 20px;
}

.article-image {
    width: 150px;
    height: auto;
    margin-right: 20px;
    flex-shrink: 0;
}

.article-content {
    flex-grow: 1;
}

.article-title {
    color: #0055a0;
    margin-top: 0;
}

.abstract {
    color: #666;
    margin-bottom: 15px;
}

.read-more {
    display: inline-block;
    background: #0055a0;
    color: white;
    padding: 8px 15px;
    text-decoration: none;
    border-radius: 3px;
    transition: background-color 0.3s;
}

.read-more:hover {
    background: #0066cc;
}

header .journal-highlights a {
    color: white; /* Белый цвет для ссылок в блоке journal-highlights */
}

/* Стили для секции заголовка журнала */
.journal-header-section {
    display: flex; /* Используем flexbox */
    flex-direction: column; /* Элементы располагаются в колонку по умолчанию (для больших экранов) */
    align-items: center; /* Центрирование по горизонтали */
    padding: 0 20px; /* Добавляем отступы для текста */
}

.journal-info {
    /* На больших экранах будет занимать всю ширину */
    text-align: center; /* Центрируем текст */
    margin-bottom: 15px; /* Отступ снизу */
}

/* Новый контейнер для изображения и текста описания */
.journal-media-and-description {
    display: flex; /* Используем flexbox для расположения рядом */
    align-items: flex-start; /* Выравнивание элементов по верху */
    gap: 20px; /* Отступ между элементами */
    width: 100%; /* Занимает всю доступную ширину */
    justify-content: center; /* Центрируем содержимое внутри контейнера */
}

.journal-cover-image {
    width: 200px;
    height: auto;
    flex-shrink: 0;
}

.journal-description {
    display: flex; /* Для внутреннего выравнивания текста */
    flex-direction: column; /* Изменено: теперь текст будет располагаться в колонку */
    align-items: flex-start;
    flex-grow: 1; /* Позволяет занимать доступное пространство */
}


/* Подвал */
footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 0;
    color: white;
    font-size: 0.9em;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 1000px;
    margin-bottom: 15px;
}

.footer-info {
    text-align: center;
    flex: 1;
}

.journal-rank {
    margin-left: 20px;
}

.journal-rank img {
    max-width: 150px;
    height: auto;
}

/* Адаптивность */
@media (max-width: 768px) {
    nav ul {
        flex-direction: column;
    }
    
    header h1 {
        font-size: 1.8em;
        text-align: center;
    }

    .journal-header-section {
        /* Уже flex-direction: column по умолчанию */
        align-items: center; /* Центрируем все элементы секции */
        text-align: center;
        padding: 0 15px;
    }

    .journal-info {
        order: 1;
        margin-bottom: 15px;
    }

    .journal-media-and-description { /* Новый контейнер для мобильных */
        flex-direction: column; /* Элементы располагаются в колонку */
        align-items: center; /* Центрирование изображения и текста */
        gap: 15px; /* Отступ между изображением и текстом */
    }

    .journal-cover-image {
        order: 2; /* Порядок для мобильных */
        width: 150px;
        max-width: 100%;
        height: auto;
        margin-top: 15px;
        margin-bottom: 0; /* Убираем нижний отступ, так как gap уже есть */
    }

    .journal-description {
        order: 3; /* Порядок для мобильных */
        width: 100%; /* Занимает всю ширину на мобильных */
    }

    .article {
        flex-direction: column;
        align-items: center;
        text-align: center; /* Центрируем всю статью по умолчанию */
    }

    .article-image {
        margin-right: 0;
        margin-bottom: 15px;
        width: 100%;
        max-width: 200px;
    }
    
    .footer-content {
        flex-direction: column;
        text-align: center;
    }
    
    .journal-rank {
        margin-left: 0;
        margin-top: 20px;
    }

    /* Изменения для маленьких экранов */
    .article-content {
        width: 100%; /* Убедимся, что контент занимает всю ширину */
    }

    .article-title {
        text-align: center; /* Выравниваем название статьи по центру */
    }

    .abstract {
        text-align: justify; /* Выравнивание аннотации по ширине */
    }

    /* Авторы и ссылка "Подробнее" также будут скрыты по умолчанию,
       а их видимость будет контролироваться JavaScript через hidden-on-mobile */
    .authors,
    .read-more {
        /* Эти элементы не будут иметь display: none; здесь напрямую,
           они будут скрыты через класс .hidden-on-mobile, добавленный в JS */
    }

    .hidden-on-mobile {
        display: none !important; /* Убедимся, что скрывается */
    }
}

/* Стили для модального окна */
.modal {
    display: none; /* Скрыто по умолчанию */
    position: fixed; /* Оставаться на месте */
    z-index: 1001; /* Сильнее, чем другие элементы */
    left: 0;
    top: 0;
    width: 100%; /* Полная ширина */
    height: 100%; /* Полная высота */
    overflow: auto; /* Включить прокрутку, если нужно */
    background-color: rgba(0,0,0,0.9); /* Черный с прозрачностью */
}

/* Класс, который делает модальное окно видимым и центрирует его */
.modal.active {
    display: block; /* Изменено на block, чтобы modal-content мог быть абсолютно позиционирован */
}

.modal-content {
    margin: auto;
    display: block;
    width: 80%;
    max-width: 700px;
    max-height: 90vh; /* Ограничиваем высоту, чтобы не выходить за пределы экрана */
    object-fit: contain; /* Сохраняет пропорции изображения, вмещая его в контейнер */

    /* Новые стили для абсолютного центрирования */
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Кнопка закрытия */
.close-button {
    position: absolute;
    top: 15px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
    cursor: pointer;
}

.close-button:hover,
.close-button:focus {
    color: #bbb;
    text-decoration: none;
    cursor: pointer;
}


/* Стили для архива */
.archive-controls {
    margin: 20px 0;
    padding: 20px;
    background-color: #f5f5f5;
    border-radius: 5px;
}

.archive-controls select {
    padding: 8px;
    font-size: 16px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-left: 10px;
}

.issues-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    padding: 20px;
}

.issue-item {
    background-color: white;
    padding: 20px;
    border-radius: 5px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.issue-item h3 {
    margin: 0 0 15px 0;
    color: #333;
}

.issue-item .read-more {
    display: inline-block;
    padding: 8px 16px;
    background-color: #4CAF50;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.issue-item .read-more:hover {
    background-color: #45a049;
}

/* Стили для форм редактирования архива */
.year-section {
    margin-bottom: 30px;
    padding: 20px;
    background-color: #f5f5f5;
    border-radius: 8px;
}

.year-section h2 {
    color: #333;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #4CAF50;
}

.issue-form {
    background-color: white;
    padding: 20px;
    margin-bottom: 15px;
    border-radius: 5px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.issue-form h3 {
    margin-top: 0;
    color: #333;
}

.issue-form input[type="number"],
.issue-form input[type="text"] {
    width: 100%;
    padding: 8px;
    margin-bottom: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.year-info {
    background-color: #f8f9fa;
    padding: 20px;
    border-radius: 5px;
    margin-bottom: 20px;
    border-left: 4px solid #4CAF50;
}

.year-info p {
    margin: 5px 0;
    color: #666;
}

.year-info p:first-child {
    color: #333;
    font-weight: 500;
}

.form-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.delete-btn {
    background-color: #ff4444;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.delete-btn:hover {
    background-color: #cc0000;
}

.editor-item {
    display: flex;
    align-items: center;
    gap: 30px;
    margin-bottom: 20px;
    background: #f8f9fa;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.editor-photo {
    width: 70px;
    height: 90px;
    object-fit: cover;
    border-radius: 20%;
    border: 2px solid #0055a0;
    background: #fff;
}

@media (max-width: 600px) {
    .editor-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .editor-photo {
        width: 70px;
        height: 70px;
    }
}

/* Стили для аккордеона */
.year-header {
    background-color: #f0f0f0;
    padding: 10px;
    cursor: pointer;
    border-bottom: 1px solid #ccc;
}

.year-header:hover {
    background-color: #e0e0f0;
}

.year-content {
    padding: 10px;
    display: none;
}

.year-content.active {
    display: block;
}

/* Дополнительные стили для форм и таблиц */
table {
    width: 100%;
}

input[type="text"], textarea, input[type="number"] {
    width: 100%;
    box-sizing: border-box; /* Важно для корректного отображения ширины */
}
