:root {
    --primary-color: #6f42c1; /* Modern Purple */
    --primary-dark: #5a32a3;
    --primary-light: #e2d9f3;
    --secondary-color: #858796;
    --success-color: #1cc88a;
    --info-color: #36b9cc;
    --warning-color: #f6c23e;
    --danger-color: #e74a3b;
    --light-bg: #f8f9fc;
    --dark-text: #5a5c69;
    --sidebar-width: 250px;
    --card-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15);
    --transition-speed: 0.3s;
}

body {
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
    background-color: var(--light-bg);
    color: var(--dark-text);
    overflow-x: hidden;
}

/* Sidebar Styling */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(180deg, var(--primary-color) 10%, var(--primary-dark) 100%);
    padding-top: 0;
    z-index: 1000;
    transition: all var(--transition-speed);
    box-shadow: 4px 0 10px rgba(0,0,0,0.1);
}

.sidebar .brand {
    padding: 1.5rem 1rem;
    color: white;
    font-size: 1.2rem;
    font-weight: 800;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.05rem;
    border-bottom: 1px solid rgba(255,255,255,0.15);
    margin-bottom: 1rem;
}

.sidebar .nav-link {
    color: rgba(255,255,255,0.8);
    padding: 14px 20px;
    margin: 0.2rem 1rem;
    border-radius: 0.35rem;
    font-weight: 600;
    transition: all 0.2s ease-in-out;
    display: flex;
    align-items: center;
}

.sidebar .nav-link:hover {
    color: #fff;
    background: rgba(255,255,255,0.1);
    transform: translateX(3px);
}

.sidebar .nav-link.active {
    color: var(--primary-color);
    background: #fff;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.sidebar .nav-link i {
    margin-right: 0.75rem;
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    padding: 1.5rem;
    min-height: 100vh;
    transition: all var(--transition-speed);
    display: flex;
    flex-direction: column;
}

/* Top Bar */
.top-bar {
    background: white;
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    border-radius: 0.35rem;
    box-shadow: var(--card-shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.top-bar h5 {
    color: var(--dark-text);
    font-weight: 700;
}

/* Cards */
.card {
    border: none;
    border-radius: 0.35rem;
    box-shadow: var(--card-shadow);
    margin-bottom: 1.5rem;
    transition: transform 0.2s;
}

.card:hover {
    transform: translateY(-2px);
}

.card-header {
    background-color: #f8f9fc;
    border-bottom: 1px solid #e3e6f0;
    padding: 1rem 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
    border-radius: 0.35rem 0.35rem 0 0 !important;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Stat Cards */
.stat-card {
    background: white;
    border-radius: 0.35rem;
    padding: 1.5rem;
    box-shadow: var(--card-shadow);
    margin-bottom: 1.5rem;
    border-left: 0.25rem solid var(--primary-color);
    transition: transform 0.2s;
    height: 100%;
}

.stat-card:hover {
    transform: translateY(-3px);
}

.stat-card .stat-value {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--dark-text);
    margin-bottom: 0.5rem;
}

.stat-card .stat-label {
    color: var(--secondary-color);
    font-size: 0.85rem;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.05rem;
}

/* Tables */
.table {
    color: var(--dark-text);
    margin-bottom: 0;
}

.table th {
    border-top: none;
    font-weight: 700;
    color: var(--primary-color);
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.05rem;
    padding: 1rem;
}

.table td {
    vertical-align: middle;
    padding: 1rem;
    border-top: 1px solid #e3e6f0;
}

.table-hover tbody tr:hover {
    background-color: rgba(0,0,0,0.02);
}

/* Badges */
.badge-status {
    padding: 0.5em 0.8em;
    border-radius: 50rem;
    font-weight: 700;
    font-size: 75%;
}

/* Buttons */
.btn {
    border-radius: 0.35rem;
    font-weight: 600;
    padding: 0.375rem 0.75rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: all 0.2s;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn-outline-primary {
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-outline-primary:hover {
    background-color: var(--primary-color);
    color: white;
}

/* User Info */
.user-info {
    display: flex;
    align-items: center;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    margin-right: 12px;
    font-size: 1.2rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1; 
}
 
::-webkit-scrollbar-thumb {
    background: #c1c1c1; 
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* 移动端遮罩层 */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

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

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        z-index: 1001;
    }
    .sidebar.show {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
        padding: 1rem;
    }
    .top-bar {
        margin: -1rem -1rem 1rem -1rem;
        border-radius: 0;
        padding: 1rem;
    }
    .stat-card {
        margin-bottom: 1rem;
    }
    .table-responsive {
        font-size: 0.85rem;
    }
    .btn-sm {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
    }
}
