/* 新功能增强样式 */

/* ==================== 统计卡片增强 ==================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.stat-icon {
    font-size: 32px;
    margin-bottom: 12px;
    color: var(--primary-color);
}

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

.stat-number {
    font-size: 28px;
    font-weight: bold;
    color: var(--text-color);
}

.stat-percent {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* 严重程度相关样式 */
.stat-card.severity-critical {
    border-left: 4px solid var(--danger-color);
}

.stat-card.severity-high {
    border-left: 4px solid #ff9800;
}

.stat-card.severity-medium {
    border-left: 4px solid var(--warning-color);
}

.stat-card.severity-low {
    border-left: 4px solid var(--info-color);
}

/* ==================== 告警增强 ==================== */
.alert-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.alert-stat {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--card-bg);
    padding: 16px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.alert-stat i {
    font-size: 32px;
}

.alert-item {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-left-width: 4px;
    border-radius: 6px;
    padding: 16px;
    margin-bottom: 12px;
}

.alert-item.severity-critical {
    border-left-color: var(--danger-color);
    background: rgba(244, 67, 54, 0.05);
}

.alert-item.severity-warning {
    border-left-color: var(--warning-color);
    background: rgba(255, 152, 0, 0.05);
}

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

.alert-detail {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    font-size: 14px;
    color: var(--text-secondary);
}

/* ==================== 时间线组件 ==================== */
.timeline {
    position: relative;
    padding-left: 40px;
    max-height: 700px;
    overflow-y: auto;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 18px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border-color);
}

.timeline-item {
    position: relative;
    margin-bottom: 24px;
    padding-bottom: 24px;
}

.timeline-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
}

.timeline-icon {
    position: absolute;
    left: -28px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    z-index: 1;
}

.timeline-item.active .timeline-icon {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
    box-shadow: 0 0 0 4px rgba(76, 175, 80, 0.2);
}

.timeline-content {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
}

.timeline-content h4 {
    margin: 0 0 8px 0;
    color: var(--text-color);
}

.timeline-content p {
    margin: 0 0 4px 0;
    color: var(--text-secondary);
}

.timeline-content small {
    font-size: 12px;
    color: var(--text-secondary);
}

/* ==================== 进度条 ==================== */
.progress-bar {
    background: #e0e0e0;
    border-radius: 10px;
    height: 24px;
    overflow: hidden;
    margin: 16px 0;
    position: relative;
}

.progress-fill {
    background: linear-gradient(90deg, var(--primary-color), #66bb6a);
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    font-weight: bold;
    transition: width 0.6s ease;
    border-radius: 10px;
}

/* ==================== 徽章和状态 ==================== */
.severity-badge, .status-badge, .time-badge, .distance-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.severity-badge {
    color: white;
}

.severity-badge.severity-critical {
    background: var(--danger-color);
}

.severity-badge.severity-high {
    background: #ff9800;
}

.severity-badge.severity-medium {
    background: var(--warning-color);
}

.severity-badge.severity-low {
    background: var(--info-color);
}

.severity-badge.severity-info {
    background: #9e9e9e;
}

.status-badge {
    background: #e0e0e0;
    color: var(--text-color);
}

.status-badge.status-active {
    background: var(--primary-color);
    color: white;
}

.status-badge.status-handled {
    background: #4caf50;
    color: white;
}

.status-badge.status-expired {
    background: #9e9e9e;
    color: white;
}

.time-badge, .distance-badge {
    background: #f5f5f5;
    color: var(--text-secondary);
}

/* ==================== 类型统计 ==================== */
.type-stats-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.type-stat-item {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
}

.type-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
    font-weight: 500;
}

.type-info i {
    font-size: 20px;
    color: var(--primary-color);
    width: 24px;
}

.type-count {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.count-number {
    font-size: 24px;
    font-weight: bold;
    color: var(--primary-color);
}

.count-percent {
    font-size: 14px;
    color: var(--text-secondary);
}

.type-bar {
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
}

.type-bar-fill {
    height: 100%;
    background: var(--primary-color);
    border-radius: 4px;
    transition: width 0.6s ease;
}

/* ==================== 仪表板区域 ==================== */
.dashboard-section {
    margin-bottom: 32px;
}

.dashboard-section h4 {
    margin-bottom: 16px;
    color: var(--text-color);
    font-size: 18px;
    font-weight: 600;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border-color);
}

/* ==================== 最近预警列表 ==================== */
.recent-warnings-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.recent-warning-item {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 12px;
}

.recent-warning-content {
    flex: 1;
}

.recent-warning-title {
    font-weight: 500;
    margin-bottom: 4px;
    color: var(--text-color);
}

.recent-warning-time {
    font-size: 12px;
    color: var(--text-secondary);
}

/* ==================== 空状态优化 ==================== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 64px;
    margin-bottom: 16px;
    color: #bdbdbd;
}

.empty-state h3 {
    margin-bottom: 8px;
    color: var(--text-color);
}

/* ==================== 按钮组增强 ==================== */
.header-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.header-actions .btn {
    white-space: nowrap;
}

/* ==================== 表单优化 ==================== */
.form-group {
    margin-bottom: 20px;
}

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

.form-input, .form-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.form-input:focus, .form-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

.form-input.error, .form-select.error {
    border-color: var(--danger-color);
}

.form-error-message {
    color: var(--danger-color);
    font-size: 12px;
    margin-top: 4px;
}

/* ==================== 响应式优化 ==================== */
@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 12px;
    }

    .stat-card {
        padding: 16px 12px;
    }

    .stat-number {
        font-size: 24px;
    }

    .timeline {
        padding-left: 32px;
    }

    .timeline-icon {
        left: -24px;
        width: 32px;
        height: 32px;
    }

    .dashboard-section h4 {
        font-size: 16px;
    }

    .type-stat-item {
        padding: 12px;
    }

    .count-number {
        font-size: 20px;
    }
}

/* ==================== 动画效果 ==================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.stat-card, .alert-item, .timeline-item, .type-stat-item {
    animation: fadeIn 0.4s ease;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.timeline-item.active .timeline-icon {
    animation: pulse 2s infinite;
}

/* ==================== 滚动条美化 ==================== */
.timeline::-webkit-scrollbar,
.recent-warnings-list::-webkit-scrollbar {
    width: 6px;
}

.timeline::-webkit-scrollbar-track,
.recent-warnings-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.timeline::-webkit-scrollbar-thumb,
.recent-warnings-list::-webkit-scrollbar-thumb {
    background: #bdbdbd;
    border-radius: 3px;
}

.timeline::-webkit-scrollbar-thumb:hover,
.recent-warnings-list::-webkit-scrollbar-thumb:hover {
    background: #9e9e9e;
}

/* ==================== 数字孪生页面布局修正 ==================== */
.digital-twin-page {
    max-width: 1180px;
    margin: 0 auto;
    padding: 16px;
}

.digital-twin-page .page-header {
    margin-bottom: 16px;
}

.digital-twin-page .card {
    width: 100%;
    box-shadow: 0 8px 24px rgba(0,0,0,0.05);
}

.digital-twin-page .row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.digital-twin-page .col-lg-6 {
    flex: 1 1 520px;
}

.digital-twin-page .zone-list,
.digital-twin-page .sensor-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
}

.digital-twin-page .zone-item,
.digital-twin-page .sensor-item {
    background: #fff;
    border: 1px solid #eef2f7;
    border-radius: 10px;
    padding: 12px 14px;
}

.digital-twin-page .zone-header,
.digital-twin-page .sensor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.digital-twin-page .stat-card {
    border: 1px solid #eef2f7;
    border-radius: 10px;
    padding: 10px 12px;
    background: linear-gradient(135deg, #f8fbff 0%, #f2f6ff 100%);
}

@media (max-width: 768px) {
    .digital-twin-page { padding: 12px; }
    .digital-twin-page .col-lg-6 { flex: 1 1 100%; }
    .digital-twin-page .zone-list, .digital-twin-page .sensor-list { grid-template-columns: 1fr; }
}
