/* Навигация и сайдбар */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 280px;
    background: var(--dark-color);
    z-index: 1000;
    transition: var(--transition);
    overflow-y: auto;
}

.sidebar.collapsed {
    width: 70px;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-logo {
    color: white;
    font-size: 2rem;
    font-weight: 700;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar.collapsed .sidebar-logo span {
    display: none;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius);
    transition: var(--transition);
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

.sidebar-nav {
    padding: 1rem 0;
}

.sidebar-section {
    margin-bottom: 2rem;
}

.sidebar-section-title {
    color: rgba(255, 255, 255, 0.5);
    font-size: 1.2rem;
    font-weight: 600;
    text-transform: uppercase;
    padding: 0 1.5rem;
    margin-bottom: 0.5rem;
}

.sidebar.collapsed .sidebar-section-title {
    display: none;
}

.sidebar-item {
    display: block;
    padding: 0.75rem 1.5rem;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: var(--transition);
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.sidebar-item.active {
    background: var(--primary-color);
    color: white;
}

.sidebar-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: white;
}

.sidebar.collapsed .sidebar-item span {
    display: none;
}

.sidebar-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* Основной контент */
.main-content {
    margin-left: 280px;
    min-height: 100vh;
    transition: var(--transition);
}

.main-content.expanded {
    margin-left: 70px;
}

.main-content .container-fluid {
    padding: 2rem;
}

/* Топбар */
.topbar {
    background: white;
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.search-box {
    position: relative;
    width: 300px;
}

.search-input {
    width: 100%;
    padding: 0.5rem 1rem 0.5rem 2.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 1.4rem;
    transition: var(--transition);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    width: 16px;
    height: 16px;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
}

.user-menu:hover {
    background: var(--light-color);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.4rem;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 500;
    font-size: 1.4rem;
    color: var(--text-primary);
}

.user-role {
    font-size: 1.2rem;
    color: var(--text-secondary);
}

/* Мобильное меню */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
}

.mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

/* Адаптивность */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.mobile-open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .mobile-menu-toggle {
        display: block;
        font-size: 2.25rem;
        line-height: 1;
        padding-left: 0;
    }
    
    .mobile-overlay.show {
        display: block;
    }

    .sidebar-toggle {
        display: none;
    }

    #tasksTable th,
    #tasksTable td {
        min-width: 50vw;
        font-size: 1.6rem;
    }

    .tasks-table-responsive {
        border: none;
        border-radius: 0;
    }

    .tasks-list-card {
        border: none;
        box-shadow: none;
    }
    
    .search-box {
        width: 200px;
    }
    
    .user-info {
        display: none;
    }

    .container-fluid {
        padding: 0 0.9rem;
    }

    .main-content .container-fluid {
        padding: 0 0.9rem !important;
    }

    .departments-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .departments-actions {
        width: 100%;
    }

    .departments-actions .btn {
        width: 100%;
    }

    .tasks-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .tasks-actions {
        width: 100%;
    }

    .card-header,
    .card-body,
    .card-footer {
        padding: 0.5rem 0.5rem 0.5rem 0;
    }

    .card-body {
        border: none;
    }

    .mb-6 { margin-bottom: 0.75rem; }
    .mb-4 { margin-bottom: 0.5rem; }
    .mt-6 { margin-top: 0.75rem; }
    .mt-4 { margin-top: 0.5rem; }
}

@media (max-width: 640px) {
    .topbar {
        padding: 0.75rem 0.9rem;
    }
    
    .search-box {
        display: none;
    }

    .topbar-right {
        width: 100%;
        justify-content: space-between;
    }
}


/* Статистика */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    font-size: 2.4rem;
}

.stat-icon.primary {
    background: #dbeafe;
    color: var(--primary-color);
}

.stat-icon.success {
    background: #d1fae5;
    color: var(--success-color);
}

.stat-icon.warning {
    background: #fed7aa;
    color: var(--warning-color);
}

.stat-icon.danger {
    background: #fee2e2;
    color: var(--danger-color);
}

.stat-value {
    font-size: 3.2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 1.4rem;
}

.stat-change {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 1.2rem;
    font-weight: 500;
    margin-top: 0.5rem;
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
}

.stat-change.positive {
    color: var(--success-color);
    background: #d1fae5;
}

.stat-change.negative {
    color: var(--danger-color);
    background: #fee2e2;
}
