:root {
    --primary: #6c5ce7;
    --primary-dark: #5649c0;
    --primary-light: #a29bfe;
    --secondary: #00cec9;
    --danger: #ff7675;
    --warning: #fdcb6e;
    --success: #00b894;
    --dark: #1e1e2e;
    --light: #f5f6fa;
    --gray: #636e72;
    --gray-light: #dfe6e9;
    --bg-dark: #12121a;
    --bg-darker: #0d0d12;
    --bg-light: #1e1e2e;
    --text-dark: #2d3436;
    --text-light: #f5f6fa;
    --glass: rgba(30, 30, 46, 0.7);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.1);
}

[data-theme="light"] {
    --bg-dark: #f5f6fa;
    --bg-darker: #dfe6e9;
    --bg-light: #ffffff;
    --glass: rgba(255, 255, 255, 0.7);
    --text-dark: #2d3436;
    --text-light: #2d3436;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-light);
    min-height: 100vh;
    overflow-x: hidden;
    transition: var(--transition);
}

/* Глобальные анимации */
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.glass-effect {
    background: var(--glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: var(--shadow);
}

/* Auth Container */
.auth-container {
    max-width: 480px;
    width: 100%;
    margin: 2rem auto;
    padding: 2.5rem;
    border-radius: var(--border-radius);
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.auth-container::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, var(--primary), var(--secondary), var(--primary));
    background-size: 200% 200%;
    animation: gradientBG 15s ease infinite;
    z-index: -2;
    opacity: 0.3;
}

.auth-container::after {
    content: '';
    position: absolute;
    inset: 1px;
    border-radius: var(--border-radius);
    background: var(--bg-light);
    z-index: -1;
}

.auth-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.3rem;
    font-weight: 800;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.logo i {
    font-size: 2rem;
}

.theme-switcher button {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--bg-dark);
    color: var(--text-light);
    transition: var(--transition);
    border: none;
}

.theme-switcher button:hover {
    transform: scale(1.1);
    color: var(--primary);
}

.auth-tabs {
    display: flex;
    margin-bottom: 2rem;
    position: relative;
}

.auth-tabs::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(108, 92, 231, 0.3), transparent);
}

.tab-btn {
    padding: 0.75rem 1.5rem;
    background: none;
    color: var(--text-light);
    font-weight: 600;
    position: relative;
    opacity: 0.7;
    transition: var(--transition);
    border: none;
    cursor: pointer;
    font-size: 1rem;
}

.tab-btn.active {
    opacity: 1;
    color: var(--primary);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: 3px;
}

.auth-content {
    margin-bottom: 2rem;
}

.auth-form {
    display: none;
    animation: fadeIn 0.5s ease-out;
}

.auth-form.active {
    display: block;
}

.form-group {
    position: relative;
    margin-bottom: 1.75rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
    color: var(--text-light);
    opacity: 0.9;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 1rem 1rem 1rem 3rem;
    background-color: var(--bg-dark);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius-sm);
    color: var(--text-light);
    font-size: 1rem;
    transition: var(--transition);
}

.form-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.3);
    outline: none;
}

.btn-primary {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    color: white;
    border-radius: var(--border-radius-sm);
    font-weight: 600;
    font-size: 1rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    transition: var(--transition);
    border: none;
    cursor: pointer;
    margin-top: 1rem;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(108, 92, 231, 0.3);
}

.btn-primary i {
    font-size: 1rem;
}

.form-footer {
    margin-top: 1.5rem;
    text-align: center;
}

.link {
    color: var(--primary-light);
    font-size: 0.95rem;
    font-weight: 500;
    transition: var(--transition);
    text-decoration: none;
}

.link:hover {
    color: var(--primary);
    text-decoration: underline;
}

.auth-message {
    padding: 1rem;
    border-radius: var(--border-radius-sm);
    margin-top: 1.5rem;
    font-size: 0.95rem;
    display: none;
    animation: slideUp 0.4s ease-out;
}

.auth-message.success {
    background-color: rgba(0, 184, 148, 0.2);
    color: var(--success);
    border-left: 4px solid var(--success);
    display: block;
}

.auth-message.error {
    background-color: rgba(255, 118, 117, 0.2);
    color: var(--danger);
    border-left: 4px solid var(--danger);
    display: block;
}

/* Dashboard Styles */
.dashboard-container {
    display: flex;
    min-height: 100vh;
    background: var(--bg-darker);
}

.sidebar {
    width: 280px;
    background: var(--bg-dark);
    display: flex;
    flex-direction: column;
    transition: var(--transition);
    position: fixed;
    height: 100vh;
    z-index: 100;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    overflow: hidden; /* Убираем общую прокрутку */
}

/* Оптимизация отступов в сайдбаре */
.sidebar-header {
    padding: 1.5rem 1.25rem; /* Уменьшаем горизонтальный padding */
}

/* Настройка логотипа */
.sidebar-header .logo {
    font-size: 1.3rem; /* Чуть уменьшаем шрифт (опционально) */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis; /* Если текст не влезает, добавит "..." */
    max-width: 100%; /* Гарантирует, что текст не выйдет за границы */
}

/* Для мобильных устройств */
@media (max-width: 768px) {
    .sidebar-header .logo span {
        display: none; /* Скрываем текст, оставляя только иконку */
    }
    .sidebar.active .sidebar-header .logo span {
        display: inline; /* Показываем текст при открытом сайдбаре */
    }
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto; /* Добавляем прокрутку только для навигации */
    padding: 1.5rem 0;
}

.sidebar-nav ul {
    list-style: none;
    padding: 0 1.5rem;
}

.sidebar-nav li {
    margin-bottom: 0.5rem;
    position: relative;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1.25rem;
    color: var(--text-light);
    opacity: 0.8;
    transition: var(--transition);
    border-radius: var(--border-radius-sm);
    text-decoration: none;
    font-weight: 500;
}

.sidebar-nav a:hover {
    opacity: 1;
    background: rgba(108, 92, 231, 0.1);
    transform: translateX(5px);
}

.sidebar-nav a i {
    width: 24px;
    text-align: center;
    font-size: 1.1rem;
}

.sidebar-nav li.active a {
    opacity: 1;
    color: var(--primary);
    background: rgba(108, 92, 231, 0.2);
}

.sidebar-nav li.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 60%;
    width: 3px;
    background: linear-gradient(to bottom, var(--primary), var(--secondary));
    border-radius: 0 3px 3px 0;
}

.sidebar-footer {
    flex-shrink: 0; /* Запрещаем сжатие футера */
    padding: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    background: var(--bg-dark);
    position: sticky;
    bottom: 0;
    z-index: 10;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
    font-weight: 600;
}

.user-info {
    flex: 1;
}

.username {
    display: block;
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.user-id {
    display: block;
    font-size: 0.85rem;
    opacity: 0.7;
}

.btn-logout {
    width: 100%;
    padding: 0.75rem;
    background: rgba(255, 118, 117, 0.1);
    color: var(--danger);
    border-radius: var(--border-radius-sm);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    transition: var(--transition);
    border: none;
    cursor: pointer;
    font-weight: 500;
}

.btn-logout:hover {
    background: rgba(255, 118, 117, 0.2);
    transform: translateY(-2px);
}

.main-content {
    flex: 1;
    margin-left: 280px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
}

.main-header {
    padding: 1.25rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 90;
	background: var(--glass);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.sidebar-toggle {
    display: none;
    font-size: 1.5rem;
    color: var(--text-light);
    opacity: 0.8;
    transition: var(--transition);
    background: none;
    border: none;
    cursor: pointer;
}

.sidebar-toggle:hover {
    opacity: 1;
    color: var(--primary);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.notification-btn {
    position: relative;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-light);
    border-radius: 50%;
    color: var(--text-light);
    opacity: 0.8;
    transition: var(--transition);
    border: none;
    cursor: pointer;
}

.notification-btn:hover {
    opacity: 1;
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
}

.badge {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 20px;
    height: 20px;
    background: var(--danger);
    color: white;
    border-radius: 50%;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.content-wrapper {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.75rem;
    margin-bottom: 2.5rem;
}

.stat-card {
    background: var(--bg-light);
    border-radius: var(--border-radius);
    padding: 1.75rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(108, 92, 231, 0.1), transparent);
    opacity: 0;
    transition: var(--transition);
}

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

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
    flex-shrink: 0;
    transition: var(--transition);
}

.stat-card:hover .stat-icon {
    transform: scale(1.1);
}

.bg-blue {
    background: linear-gradient(135deg, var(--primary), #7f6bff);
}

.bg-green {
    background: linear-gradient(135deg, var(--success), #00d8a7);
}

.bg-purple {
    background: linear-gradient(135deg, #9c27b0, #d53aff);
}

.bg-orange {
    background: linear-gradient(135deg, var(--warning), #ffb347);
}

.stat-info h3 {
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    opacity: 0.8;
}

.stat-info span {
    font-size: 1.75rem;
    font-weight: 700;
    background: linear-gradient(90deg, var(--text-light), var(--text-light));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.content-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
}

.chart-container, .table-container {
    background: var(--bg-light);
    border-radius: var(--border-radius);
    transition: var(--transition);
    overflow: hidden;
}

.chart-container:hover, .table-container:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow);
}

.chart-header, .table-header {
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.chart-actions {
    display: flex;
    gap: 0.75rem;
}

.btn-chart-action {
    padding: 0.5rem 1rem;
    background: var(--bg-dark);
    color: var(--text-light);
    border-radius: var(--border-radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    transition: var(--transition);
    border: none;
    cursor: pointer;
}

.btn-chart-action.active {
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    color: white;
}

.chart-wrapper {
    height: 320px;
    padding: 1.5rem;
}

.btn-refresh {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-dark);
    border-radius: 50%;
    color: var(--text-light);
    transition: var(--transition);
    border: none;
    cursor: pointer;
}

.btn-refresh:hover {
    background: var(--primary);
    color: white;
    transform: rotate(180deg);
}

.table-wrapper {
    overflow-x: auto;
    padding: 0 1.5rem 1.5rem;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

th, td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    white-space: nowrap;
}

th {
    font-size: 0.85rem;
    font-weight: 600;
    opacity: 0.7;
    text-transform: uppercase;
    color: var(--primary-light);
}

tr:hover td {
    background: rgba(108, 92, 231, 0.05);
}

.form-icon {
    position: absolute;
    left: 1rem;
    top: 67%;
    transform: translateY(-50%);
    color: var(--gray);
    font-size: 1.1rem;
}

.form-group input:focus + .form-icon {
    color: var(--primary);

}

/* Анимации */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideUp {
    from { 
        opacity: 0;
        transform: translateY(20px);
    }
    to { 
        opacity: 1;
        transform: translateY(0);
    }
}

/* Мобильная адаптация */
@media (max-width: 1200px) {
    .content-grid {
        grid-template-columns: 1fr;
    }
    
    .chart-wrapper {
        height: 280px;
    }
}

@media (max-width: 992px) {
    .sidebar {
        width: 240px;
    }
    
    .main-content {
        margin-left: 240px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
        z-index: 1000;
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .sidebar-toggle {
        display: block;
    }
    
    .header-left h1 {
        font-size: 1.5rem;
    }
}

@media (max-width: 576px) {
    .auth-container {
        margin: 0;
        border-radius: 0;
        min-height: 100vh;
        padding: 2rem 1.5rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .content-wrapper {
        padding: 1.5rem;
    }
    
    .stat-card {
        flex-direction: column;
        text-align: center;
    }
    
    .stat-info {
        margin-top: 1rem;
    }
    
    th, td {
        padding: 0.75rem;
    }
}

/* Кастомный скролл */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}