/* ========================================
   1. Глобальные переменные и базовые стили
   ======================================== */
:root {
    --gradient-start: #2a7f6e; /* Зеленый */
    --gradient-mid: #1e4a7a; /* Синий */
    --gradient-end: #4a2a7f; /* Фиолетовый */
    --text-light: #f8f9fa;
    --shadow-sm: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --shadow-md: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    --transition-speed: 0.3s;
}

/* ========================================
   2. Базовые стили и структура страницы
   ======================================== */
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-mid), var(--gradient-end));
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
    color: #333;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    display: flex;
    flex-direction: column;
}

/* Анимация движения градиента */
@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

/* ========================================
   3. Основной контейнер контента
   ======================================== */
.content-wrapper {
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
    position: relative;
    z-index: 1;
    overflow: visible !important;
}

/* Основной контейнер с содержимым */
.container {
    flex: 1 0 auto;
    padding-bottom: 1.5rem;
    overflow: visible !important;
}

/* Основной блок с контентом */
main {
    padding-bottom: 1rem;
}

/* ========================================
   4. Навигация (Navbar)
   ======================================== */
.navbar {
    background: rgba(255, 255, 255, 0.85) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    position: relative;
    z-index: 1060 !important;
}

.navbar-brand {
    font-weight: 700;
    color: var(--gradient-start) !important;
    transition: color var(--transition-speed);
}

    .navbar-brand:hover {
        color: var(--gradient-end) !important;
    }

.nav-link {
    color: #495057 !important;
    transition: all var(--transition-speed);
    border-radius: 0.5rem;
    padding: 0.5rem 1rem !important;
    margin: 0 0.1rem;
}

    .nav-link:hover {
        background: rgba(42, 127, 110, 0.1);
        color: var(--gradient-start) !important;
        transform: translateY(-2px);
    }

    .nav-link.active {
        background: linear-gradient(135deg, var(--gradient-start), var(--gradient-mid));
        color: white !important;
        box-shadow: var(--shadow-md);
    }

/* Выпадающее меню */
.dropdown-menu {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: var(--shadow-md);
    border-radius: 0.75rem;
    padding: 0.5rem;
    animation: slideDown 0.2s ease;
    z-index: 1050 !important;
}

/* Фикс для выпадающего меню в навигации */
.navbar-nav {
    position: static !important;
}

    .navbar-nav .dropdown-menu {
        position: absolute !important;
        margin-top: 0.5rem;
    }

.dropdown-item {
    border-radius: 0.5rem;
    transition: all var(--transition-speed);
    padding: 0.5rem 1rem;
}

    .dropdown-item:hover {
        background: linear-gradient(135deg, var(--gradient-start), var(--gradient-mid));
        color: white !important;
        transform: translateX(4px);
    }

    .dropdown-item.text-danger:hover {
        background: #dc3545;
        color: white !important;
    }

/* Анимация выпадающего меню */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Стили для вложенных меню */
.dropdown-submenu {
    position: relative;
}

    .dropdown-submenu > .dropdown-menu {
        top: 0;
        left: 100%;
        margin-top: -6px;
        margin-left: -1px;
        border-radius: 0.375rem;
    }

    .dropdown-submenu:hover > .dropdown-menu {
        display: block;
    }

/* ========================================
   5. Карточки (Cards)
   ======================================== */
.card {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 1rem !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transition: all var(--transition-speed) ease;
    position: relative;
    z-index: 1;
}

    .card:hover {
        transform: translateY(-5px);
        box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
    }

.card-header {
    border-radius: 1rem 1rem 0 0 !important;
    background: rgba(255, 255, 255, 0.5) !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    backdrop-filter: blur(5px);
    font-weight: 600;
}

/* ========================================
   6. Кнопки (Buttons)
   ======================================== */
.btn {
    border-radius: 0.75rem;
    padding: 0.5rem 1.25rem;
    font-weight: 500;
    transition: all var(--transition-speed) ease;
    position: relative;
    overflow: hidden;
}

/* Градиентные кнопки */
.btn-primary {
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-mid));
    border: none;
    color: white;
}

    .btn-primary:hover {
        transform: translateY(-3px);
        box-shadow: 0 8px 20px rgba(30, 74, 122, 0.3);
        color: white;
    }

    .btn-primary:active {
        transform: translateY(0);
    }

.btn-success {
    background: linear-gradient(135deg, #28a745, #209cee);
    border: none;
}

    .btn-success:hover {
        transform: translateY(-3px);
        box-shadow: 0 8px 20px rgba(40, 167, 69, 0.3);
    }

.btn-danger {
    background: linear-gradient(135deg, #dc3545, #e74c3c);
    border: none;
}

    .btn-danger:hover {
        transform: translateY(-3px);
        box-shadow: 0 8px 20px rgba(220, 53, 69, 0.3);
    }

/* Кнопки с Outline */
.btn-outline-primary {
    border: 2px solid var(--gradient-start);
    color: var(--gradient-start);
}

    .btn-outline-primary:hover {
        background: linear-gradient(135deg, var(--gradient-start), var(--gradient-mid));
        border-color: transparent;
        color: white;
        transform: translateY(-3px);
        box-shadow: 0 8px 20px rgba(42, 127, 110, 0.3);
    }

/* ========================================
   7. Таблицы
   ======================================== */
.table {
    background: rgba(255, 255, 255, 0.8);
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

    .table thead th {
        background: linear-gradient(135deg, var(--gradient-start), var(--gradient-mid));
        color: white;
        font-weight: 600;
        border: none;
        padding: 1rem;
    }

    .table tbody tr {
        transition: background var(--transition-speed);
    }

        .table tbody tr:hover {
            background: rgba(42, 127, 110, 0.05);
        }

/* ========================================
   8. Формы (Input, Select, Textarea)
   ======================================== */
.form-control, .form-select {
    border-radius: 0.75rem;
    border: 2px solid #e9ecef;
    transition: all var(--transition-speed);
    background: rgba(255, 255, 255, 0.8);
}

    .form-control:focus, .form-select:focus {
        border-color: var(--gradient-start);
        box-shadow: 0 0 0 0.2rem rgba(42, 127, 110, 0.15);
        transform: scale(1.02);
    }

/* ========================================
   9. Прогресс-бар
   ======================================== */
.progress {
    position: relative;
    z-index: 0;
    border-radius: 1rem;
    background: rgba(0, 0, 0, 0.05);
    overflow: hidden;
    height: 2rem;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

.progress-bar {
    background: linear-gradient(90deg, var(--gradient-start), var(--gradient-mid), var(--gradient-end));
    font-weight: 700;
    font-size: 0.9rem;
    transition: width 0.6s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
    position: relative;
    overflow: hidden;
}

    /* Эффект "блеска" поверх прогрессбара */
    .progress-bar::after {
        content: '';
        position: absolute;
        top: 0;
        left: -75%;
        width: 50%;
        height: 100%;
        background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
        transform: skewX(-25deg);
        animation: shimmer 4s infinite;
    }

@keyframes shimmer {
    0% {
        left: -75%;
    }

    100% {
        left: 125%;
    }
}

/* ========================================
   10. Аккордеон (для списка материалов)
   ======================================== */
.accordion-button {
    border-radius: 0.75rem !important;
    background: rgba(255, 255, 255, 0.5);
    transition: all var(--transition-speed);
}

    .accordion-button:not(.collapsed) {
        background: linear-gradient(135deg, var(--gradient-start), var(--gradient-mid));
        color: white;
        box-shadow: none;
    }

    .accordion-button:hover {
        transform: scale(1.01);
    }

.accordion-item {
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 0.75rem !important;
    margin-bottom: 0.5rem;
    background: rgba(255, 255, 255, 0.5);
}

/* ========================================
   11. Футер (Footer) - ИСПРАВЛЕННЫЙ
   ======================================== */
.footer {
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.7) !important;
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    padding: 0.6rem 0 !important;
    margin-top: 1.5rem !important;
    color: #495057 !important;
    text-align: center;
    font-size: 0.85rem;
    width: 100%;
    position: relative;
    z-index: 1;
}

/* ========================================
   12. Уведомления (Alerts) с правильным z-index
   ======================================== */
.alert {
    position: relative;
    z-index: 1040 !important; /* Меньше, чем у меню (1050) */
}

/* ========================================
   13. Анимации для элементов при загрузке
   ======================================== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card, .table, .alert {
    animation: fadeInUp 0.6s ease forwards;
}

/* ========================================
   14. Адаптивность для мобильных
   ======================================== */
@media (max-width: 768px) {
    .navbar-brand {
        font-size: 1.1rem;
    }

    .card {
        margin-bottom: 1rem;
    }

    .table thead th {
        font-size: 0.85rem;
        padding: 0.75rem;
    }

    .btn {
        padding: 0.4rem 1rem;
        font-size: 0.9rem;
    }

    .footer {
        padding: 0.4rem 0 !important;
        font-size: 0.7rem;
        margin-top: 1rem !important;
    }

        .footer .row {
            flex-direction: column;
            text-align: center;
        }

        .footer .col-md-6 {
            width: 100%;
            text-align: center !important;
        }

    .container {
        padding-bottom: 1rem;
    }
}
/* ПРИНУДИТЕЛЬНЫЙ ФИКС ФУТЕРА И СКРОЛЛА */
html, body {
    height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow-y: auto !important;
}

.content-wrapper {
    min-height: 100vh !important;
    padding-bottom: 80px !important; /* Запас под футер */
    display: block !important;
}

.footer {
    position: relative !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 100% !important;
    padding: 10px 0 !important;
    margin-top: 20px !important;
    background: rgba(255, 255, 255, 0.9) !important;
    flex-shrink: 0 !important;
    z-index: 10 !important;
}

.container {
    padding-bottom: 60px !important;
}

/* Убираем возможные overflow: hidden */
body, .content-wrapper, .container, main {
    overflow: visible !important;
}
/* ========================================
   ЖЕСТКИЙ ФИКС ФУТЕРА И СКРОЛЛА (последний слой)
   ======================================== */
html, body {
    height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow-y: auto !important;
}

body {
    display: flex !important;
    flex-direction: column !important;
}

.content-wrapper {
    flex: 1 0 auto !important;
    display: flex !important;
    flex-direction: column !important;
    min-height: 100vh !important;
    padding-bottom: 0 !important; /* Убираем лишний отступ */
}

.container {
    flex: 1 0 auto !important;
    padding-bottom: 20px !important;
}

main {
    flex: 1 0 auto !important;
    padding-bottom: 20px !important;
}

/* Футер - прижат к низу, но не перекрывает контент */
.footer {
    flex-shrink: 0 !important;
    position: relative !important;
    bottom: auto !important;
    left: auto !important;
    width: 100% !important;
    padding: 8px 0 !important; /* Уменьшаем высоту */
    margin-top: 0 !important; /* Убираем большой отступ */
    background: rgba(255, 255, 255, 0.8) !important;
    border-top: 1px solid rgba(0, 0, 0, 0.05) !important;
    color: #495057 !important;
    text-align: center !important;
    font-size: 0.8rem !important;
    z-index: 10 !important;
}

/* Убираем возможные overflow: hidden у контейнеров */
body, .content-wrapper, .container, main {
    overflow: visible !important;
}

/* Для мобильных */
@media (max-width: 768px) {
    .footer {
        padding: 4px 0 !important;
        font-size: 0.65rem !important;
    }

    .container {
        padding-bottom: 10px !important;
    }
}
