/* 工业物联网仪表盘样式 */

.iot-dashboard {
    background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 20px;
    padding: 24px;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.1),
        0 0 0 1px rgba(255, 255, 255, 0.5) inset;
    max-width: 500px;
    margin: 0 auto;
    animation: float 6s ease-in-out infinite;
}

/* 仪表盘头部 */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(226, 232, 240, 0.8);
}

.dashboard-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    color: #1e293b;
    font-size: 1.1rem;
}

.dashboard-title i {
    color: #2563eb;
    font-size: 1.2rem;
}

.dashboard-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: #10b981;
    font-weight: 500;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    animation: pulse 2s infinite;
}

.status-dot.online {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4);
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(16, 185, 129, 0);
    }
}

/* 核心数据展示 */
.dashboard-metrics {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.metric-card {
    background: white;
    border-radius: 12px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(226, 232, 240, 0.8);
    transition: all 0.3s ease;
}

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

.metric-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: white;
    flex-shrink: 0;
}

.metric-icon.energy {
    background: linear-gradient(135deg, #f59e0b 0%, #f97316 100%);
}

.metric-icon.temp {
    background: linear-gradient(135deg, #ef4444 0%, #f97316 100%);
}

.metric-icon.humidity {
    background: linear-gradient(135deg, #0ea5e9 0%, #06b6d4 100%);
}

.metric-icon.device {
    background: linear-gradient(135deg, #2563eb 0%, #0ea5e9 100%);
}

.metric-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.metric-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: #1e293b;
    line-height: 1;
}

.metric-unit {
    font-size: 0.75rem;
    color: #64748b;
    margin-left: 2px;
}

.metric-label {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-top: 2px;
}

.metric-trend {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 20px;
}

.metric-trend.up {
    color: #10b981;
    background: rgba(16, 185, 129, 0.1);
}

.metric-trend.down {
    color: #10b981;
    background: rgba(16, 185, 129, 0.1);
}

.metric-trend.stable {
    color: #64748b;
    background: rgba(100, 116, 139, 0.1);
}

/* 设备状态网格 */
.device-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.device-status-card {
    background: white;
    border-radius: 10px;
    padding: 12px 8px;
    text-align: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(226, 232, 240, 0.8);
    position: relative;
    transition: all 0.3s ease;
}

.device-status-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.device-icon-wrapper {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 8px;
    font-size: 1rem;
    color: white;
}

.device-status-card.active .device-icon-wrapper {
    background: linear-gradient(135deg, #10b981 0%, #22c55e 100%);
}

.device-status-card.warning .device-icon-wrapper {
    background: linear-gradient(135deg, #f59e0b 0%, #f97316 100%);
    animation: pulse-warning 2s infinite;
}

@keyframes pulse-warning {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4);
    }
    50% {
        box-shadow: 0 0 0 6px rgba(245, 158, 11, 0);
    }
}

.device-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.device-name {
    font-size: 0.75rem;
    font-weight: 600;
    color: #1e293b;
}

.device-state {
    font-size: 0.7rem;
    color: #64748b;
}

.device-indicator {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.device-status-card.active .device-indicator {
    background: #10b981;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.3);
}

.device-status-card.warning .device-indicator {
    background: #f59e0b;
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.3);
}

/* 实时数据流 */
.data-stream {
    background: #f8fafc;
    border-radius: 10px;
    padding: 12px;
    border: 1px solid rgba(226, 232, 240, 0.8);
}

.stream-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #475569;
    margin-bottom: 10px;
}

.stream-header i {
    color: #2563eb;
}

.stream-items {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.stream-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    padding: 6px 8px;
    background: white;
    border-radius: 6px;
    border-left: 3px solid transparent;
}

.stream-item:nth-child(1) {
    border-left-color: #10b981;
    animation: slideIn 0.5s ease;
}

.stream-item:nth-child(2) {
    border-left-color: #f59e0b;
    animation: slideIn 0.5s ease 0.1s both;
}

.stream-item:nth-child(3) {
    border-left-color: #2563eb;
    animation: slideIn 0.5s ease 0.2s both;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.stream-time {
    color: #94a3b8;
    font-family: monospace;
    font-size: 0.7rem;
    min-width: 60px;
}

.stream-device {
    color: #475569;
    font-weight: 500;
    min-width: 70px;
}

.stream-value {
    color: #1e293b;
    font-weight: 600;
    flex: 1;
}

.stream-status {
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 600;
}

.stream-status.normal {
    color: #10b981;
    background: rgba(16, 185, 129, 0.1);
}

.stream-status.warning {
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.1);
}

/* 响应式调整 */
@media (max-width: 768px) {
    .iot-dashboard {
        padding: 16px;
        max-width: 100%;
    }
    
    .dashboard-metrics {
        grid-template-columns: 1fr;
    }
    
    .device-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .metric-value {
        font-size: 1.2rem;
    }
    
    .stream-item {
        flex-wrap: wrap;
    }
}
