/* ===============================
    СОВРЕМЕННАЯ ТИПОГРАФИКА
    =============================== */
:root {
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --border-radius-lg: 20px;
    --border-radius-md: 15px;
    --border-radius-sm: 10px;
    --border-radius-xs: 8px;
    --shadow-light: 0 4px 15px rgba(0,0,0,0.1);
    --shadow-medium: 0 8px 25px rgba(0,0,0,0.2);
    --shadow-heavy: 0 15px 35px rgba(0,0,0,0.3);
    --transition-fast: 0.2s ease;
    --transition-medium: 0.3s ease;
    --transition-slow: 0.5s ease;
}

* {
    font-family: var(--font-family);
}

body {
    font-weight: 400;
    letter-spacing: -0.01em;
    background: linear-gradient(135deg, #0f0f23 0%, #1a1a2e 50%, #16213e 100%);
    background-attachment: fixed;
    min-height: 100vh;
    position: relative;
}

/* Добавим красивые floating particles на фон */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at top, rgba(0, 123, 255, 0.05) 0%, transparent 70%),
                radial-gradient(ellipse at bottom, rgba(40, 167, 69, 0.05) 0%, transparent 70%);
    pointer-events: none;
    z-index: -1;
}

/* ===============================
    УЛУЧШЕННЫЙ FLOATING NAVBAR
    =============================== */
.navbar {
    background: linear-gradient(135deg, rgba(255,255,255,0.12) 0%, rgba(255,255,255,0.06) 100%) !important;
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: var(--border-radius-lg);
    padding: 18px 30px;
    box-shadow: 
        var(--shadow-heavy),
        0 0 0 1px rgba(255,255,255,0.05) inset;
    position: sticky;
    top: 20px;
    z-index: 1030;
    margin: 20px auto 0 auto;
    max-width: 1300px;
    width: calc(100% - 40px);
    transition: all var(--transition-medium);
    transform: translateZ(0); /* Включаем hardware acceleration */
}

.navbar:hover {
    transform: translateY(-3px) scale(1.005);
    box-shadow: 
        0 20px 50px rgba(0,0,0,0.4),
        0 0 0 1px rgba(255,255,255,0.1) inset;
    border-color: rgba(255,255,255,0.25);
}

/* Container adjustments */
.navbar .container {
    max-width: none;
    padding: 0;
}

/* Улучшенный brand с микроанимациями */
.navbar-brand {
    font-weight: 700;
    font-size: 1.6rem;
    color: #ffffff !important;
    transition: all var(--transition-medium);
    display: flex;
    align-items: center;
    gap: 15px;
    letter-spacing: -0.02em;
}

.navbar-brand:hover {
    color: #007bff !important;
    transform: translateX(5px);
}

.navbar-brand i {
    font-size: 2rem;
    color: #28a745;
    animation: brand-glow 4s ease-in-out infinite;
    filter: drop-shadow(0 0 8px rgba(40, 167, 69, 0.4));
}

@keyframes brand-glow {
    0%, 100% { 
        transform: scale(1) rotate(0deg); 
        filter: drop-shadow(0 0 8px rgba(40, 167, 69, 0.4));
    }
    50% { 
        transform: scale(1.08) rotate(-3deg); 
        filter: drop-shadow(0 0 15px rgba(40, 167, 69, 0.6));
    }
}

/* Улучшенные навигационные ссылки */
.navbar-nav .nav-link {
    color: rgba(255,255,255,0.9) !important;
    font-weight: 500;
    padding: 12px 18px !important;
    border-radius: var(--border-radius-xs);
    transition: all var(--transition-medium);
    margin: 0 6px;
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
    overflow: hidden;
}

.navbar-nav .nav-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(255,255,255,0.1), rgba(255,255,255,0.05));
    border-radius: var(--border-radius-xs);
    opacity: 0;
    transform: scale(0.8);
    transition: all var(--transition-medium);
}

.navbar-nav .nav-link:hover::before {
    opacity: 1;
    transform: scale(1);
}

.navbar-nav .nav-link:hover {
    color: #ffffff !important;
    transform: translateY(-2px);
}

.navbar-nav .nav-link.active {
    color: #007bff !important;
    background: linear-gradient(135deg, rgba(0, 123, 255, 0.2), rgba(0, 123, 255, 0.1));
    box-shadow: 0 0 20px rgba(0, 123, 255, 0.3);
}

/* Улучшенная поисковая форма */
.search-form {
    position: relative;
    margin: 0 25px;
}

.search-input {
    background: rgba(255,255,255,0.12) !important;
    border: 1px solid rgba(255,255,255,0.25) !important;
    color: #ffffff !important;
    border-radius: 25px !important;
    padding: 12px 50px 12px 22px !important;
    transition: all var(--transition-medium);
    width: 280px;
    font-weight: 400;
    backdrop-filter: blur(10px);
}

.search-input:focus {
    background: rgba(255,255,255,0.18) !important;
    border-color: #007bff !important;
    box-shadow: 
        0 0 0 0.2rem rgba(0, 123, 255, 0.25) !important,
        0 8px 25px rgba(0, 123, 255, 0.15) !important;
    color: #ffffff !important;
    width: 320px;
    transform: translateY(-1px);
}

.search-input::placeholder {
    color: rgba(255,255,255,0.6) !important;
    font-weight: 400;
}

.search-btn {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    background: linear-gradient(135deg, #007bff, #0056b3);
    border: none;
    border-radius: 50%;
    width: 38px;
    height: 38px;
    color: white;
    transition: all var(--transition-medium);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 123, 255, 0.3);
}

.search-btn:hover {
    background: linear-gradient(135deg, #0056b3, #004085);
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 123, 255, 0.5);
}

/* Улучшенная кнопка logout */
.logout-btn {
    background: linear-gradient(135deg, rgba(220, 53, 69, 0.2), rgba(220, 53, 69, 0.1)) !important;
    border: 1px solid rgba(220, 53, 69, 0.4) !important;
    color: #ff6b6b !important;
    border-radius: var(--border-radius-xs) !important;
    padding: 12px 18px !important;
    font-weight: 500;
    transition: all var(--transition-medium);
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
    overflow: hidden;
}

.logout-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(220, 53, 69, 0.3), rgba(220, 53, 69, 0.2));
    opacity: 0;
    transition: all var(--transition-medium);
}

.logout-btn:hover::before {
    opacity: 1;
}

.logout-btn:hover {
    border-color: rgba(220, 53, 69, 0.6) !important;
    color: #ffffff !important;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(220, 53, 69, 0.3);
}

/* ===============================
    УЛУЧШЕННЫЕ СООБЩЕНИЯ
    =============================== */
.alert {
    background: linear-gradient(135deg, rgba(255,255,255,0.12) 0%, rgba(255,255,255,0.06) 100%);
    backdrop-filter: blur(15px);
    border-radius: var(--border-radius-md);
    border: 1px solid rgba(255,255,255,0.15);
    box-shadow: var(--shadow-medium);
    padding: 18px 22px;
    margin-bottom: 25px;
    position: relative;
    overflow: hidden;
    color: #ffffff;
    font-weight: 500;
    animation: slideInDown 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

@keyframes slideInDown {
    0% {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Улучшенные индикаторы статуса */
.alert::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 5px;
    border-radius: var(--border-radius-md) 0 0 var(--border-radius-md);
}

.alert-success::before { background: linear-gradient(180deg, #28a745, #20c997); }
.alert-info::before { background: linear-gradient(180deg, #17a2b8, #138496); }
.alert-warning::before { background: linear-gradient(180deg, #ffc107, #e0a800); }
.alert-danger::before { background: linear-gradient(180deg, #dc3545, #c82333); }

/* ===============================
    RESPONSIVE УЛУЧШЕНИЯ
    =============================== */
@media (max-width: 992px) {
    .navbar {
        margin: 15px auto 0 auto;
        width: calc(100% - 30px);
        border-radius: var(--border-radius-md);
        padding: 15px 25px;
    }

    .search-form {
        margin: 20px 0;
        order: 3;
        width: 100%;
    }

    .search-input {
        width: 100% !important;
    }

    .search-input:focus {
        width: 100% !important;
    }

    .navbar-nav {
        padding-top: 15px;
    }
}

@media (max-width: 576px) {
    .navbar {
        margin: 12px auto 0 auto;
        width: calc(100% - 20px);
        border-radius: var(--border-radius-sm);
        padding: 12px 18px;
        top: 12px;
    }

    .navbar-brand {
        font-size: 1.4rem;
    }
}

/* ===============================
    ACCESSIBILITY УЛУЧШЕНИЯ
    =============================== */

/* Focus indicators */
.btn:focus,
.form-control:focus,
.nav-link:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* Reduced motion для пользователей с чувствительностью */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===============================
    ДОПОЛНИТЕЛЬНЫЕ УЛУЧШЕНИЯ
    =============================== */

/* Улучшенный scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.05);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #007bff, #0056b3);
    border-radius: 4px;
    transition: all var(--transition-medium);
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #0056b3, #004085);
}

/* Selection styling */
::selection {
    background: rgba(0, 123, 255, 0.3);
    color: #ffffff;
}

/* Content spacing adjustments */
.main-container {
    margin-top: 30px;
    transition: all var(--transition-medium);
}

@media (max-width: 992px) {
    .main-container {
        margin-top: 100px;
    }
}

@media (max-width: 576px) {
    .main-container {
        margin-top: 90px;
    }
}