/* 传感器实时监控样式 */

#sensor-monitor-app,
.sensor-monitor-container {
    min-height: calc(100vh - 200px);
    background: #f0f2f5;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* 顶部状态栏 */
.monitor-header {
    background: #fff;
    padding: 20px 30px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.header-left h1 {
    margin: 0;
    font-size: 24px;
    color: #1890ff;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 4px;
    background: #f5f5f5;
}

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.status-indicator.status-connected {
    background: #52c41a;
}

.status-indicator.status-disconnected {
    background: #ff4d4f;
}

.status-indicator.status-connecting {
    background: #faad14;
}

.status-indicator.status-error {
    background: #ff4d4f;
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.3;
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.status-text {
    font-size: 14px;
    color: #666;
}

.header-right {
    display: flex;
    gap: 30px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.stat-label {
    font-size: 12px;
    color: #999;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 20px;
    font-weight: bold;
    color: #1890ff;
}

.stat-value.alert-count {
    color: #ff4d4f;
}

/* 传感器选择器 */
.sensor-selector {
    background: #fff;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.sensor-selector label {
    font-weight: 500;
    color: #333;
}

.sensor-selector select {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    font-size: 14px;
    min-height: 100px;
}

.btn-primary, .btn-secondary {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: #1890ff;
    color: #fff;
}

.btn-primary:hover {
    background: #40a9ff;
}

.btn-secondary {
    background: #f5f5f5;
    color: #333;
}

.btn-secondary:hover {
    background: #e6e6e6;
}

/* 主要内容区域 */
.monitor-content {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

/* 传感器卡片面板 */
.sensor-cards-panel {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 20px;
    max-height: calc(100vh - 300px);
    overflow-y: auto;
}

.sensor-cards-panel h2 {
    margin: 0 0 15px 0;
    font-size: 18px;
    color: #333;
}

.sensor-cards-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* 传感器卡片 */
.sensor-card {
    background: #fafafa;
    border: 1px solid #e8e8e8;
    border-radius: 6px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.3s;
}

.sensor-card:hover {
    border-color: #1890ff;
    box-shadow: 0 2px 8px rgba(24, 144, 255, 0.2);
}

.sensor-card.active {
    border-color: #1890ff;
    background: #e6f7ff;
}

.sensor-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.sensor-card-name {
    font-weight: 500;
    color: #333;
    font-size: 14px;
}

.sensor-card-status {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.sensor-card-status.normal {
    background: #52c41a;
}

.sensor-card-status.warning {
    background: #faad14;
}

.sensor-card-status.alert {
    background: #ff4d4f;
}

.sensor-card-status.offline {
    background: #d9d9d9;
}

.sensor-card-value {
    font-size: 24px;
    font-weight: bold;
    color: #1890ff;
    margin: 8px 0;
}

.sensor-card-info {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #999;
}

/* 图表面板 */
.chart-panel {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.chart-header h2 {
    margin: 0;
    font-size: 18px;
    color: #333;
}

.chart-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.chart-controls label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    cursor: pointer;
}

.chart-container {
    flex: 1;
    min-height: 400px;
}

/* 报警面板 */
.alert-panel {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 20px;
}

.alert-panel h2 {
    margin: 0 0 15px 0;
    font-size: 18px;
    color: #333;
}

.alert-list {
    max-height: 200px;
    overflow-y: auto;
}

.alert-item {
    padding: 12px;
    border-left: 4px solid;
    border-radius: 4px;
    margin-bottom: 10px;
    background: #fafafa;
}

.alert-item.warning {
    border-color: #faad14;
    background: #fffbe6;
}

.alert-item.critical {
    border-color: #ff4d4f;
    background: #fff1f0;
}

.alert-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.alert-item-sensor {
    font-weight: 500;
    color: #333;
}

.alert-item-time {
    font-size: 12px;
    color: #999;
}

.alert-item-message {
    font-size: 14px;
    color: #666;
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .monitor-content {
        grid-template-columns: 1fr;
    }
    
    .sensor-cards-panel {
        max-height: 300px;
    }
}

@media (max-width: 768px) {
    #sensor-monitor-app {
        padding: 10px;
    }
    
    .monitor-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    
    .header-right {
        width: 100%;
        justify-content: space-around;
    }
}

