/* 人员定位子系统样式 - 与瓦斯监控风格保持一致 */

* {
    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;
}

.personnel-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: 16px;
    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: 10px;
    font-size: 13px;
    color: #8892a0;
}

/* 筛选栏 */
.filter-bar {
    display: flex;
    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);
    flex-wrap: wrap;
}

.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;
}

.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-link-btn {
    background: none;
    border: none;
    color: #31c4ff;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
}

.table-link-btn:hover {
    color: #67d7ff;
    text-decoration: underline;
}

.table-link-btn.secondary {
    color: #00ff88;
}

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

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

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

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

/* 井下异常合并表头 */
.th-exception {
    background: rgba(255, 160, 0, 0.12) !important;
    color: #ffa000 !important;
    border-bottom: 1px solid rgba(255, 160, 0, 0.3) !important;
}

/* 井下异常子列表头 */
thead tr:last-child th {
    background: rgba(255, 140, 0, 0.08);
    color: #ffb300;
    font-size: 12px;
}

.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;
}

/* 数值高亮 */
.val-warn {
    color: #ffc107;
    font-weight: 600;
}

.val-danger {
    color: #ff5252;
    font-weight: 600;
}

/* 分页 */
.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;
}

.monitor-section {
    margin-bottom: 24px;
}

.section-title {
    font-size: 16px;
    font-weight: 600;
    color: #e0e6ed;
    margin-bottom: 12px;
}

.monitor-split {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.leader-absence-layout {
    display: grid;
    grid-template-columns: 35% 65%;
    gap: 20px;
    align-items: start;
}

.leader-panel {
    background: rgba(36, 60, 89, 0.52);
    border: 1px solid rgba(0, 180, 255, 0.14);
    border-radius: 12px;
    padding: 18px;
    min-width: 0;  /* 阻止面板撑开 grid 轨道 */
    overflow: hidden;
}

/* 领导空岗详情表不需要 900px 宽，覆盖全局设置 */
.leader-panel .data-table {
    min-width: 0;
}
.leader-panel .table-container {
    overflow-x: auto;
}

.leader-calendar-summary {
    font-size: 13px;
    color: #8892a0;
    margin-bottom: 14px;
}

.leader-calendar-weekdays,
.leader-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 10px;
}

.leader-calendar-weekdays {
    margin-bottom: 10px;
}

.leader-calendar-weekdays span {
    text-align: center;
    font-size: 13px;
    color: #7fb7d6;
}

.leader-calendar-cell {
    aspect-ratio: 1 / 1.48;
    min-height: 0;
    position: relative;
    border-radius: 10px;
    border: 1px solid rgba(0, 180, 255, 0.12);
    background: rgba(25, 42, 62, 0.72);
    padding: 6px 6px 8px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
    cursor: pointer;
    transition: all 0.25s ease;
    overflow: hidden;
}

.leader-calendar-cell:hover {
    border-color: rgba(0, 180, 255, 0.35);
    transform: translateY(-1px);
}

.leader-calendar-cell.empty {
    background: rgba(25, 42, 62, 0.25);
    cursor: default;
}

.leader-calendar-cell.empty:hover {
    transform: none;
    border-color: rgba(0, 180, 255, 0.12);
}

.leader-calendar-cell.active {
    border-color: rgba(0, 180, 255, 0.58);
    box-shadow: 0 0 0 1px rgba(0, 180, 255, 0.18) inset;
}

.leader-calendar-cell.has-data {
    background: linear-gradient(180deg, rgba(54, 28, 20, 0.82), rgba(33, 18, 14, 0.82));
    border-color: rgba(255, 153, 102, 0.32);
}

.leader-calendar-day {
    font-size: 15px;
    font-weight: 700;
    color: #eaf7ff;
    position: relative;
    z-index: 1;
    line-height: 1;
}

.leader-calendar-count {
    position: absolute;
    right: 5px;
    bottom: 5px;
    min-width: 0;
    padding: 3px 5px 4px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0px;
    background: rgba(255, 128, 82, 0.16);
    border: 1px solid rgba(255, 176, 137, 0.12);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
    color: #ffb089;
}

.leader-calendar-count-value {
    font-size: 12px;
    line-height: 1;
    font-weight: 700;
    color: #ffd0b4;
}

.leader-calendar-count-unit {
    font-size: 9px;
    line-height: 1;
    font-weight: 600;
    color: #ffb089;
    letter-spacing: 0.02em;
}

.leader-calendar-empty-text {
    position: absolute;
    right: 5px;
    bottom: 5px;
    font-size: 11px;
    color: #63798d;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(19, 30, 44, 0.74);
    backdrop-filter: blur(6px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    z-index: 1000;
}

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

.modal-panel {
    width: min(1180px, 100%);
    max-height: calc(100vh - 48px);
    overflow: hidden;
    border-radius: 16px;
    border: 1px solid rgba(0, 180, 255, 0.22);
    background: linear-gradient(180deg, rgba(30, 46, 69, 0.98), rgba(26, 41, 63, 0.98));
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

.modal-large {
    width: min(1320px, 100%);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    border-bottom: 1px solid rgba(0, 180, 255, 0.16);
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: #e9f4ff;
}

.modal-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid rgba(0, 180, 255, 0.26);
    background: rgba(0, 180, 255, 0.08);
    color: #cfefff;
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
}

.modal-body {
    padding: 20px 22px 24px;
    max-height: calc(100vh - 140px);
    overflow: auto;
}

.modal-filter-bar {
    margin-bottom: 18px;
}

.leader-duty-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.leader-duty-summary-card {
    padding: 14px 16px;
    border-radius: 12px;
    background: rgba(30, 51, 79, 0.84);
    border: 1px solid rgba(0, 180, 255, 0.12);
}

.leader-duty-summary-label {
    display: block;
    font-size: 12px;
    color: #8fb6d1;
    margin-bottom: 8px;
}

.leader-duty-summary-card strong {
    display: block;
    font-size: 24px;
    line-height: 1.2;
    color: #eef7ff;
}

.track-graph-layout {
    display: grid;
    grid-template-columns: 64% 36%;
    gap: 18px;
    min-height: 620px;
}

.track-graph-map-panel,
.track-graph-side-panel {
    border: 1px solid rgba(0, 180, 255, 0.16);
    border-radius: 14px;
    background: rgba(24, 38, 58, 0.72);
}

.track-graph-map-panel {
    display: flex;
    flex-direction: column;
    min-height: 620px;
}

.track-graph-toolbar {
    display: flex;
    gap: 10px;
    padding: 14px 14px 10px;
    border-bottom: 1px solid rgba(0, 180, 255, 0.12);
}

.track-graph-map-host {
    position: relative;
    flex: 1;
    min-height: 560px;
    overflow: hidden;
    border-radius: 0 0 14px 14px;
    background:
        radial-gradient(circle at 20% 20%, rgba(0, 180, 255, 0.12), transparent 35%),
        linear-gradient(180deg, rgba(9, 19, 35, 0.96), rgba(6, 13, 25, 0.98));
}

.track-graph-map-host svg {
    width: 100%;
    height: 100%;
    display: block;
    user-select: none;
}

.track-graph-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: #8da4b8;
    font-size: 14px;
}

.track-graph-side-panel {
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.track-graph-worker-summary h4 {
    margin: 0 0 6px;
    font-size: 24px;
    color: #eef7ff;
}

.track-graph-worker-summary p {
    margin: 0;
    color: #8fb6d1;
    font-size: 15px;
}

.track-graph-info-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.track-graph-info-grid .info-item {
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(30, 51, 79, 0.84);
    border: 1px solid rgba(0, 180, 255, 0.12);
}

.track-graph-info-grid .info-item span {
    display: block;
    font-size: 12px;
    color: #6f8aa2;
    margin-bottom: 4px;
}

.track-graph-info-grid .info-item strong {
    font-size: 15px;
    color: #e9f4ff;
}

.track-graph-route-panel {
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
}

.track-graph-route-title {
    font-size: 16px;
    font-weight: 600;
    color: #dceefe;
}

.track-graph-route-list {
    flex: 1;
    overflow: auto;
    padding-right: 4px;
}

.track-graph-route-item {
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(28, 47, 72, 0.72);
    border: 1px solid rgba(0, 180, 255, 0.1);
    margin-bottom: 10px;
    transition: border-color 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

.track-graph-route-item.active {
    border-color: rgba(0, 180, 255, 0.48);
    background: rgba(0, 180, 255, 0.12);
    transform: translateX(2px);
}

.track-graph-route-item .place {
    display: block;
    color: #eaf4ff;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
}

.track-graph-route-item .time {
    color: #84a1b8;
    font-size: 12px;
}

/* 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; }

/* 响应式 */
@media (max-width: 1100px) {
    .leader-duty-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 768px) {
    .sidebar { width: 60px; }
    .nav-text { display: none; }
    .nav-item { justify-content: center; padding: 14px; }
    .realtime-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .monitor-split { grid-template-columns: 1fr; }
    .leader-absence-layout { grid-template-columns: 1fr; }
    .leader-duty-summary { grid-template-columns: 1fr; }
    .track-graph-layout { grid-template-columns: 1fr; }
    .track-graph-map-panel { min-height: 420px; }
    .track-graph-map-host { min-height: 360px; }
    .modal-body { padding: 14px; }
}
