@import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght@300;400;500;600;700&display=swap');

/* ===== ОСНОВНЫЕ ПЕРЕМЕННЫЕ ===== */
:root {
    /* Цветовые переменные */
    --header-text: #1a365d;
    --header-bg: linear-gradient(135deg,
    rgba(245, 245, 245, 0.97),
    rgba(235, 235, 235, 0.97),
    rgba(225, 225, 225, 0.97));
    --header-title-color: dimgray;

    /* Переменные Bootstrap */
    --bs-body-font-family: 'Open Sans', sans-serif;
    --bs-primary-rgb: 13, 110, 253;
    --bs-border-radius: 0.375rem;

    /* Размеры шрифта для адаптивности */
    --base-font-size: 14px;
}

/* ===== БАЗОВЫЕ СТИЛИ ===== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: var(--base-font-size);
    scroll-behavior: smooth;
}

body {
    font-family: var(--bs-body-font-family), sans-serif;
    line-height: 1.5;
    color: #212529;
    background-image: url("../img/bg.webp");
    background-size: cover;
    background-attachment: fixed;
    background-position: center;
    min-height: 100vh;
    margin: 0;
    display: flex;
    flex-direction: column;
}

/* Адаптивные размеры шрифта */
@media (min-width: 370px) { html { font-size: 15px; } }
@media (min-width: 768px) { html { font-size: 16px; } }

/* ===== ОБЩИЕ КЛАССЫ ДЛЯ МАКЕТА ===== */
.container {
    width: 100%;
    padding-right: 15px;
    padding-left: 15px;
    margin-right: auto;
    margin-left: auto;
}

/* Адаптивные breakpoints для контейнера */
@media (min-width: 576px) { .container { max-width: 540px; } }
@media (min-width: 768px) { .container { max-width: 720px; } }
@media (min-width: 992px) { .container { max-width: 960px; } }
@media (min-width: 1200px) { .container { max-width: 1140px; } }
@media (min-width: 1400px) { .container { max-width: 1320px; } }

/* Фоновое изображение с оверлеем */
.bg-image {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    position: relative;
    padding-bottom: env(safe-area-inset-bottom);
}

.bg-image::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.3);
    z-index: 1;
}

.bg-image > * {
    position: relative;
    z-index: 2;
}

/* Параллакс эффект для фона */
.bg-parallax {
    background-attachment: fixed;
}

/* ===== ШАПКА САЙТА ===== */
.header-container {
    background: var(--header-bg);
    backdrop-filter: blur(8px);
    box-shadow:
            0 4px 20px rgba(0, 0, 0, 0.08),
            inset 0 1px 1px rgba(255, 255, 255, 0.9),
            inset 0 -1px 1px rgba(0, 0, 0, 0.05);
    border-bottom: 1px solid rgba(0, 0, 0, 0.07);
    padding: 0.5rem 0;
    width: 100%;
    position: sticky;
    top: 0;
    z-index: 1030;
    margin-top: 0; /* Убираем возможные внешние отступы */
}
/* Убираем любые отступы сверху на мобильных устройствах */
@media (max-width: 767.98px) {
    .header-container {
        padding-top: 0;
        margin-top: 0;
    }
    /* Если шапка внутри другого контейнера, убираем его отступы */
    body {
        padding-top: 0 !important;
    }
}

.header-container h1 {
    color: var(--header-title-color);
    font-weight: 600;
    text-shadow:
            1px 1px 0 rgba(0, 0, 0, 0.1),
            2px 2px 4px rgba(0, 0, 139, 0.3);
    margin: 0;
    font-size: 1.1rem;
}

/* ===== КОМПОНЕНТЫ ИЗОБРАЖЕНИЙ ===== */
.img-fluid {
    max-width: 100%;
    height: auto;
    display: block;
}

.img-thumbnail {
    padding: 0.25rem;
    background-color: #fff;
    border: 1px solid #dee2e6;
    border-radius: var(--bs-border-radius);
    max-width: 100%;
    height: auto;
}

.figure {
    display: inline-block;
    margin: 0 0 1rem;
}

.figure-img {
    margin-bottom: 0.5rem;
    line-height: 1;
}

.figure-caption {
    font-size: 0.875em;
    color: #6c757d;
}

/* Соотношения сторон для адаптивных элементов */
.ratio {
    position: relative;
    width: 100%;
}

.ratio::before {
    display: block;
    padding-top: var(--bs-aspect-ratio);
    content: "";
}

.ratio > * {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.ratio-1x1 { --bs-aspect-ratio: 100%; }
.ratio-4x3 { --bs-aspect-ratio: 75%; }
.ratio-16x9 { --bs-aspect-ratio: 56.25%; }
.ratio-21x9 { --bs-aspect-ratio: 42.8571428571%; }

/* ===== ТИПОГРАФИКА ===== */
h1, .h1 { font-size: 1.75rem; margin-bottom: 0.875rem; font-weight: 600; }
h2, .h2 { font-size: 1.5rem; margin-bottom: 0.75rem; font-weight: 600; }
h3, .h3 { font-size: 1.25rem; margin-bottom: 0.625rem; font-weight: 600; }
h4, .h4 { font-size: 1.125rem; margin-bottom: 0.5rem; }
h5, .h5 { font-size: 1rem; margin-bottom: 0.5rem; }
h6, .h6 { font-size: 0.875rem; margin-bottom: 0.5rem; }

/* Адаптивные заголовки для мобильных */
@media (max-width: 767.98px) {
    h1, .h1 { font-size: 1.5rem; }
    h2, .h2 { font-size: 1.25rem; }
}

/* ===== НАВИГАЦИЯ И МЕНЮ ===== */
.navbar {
    background-color: rgba(var(--bs-primary-rgb), 1) !important;
    padding: 0.75rem 1rem;
}

.navbar-brand {
    font-size: 1.125rem;
    font-weight: 600;
    color: #fff !important;
}

.navbar-nav .nav-link {
    color: rgba(255, 255, 255, 0.85) !important;
    padding: 0.375rem 0.75rem;
}

.navbar-nav .nav-link:hover {
    color: #fff !important;
}

.navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255,255,255,0.85%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* Выпадающие меню */
.dropdown {
    position: relative;
}

.dropdown-toggle {
    white-space: nowrap;
}

.dropdown-menu {
    position: absolute;
    z-index: 1000;
    display: none;
    min-width: 10rem;
    padding: 0.5rem 0;
    margin: 0;
    font-size: 0.875rem;
    color: #212529;
    text-align: left;
    list-style: none;
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: var(--bs-border-radius);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.1);
}

.dropdown-menu.show {
    display: block;
}

.dropdown-item {
    display: block;
    width: 100%;
    padding: 0.5rem 1rem;
    clear: both;
    font-weight: 400;
    color: #212529;
    text-align: inherit;
    text-decoration: none;
    white-space: nowrap;
    background-color: transparent;
    border: 0;
}

.dropdown-item:hover,
.dropdown-item:focus {
    color: #16181b;
    background-color: #f8f9fa;
}

/* Адаптация выпадающих меню для мобильных */
@media (max-width: 767.98px) {
    .dropdown-menu {
        position: static;
        float: none;
        width: 100%;
        box-shadow: none;
        border: 1px solid rgba(0, 0, 0, 0.1);
    }

    .navbar {
        padding: 0.5rem;
    }
}

/* ===== КАРТОЧКИ И ТАБЛИЦЫ ===== */
.card {
    border-radius: var(--bs-border-radius);
    margin-bottom: 1rem;
}

.card-body {
    padding: 1.25rem;
}

.list-group-item {
    padding: 0.625rem 1rem;
    border-radius: var(--bs-border-radius) !important;
}

.table {
    font-size: 0.875rem;
    margin-bottom: 1rem;
    width: 100%;
}

.table th,
.table td {
    padding: 0.625rem;
    vertical-align: middle;
}

.table thead th {
    font-weight: 600;
}

/* Адаптивные таблицы */
@media (max-width: 767.98px) {
    .table-responsive {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .card-body {
        padding: 1rem;
    }
}

/* ===== ФОРМЫ И КНОПКИ ===== */
.btn {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    border-radius: var(--bs-border-radius);
    transition: all 0.3s ease;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.8125rem;
}

.btn-lg {
    padding: 0.5rem 1rem;
    font-size: 0.9375rem;
}

.btn-primary {
    background-color: rgba(var(--bs-primary-rgb), 1);
    border-color: rgba(var(--bs-primary-rgb), 1);
}

.btn-primary:hover {
    background-color: rgba(var(--bs-primary-rgb), 0.8);
    border-color: rgba(var(--bs-primary-rgb), 0.8);
}

.form-control {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    border-radius: var(--bs-border-radius);
    width: 100%;
}

.form-label {
    margin-bottom: 0.375rem;
    font-weight: 500;
    display: block;
}

/* Специальные стили для формы входа */
.login-container {
    max-width: 400px;
    width: 100%;
    background: linear-gradient(rgba(245, 245, 245, 0.95), rgba(235, 235, 235, 0.95));
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow:
            0 0.5rem 1.5rem rgba(0, 0, 0, 0.2),
            inset 0 0 0 1px rgba(255, 255, 255, 0.1),
            0 10px 20px -10px rgba(0, 0, 0, 0.25);
    border-radius: 0.75rem;
    padding: 2rem;
    backdrop-filter: blur(5px);
    margin: 1rem auto;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.1);
}

.logo {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto 1.5rem;
    filter: drop-shadow(0 5px 10px rgba(0, 0, 0, 0.1));
}

.password-toggle-btn {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    background-color: #f8f9fa;
    border-color: #ced4da;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.password-toggle-btn:hover {
    transform: translateY(-2px);
    box-shadow:
            0 4px 8px rgba(0, 0, 0, 0.1),
            0 0 0 2px rgba(0, 123, 255, 0.25);
}

.password-data {
    background-color: #f8f9fa;
    border-radius: 0.5rem;
    padding: 1.25rem;
    margin-top: 1.5rem;
    box-shadow:
            0 4px 6px rgba(0, 0, 0, 0.05) inset,
            0 1px 3px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

/* ===== МОДАЛЬНЫЕ ОКНА ===== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1050;
    width: 100%;
    height: 100%;
    overflow: hidden;
    outline: 0;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-dialog {
    position: relative;
    width: auto;
    margin: 0.5rem;
    pointer-events: none;
    max-width: 500px;
}

.modal-content {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    pointer-events: auto;
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: var(--bs-border-radius);
    outline: 0;
}

.modal-header {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    border-bottom: 1px solid #dee2e6;
    border-top-left-radius: calc(var(--bs-border-radius) - 1px);
    border-top-right-radius: calc(var(--bs-border-radius) - 1px);
}

.modal-title {
    margin-bottom: 0;
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.5;
}

.modal-body {
    position: relative;
    flex: 1 1 auto;
    padding: 1rem;
}

.modal-footer {
    display: flex;
    flex-wrap: wrap;
    flex-shrink: 0;
    align-items: center;
    justify-content: flex-end;
    padding: 0.75rem;
    border-top: 1px solid #dee2e6;
    border-bottom-right-radius: calc(var(--bs-border-radius) - 1px);
    border-bottom-left-radius: calc(var(--bs-border-radius) - 1px);
}

.modal-footer > * {
    margin: 0.25rem;
}

/* Адаптация модальных окон для мобильных */
@media (max-width: 575.98px) {
    .modal-dialog {
        margin: 0;
        max-width: none;
        min-height: 100%;
    }

    .modal-content {
        min-height: 100vh;
        border-radius: 0;
    }
}

/* ===== ДОПОЛНИТЕЛЬНЫЕ КОМПОНЕНТЫ ===== */
.badge {
    padding: 0.35em 0.65em;
    font-size: 0.75em;
    font-weight: 600;
    border-radius: var(--bs-border-radius);
}

.badge-primary {
    background-color: rgba(var(--bs-primary-rgb), 1);
}

.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--bs-border-radius);
}

.progress {
    height: 0.75rem;
    border-radius: var(--bs-border-radius);
}

.progress-bar {
    background-color: rgba(var(--bs-primary-rgb), 1);
}

.breadcrumb {
    padding: 0.75rem;
    border-radius: var(--bs-border-radius);
}

.pagination .page-link {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}

.text-primary {
    color: rgba(var(--bs-primary-rgb), 1) !important;
}

.bg-primary {
    background-color: rgba(var(--bs-primary-rgb), 1) !important;
}

/* ===== АДАПТИВНЫЕ СТИЛИ ДЛЯ ФОРМЫ ВХОДА ===== */
@media (min-width: 992px) {
    .login-container {
        max-width: 450px;
        padding: 2.5rem;
        box-shadow:
                0 0.75rem 2rem rgba(0, 0, 0, 0.2),
                inset 0 0 0 1px rgba(255, 255, 255, 0.1),
                0 15px 30px -15px rgba(0, 0, 0, 0.25);
    }
}

@media (max-width: 767.98px) {
    .login-container {
        padding: 1.75rem;
        backdrop-filter: blur(3px);
        box-shadow:
                0 0.4rem 1rem rgba(0, 0, 0, 0.15),
                inset 0 0 0 1px rgba(255, 255, 255, 0.1);
    }

    .bg-parallax {
        background-attachment: scroll;
    }
}

@media (max-width: 575.98px) {
    .login-container {
        border-radius: 0.5rem;
        padding: 1.5rem;
        box-shadow:
                0 0.25rem 0.75rem rgba(0, 0, 0, 0.1),
                inset 0 0 0 1px rgba(255, 255, 255, 0.05);
        margin: 0.5rem;
    }

    body {
        padding-top: 2rem;
    }
}

@media (max-width: 370px) {
    body {
        padding: 0 !important;
    }

    .login-container {
        width: 100%;
        min-height: 100vh;
        border-radius: 0;
        margin: 0;
        padding: 1.5rem;
        box-shadow:
                inset 0 0 0 1px rgba(255, 255, 255, 0.1),
                0 0 20px rgba(0, 0, 0, 0.1) !important;
    }
}

/* Анимации при наведении (только для устройств с hover) */
@media (hover: hover) and (pointer: fine) {
    .login-container:hover {
        transform: translateY(-5px);
        box-shadow:
                0 1rem 2rem rgba(0, 0, 0, 0.25),
                inset 0 0 0 1px rgba(255, 255, 255, 0.2),
                0 15px 30px -10px rgba(0, 0, 0, 0.3);
    }

    .password-data:hover {
        box-shadow:
                0 4px 10px rgba(0, 0, 0, 0.08) inset,
                0 2px 6px rgba(0, 0, 0, 0.1);
        transform: translateY(-2px);
    }
}