:root {
    --primary: #1e88e5;
    --primary-dark: #1976d2;
    --primary-light: #bbdefb;
    --secondary: #6c757d;
    --success: #28a745;
    --info: #17a2b8;
    --warning: #ffc107;
    --danger: #dc3545;
    --light: #f8f9fa;
    --dark: #343a40;
    --sidebar-width: 250px;
    --sidebar-collapsed-width: 70px;
    --header-height: 60px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f7fb;
    color: #333;
    overflow-x: hidden;
}

.app-container {
    display: flex;
    min-height: 100vh;
}

/* 侧边栏样式 */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    transition: all 0.3s ease;
    position: fixed;
    height: 100vh;
    z-index: 1000;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
}

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

.sidebar-header {
    padding: 20px 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
}

.sidebar-header h2 {
    font-size: 1.5rem;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.sidebar.collapsed .sidebar-header h2 span {
    display: none;
}

.sidebar-menu {
    list-style: none;
    padding: 20px 0;
}

.sidebar-menu li {
    margin-bottom: 5px;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.3s;
    font-size: 1rem;
    font-weight: 500;
}

.sidebar-menu a:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.sidebar-menu a i {
    margin-right: 15px;
    font-size: 1.2rem;
    min-width: 24px;
    text-align: center;
}

.sidebar-menu li.active a {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border-left: 4px solid white;
}

.sidebar.collapsed .sidebar-menu a span {
    display: none;
}

.sidebar.collapsed .sidebar-menu a i {
    margin-right: 0;
    font-size: 1.4rem;
}

.sidebar-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
}

.toggle-btn {
    background: transparent;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 5px;
}

/* 主内容区 */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    transition: all 0.3s ease;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

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

/* 顶部导航 */
.top-navbar {
    height: var(--header-height);
    background: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    z-index: 999;
}

.menu-toggle {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--dark);
    cursor: pointer;
    display: none;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--dark);
    font-weight: 500;
}

.logout-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    margin-left: 15px;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.3s;
}

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

/* 统计卡片 */
.stats-container {
    padding: 20px;
}

.stat-card {
    border-radius: 10px;
    color: white;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    padding: 20px;
    height: 120px;
    transition: transform 0.3s;
}

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

.stat-card .icon {
    font-size: 2.5rem;
    margin-right: 20px;
    opacity: 0.8;
}

.stat-card .content {
    flex: 1;
}

.stat-card .value {
    font-size: 2rem;
    font-weight: bold;
    line-height: 1;
}

.stat-card .label {
    font-size: 1rem;
    opacity: 0.9;
    margin-top: 5px;
}

.stat-card .footer {
    background: rgba(0, 0, 0, 0.1);
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.9rem;
    margin-top: 10px;
}

/* 图表卡片 */
.charts-container {
    padding: 0 20px;
}

.chart-card {
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    height: 100%;
}

.chart-card .card-header {
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--dark);
}

.chart-card .card-body {
    padding: 15px;
    height: calc(100% - 55px);
}

.chart {
    height: 300px;
    width: 100%;
}

/* 数据卡片 */
.latest-data {
    padding: 0 20px 20px;
}

.data-card {
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    height: 100%;
}

.data-card .card-header {
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--dark);
}

.data-card .card-body {
    padding: 0;
}

.table {
    margin-bottom: 0;
}

.table th {
    background: #f8f9fa;
    color: #495057;
    font-weight: 600;
    border-top: none;
}

.table tr:last-child td {
    border-bottom: none;
}

/* 页脚 */
.footer {
    padding: 15px 20px;
    background: white;
    border-top: 1px solid #eee;
    text-align: center;
    color: #ccc;
    font-size: 0.9rem;
    margin-top: auto;
}

/* 新增用户下拉菜单样式 */
.user-dropdown {
    position: relative;
}

.user-info {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 30px;
    transition: all 0.3s;
    background: rgba(30, 136, 229, 0.1);
}

.user-info:hover {
    background: rgba(30, 136, 229, 0.2);
}

.user-info .avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
    color: white;
    font-size: 1.5rem;
}

.user-info .user-details {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}

.user-info .username {
    font-weight: 600;
    font-size: 1rem;
}

.user-info .role {
    font-size: 0.8rem;
    color: #6c757d;
}

.dropdown-menu {
    border: none;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    padding: 10px 0;
    margin-top: 10px;
}

.dropdown-item {
    padding: 8px 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s;
    font-size: 0.95rem;
}

.dropdown-item:hover {
    background: #f8f9fa;
    color: var(--primary);
}

.dropdown-item i {
    width: 20px;
    text-align: center;
}

/* 顶部导航栏优化 */
.top-navbar .left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.page-title {
    font-size: 1.4rem;
    font-weight: 600;
    color: #343a40;
    margin: 0;
}

/* 侧边栏文字优化 */
.sidebar-text {
    transition: opacity 0.3s ease;
}

.sidebar.collapsed .sidebar-text {
    opacity: 0;
    width: 0;
    overflow: hidden;
    display: inline-block;
}

/* 模态框样式 */
.modal-content {
    border-radius: 12px;
    overflow: hidden;
    border: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.modal-header {
    background: var(--primary);
    color: white;
    border: none;
    padding: 15px 20px;
}

.modal-title {
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-body {
    padding: 25px;
}

.modal-footer {
    border-top: 1px solid #eee;
    padding: 15px 25px;
}

.btn-close {
    filter: invert(1);
}

/* 响应式调整 */
@media (max-width: 768px) {
    .user-info .user-details {
        display: none;
    }

    .user-info .avatar {
        margin-right: 0;
    }

    .page-title {
        font-size: 1.2rem;
    }
}

/* 响应式调整 */
@media (max-width: 992px) {
    .sidebar {
        left: -250px;
    }

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

    .main-content {
        margin-left: 0;
    }

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

    .menu-toggle {
        display: block;
    }
}

@media (max-width: 768px) {
    .stat-card {
        margin-bottom: 20px;
    }
}