/* 传感器管理页面样式 */

/* Flex 自适应布局容器 */
.sensor-management-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

#sensor-management-app {
    min-height: calc(100vh - 200px);
    background: #f0f2f5;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* 顶部标题栏 */
.management-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;
    flex-shrink: 0;
}

.management-header h1 {
    margin: 0;
    font-size: 24px;
    color: #1890ff;
}

.header-right {
    display: flex;
    gap: 10px;
}

/* 筛选工具栏 */
.filter-toolbar {
    background: #fff;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    flex-shrink: 0;
}

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

.filter-group label {
    font-size: 14px;
    color: #666;
    white-space: nowrap;
}

.filter-group input,
.filter-group select {
    padding: 6px 12px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    font-size: 14px;
    min-width: 120px;
}

/* 表格容器 - Flex 自适应 */
.sensor-table-container {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    margin-bottom: 20px;
}

/* 表格内容区域滚动 */
.sensor-table-container .sensor-table {
    width: 100%;
    border-collapse: collapse;
}

/* 表格头部固定 */
.sensor-table thead {
    background: #fafafa;
    position: sticky;
    top: 0;
    z-index: 1;
}

/* 表格主体滚动容器 */
.sensor-table-wrapper {
    flex: 1;
    overflow: auto;
    min-height: 0;
}

.sensor-table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #e8e8e8;
    white-space: nowrap;
}

.sensor-table td {
    padding: 12px;
    border-bottom: 1px solid #f0f0f0;
}

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

.sensor-table tbody tr.loading-state {
    text-align: center;
    color: #999;
}

/* 状态标签 */
.status-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.status-badge.normal {
    background: #f6ffed;
    color: #52c41a;
    border: 1px solid #b7eb8f;
}

.status-badge.warning {
    background: #fffbe6;
    color: #faad14;
    border: 1px solid #ffe58f;
}

.status-badge.alert {
    background: #fff2e8;
    color: #fa541c;
    border: 1px solid #ffbb96;
}

.status-badge.offline {
    background: #f5f5f5;
    color: #999;
    border: 1px solid #d9d9d9;
}

/* 操作按钮 */
.action-buttons {
    display: flex;
    gap: 8px;
}

.btn-small {
    padding: 4px 8px;
    font-size: 12px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-edit {
    background: #1890ff;
    color: #fff;
}

.btn-edit:hover {
    background: #40a9ff;
}

.btn-delete {
    background: #ff4d4f;
    color: #fff;
}

.btn-delete:hover {
    background: #ff7875;
}

.btn-view {
    background: #52c41a;
    color: #fff;
}

.btn-view:hover {
    background: #73d13d;
}

/* 分页 */
.pagination-container {
    background: #fff;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

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

/* 模态框 - 仅影响传感器管理页面的模态框 */
/* 注意：只在传感器管理页面（sensor_management.html）中生效 */
body:has(#sensor-management-app) #sensor-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none; /* 默认隐藏 */
    justify-content: center;
    align-items: center;
    z-index: 10000;
    overflow: auto;
}

/* 显示模态框时使用此类 */
#sensor-modal.modal-visible {
    display: flex !important;
}

.modal-content {
    background: #fff;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 18px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: #333;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid #f0f0f0;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
}

.form-group .required {
    color: #ff4d4f;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #1890ff;
    box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
}

.threshold-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

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

.threshold-item label {
    width: 100px;
    margin: 0;
    font-weight: normal;
}

.threshold-item input {
    flex: 1;
}

.threshold-item span {
    color: #999;
}

/* 按钮样式 */
.btn-primary,
.btn-secondary {
    padding: 8px 16px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.btn-primary {
    background: #1890ff;
    color: #fff;
}

.btn-primary:hover {
    background: #40a9ff;
}

.btn-secondary {
    background: #fff;
    color: #333;
    border: 1px solid #d9d9d9;
}

.btn-secondary:hover {
    background: #f5f5f5;
}

/* 查看模态框字段 */
.view-field {
    display: flex;
    margin-bottom: 15px;
    padding: 10px;
    background: #fafafa;
    border-radius: 4px;
}

.view-field label {
    width: 120px;
    font-weight: 500;
    color: #666;
    margin: 0;
}

.view-field span {
    flex: 1;
    color: #333;
}

