:root {
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 70px;
    --primary-color: #667eea;
    --secondary-color: #764ba2;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8f9fa;
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: white;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 1030;
    transition: width 0.3s ease, transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

.sidebar.collapsed .menu-text {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

.sidebar.collapsed .menu-toggle {
    display: none;
}

.sidebar.collapsed .submenu {
    display: none !important;
}

.sidebar.collapsed .sidebar-brand .brand-text {
    display: none;
}

.sidebar.collapsed .sidebar-brand {
    justify-content: center;
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

/* Sidebar Brand */
.sidebar-brand {
    padding: 20px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    display: flex;
    align-items: center;
    text-decoration: none;
    font-size: 1.3rem;
    font-weight: 600;
    border-bottom: 2px solid rgba(255,255,255,0.1);
    transition: all 0.3s ease;
}

.sidebar-brand:hover {
    color: white;
    background: linear-gradient(135deg, #7c8ff5 0%, #8a5bb5 100%);
}

.sidebar-brand i {
    font-size: 1.5rem;
    margin-right: 10px;
    flex-shrink: 0;
}

.brand-text {
    white-space: nowrap;
    transition: opacity 0.3s ease;
}

/* Sidebar Menu */
.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
    flex: 1;
}

.sidebar-menu > li {
    border-bottom: 1px solid #f0f0f0;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: #333;
    text-decoration: none;
    transition: all 0.3s;
}

.sidebar-menu > li > a {
    font-weight: 500;
}

.sidebar-menu a:hover {
    background: #f8f9fa;
    color: var(--primary-color);
}

.sidebar-menu a.active {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
}

.sidebar-menu a i {
    width: 25px;
    margin-right: 10px;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.menu-text {
    transition: opacity 0.3s ease, width 0.3s ease;
    white-space: nowrap;
}

/* Submenu */
.submenu {
    list-style: none;
    padding: 0;
    margin: 0;
    background: #f8f9fa;
    display: none;
}

.submenu.show {
    display: block;
}

.submenu a {
    padding-left: 55px;
    font-size: 0.95rem;
}

.menu-toggle {
    margin-left: auto;
    transition: transform 0.3s;
}

.menu-toggle.rotated {
    transform: rotate(180deg);
}

/* User Section */
.user-section {
    padding: 15px 20px;
    background: #f8f9fa;
    border-top: 1px solid #e0e0e0;
    border-bottom: 1px solid #e0e0e0;
}

.user-info {
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s;
    padding: 5px;
    border-radius: 8px;
}

.user-info:hover {
    background: #e9ecef;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    margin-right: 12px;
    flex-shrink: 0;
    font-size: 1.1rem;
}

.user-details {
    flex: 1;
    min-width: 0;
    transition: opacity 0.3s ease;
}

.user-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-department {
    font-size: 0.8rem;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar.collapsed .user-section {
    padding: 10px;
}

.sidebar.collapsed .user-details {
    display: none;
}

.sidebar.collapsed .user-avatar {
    margin: 0 auto;
}

/* User Menu */
.user-menu {
    list-style: none;
    padding: 0;
    margin: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    overflow: hidden;
    display: none;
    margin-top: 10px;
}

.user-menu.show {
    display: block;
}

.user-menu li {
    border-bottom: 1px solid #f0f0f0;
}

.user-menu li:last-child {
    border-bottom: none;
}

.user-menu a {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: #333;
    text-decoration: none;
    transition: all 0.3s;
}

.user-menu a:hover {
    background: #f8f9fa;
    color: var(--primary-color);
}

.user-menu a.text-danger:hover {
    background: #fff5f5;
    color: #dc3545;
}

.user-menu a i {
    margin-right: 10px;
    width: 20px;
}

/* Toggle Sidebar Button */
.sidebar-toggle-btn {
    padding: 15px 20px;
    background: #f8f9fa;
    border: none;
    border-top: 1px solid #e0e0e0;
    cursor: pointer;
    display: flex;
    align-items: center;
    color: #333;
    font-weight: 500;
    transition: all 0.3s;
    width: 100%;
    text-align: left;
}

.sidebar-toggle-btn:hover {
    background: #e9ecef;
    color: var(--primary-color);
}

.sidebar-toggle-btn i {
    font-size: 1.2rem;
    margin-right: 10px;
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.sidebar.collapsed .sidebar-toggle-btn {
    justify-content: center;
}

.sidebar.collapsed .sidebar-toggle-btn .menu-text {
    display: none;
}

/* Main content */
.main-content {
    margin-left: var(--sidebar-width);
    padding: 30px;
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

.main-content.expanded {
    margin-left: var(--sidebar-collapsed-width);
}

/* Cards */
.card {
    border: none;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    border-radius: 10px;
    margin-bottom: 20px;
}

.card-header {
    background: white;
    border-bottom: 2px solid #f0f0f0;
    font-weight: 600;
    padding: 15px 20px;
}

/* Buttons */
.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border: none;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

/* Table */
.table {
    background: white;
}

.table thead th {
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
    color: #495057;
}

/* Page header */
.page-header {
    background: white;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

.page-header h1 {
    margin: 0;
    font-size: 1.8rem;
    font-weight: 600;
    color: #333;
}

.breadcrumb {
    background: none;
    padding: 0;
    margin: 5px 0 0 0;
}

/* Mobile Menu Button */
.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1025;
    opacity: 0;
    transition: opacity 0.3s;
}

.mobile-menu-overlay.show {
    display: block;
    opacity: 1;
}

.mobile-toggle-btn {
    display: none;
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1035;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    transition: all 0.3s;
}

.mobile-toggle-btn:hover {
    transform: scale(1.1);
}

/* Mobile responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .mobile-toggle-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }
}
