/* ===== MODERN UI IMPROVEMENTS ===== */

:root {
    /* Обновленная цветовая палитра */
    --bg-primary: #0a0c10;
    --bg-secondary: #13151d;
    --bg-tertiary: #1c1f2b;
    --bg-quaternary: #252936;

    /* Улучшенные границы */
    --border: rgba(255, 255, 255, 0.06);
    --border-hover: rgba(139, 92, 246, 0.3);

    /* Градиенты */
    --gradient-primary: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 50%, #6d28d9 100%);
    --gradient-accent: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    --gradient-success: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --gradient-warm: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);

    /* Тени */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.4);
    --shadow-glow-purple: 0 8px 32px rgba(139, 92, 246, 0.25);
    --shadow-glow-blue: 0 8px 32px rgba(59, 130, 246, 0.25);
}

/* ===== Улучшенный Sidebar ===== */
.sidebar {
    background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    border-right: 1px solid var(--border);
    backdrop-filter: blur(10px);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.2);
}

.logo-box {
    position: relative;
}

.logo-box::after {
    content: '';
    position: absolute;
    bottom: -20px;
    left: 30px;
    right: 30px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border), transparent);
}

.logo-box img {
    filter: drop-shadow(0 4px 12px rgba(139, 92, 246, 0.4));
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.logo-box:hover img {
    filter: drop-shadow(0 6px 20px rgba(139, 92, 246, 0.6));
    transform: scale(1.05);
}

.logo-name {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 800;
    letter-spacing: -0.5px;
}

/* Улучшенная навигация */
.nav-link {
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 12px;
    margin: 2px 12px;
}

.nav-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 0;
    background: var(--gradient-primary);
    border-radius: 0 4px 4px 0;
    transition: height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-link:hover::before {
    height: 60%;
}

.nav-link.active::before {
    height: 80%;
}

.nav-link:hover {
    background: rgba(139, 92, 246, 0.08);
    padding-left: 36px;
    box-shadow: inset 0 0 20px rgba(139, 92, 246, 0.1);
}

.nav-link.active {
    background: rgba(139, 92, 246, 0.15);
    box-shadow: inset 0 0 30px rgba(139, 92, 246, 0.2);
}

/* ===== Улучшенный Topbar ===== */
.topbar {
    background: rgba(19, 21, 29, 0.8);
    backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
}

.search input {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.2);
}

.search input:focus {
    background: var(--bg-quaternary);
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.15), inset 0 2px 8px rgba(0, 0, 0, 0.2);
    transform: translateY(-1px);
}

/* Улучшенный аватар */
.avatar {
    background: var(--gradient-primary);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.avatar::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transform: rotate(45deg);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0%, 100% { transform: translateX(-100%) rotate(45deg); }
    50% { transform: translateX(100%) rotate(45deg); }
}

.user-box:hover .avatar {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.6);
}

.logout-btn {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.logout-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(239, 68, 68, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.logout-btn:hover::before {
    width: 300px;
    height: 300px;
}

.logout-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: var(--danger);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.logout-btn:active {
    transform: translateY(0);
}

/* ===== Улучшенные карточки статистики ===== */
.stat-card {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 32px;
    position: relative;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
    background: var(--gradient-primary);
    opacity: 0.8;
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at top right, rgba(139, 92, 246, 0.05), transparent 70%);
    pointer-events: none;
}

.stat-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: var(--shadow-glow-purple);
    border-color: rgba(139, 92, 246, 0.3);
}

.stat-value {
    font-size: 56px;
    font-weight: 900;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -2px;
    text-shadow: 0 4px 20px rgba(139, 92, 246, 0.3);
}

.stat-badge {
    backdrop-filter: blur(10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-badge:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* ===== Улучшенные кнопки ===== */
.btn {
    background: var(--gradient-primary);
    border: none;
    box-shadow: 0 4px 16px rgba(139, 92, 246, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.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:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(139, 92, 246, 0.5);
}

.btn:active {
    transform: translateY(-1px);
}

/* ===== Улучшенные action cards ===== */
.action-card {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 28px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.action-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, rgba(139, 92, 246, 0.08), transparent 70%);
    opacity: 0;
    transition: opacity 0.4s;
}

.action-card:hover::before {
    opacity: 1;
}

.action-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(139, 92, 246, 0.4);
}

.action-icon {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.action-card:hover .action-icon {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
}

/* ===== Таблицы ===== */
.table-container {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    border: 1px solid var(--border);
    border-radius: 24px;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(10px);
}

tbody tr {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

tbody tr:hover {
    background: rgba(139, 92, 246, 0.08);
    transform: scale(1.01);
    box-shadow: inset 0 0 20px rgba(139, 92, 246, 0.1);
}

/* ===== Анимация появления ===== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.stat-card, .action-card, .table-container {
    animation: fadeInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) backwards;
}

.stat-card:nth-child(1) { animation-delay: 0.1s; }
.stat-card:nth-child(2) { animation-delay: 0.2s; }
.stat-card:nth-child(3) { animation-delay: 0.3s; }
.stat-card:nth-child(4) { animation-delay: 0.4s; }

.action-card:nth-child(1) { animation-delay: 0.2s; }
.action-card:nth-child(2) { animation-delay: 0.3s; }
.action-card:nth-child(3) { animation-delay: 0.4s; }
.action-card:nth-child(4) { animation-delay: 0.5s; }

/* ===== Улучшенные формы ===== */
input, select, textarea {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

input:focus, select:focus, textarea:focus {
    background: var(--bg-quaternary);
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.15), inset 0 2px 4px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--primary), #7c3aed);
    border-radius: 5px;
    border: 2px solid var(--bg-primary);
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #7c3aed, var(--primary));
}

/* ===== Page header улучшения ===== */
.page-title {
    background: linear-gradient(135deg, var(--text-primary), var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -1px;
}

/* ===== Mobile menu button ===== */
.mobile-menu-btn {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-menu-btn:hover {
    background: var(--bg-quaternary);
    border-color: var(--primary);
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}
