* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* 头部样式 */
header {
    background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
    color: white;
    padding: 20px 30px;
    border-radius: 12px;
    margin-bottom: 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

header h1 {
    font-size: 1.8rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.time-display {
    background: rgba(255, 255, 255, 0.2);
    padding: 8px 15px;
    border-radius: 8px;
    font-weight: 600;
}

.btn-refresh {
    background-color: white;
    color: #2575fc;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.btn-refresh:hover {
    background-color: #f0f0f0;
    transform: translateY(-2px);
}

/* 概览卡片 */
.overview h2 {
    color: #444;
    margin-bottom: 20px;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border-left: 5px solid #2575fc;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.card-title {
    font-size: 0.9rem;
    color: #777;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-value {
    font-size: 2rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 5px;
}

.card-change {
    font-size: 0.85rem;
    color: #28a745;
}

.card-change.negative {
    color: #dc3545;
}

/* 图表区域 */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

@media (max-width: 1200px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
}

.chart-container {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.chart-container h3 {
    color: #444;
    margin-bottom: 15px;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* 访客列表 */
.visitor-list {
    background: white;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.section-header h2 {
    color: #444;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.table-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.search-box {
    position: relative;
    width: 250px;
}

.search-box input {
    width: 100%;
    padding: 10px 15px 10px 40px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.95rem;
}

.search-box i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #777;
}

#pageSize {
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background-color: white;
    font-size: 0.95rem;
}

.table-container {
    overflow-x: auto;
    margin-bottom: 20px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

table thead {
    background-color: #f8f9fa;
}

table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: #555;
    border-bottom: 2px solid #dee2e6;
}

table td {
    padding: 15px;
    border-bottom: 1px solid #eaeaea;
}

table tr:hover {
    background-color: #f8f9fa;
}

/* 分页 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
}

.pagination button {
    padding: 8px 15px;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pagination button:hover:not(:disabled) {
    background-color: #e9ecef;
}

.pagination button.active {
    background-color: #2575fc;
    color: white;
    border-color: #2575fc;
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 热门页面 */
.top-pages {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    margin-bottom: 30px;
}

.top-pages h2 {
    color: #444;
    margin-bottom: 20px;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.pages-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.page-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background-color: #f8f9fa;
    border-radius: 8px;
    transition: background-color 0.2s ease;
}

.page-item:hover {
    background-color: #e9ecef;
}

.page-url {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.page-count {
    background-color: #2575fc;
    color: white;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    min-width: 40px;
    text-align: center;
}

/* 页脚 */
footer {
    text-align: center;
    padding: 20px;
    color: #777;
    border-top: 1px solid #eee;
    margin-top: 20px;
}

/* 加载指示器 */
#loadingOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    display: none;
}

.loading-spinner {
    background: white;
    padding: 30px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
}

.loading-spinner i {
    font-size: 3rem;
    color: #2575fc;
    margin-bottom: 15px;
}

.loading-spinner p {
    font-size: 1.1rem;
    color: #444;
}

/* 响应式设计 */
@media (max-width: 768px) {
    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .header-info {
        width: 100%;
        justify-content: space-between;
    }
    
    .cards {
        grid-template-columns: 1fr;
    }
    
    .charts-grid {
        grid-template-columns: 1fr;
    }
    
    .chart-container {
        padding: 15px;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .table-controls {
        width: 100%;
        justify-content: space-between;
    }
    
    .search-box {
        width: 70%;
    }
    
    table th, table td {
        padding: 10px 8px;
        font-size: 0.9rem;
    }
}
/* 修复图表容器高度问题 */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
    height: auto; /* 确保高度自动 */
    min-height: 0; /* 修复网格项溢出问题 */
    align-items: start; /* 对齐到顶部 */
}

.chart-container {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    height: 400px; /* 固定高度 */
    position: relative; /* 为canvas定位提供参考 */
    display: flex;
    flex-direction: column;
    min-height: 0; /* 防止内容溢出 */
}

.chart-container h3 {
    color: #444;
    margin-bottom: 15px;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0; /* 防止标题被压缩 */
}

.chart-container canvas {
    flex: 1; /* 填充剩余空间 */
    min-height: 0; /* 防止canvas溢出 */
    width: 100% !important; /* 强制宽度100% */
    height: 100% !important; /* 强制高度100% */
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .chart-container {
        height: 350px; /* 移动端稍小的高度 */
        padding: 15px;
    }
}
/* ===================== 筛选面板样式 ===================== */
.filter-panel {
    background: white;
    border-radius: 10px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    border: 1px solid #eaeaea;
    overflow: hidden;
}

.filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #eaeaea;
    cursor: pointer;
}

.filter-header h3 {
    margin: 0;
    color: #444;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-filter-toggle {
    background: none;
    border: none;
    color: #6c757d;
    cursor: pointer;
    padding: 5px;
    transition: transform 0.3s ease;
}

.btn-filter-toggle:hover {
    color: #2575fc;
}

.filter-content {
    padding: 20px;
    transition: max-height 0.3s ease;
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

@media (max-width: 1200px) {
    .filter-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 992px) {
    .filter-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .filter-grid {
        grid-template-columns: 1fr;
    }
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-group label {
    font-size: 0.9rem;
    color: #555;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

.filter-input,
.filter-select {
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.95rem;
    transition: border-color 0.2s ease;
    width: 100%;
}

.filter-input:focus,
.filter-select:focus {
    outline: none;
    border-color: #2575fc;
    box-shadow: 0 0 0 3px rgba(37, 117, 252, 0.1);
}

.filter-input[type="date"] {
    min-height: 42px;
}

.filter-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.btn-filter-apply {
    background: #2575fc;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.2s ease;
}

.btn-filter-apply:hover {
    background: #1c5fc4;
}

.btn-filter-reset {
    background: #6c757d;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.2s ease;
}

.btn-filter-reset:hover {
    background: #545b62;
}

.btn-filter-advanced {
    background: #f8f9fa;
    color: #495057;
    border: 1px solid #dee2e6;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.btn-filter-advanced:hover {
    background: #e9ecef;
}

/* 当前筛选条件展示 */
.active-filters {
    background: #f8f9fa;
    border-radius: 6px;
    padding: 15px;
    margin-top: 20px;
    border: 1px solid #e9ecef;
    display: none;
}

.active-filters.show {
    display: block;
}

.active-filters-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #dee2e6;
}

.active-filters-header span {
    font-weight: 600;
    color: #495057;
}

.btn-clear-all {
    background: none;
    border: none;
    color: #dc3545;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 5px 10px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.btn-clear-all:hover {
    background: rgba(220, 53, 69, 0.1);
}

.active-filters-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.filter-tag {
    background: #e3f2fd;
    color: #1565c0;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.filter-tag .remove-tag {
    background: none;
    border: none;
    color: #1565c0;
    cursor: pointer;
    font-size: 1rem;
    padding: 0;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.filter-tag .remove-tag:hover {
    background: rgba(21, 101, 192, 0.2);
}

/* 快速筛选按钮 */
.quick-filters {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.quick-filter-btn {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    color: #495057;
    transition: all 0.2s ease;
}

.quick-filter-btn:hover {
    background: #e9ecef;
}

.quick-filter-btn.active {
    background: #2575fc;
    color: white;
    border-color: #2575fc;
}

/* 搜索框样式增强 */
.search-box {
    position: relative;
    width: 300px;
}

.search-box input {
    width: 100%;
    padding: 10px 15px 10px 40px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.search-box input:focus {
    outline: none;
    border-color: #2575fc;
    box-shadow: 0 0 0 3px rgba(37, 117, 252, 0.1);
}

.search-box i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #777;
}

/* 分页样式增强 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 5px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.pagination button {
    padding: 8px 12px;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 40px;
}

.pagination button:hover:not(:disabled) {
    background-color: #e9ecef;
}

.pagination button.active {
    background-color: #2575fc;
    color: white;
    border-color: #2575fc;
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 加载状态 */
.loading {
    text-align: center;
    padding: 20px;
    color: #6c757d;
}

.loading i {
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}