/* 基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
}

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

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

/* 头部样式 */
header {
    background: linear-gradient(135deg, #4b6cb7 0%, #182848 100%);
    color: white;
    padding: 25px;
    border-radius: 12px;
    margin-bottom: 25px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

header h1 {
    font-size: 28px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 12px;
}

/* 导航样式 */
nav {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

nav a {
    color: white;
    text-decoration: none;
    padding: 10px 20px;
    border-radius: 6px;
    background-color: rgba(255, 255, 255, 0.15);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

nav a:hover {
    background-color: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
}

nav a.active {
    background-color: rgba(255, 255, 255, 0.3);
    font-weight: bold;
}

/* 卡片样式 */
.card {
    background-color: white;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    border: 1px solid #eaeaea;
}

.card h2 {
    font-size: 20px;
    margin-bottom: 20px;
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 10px;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #444;
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: #4b6cb7;
}

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

.checkbox input {
    width: 18px;
    height: 18px;
}

/* 按钮样式 */
.btn {
    padding: 12px 25px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-primary {
    background-color: #4b6cb7;
    color: white;
}

.btn-primary:hover {
    background-color: #3a5aa0;
    transform: translateY(-2px);
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

.btn-success {
    background-color: #28a745;
    color: white;
}

.btn-success:hover {
    background-color: #218838;
}

.btn:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
    transform: none !important;
}

/* 表格样式 */
.table-container {
    overflow-x: auto;
    margin: 20px 0;
}

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

table thead {
    background-color: #f8f9fa;
}

table th, table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #eaeaea;
}

table th {
    font-weight: 700;
    color: #495057;
}

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

.text-center {
    text-align: center;
    color: #6c757d;
    padding: 40px !important;
}

/* 操作栏 */
.action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eaeaea;
}

/* 状态指示器 */
.status-idle { color: #6c757d; font-weight: bold; }
.status-active { color: #28a745; font-weight: bold; }
.status-error { color: #dc3545; font-weight: bold; }

/* 统计头部 */
.stats-header {
    display: flex;
    justify-content: space-between;
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-label {
    font-size: 14px;
    color: #6c757d;
}

/* 实时数据容器 */
.data-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.sensor-card {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 10px;
    padding: 20px;
    border-left: 5px solid #4b6cb7;
}

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

.sensor-id {
    font-family: monospace;
    background-color: rgba(0, 0, 0, 0.05);
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 14px;
}

.sensor-value {
    font-size: 32px;
    font-weight: bold;
    color: #2c3e50;
    text-align: center;
    margin: 15px 0;
}

.sensor-meta {
    display: flex;
    justify-content: space-between;
    color: #6c757d;
    font-size: 14px;
}

.no-data {
    text-align: center;
    padding: 60px 20px;
    color: #6c757d;
    grid-column: 1 / -1;
}

.no-data i {
    margin-bottom: 15px;
    color: #adb5bd;
}

/* 页脚 */
footer {
    text-align: center;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid #eaeaea;
    color: #6c757d;
    font-size: 14px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    header {
        padding: 20px;
    }
    
    header h1 {
        font-size: 24px;
    }
    
    nav {
        flex-direction: column;
    }
    
    .action-bar {
        flex-direction: column;
        gap: 15px;
    }
    
    .stats-header {
        flex-direction: column;
        gap: 15px;
    }
    
    .data-container {
        grid-template-columns: 1fr;
    }
}