/* 基础样式 */
* {
    box-sizing: border-box;
}

body {
    background: #f5f6fa;
    overflow-x: hidden;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* 侧边栏样式 */
.sidebar {
    width: 220px;
    background: #fff;
    height: 100vh;
    position: fixed;
    border-right: 1px solid #e5e5e5;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    left: 0;
    top: 0;
    transition: transform 0.3s ease;
}

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

.sidebar::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.sidebar::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 2px;
}

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

.sidebar .logo {
    color: #000;
    font-weight: bold;
    font-size: 24px;
    text-align: center;
    padding: 20px 0;
    letter-spacing: 1px;
    flex-shrink: 0;
}

.sidebar .logo img {
    width: 180px;
    max-width: 100%;
    height: auto;
    margin: 0 auto;
    display: block;
}

.sidebar .nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
}

.sidebar .nav-link {
    color: #555;
    margin: 4px 12px;
    padding: 10px 16px;
    border-radius: 6px;
    white-space: nowrap;
    display: block;
    text-decoration: none;
    transition: all 0.2s ease;
}

.sidebar .nav-link.active,
.sidebar .nav-link:hover {
    background: #e9ecef;
    color: #000;
}

.sidebar .nav-link .bi {
    margin-right: 10px;
    width: 16px;
    text-align: center;
}

.sidebar-heading {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 16px 12px 8px 12px;
    color: #6c757d;
}

.sidebar footer {
    flex-shrink: 0;
    padding: 16px;
    border-top: 1px solid #e5e5e5;
    background: #f8f9fa;
    font-size: 12px;
}

/* 主内容区域 */
.main-wrapper {
    margin-left: 220px;
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

.main {
    padding: 24px;
}

/* 顶部栏 */
.topbar {
    background: #fff;
    border-bottom: 1px solid #e5e5e5;
    padding: 0 24px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    flex-wrap: wrap;
}

.topbar .page-title {
    font-size: 28px;
    font-weight: 500;
    margin: 0;
    flex: 1;
    min-width: 0;
}

.user-info {
    color: #232f3e;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.user-info img {
    width: 32px;
    height: 32px;
    object-fit: cover;
    border-radius: 50%;
}

/* 移动端菜单按钮 */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    color: #333;
    padding: 8px;
    cursor: pointer;
}

/* 卡片样式 */
.stat-card {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 20px;
    height: 100%;
}

.stat-card h5 {
    color: #888;
    font-size: 14px;
    margin-bottom: 8px;
}

.stat-card .stat-value {
    font-size: 28px;
    font-weight: bold;
    line-height: 1.2;
}

.stat-card .stat-change {
    font-size: 12px;
}

.card {
    border-radius: 8px;
    border: 1px solid #e5e5e5;
    box-shadow: none;
    height: 100%;
}

.chart-container {
    height: 320px;
    position: relative;
}

/* 表格响应式 */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table th,
.table td {
    white-space: nowrap;
    vertical-align: middle;
}

.table th:first-child,
.table td:first-child {
    width: 45px;
    text-align: center;
}

.table th:not(:first-child),
.table td:not(:first-child) {
    min-width: 120px;
}

.table th:nth-child(2),
.table td:nth-child(2) {
    min-width: auto;
    width: auto;
}

/* 按钮组响应式 */
.btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.btn-group .btn {
    flex: 1;
    min-width: 120px;
}

/* 搜索区域响应式 */
.search-area {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.search-area .input-group {
    min-width: 150px;
    flex: 1;
}

/* 响应式断点 */
@media (max-width: 1200px) {
    .sidebar {
        width: 200px;
    }
    
    .main-wrapper {
        margin-left: 200px;
    }
    
    .sidebar .logo img {
        width: 160px;
    }
}

@media (max-width: 992px) {
    .sidebar {
        width: 180px;
    }
    
    .main-wrapper {
        margin-left: 180px;
    }
    
    .sidebar .logo img {
        width: 140px;
    }
    
    .sidebar .nav-link {
        padding: 8px 12px;
        font-size: 14px;
    }
    
    .main {
        padding: 16px;
    }
    
    .topbar {
        padding: 0 16px;
    }
    
    .topbar .page-title {
        font-size: 24px;
    }
}

@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: block;
    }
    
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .main-wrapper {
        margin-left: 0;
    }
    
    .topbar {
        padding: 0 12px;
        height: auto;
        min-height: 64px;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .topbar .page-title {
        font-size: 20px;
        order: 1;
    }
    
    .user-info {
        order: 2;
        width: 100%;
        justify-content: space-between;
    }
    
    .main {
        padding: 12px;
    }
    
    .stat-card {
        padding: 16px;
        margin-bottom: 12px;
    }
    
    .stat-card .stat-value {
        font-size: 24px;
    }
    
    .btn-group {
        flex-direction: column;
        width: 100%;
    }
    
    .btn-group .btn {
        width: 100%;
        margin-bottom: 8px;
    }
    
    .search-area {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-area .input-group {
        width: 100%;
    }
    
    .chart-container {
        height: 250px;
    }
    
    /* 表格在移动端的特殊处理 */
    .table-responsive {
        font-size: 14px;
    }
    
    .table th,
    .table td {
        padding: 8px 4px;
        min-width: 80px;
    }
    
    /* 隐藏一些不重要的列 */
    .table th:nth-child(5),
    .table td:nth-child(5),
    .table th:nth-child(6),
    .table td:nth-child(6) {
        display: none;
    }
}

@media (max-width: 576px) {
    .sidebar {
        width: 100%;
    }
    
    .main {
        padding: 8px;
    }
    
    .topbar {
        padding: 0 8px;
    }
    
    .topbar .page-title {
        font-size: 18px;
    }
    
    .user-info {
        font-size: 14px;
    }
    
    .user-info img {
        width: 28px;
        height: 28px;
    }
    
    .stat-card {
        padding: 12px;
    }
    
    .stat-card .stat-value {
        font-size: 20px;
    }
    
    .chart-container {
        height: 200px;
    }
    
    /* 进一步简化表格 */
    .table th:nth-child(4),
    .table td:nth-child(4),
    .table th:nth-child(7),
    .table td:nth-child(7) {
        display: none;
    }
    
    .table th,
    .table td {
        padding: 6px 2px;
        font-size: 12px;
    }
    
    /* 按钮组在超小屏幕上的处理 */
    .btn-group .btn {
        font-size: 14px;
        padding: 8px 12px;
    }
    
    /* 搜索框在超小屏幕上的处理 */
    .search-area .input-group {
        font-size: 14px;
    }
    
    .search-area .form-control,
    .search-area .form-select {
        font-size: 14px;
        padding: 8px 12px;
    }
}

/* 平板横屏优化 */
@media (min-width: 768px) and (max-width: 1024px) and (orientation: landscape) {
    .sidebar {
        width: 200px;
    }
    
    .main-wrapper {
        margin-left: 200px;
    }
    
    .main {
        padding: 20px;
    }
    
    .chart-container {
        height: 280px;
    }
}

/* 大屏幕优化 */
@media (min-width: 1400px) {
    .sidebar {
        width: 240px;
    }
    
    .main-wrapper {
        margin-left: 240px;
    }
    
    .main {
        padding: 32px;
    }
    
    .chart-container {
        height: 400px;
    }
}

/* 打印样式 */
@media print {
    .sidebar,
    .topbar,
    .btn,
    .mobile-menu-toggle {
        display: none !important;
    }
    
    .main-wrapper {
        margin-left: 0 !important;
    }
    
    .main {
        padding: 0 !important;
    }
    
    .card {
        border: 1px solid #000 !important;
        box-shadow: none !important;
    }
}

/* 无障碍优化 */
@media (prefers-reduced-motion: reduce) {
    .sidebar,
    .main-wrapper {
        transition: none;
    }
}

/* 高对比度模式 */
@media (prefers-contrast: high) {
    .sidebar {
        border-right: 2px solid #000;
    }
    
    .card {
        border: 2px solid #000;
    }
    
    .stat-card {
        border: 2px solid #000;
    }
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
    body {
        background: #1a1a1a;
        color: #fff;
    }
    
    .sidebar {
        background: #2d2d2d;
        border-right-color: #444;
    }
    
    .topbar {
        background: #2d2d2d;
        border-bottom-color: #444;
    }
    
    .card,
    .stat-card {
        background: #2d2d2d;
        border-color: #444;
    }
    
    .sidebar .nav-link {
        color: #ccc;
    }
    
    .sidebar .nav-link.active,
    .sidebar .nav-link:hover {
        background: #444;
        color: #fff;
    }
} 