﻿/* ======================================
   物业人员定位监控系统 - 样式
   ====================================== */

:root {
  --primary: #1a73e8;
  --primary-dark: #1557b0;
  --danger: #e74c3c;
  --warning: #f39c12;
  --success: #27ae60;
  --gray: #95a5a6;
  --bg: #f0f2f5;
  --card-bg: #fff;
  --text: #2c3e50;
  --text-light: #7f8c8d;
  --border: #e0e0e0;
  --shadow: 0 2px 8px rgba(0,0,0,0.1);
  --radius: 8px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif; background: var(--bg); color: var(--text); }

/* ====================================== 头部 */
.header {
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(135deg, #1a73e8, #0d47a1);
  color: white; padding: 12px 24px; box-shadow: 0 2px 10px rgba(0,0,0,0.2);
  z-index: 1000; position: relative;
}
.header h1 { font-size: 20px; }
.header-left { display: flex; align-items: center; gap: 12px; }
.mall-name { background: rgba(255,255,255,0.15); padding: 4px 12px; border-radius: 12px; font-size: 13px; }
.header-right { display: flex; align-items: center; gap: 16px; }
.status-summary { display: flex; gap: 12px; font-size: 13px; }
.stat { display: flex; align-items: center; gap: 4px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot.online { background: #2ecc71; }
.dot.offline { background: #95a5a6; }
.dot.warning { background: #f39c12; }
.dot.danger { background: #e74c3c; }
.warning-text { color: #fdcb6e; }
.danger-text { color: #ff7675; }

/* ====================================== 主布局 */
.main-container { display: flex; height: calc(100vh - 56px); gap: 0; }

/* ====================================== 地图 */
.map-wrapper { flex: 1; position: relative; }
#map { width: 100%; height: 100%; }
.map-overlay {
  position: absolute; bottom: 20px; left: 20px;
  background: rgba(0,0,0,0.75); color: white;
  padding: 8px 16px; border-radius: 20px; font-size: 13px;
  z-index: 1000; backdrop-filter: blur(4px);
}

/* ====================================== 人员面板 */
.staff-panel {
  width: 340px; background: var(--card-bg);
  display: flex; flex-direction: column;
  border-left: 1px solid var(--border);
}
.panel-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px 8px; }
.panel-header h2 { font-size: 16px; }
.badge { background: var(--primary); color: white; padding: 2px 10px; border-radius: 12px; font-size: 12px; }
.search-box { padding: 8px 16px; }
.search-box input { width: 100%; padding: 8px 12px; border: 1px solid var(--border); border-radius: 20px; font-size: 14px; outline: none; }
.search-box input:focus { border-color: var(--primary); }
.staff-list { flex: 1; overflow-y: auto; padding: 8px 16px 16px; }
.loading { text-align: center; color: var(--text-light); padding: 40px 0; }

/* 单个员工卡片 */
.staff-card {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; margin-bottom: 6px;
  border-radius: var(--radius); cursor: pointer;
  transition: all 0.2s; border: 1px solid transparent;
}
.staff-card:hover { background: #f5f7fa; border-color: var(--border); }
.staff-card.online { border-left: 3px solid var(--success); }
.staff-card.offline { border-left: 3px solid var(--gray); opacity: 0.6; }
.staff-card.warning { border-left: 3px solid var(--warning); background: #fff8e1; }
.staff-card.danger { border-left: 3px solid var(--danger); background: #ffebee; }
.staff-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 16px; font-weight: bold;
  flex-shrink: 0;
}
.staff-info { flex: 1; min-width: 0; }
.staff-name { font-size: 15px; font-weight: 600; }
.staff-role { font-size: 12px; color: var(--text-light); }
.staff-meta { font-size: 11px; color: var(--text-light); margin-top: 2px; }
.staff-status-badge { font-size: 11px; padding: 2px 8px; border-radius: 10px; font-weight: 500; }
.staff-status-badge.online { background: #e8f5e9; color: #2e7d32; }
.staff-status-badge.offline { background: #f5f5f5; color: #757575; }
.staff-status-badge.warning { background: #fff8e1; color: #f57f17; }
.staff-status-badge.danger { background: #ffebee; color: #c62828; }

/* ====================================== 告警面板 */
.alert-panel {
  position: fixed; bottom: 20px; right: 360px; width: 380px;
  max-height: 280px; background: var(--card-bg);
  border-radius: var(--radius) var(--radius) 0 0;
  box-shadow: 0 -2px 20px rgba(0,0,0,0.15); z-index: 2000;
  display: flex; flex-direction: column;
}
.alert-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 16px; border-bottom: 1px solid var(--border);
  font-size: 14px; cursor: pointer;
}
.alert-list { flex: 1; overflow-y: auto; max-height: 200px; padding: 8px 12px; }
.alert-empty { text-align: center; color: var(--text-light); padding: 16px; font-size: 13px; }
.alert-item {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 8px 10px; margin-bottom: 4px;
  border-radius: 6px; font-size: 13px; line-height: 1.4;
  animation: slideIn 0.3s ease;
}
.alert-item.danger { background: #ffebee; border-left: 3px solid var(--danger); }
.alert-item.warning { background: #fff8e1; border-left: 3px solid var(--warning); }
.alert-item.info { background: #e3f2fd; border-left: 3px solid var(--primary); }
.alert-time { font-size: 11px; color: var(--text-light); white-space: nowrap; }
@keyframes slideIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }

/* ====================================== 按钮 */
.btn {
  padding: 8px 16px; border: none; border-radius: 6px;
  cursor: pointer; font-size: 13px; transition: all 0.2s;
}
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-xs { padding: 3px 10px; font-size: 11px; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { background: transparent; border: 1px solid rgba(255,255,255,0.4); color: white; }
.btn-outline:hover { background: rgba(255,255,255,0.1); }
.btn-lg { padding: 14px 28px; font-size: 16px; border-radius: 10px; }
.btn-close { background: none; border: none; font-size: 24px; cursor: pointer; color: var(--text-light); }

/* ====================================== 弹窗 */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  z-index: 5000; display: flex; align-items: center; justify-content: center;
}
.modal { background: var(--card-bg); border-radius: 12px; width: 600px; max-width: 90vw; max-height: 80vh; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,0.3); }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 24px; border-bottom: 1px solid var(--border); }
.modal-body { padding: 20px 24px; overflow-y: auto; }
.form-row { display: flex; gap: 8px; margin-bottom: 16px; }
.form-row input, .form-row select { padding: 8px 12px; border: 1px solid var(--border); border-radius: 6px; font-size: 14px; outline: none; }
.form-row input:focus, .form-row select:focus { border-color: var(--primary); }
.form-row input { flex: 1; }
.staff-table { width: 100%; border-collapse: collapse; }
.staff-table th, .staff-table td { padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--border); font-size: 13px; }
.staff-table th { font-weight: 600; color: var(--text-light); font-size: 12px; }
.btn-danger { background: var(--danger); color: white; padding: 4px 10px; border: none; border-radius: 4px; cursor: pointer; font-size: 12px; }

/* ====================================== 员工端 */
.staff-body { background: #f5f6fa; display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.staff-screen { width: 100%; max-width: 420px; margin: 0 auto; }
.login-card {
  background: white; border-radius: 16px; padding: 40px 32px;
  text-align: center; box-shadow: 0 10px 40px rgba(0,0,0,0.1);
  margin: 40px 16px;
}
.login-icon { font-size: 64px; margin-bottom: 12px; }
.login-card h1 { font-size: 24px; margin-bottom: 4px; }
.login-sub { color: var(--text-light); margin-bottom: 24px; font-size: 14px; }
.login-form { display: flex; flex-direction: column; gap: 16px; }
.input-lg {
  padding: 14px 16px; border: 2px solid var(--border); border-radius: 10px;
  font-size: 16px; outline: none; background: #fafafa; width: 100%;
}
.input-lg:focus { border-color: var(--primary); background: white; }

/* 定位界面 */
#trackScreen { padding: 0; background: #f5f6fa; max-width: 100%; margin: 0; }
.track-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px; background: white; box-shadow: 0 1px 4px rgba(0,0,0,0.1);
  position: sticky; top: 0; z-index: 100;
}
.track-header-left { display: flex; align-items: center; gap: 10px; }
.staff-avatar { font-size: 36px; }
.track-status-bar {
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  gap: 8px; padding: 12px 16px; background: white; margin: 8px 0;
}
.status-item { text-align: center; padding: 8px 4px; border-radius: 8px; background: #f8f9fa; }
.status-label { display: block; font-size: 11px; color: var(--text-light); margin-bottom: 4px; }
.status-value { font-size: 16px; font-weight: 700; }
.track-map-wrapper { height: 350px; margin: 0 0 8px; background: #e8e8e8; }
#staffMap { width: 100%; height: 100%; }
.track-info {
  background: white; padding: 16px; margin: 0 0 8px;
  display: flex; flex-direction: column; gap: 8px;
}
.info-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; border-bottom: 1px solid #f0f0f0; font-size: 13px; }
.info-row:last-child { border-bottom: none; }
.alert-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  padding: 14px 16px; text-align: center; font-size: 15px; font-weight: 600;
  animation: slideDown 0.3s ease;
}
.alert-banner.danger { background: var(--danger); color: white; }
.alert-banner.warning { background: var(--warning); color: white; }
.alert-banner.success { background: var(--success); color: white; }
@keyframes slideDown { from { transform: translateY(-100%); } to { transform: translateY(0); } }

/* ====================================== 响应式 */
@media (max-width: 768px) {
  .header { flex-direction: column; gap: 8px; padding: 10px 16px; }
  .header-right { flex-wrap: wrap; justify-content: center; }
  .main-container { flex-direction: column; height: auto; }
  .staff-panel { width: 100%; max-height: 300px; border-left: none; border-top: 1px solid var(--border); }
  .map-wrapper { height: 60vh; }
  .alert-panel { right: 0; left: 0; width: auto; bottom: 0; }
  .status-summary { font-size: 12px; gap: 8px; }
}
