/* 全局样式 - 统一设计系统 */
:root {
    /* 主色系 - 环保青绿 */
    --primary-color: #26a69a;
    --primary-hover: #40c9a0;
    --primary-dark: #00897b;
    --primary-light: #80cbc4;
    --primary-bg: rgba(38, 166, 154, 0.08);
    
    /* 状态色 */
    --success-color: #52c41a;
    --warning-color: #faad14;
    --danger-color: #f5222d;
    
    /* 文字色 */
    --text-color: #333333;
    --text-secondary: #666666;
    --text-light: #999999;
    
    /* 背景色 */
    --bg-color: #f0f2f5;
    --bg-white: #ffffff;
    --border-color: #e8e8e8;
    
    /* 阴影统一 */
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.12);
    
    /* 尺寸 */
    --header-height: 64px;
    --sidebar-width: 240px;
    
    /* 圆角统一 */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-color);
    background-color: var(--bg-color);
}

a {
    color: var(--primary-color);
    text-decoration: none;
    cursor: pointer;
    transition: color 0.3s;
}

a:hover {
    color: var(--primary-hover);
}

/* 通用工具类 */
.container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
}

.container-fluid {
    width: 100%;
    padding: 24px;
}

/* 卡片 - 统一圆角 12px */
.card {
    background: var(--bg-white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 24px;
    transition: box-shadow 0.3s, transform 0.3s;
}

.card:hover {
    box-shadow: var(--shadow-hover);
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

/* 按钮样式 - 统一圆角 8px */
.btn {
    display: inline-block;
    padding: 8px 16px;
    font-size: 14px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
}

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

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

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-warning {
    background: var(--warning-color);
    color: white;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-outline {
    background: white;
    border-color: var(--border-color);
    color: var(--text-color);
}

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

.btn-sm {
    padding: 4px 12px;
    font-size: 12px;
}

.btn-lg {
    padding: 12px 24px;
    font-size: 16px;
}

/* 表单样式 */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-color);
}

.form-control {
    width: 100%;
    padding: 8px 12px;
    font-size: 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    transition: all 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(38, 166, 154, 0.15);
}

/* 表格样式 */
.table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.table th,
.table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    font-weight: 600;
    color: var(--text-color);
    background: #fafafa;
}

.table tbody tr:hover {
    background: #f5f5f5;
}

/* 状态标签 */
.badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 12px;
    border-radius: var(--radius-sm);
}

.badge-success {
    background: #f6ffed;
    color: var(--success-color);
    border: 1px solid #b7eb8f;
}

.badge-warning {
    background: #fffbe6;
    color: var(--warning-color);
    border: 1px solid #ffe58f;
}

.badge-danger {
    background: #fff2f0;
    color: var(--danger-color);
    border: 1px solid #ffccc7;
}

.badge-info {
    background: #e6f7ff;
    color: var(--primary-color);
    border: 1px solid #91d5ff;
}

.badge-red {
    background: #fff2f0;
    color: var(--danger-color);
    border: 1px solid #ffccc7;
}

.badge-orange {
    background: #fff7e6;
    color: #d46b08;
    border: 1px solid #ffd591;
}

.badge-yellow {
    background: #fffbe6;
    color: var(--warning-color);
    border: 1px solid #ffe58f;
}

.badge-blue {
    background: #e6f7ff;
    color: #1890ff;
    border: 1px solid #91d5ff;
}

/* 网格系统 */
.row {
    display: flex;
    flex-wrap: wrap;
    margin: -12px;
}

.col {
    flex: 1;
    padding: 12px;
}

.col-6 {
    flex: 0 0 50%;
    max-width: 50%;
    padding: 12px;
}

.col-4 {
    flex: 0 0 33.333%;
    max-width: 33.333%;
    padding: 12px;
}

.col-3 {
    flex: 0 0 25%;
    max-width: 25%;
    padding: 12px;
}

/* 统计卡片 - 青绿色系渐变 */
.stat-card {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-color) 100%);
    color: white;
    border-radius: var(--radius-md);
    padding: 24px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255,255,255,0.15) 0%, transparent 70%);
    pointer-events: none;
}

.stat-card.success {
    background: linear-gradient(135deg, #52c41a, #73d13d);
}

.stat-card.warning {
    background: linear-gradient(135deg, #faad14, #ffc53d);
}

.stat-card.danger {
    background: linear-gradient(135deg, #f5222d, #ff4d4f);
}

.stat-card.warningall {
    background: linear-gradient(135deg, #faad14, #ff4d4f);
}


.stat-value {
    font-size: 36px;
    font-weight: bold;
    margin-bottom: 8px;
    position: relative;
    z-index: 1;
}

.stat-label {
    font-size: 14px;
    opacity: 0.9;
    position: relative;
    z-index: 1;
}

/* 侧边栏通用样式 - 可在任何页面直接复用 */
/* 注意：display/position 等布局属性由各页面自行控制 */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #00695c 0%, #00897b 100%);
    color: white;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: flex-start;
    background: rgba(0, 33, 41, 0.35);
    font-size: 16px;
    font-weight: 600;
}

.sidebar-logo {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-menu {
    padding: 16px 0;
}

.menu-item {
    padding: 14px 24px;
    color: rgba(255, 255, 255, 0.65);
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
}

.menu-item:hover {
    color: white;
    background: rgba(255, 255, 255, 0.08);
}

.menu-item.active {
    color: white;
    background: var(--primary-color);
}

.menu-icon {
    width: 24px;
    height: 24px;
    margin-right: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

/* 用户信息 - 可在任何页面直接复用 */
.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    transition: background 0.3s;
}

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

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
}

.user-dropdown {
    position: absolute;
    top: 56px;
    right: 24px;
    background: white;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-hover);
    padding: 8px 0;
    min-width: 160px;
    display: none;
    z-index: 1000;
}

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

.dropdown-item {
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.3s;
}

.dropdown-item:hover {
    background: #f5f5f5;
}

.dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 8px 0;
}

/* 布局骨架 - 各页面可覆盖 display/position/z-index */
.layout {
    display: flex;
    min-height: 100vh;
}

.header {
    height: var(--header-height);
    background: white;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 99;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.page-content {
    padding: 24px;
}

/* 模态框 - 可在任何页面直接复用 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: var(--radius-md);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 16px;
    font-weight: 600;
}

.modal-close {
    cursor: pointer;
    font-size: 20px;
    color: var(--text-light);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* 筛选面板 - 可在任何页面直接复用 */
.filter-panel {
    background: #fafafa;
    border-radius: var(--radius-sm);
    padding: 16px;
    margin-bottom: 20px;
}

.filter-row {
    display: flex;
    gap: 16px;
    margin-bottom: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-label {
    font-size: 14px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.filter-select {
    padding: 6px 12px;
    border: 1px solid #d9d9d9;
    border-radius: var(--radius-sm);
    font-size: 14px;
    min-width: 150px;
    background: white;
    transition: border-color 0.3s;
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.filter-input {
    padding: 6px 12px;
    border: 1px solid #d9d9d9;
    border-radius: var(--radius-sm);
    font-size: 14px;
    width: 200px;
    transition: border-color 0.3s;
}

.filter-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* 标签页 - 可在任何页面直接复用 */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 24px;
}

.tab {
    padding: 12px 24px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.3s;
}

.tab:hover {
    color: var(--primary-color);
}

.tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* 统计网格 - 可在任何页面直接复用 */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 24px;
}

.stat-item {
    background: white;
    border-radius: var(--radius-md);
    padding: 24px;
    text-align: center;
    box-shadow: var(--shadow);
}

.stat-item-label {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.stat-item-value {
    font-size: 36px;
    font-weight: bold;
    color: var(--text-color);
}

/* 数据卡片 - 可在任何页面直接复用 */
.data-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.data-card {
    background: white;
    border-radius: var(--radius-sm);
    padding: 16px;
    border: 1px solid var(--border-color);
    transition: all 0.3s;
}

.data-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-color: var(--primary-color);
}

.data-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.data-card-title {
    font-weight: 600;
    color: var(--text-color);
    font-size: 14px;
}

.data-card-value {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 4px;
}

.data-card-unit {
    font-size: 12px;
    color: var(--text-light);
}

.data-card-footer {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
    font-size: 12px;
    color: var(--text-light);
}

/* 图表容器 */
.chart-container {
    position: relative;
    height: 300px;
}

/* 刷新控件 */
.auto-refresh {
    display: flex;
    align-items: center;
    gap: 8px;
}

.refresh-btn {
    padding: 8px 16px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.3s;
}

.refresh-btn:hover {
    background: var(--primary-hover);
}

/* 状态颜色 */
.status-normal {
    color: var(--success-color);
}

.status-warning {
    color: var(--warning-color);
}

.status-danger {
    color: var(--danger-color);
}

/* 操作栏 */
.action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

/* 多选框组 */
.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 导出按钮 */
.btn-export {
    background: var(--success-color);
    color: white;
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
}

.btn-export:hover {
    background: #49a015;
}

/* 时间粒度选择 */
.time-granularity {
    display: flex;
    gap: 8px;
    align-items: center;
}

.granularity-btn {
    padding: 6px 12px;
    border: 1px solid #d9d9d9;
    background: white;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    transition: all 0.3s;
}

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

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

/* 表格增强列 */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    font-weight: 600;
    background: #fafafa;
    position: sticky;
    top: 0;
}

.data-table tbody tr:hover {
    background: #f5f5f5;
}

.time-col {
    position: sticky;
    left: 0;
    background: white;
    z-index: 1;
    min-width: 160px;
}

.seq-col {
    min-width: 60px;
    text-align: center;
}

/* 新建标签按钮 */
.tab-new-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    margin-left: 4px;
    margin-right: 8px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text-light);
    font-size: 16px;
    transition: all 0.3s;
    flex-shrink: 0;
}

.tab-new-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* 主内容区 */
.layout .main-content { flex: 1; margin-left: 0; min-height: 100vh; }

/* 顶部导航 */
.layout .header {
    height: var(--header-height);
    background: white;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 99;
}
.layout .header-title { font-size: 18px; font-weight: 600; }

/* 页面内容 */
.layout .page-content { padding: 24px; }

/* 加载动画 */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* 消息提示 */
.message {
    position: fixed;
    top: 24px;
    right: 24px;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    z-index: 1000;
    animation: slideIn 0.3s ease;
}

.message-success {
    background: #f6ffed;
    border: 1px solid #b7eb8f;
    color: var(--success-color);
}

.message-error {
    background: #fff2f0;
    border: 1px solid #ffccc7;
    color: var(--danger-color);
}

.message-warning {
    background: #fffbe6;
    border: 1px solid #ffe58f;
    color: var(--warning-color);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

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

.pagination button {
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    background: white;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.3s;
}

.pagination button:hover:not(:disabled) {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.pagination button.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

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

/* 响应式 */
@media (max-width: 768px) {
    .col-6, .col-4, .col-3 {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .container {
        padding: 16px;
    }
}
