/* Общие стили */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --bg-main: linear-gradient(135deg, #0f0f23 0%, #1a1a2e 100%);
    --bg-card: rgba(255, 255, 255, 0.05);
    --bg-card-hover: rgba(255, 255, 255, 0.08);
    --text-primary: #ffffff;
    --text-secondary: #a0a6b8;
    --border-color: rgba(255, 255, 255, 0.1);
    --btn-primary-bg: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --btn-primary-hover: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
    --btn-secondary-bg: rgba(255, 255, 255, 0.1);
    --btn-secondary-hover: rgba(255, 255, 255, 0.15);
    --alert-success: #10b981;
    --alert-danger: #ef4444;
    --alert-warning: #f59e0b;
    --shadow-light: rgba(255, 255, 255, 0.05);
    --shadow-dark: rgba(0, 0, 0, 0.3);
    --accent-color: #8b5cf6;
    --accent-glow: rgba(139, 92, 246, 0.3);
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-main);
    color: var(--text-primary);
    margin: 0;
    padding: 0;
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 80%, rgba(120, 119, 198, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 119, 198, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(120, 219, 255, 0.1) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 30px 20px;
}

/* Навигация */
nav {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

nav .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    position: relative;
}

nav .logo {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 1001;
}

nav .logo::before {
    content: '🤖';
    font-size: 1.2em;
}

.nav-links {
    display: flex;
    gap: 4px;
    align-items: center;
}

.nav-item {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 12px 16px;
    border-radius: 10px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
    position: relative;
    overflow: hidden;
    white-space: nowrap;
}

.nav-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
}

.nav-item:hover {
    color: var(--text-primary);
    transform: translateY(-1px);
}

.nav-item:hover::before {
    opacity: 1;
}

.nav-logout {
    background: rgba(239, 68, 68, 0.1) !important;
    color: #ef4444 !important;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.nav-logout:hover {
    background: rgba(239, 68, 68, 0.2) !important;
    color: #fee2e2 !important;
}

/* Выпадающие меню */
.nav-dropdown {
    position: relative;
}

.dropdown-toggle::after {
    content: '▾';
    margin-left: 6px;
    font-size: 0.8em;
    transition: transform 0.3s ease;
}

.nav-dropdown.active .dropdown-toggle::after {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    background: rgba(15, 15, 35, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 8px 0;
    min-width: 160px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    box-shadow: 
        0 10px 40px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.nav-dropdown.active .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-menu a {
    display: block;
    padding: 10px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s ease;
    border-radius: 0;
}

.dropdown-menu a:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    transform: none;
}

.dropdown-menu a:hover::before {
    display: none;
}

/* Карточки и блоки контента */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 32px;
    margin-bottom: 24px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.12),
        inset 0 1px 0 var(--shadow-light);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
}

.card:hover {
    background: var(--bg-card-hover);
    transform: translateY(-2px);
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 var(--shadow-light);
}

/* Заголовки */
h1, h2, h3 {
    color: var(--text-primary);
    margin-top: 0;
    font-weight: 600;
    letter-spacing: -0.02em;
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #ffffff 0%, #a0a6b8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

h2 {
    font-size: 1.875rem;
    margin-bottom: 1rem;
}

h3 {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
}

/* Формы и элементы управления */
label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="date"],
textarea,
select {
    width: 100%;
    padding: 16px 20px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(10px);
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

input:focus, 
textarea:focus, 
select:focus {
    border-color: var(--accent-color);
    background: rgba(255, 255, 255, 0.05);
    outline: 0;
    box-shadow: 
        0 0 0 3px var(--accent-glow),
        0 8px 32px rgba(139, 92, 246, 0.15);
    transform: translateY(-1px);
}

input::placeholder,
textarea::placeholder {
    color: var(--text-secondary);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px 32px;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    border: none;
    border-radius: 12px;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    font-family: inherit;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    color: #ffffff;
    background: var(--btn-primary-bg);
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover {
    background: var(--btn-primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    color: var(--text-primary);
    background: var(--btn-secondary-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--btn-secondary-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* Таблицы */
.table-responsive {
    overflow-x: auto;
    border-radius: 16px;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
}

table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
}

th, td {
    padding: 20px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

th {
    background: rgba(255, 255, 255, 0.02);
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

tbody tr {
    transition: background-color 0.2s ease;
}

tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

/* Списки */
ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

ul li {
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.2s ease;
    border-radius: 8px;
    margin-bottom: 4px;
}

ul li:hover {
    background: rgba(255, 255, 255, 0.03);
    transform: translateX(4px);
}

ul li:last-child {
    border-bottom: none;
}

/* Выделение ссылок и имен пользователей */
a {
    color: #8b5cf6;
    text-decoration: none;
    transition: all 0.3s ease;
    font-weight: 500;
}

a:hover {
    color: #a78bfa;
    text-decoration: underline;
}

/* Уведомления */
.alert {
    padding: 20px 24px;
    margin-bottom: 24px;
    border-radius: 16px;
    font-weight: 500;
    border: 1px solid;
    backdrop-filter: blur(20px);
    position: relative;
    overflow: hidden;
}

.alert::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--alert-success);
    border-color: rgba(16, 185, 129, 0.3);
}

.alert-success::before {
    background: var(--alert-success);
}

.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--alert-danger);
    border-color: rgba(239, 68, 68, 0.3);
}

.alert-danger::before {
    background: var(--alert-danger);
}

.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--alert-warning);
    border-color: rgba(245, 158, 11, 0.3);
}

.alert-warning::before {
    background: var(--alert-warning);
}

.text-gray-500 {
    color: var(--text-secondary);
    font-size: 0.9em;
}

/* Статистические карточки */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    padding: 24px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    text-align: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, var(--accent-color), #764ba2);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Дополнительные улучшения для графиков */
canvas {
    border-radius: 12px !important;
}

/* Скроллбар */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    transition: background 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Анимации */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    animation: fadeInUp 0.6s ease-out;
}

/* Селекторы состояний */
.btn:active {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn:disabled:hover {
    transform: none;
    box-shadow: none;
}

/* Код и моноширинные элементы */
code {
    background: rgba(255, 255, 255, 0.1);
    color: #a78bfa;
    padding: 4px 8px;
    border-radius: 6px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9em;
    font-weight: 500;
}

/* Дополнительные утилиты */
.text-center {
    text-align: center;
}

.mt-4 {
    margin-top: 1rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

.p-4 {
    padding: 1rem;
}

/* Мобильная адаптивность */
@media (max-width: 768px) {
    .container {
        padding: 20px 15px;
    }
    
    nav .container {
        padding: 0 15px;
    }
    
    .nav-links {
        display: none;
    }
    
    .mobile-menu-toggle {
        display: flex;
        flex-direction: column;
        width: 24px;
        height: 20px;
        cursor: pointer;
        z-index: 1001;
    }

    .mobile-menu-toggle span {
        display: block;
        height: 2px;
        width: 100%;
        background: var(--text-primary);
        margin-bottom: 4px;
        transition: all 0.3s ease;
        border-radius: 1px;
    }

    .mobile-menu-toggle span:last-child {
        margin-bottom: 0;
    }

    .mobile-menu-toggle.active span:nth-child(1) {
        transform: rotate(45deg) translate(6px, 6px);
    }

    .mobile-menu-toggle.active span:nth-child(2) {
        opacity: 0;
    }

    .mobile-menu-toggle.active span:nth-child(3) {
        transform: rotate(-45deg) translate(6px, -6px);
    }

    .mobile-nav {
        position: fixed;
        top: 80px;
        left: 0;
        right: 0;
        background: rgba(15, 15, 35, 0.98);
        backdrop-filter: blur(20px);
        border-top: 1px solid var(--border-color);
        padding: 20px;
        opacity: 0;
        visibility: hidden;
        transform: translateY(-20px);
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 999;
        max-height: calc(100vh - 80px);
        overflow-y: auto;
    }

    .mobile-nav.active {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }

    .mobile-nav > a {
        display: block;
        padding: 14px 0;
        color: var(--text-secondary);
        text-decoration: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
        transition: color 0.2s ease;
        font-weight: 500;
    }

    .mobile-nav > a:hover {
        color: var(--text-primary);
    }

    .mobile-section {
        margin: 20px 0;
    }

    .mobile-section h4 {
        color: var(--text-primary);
        font-size: 0.9rem;
        font-weight: 600;
        margin-bottom: 12px;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        opacity: 0.8;
    }

    .mobile-section a {
        display: block;
        padding: 10px 0 10px 20px;
        color: var(--text-secondary);
        text-decoration: none;
        transition: all 0.2s ease;
        border-left: 2px solid transparent;
        font-size: 0.95rem;
    }

    .mobile-section a:hover {
        color: var(--text-primary);
        border-left-color: var(--accent-color);
    }

    .mobile-logout {
        background: rgba(239, 68, 68, 0.1) !important;
        color: #ef4444 !important;
        border: 1px solid rgba(239, 68, 68, 0.2);
        border-radius: 8px;
        margin-top: 20px;
        text-align: center;
    }

    body.mobile-menu-open {
        overflow: hidden;
    }

    .btn {
        width: 100%;
        margin-top: 10px;
        padding: 14px 24px;
    }

    .card {
        padding: 24px 20px;
        border-radius: 16px;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    th, td {
        padding: 12px 8px;
        font-size: 0.9rem;
    }
}

/* Специальные стили для выпадающих меню на планшетах */
@media (min-width: 769px) and (max-width: 1024px) {
    .dropdown-menu {
        min-width: 140px;
    }
    
    .nav-item {
        padding: 10px 12px;
        font-size: 0.9rem;
    }
    
    .dropdown-toggle::after {
        margin-left: 4px;
    }
}

/* Дополнительная адаптивность для маленьких экранов */
@media (max-width: 480px) {
    nav .logo {
        font-size: 1.3rem;
    }
    
    .mobile-nav {
        padding: 15px;
        top: 70px;
        max-height: calc(100vh - 70px);
    }
    
    .mobile-section {
        margin: 16px 0;
    }
    
    h1 {
        font-size: 1.8rem;
    }
    
    .card {
        padding: 20px 16px;
    }
}

/* Ландшафтная ориентация на мобильных */
@media (max-width: 768px) and (orientation: landscape) {
    .mobile-nav {
        max-height: calc(100vh - 60px);
        top: 60px;
    }
}

/* По умолчанию скрываем мобильные элементы на десктопе */
.mobile-menu-toggle {
    display: none;
}

.mobile-nav {
    display: none;
}