/* 瓦斯监控子系统样式 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', 'PingFang SC', sans-serif;
    background: linear-gradient(135deg, #1a2a45 0%, #2a3d5c 50%, #1d3356 100%);
    min-height: 100vh;
    color: #e0e6ed;
}

.gas-system {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* 顶部导航 */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 30px;
    background: rgba(26, 42, 64, 0.95);
    border-bottom: 1px solid rgba(0, 180, 255, 0.3);
    box-shadow: 0 2px 20px rgba(0, 180, 255, 0.1);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.back-btn {
    color: #00b4ff;
    text-decoration: none;
    font-size: 14px;
    padding: 8px 16px;
    border: 1px solid rgba(0, 180, 255, 0.3);
    border-radius: 6px;
    transition: all 0.3s ease;
}

.back-btn:hover {
    background: rgba(0, 180, 255, 0.1);
    border-color: #00b4ff;
}

.header h1 {
    font-size: 22px;
    font-weight: 500;
    background: linear-gradient(90deg, #00b4ff, #00ff88);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.current-time {
    font-size: 14px;
    color: #8892a0;
}

/* 主容器 */
.main-container {
    display: flex;
    flex: 1;
}

/* 侧边栏 */
.sidebar {
    width: 220px;
    background: rgba(31, 50, 74, 0.95);
    border-right: 1px solid rgba(0, 180, 255, 0.2);
    padding: 20px 0;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    color: #b0bac8;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: rgba(0, 180, 255, 0.1);
    color: #e0e6ed;
}

.nav-item.active {
    background: rgba(0, 180, 255, 0.15);
    color: #00b4ff;
    border-left-color: #00b4ff;
}

.nav-icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

/* 内容区域 */
.content {
    flex: 1;
    padding: 25px;
    overflow-y: auto;
}

.page {
    display: none;
}

.page.active {
    display: block;
}

.page-header {
    margin-bottom: 25px;
}

.page-header h2 {
    font-size: 24px;
    font-weight: 600;
    line-height: 1.4;
    color: #e0e6ed;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(0, 180, 255, 0.2);
}

.page-subtitle {
    margin-top: 12px;
    font-size: 13px;
    color: #8892a0;
}

/* 筛选栏 */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 20px;
    padding: 20px;
    background: rgba(36, 60, 89, 0.8);
    border-radius: 10px;
    margin-bottom: 25px;
    border: 1px solid rgba(0, 180, 255, 0.2);
}

.filter-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-item label {
    font-size: 13px;
    color: #8892a0;
}

.filter-item select,
.filter-item input {
    padding: 10px 15px;
    font-size: 14px;
    color: #e0e6ed;
    background: rgba(26, 42, 64, 0.8);
    border: 1px solid rgba(0, 180, 255, 0.3);
    border-radius: 6px;
    min-width: 180px;
    outline: none;
    transition: all 0.3s ease;
}

.filter-item select:focus,
.filter-item input:focus {
    border-color: #00b4ff;
    box-shadow: 0 0 10px rgba(0, 180, 255, 0.2);
}

.filter-item select option {
    background: #1a2a45;
    color: #e0e6ed;
}

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

.inline-filter select {
    min-width: 88px;
}

.inline-filter input {
    min-width: 120px;
}

.sensor-config-link {
    color: #7fd6ff;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.sensor-config-link:hover {
    color: #00b4ff;
}

.btn-query,
.btn-export {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    font-size: 14px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-query {
    background: linear-gradient(135deg, #00b4ff, #0088cc);
    color: white;
}

.btn-query:hover {
    background: linear-gradient(135deg, #00c8ff, #009ddd);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 180, 255, 0.3);
}

.btn-export {
    background: rgba(0, 255, 136, 0.2);
    color: #00ff88;
    border: 1px solid rgba(0, 255, 136, 0.3);
}

.btn-export:hover {
    background: rgba(0, 255, 136, 0.3);
}

/* 数据表格 */
.table-container {
    background: rgba(36, 60, 89, 0.6);
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid rgba(0, 180, 255, 0.2);
}

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

.data-table th,
.data-table td {
    padding: 14px 16px;
    text-align: center;
    border-bottom: 1px solid rgba(0, 180, 255, 0.1);
}

.data-table th {
    background: rgba(0, 180, 255, 0.1);
    color: #00b4ff;
    font-weight: 500;
    font-size: 13px;
    white-space: nowrap;
}

.data-table td {
    font-size: 14px;
    color: #e0e6ed;
}

.data-table tbody tr:hover {
    background: rgba(0, 180, 255, 0.05);
}

.data-table tbody tr:nth-child(even) {
    background: rgba(0, 0, 0, 0.15);
}

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

.status-badge.normal {
    background: rgba(0, 255, 136, 0.2);
    color: #00ff88;
}

.status-badge.warning {
    background: rgba(255, 193, 7, 0.2);
    color: #ffc107;
}

.status-badge.danger {
    background: rgba(255, 82, 82, 0.2);
    color: #ff5252;
}

.status-badge.offline {
    background: rgba(150, 150, 150, 0.2);
    color: #999;
}

/* 数值高亮 */
.value-highlight {
    font-weight: 600;
}

.value-highlight.danger {
    color: #ff5252;
}

.value-highlight.warning {
    color: #ffc107;
}

.clickable-value {
    cursor: pointer;
    text-decoration: underline;
    text-decoration-color: rgba(0, 180, 255, 0.45);
    text-underline-offset: 3px;
    transition: color 0.2s ease, text-decoration-color 0.2s ease;
}

.clickable-value:hover {
    color: #8be2ff;
    text-decoration-color: rgba(139, 226, 255, 0.95);
}

.filing-alarm-badge {
    display: inline-block;
    margin-left: 5px;
    padding: 1px 6px;
    border: 1px solid rgba(255, 193, 7, 0.55);
    border-radius: 8px;
    background: rgba(255, 193, 7, 0.14);
    color: #ffd45c;
    font-size: 11px;
    line-height: 1.4;
    white-space: nowrap;
    vertical-align: 1px;
}

/* 分页 */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding: 15px 20px;
    background: rgba(36, 60, 89, 0.6);
    border-radius: 10px;
    border: 1px solid rgba(0, 180, 255, 0.2);
}

.page-info {
    font-size: 13px;
    color: #8892a0;
}

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

.page-btn {
    padding: 8px 16px;
    font-size: 13px;
    color: #00b4ff;
    background: rgba(0, 180, 255, 0.1);
    border: 1px solid rgba(0, 180, 255, 0.3);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.page-btn:hover:not(:disabled) {
    background: rgba(0, 180, 255, 0.2);
}

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.current-page {
    font-size: 13px;
    color: #e0e6ed;
}

/* 开发中占位 */
.coming-soon {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 400px;
    color: #8892a0;
}

.coming-soon span {
    font-size: 60px;
    margin-bottom: 20px;
}

.coming-soon p {
    font-size: 18px;
}

.realtime-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: rgba(36, 60, 89, 0.75);
    border: 1px solid rgba(0, 180, 255, 0.2);
    border-radius: 10px;
    padding: 18px 20px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.stat-label {
    color: #8892a0;
    font-size: 13px;
    margin-bottom: 10px;
}

.stat-value {
    color: #00b4ff;
    font-size: 30px;
    font-weight: 700;
    line-height: 1;
}

.stat-value.danger {
    color: #ff6b6b;
}

.stat-value.warning {
    color: #ffc107;
}

.table-link-btn {
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid rgba(0, 180, 255, 0.28);
    background: rgba(0, 180, 255, 0.12);
    color: #8be2ff;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.table-link-btn:hover {
    background: rgba(0, 180, 255, 0.2);
    border-color: rgba(0, 180, 255, 0.5);
}

/* Flatpickr 自定义样式 */
.flatpickr-calendar {
    background: #2a3d5c !important;
    border: 1px solid rgba(0, 180, 255, 0.3) !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5) !important;
}

.flatpickr-day {
    color: #e0e6ed !important;
}

.flatpickr-day:hover {
    background: rgba(0, 180, 255, 0.2) !important;
    border-color: #00b4ff !important;
}

.flatpickr-day.selected {
    background: #00b4ff !important;
    border-color: #00b4ff !important;
}

.flatpickr-months .flatpickr-month {
    background: rgba(0, 180, 255, 0.1) !important;
}

.flatpickr-current-month .flatpickr-monthDropdown-months,
.flatpickr-current-month input.cur-year {
    color: #e0e6ed !important;
}

.flatpickr-weekday {
    color: #00b4ff !important;
}

/* 弹窗 */
.modal-overlay {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 30px;
    background: rgba(21, 32, 50, 0.72);
    backdrop-filter: blur(8px);
    z-index: 2000;
}

.modal-overlay.active {
    display: flex;
}

.modal-dialog {
    width: min(1500px, 96vw);
    max-height: 90vh;
    background: linear-gradient(180deg, rgba(40, 63, 93, 0.96) 0%, rgba(29, 49, 73, 0.98) 100%);
    border: 1px solid rgba(0, 180, 255, 0.25);
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.42);
    overflow: hidden;
}

.alarm-detail-dialog {
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    padding: 20px 24px 16px;
    border-bottom: 1px solid rgba(0, 180, 255, 0.18);
    background: rgba(23, 40, 62, 0.45);
}

.modal-title-group h3 {
    font-size: 20px;
    font-weight: 600;
    color: #eaf7ff;
}

.modal-title-group p {
    margin-top: 8px;
    font-size: 13px;
    color: #91a5be;
}

.modal-close {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid rgba(0, 180, 255, 0.22);
    background: rgba(255, 255, 255, 0.06);
    color: #cfefff;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.modal-close:hover {
    background: rgba(0, 180, 255, 0.15);
    transform: scale(1.04);
}

.modal-body {
    padding: 18px 24px 24px;
    overflow: auto;
}

.modal-table-container {
    max-height: calc(90vh - 130px);
    overflow: auto;
}

.history-config-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 16px;
}

.history-config-item {
    padding: 12px 14px;
    border-radius: 8px;
    background: rgba(28, 44, 64, 0.72);
    border: 1px solid rgba(0, 180, 255, 0.14);
}

.history-config-label {
    margin-bottom: 6px;
    font-size: 12px;
    color: #7f96b5;
}

.history-config-value {
    font-size: 14px;
    color: #e0e6ed;
    word-break: break-all;
}

.history-config-empty {
    grid-column: 1 / -1;
    padding: 36px 0;
    text-align: center;
    color: #91a5be;
}

.curve-link-btn {
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid rgba(0, 180, 255, 0.28);
    background: rgba(0, 180, 255, 0.12);
    color: #8be2ff;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.curve-link-btn:hover {
    background: rgba(0, 180, 255, 0.2);
    border-color: rgba(0, 180, 255, 0.5);
}

.sensor-count-btn,
.action-btn {
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid rgba(0, 180, 255, 0.28);
    background: rgba(0, 180, 255, 0.12);
    color: #8be2ff;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sensor-count-btn:hover,
.action-btn:hover {
    background: rgba(0, 180, 255, 0.2);
    border-color: rgba(0, 180, 255, 0.5);
}

.action-btn + .action-btn {
    margin-left: 8px;
}

.action-btn-danger {
    color: #ff9b9b;
    border-color: rgba(255, 114, 114, 0.3);
    background: rgba(255, 114, 114, 0.1);
}

.action-btn-danger:hover {
    background: rgba(255, 114, 114, 0.18);
    border-color: rgba(255, 114, 114, 0.45);
}

.is-hidden {
    display: none !important;
}

.filing-modal-dialog {
    width: min(1180px, 94vw);
}

.filing-edit-dialog {
    width: min(980px, 92vw);
    max-height: min(92vh, 1040px);
    display: flex;
    flex-direction: column;
}

.filing-edit-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
    min-height: 0;
    flex: 1;
}

.filing-edit-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    min-height: 0;
    flex: 1;
    overflow-y: auto;
    padding-right: 6px;
}

.filing-edit-grid label {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filing-edit-grid span,
.filing-sensor-header {
    font-size: 14px;
    color: #b0cde6;
}

.filing-edit-grid input,
.filing-edit-grid select,
.filing-edit-grid textarea,
.filing-sensor-panel input {
    border-radius: 10px;
    border: 1px solid rgba(134, 178, 218, 0.32);
    background: rgba(34, 55, 82, 0.88);
    color: #f4fbff;
    padding: 11px 13px;
    outline: none;
}

.filing-edit-grid input:focus,
.filing-edit-grid select:focus,
.filing-edit-grid textarea:focus,
.filing-sensor-panel input:focus {
    border-color: rgba(0, 210, 255, 0.7);
    box-shadow: 0 0 0 3px rgba(0, 210, 255, 0.14);
}

.full-width {
    grid-column: 1 / -1;
}

.filing-sensor-panel {
    border-radius: 12px;
    border: 1px solid rgba(130, 175, 215, 0.24);
    background: rgba(33, 53, 78, 0.76);
    padding: 14px;
}

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

.filing-sensor-list {
    min-height: 120px;
    max-height: 420px;
    overflow: auto;
    margin-top: 12px;
    border-top: 1px solid rgba(130, 175, 215, 0.12);
}

.filing-sensor-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 4px;
    border-bottom: 1px solid rgba(130, 175, 215, 0.1);
}

.filing-sensor-item:last-child {
    border-bottom: none;
}

.filing-sensor-item-title {
    font-weight: 700;
    color: #f2fbff;
}

.filing-sensor-item-meta {
    margin-top: 4px;
    font-size: 13px;
    color: #abc1d7;
}

.filing-edit-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-shrink: 0;
    margin: 0 -24px -24px;
    padding: 16px 24px 20px;
    background: linear-gradient(180deg, rgba(31, 51, 76, 0.82) 0%, rgba(27, 45, 67, 0.96) 100%);
    border-top: 1px solid rgba(0, 180, 255, 0.18);
}

#filing-edit-modal .modal-body {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.filing-edit-message {
    min-height: 20px;
    font-size: 14px;
    color: #9ecfff;
}

.filing-edit-message.error {
    color: #ff7f96;
}

.filing-edit-message.success {
    color: #72e2a7;
}

.filter-item-wide {
    min-width: 280px;
    flex: 1 1 320px;
}

#page-history-query .filter-bar {
    gap: 16px;
}

#page-history-query .filter-item {
    flex: 0 1 180px;
}

#page-history-query .filter-item.filter-item-wide {
    min-width: 240px;
    max-width: 320px;
    flex: 1 1 260px;
}

#page-history-query .filter-item.filter-item-wide input {
    min-width: 220px;
}

#page-history-query #btn-history-query {
    align-self: flex-end;
    min-width: 128px;
    white-space: nowrap;
}

.table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 18px 0 14px;
}

.table-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* 响应式 */
@media (max-width: 1200px) {
    .filter-bar {
        flex-wrap: wrap;
    }
}

@media (max-width: 768px) {
    .realtime-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .table-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .table-toolbar-actions {
        width: 100%;
        justify-content: flex-end;
        flex-wrap: wrap;
    }

    .sidebar {
        width: 60px;
    }

    .nav-text {
        display: none;
    }

    .nav-item {
        justify-content: center;
        padding: 14px;
    }

    .modal-overlay {
        padding: 12px;
    }

    .modal-header,
    .modal-body {
        padding-left: 16px;
        padding-right: 16px;
    }
}
