/* Общие стили */
body {
    margin: 0;
    padding: 0;
    font-family: 'Roboto', sans-serif;
    color: #fff;
    min-height: 100vh;
    position: relative;
    overflow: hidden; /* Оставляем для предотвращения прокрутки из-за анимации */
}

/* Фон с анимацией */
.background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('/static/logo.png') no-repeat center center;
    background-size: cover; /* Для десктопов — заполняет экран */
    z-index: -1; /* Под overlay */
}

/* Анимация отдаления фона только на странице входа */
body.login-page .background {
    animation: backgroundScale 5s infinite;
}

/* Анимация отдаления фона */
@keyframes backgroundScale {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1); /* Отдаление */
    }
    100% {
        transform: scale(1);
    }
}

/* Затемнение фона */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 20px;
    z-index: 0; /* Над фоном, под содержимым */
    overflow-y: auto; /* Разрешаем прокрутку внутри overlay */
}

/* Анимация снятия затемнения на странице входа */
body.login-page .overlay {
    animation: overlayFade 5s infinite;
}

@keyframes overlayFade {
    0% {
        background: rgba(0, 0, 0, 0.8); /* Полное затемнение */
    }
    50% {
        background: rgba(0, 0, 0, 0); /* Полное снятие затемнения */
    }
    100% {
        background: rgba(0, 0, 0, 0.8); /* Возврат затемнения */
    }
}

/* Контейнер панели */
.container {
    width: 80%;
    max-width: 1000px;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    position: relative;
}

/* Заголовки */
h1 {
    position: absolute;
    top: -40px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 2em;
    color: #00eaff;
    text-shadow: 0 0 10px rgba(0, 234, 255, 0.7);
    width: 100%; /* Устанавливаем ширину для корректного выравнивания фраз */
    text-align: center; /* Центрируем текст внутри h1 */
}

/* Анимация смены фраз */
.header-phrase {
    display: inline-block;
    opacity: 0;
    position: absolute; /* Фразы накладываются друг на друга */
    left: 50%;
    transform: translateX(-50%); /* Центрируем каждую фразу */
    white-space: nowrap; /* Слова в фразе идут горизонтально, а не вертикально */
    animation: slideText 21s infinite;
}

.header-phrase:nth-child(1) {
    animation-delay: 0s;
}

.header-phrase:nth-child(2) {
    animation-delay: 7s;
}

.header-phrase:nth-child(3) {
    animation-delay: 14s;
}

/* Анимация: исчезновение справа налево, появление слева направо */
@keyframes slideText {
    0% {
        opacity: 0;
        transform: translateX(-50%) translateX(100%); /* Начало справа */
    }
    5% {
        opacity: 1;
        transform: translateX(-50%) translateX(0); /* Появление в центре */
    }
    28% {
        opacity: 1;
        transform: translateX(-50%) translateX(0); /* Удержание в центре */
    }
    33% {
        opacity: 0;
        transform: translateX(-50%) translateX(-100%); /* Исчезновение влево */
    }
    100% {
        opacity: 0;
        transform: translateX(-50%) translateX(-100%); /* Остается слева */
    }
}
/* Навигация */
nav {
    margin: 20px 0;
}

nav a {
    color: #007bff;
    margin: 0 15px;
    text-decoration: none;
    font-size: 1.2em;
}

nav a:hover {
    text-decoration: underline;
}

/* Контейнер для управления */
.manage-container {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

/* Блоки управления */
.manage-box {
    flex: 1;
    min-width: 250px;
    background: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 5px;
}

/* Поля формы с отступами */
.form-field {
    margin-bottom: 15px;
}

/* Контейнер для таблицы с прокруткой */
.table-container {
    max-height: 70vh; /* Ограничиваем высоту таблицы */
    overflow-y: auto; /* Добавляем вертикальную прокрутку */
    margin-bottom: 20px;
}

/* Таблица */
table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 10px;
    border: 1px solid #fff;
}

th {
    background: rgba(255, 255, 255, 0.1);
}

/* Формы */
form {
    margin-bottom: 20px;
}

label {
    font-size: 1.1em;
    margin-right: 10px;
}

input[type="text"], input[type="number"], input[type="password"], select {
    padding: 8px;
    border: none;
    border-radius: 5px;
    font-family: 'Roboto', sans-serif;
    background: #333;
    color: #fff;
}

input[type="submit"] {
    padding: 5px 10px;
    background: #007bff;
    color: #fff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-family: 'Montserrat', sans-serif;
}

input[type="submit"]:hover {
    background: #0056b3;
}

/* Кастомные чекбоксы */
.checkbox-container {
    display: inline-block;
    position: relative;
    padding-left: 35px;
    margin-bottom: 12px;
    cursor: pointer;
    font-size: 1em;
    user-select: none;
}

.checkbox-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: absolute;
    top: 0;
    left: 0;
    height: 25px;
    width: 25px;
    background-color: #eee;
    border-radius: 5px;
}

.checkbox-container:hover input ~ .checkmark {
    background-color: #ccc;
}

.checkbox-container input:checked ~ .checkmark {
    background-color: #007bff;
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.checkbox-container input:checked ~ .checkmark:after {
    display: block;
}

.checkbox-container .checkmark:after {
    left: 9px;
    top: 5px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 3px 3px 0;
    transform: rotate(45deg);
}

/* Выход в правом верхнем углу */
.logout-container {
    position: absolute;
    top: 10px;
    right: 10px;
}

.logout-link {
    color: #007bff; /* Такой же цвет, как у ссылок в навигации */
    text-decoration: none;
    font-size: 1.1em;
}

.logout-link:hover {
    text-decoration: underline;
}

/* Форма входа */
.login-form {
    margin-top: 60px;
    text-align: center;
}

/* Метки формы входа */
.login-label {
    display: inline-block;
    width: 80px;
    text-align: right;
}

/* Унификация размеров полей ввода на странице входа */
.login-input {
    width: 200px;
}

/* Кнопка входа */
.login-button input[type="submit"] {
    width: 100px;
    margin-left: 85px;
}

/* Ссылки */
a {
    color: #007bff;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Адаптация для мобильных устройств (экраны до 768px) */
@media (max-width: 768px) {
    /* Фон */
    .background {
        background-size: contain; /* Помещаем фон целиком */
        background-position: center center; /* Центрируем изображение */
    }

    /* Контейнер панели */
    .container {
        width: 90%; /* Увеличиваем ширину для меньших экранов */
        padding: 10px; /* Уменьшаем отступы */
    }

    /* Заголовки */
    h1 {
        font-size: 1.5em; /* Уменьшаем размер заголовка */
        top: -30px; /* Поднимаем чуть выше */
    }

    h2 {
        font-size: 1.2em; /* Уменьшаем подзаголовки */
    }

    /* Навигация */
    nav a {
        font-size: 1em; /* Уменьшаем размер текста */
        margin: 0 10px; /* Уменьшаем отступы между ссылками */
    }

    /* Контейнер для управления */
    .manage-container {
        flex-direction: column; /* Располагаем блоки вертикально */
        gap: 10px; /* Уменьшаем отступ между блоками */
    }

    /* Блоки управления */
    .manage-box {
        min-width: 100%; /* Занимают всю ширину */
        padding: 10px; /* Уменьшаем отступы внутри блоков */
    }

    /* Таблица */
    .table-container {
        max-height: 50vh; /* Уменьшаем высоту на мобильных */
        overflow-x: auto; /* Добавляем горизонтальную прокрутку */
        overflow-y: auto; /* Сохраняем вертикальную прокрутку */
    }

    table {
        min-width: 600px; /* Устанавливаем минимальную ширину, чтобы таблица прокручивалась горизонтально */
    }

    th, td {
        padding: 8px; /* Уменьшаем отступы в ячейках */
        font-size: 0.9em; /* Уменьшаем размер текста */
    }

    /* Поля ввода */
    .login-input {
        width: 100%; /* Поля занимают всю доступную ширину */
        max-width: 200px; /* Ограничиваем максимальную ширину */
    }

    /* Метки формы входа */
    .login-label {
        width: 60px; /* Уменьшаем ширину меток */
        font-size: 0.9em; /* Уменьшаем размер текста */
    }

    /* Кнопка входа */
    .login-button input[type="submit"] {
        width: 80px; /* Уменьшаем ширину кнопки */
        margin-left: 70px; /* Корректируем смещение для меньших экранов */
    }

    /* Выход в правом верхнем углу */
    .logout-container {
        top: 5px;
        right: 5px;
    }

    .logout-link {
        font-size: 0.9em; /* Уменьшаем размер текста */
    }
}

/* Адаптация для вертикальной ориентации (portrait) */
@media (max-width: 768px) and (orientation: portrait) {
    .background {
        background-size: contain; /* Помещаем фон целиком */
        background-position: center center; /* Центрируем изображение */
    }
}

/* Адаптация для горизонтальной ориентации (landscape) */
@media (max-width: 768px) and (orientation: landscape) {
    .background {
        background-size: cover; /* В горизонтальном режиме заполняем экран */
        background-position: center center; /* Центрируем изображение */
    }
}

/* Отключаем text-align: center только для списка в разделе "Полная кастомизация настроек" */
 .main-section .feature ul {
    text-align: left; /* Выравнивание текста списка по левому краю */
}
