/* common.css - 天枢AIOT Web版公共样式 */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #4a6fa5;
  --dark: #1a1a2e;
  --dark2: #16213e;
  --bg: #f5f6fa;
  --white: #fff;
  --text: #333;
  --text-sub: #999;
  --green: #4caf50;
  --red: #f44336;
  --orange: #ffa000;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(0,0,0,0.07);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ===== 顶部导航 ===== */
.navbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: 56px;
  background: var(--dark);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.navbar-title {
  color: #fff; font-size: 17px; font-weight: 600;
}
.navbar-back {
  color: rgba(255,255,255,0.8); font-size: 14px; cursor: pointer;
  display: flex; align-items: center; gap: 4px;
  text-decoration: none; padding: 4px 8px; border-radius: 6px;
}
.navbar-back:hover { background: rgba(255,255,255,0.1); }
.navbar-right { display: flex; align-items: center; gap: 8px; }

/* ===== Tab Bar ===== */
.tab-bar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
  height: 56px; background: var(--white);
  display: flex; border-top: 1px solid #e0e0e0;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.05);
}
.tab-item {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 3px; cursor: pointer; text-decoration: none;
  color: #888; font-size: 11px;
  transition: color .2s;
}
.tab-item.active { color: var(--primary); }
.tab-icon { font-size: 22px; line-height: 1; }

/* ===== 主内容区 ===== */
.main { padding-top: 56px; padding-bottom: 72px; }

/* ===== 通用卡片 ===== */
.card {
  background: var(--white); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow);
}

/* ===== 按钮 ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 44px; padding: 0 24px; border: none; border-radius: 22px;
  font-size: 15px; font-weight: 500; cursor: pointer;
  transition: opacity .2s, transform .1s;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--dark) 100%);
  color: #fff;
}
.btn-outline {
  background: #fff; color: var(--primary);
  border: 1.5px solid var(--primary);
}
.btn-danger { background: var(--red); color: #fff; }
.btn-block { width: 100%; display: flex; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* ===== Tag ===== */
.tag { padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 500; }
.tag-green { background: #e8f5e9; color: #2e7d32; }
.tag-gray { background: #f5f5f5; color: #999; }
.tag-red { background: #fce4ec; color: #c62828; }
.tag-blue { background: #e3f2fd; color: #1565c0; }

/* ===== 加载/空状态 ===== */
.loading-wrap { text-align: center; padding: 60px 16px; color: var(--text-sub); font-size: 14px; }
.empty-wrap { text-align: center; padding: 60px 16px; }
.empty-icon { font-size: 56px; display: block; margin-bottom: 12px; }
.empty-text { font-size: 14px; color: var(--text-sub); margin-bottom: 16px; display: block; }

/* ===== 分割线 ===== */
.divider { display: flex; align-items: center; margin: 20px 0; }
.divider-line { flex: 1; height: 1px; background: #e0e0e0; }
.divider-text { padding: 0 12px; font-size: 12px; color: var(--text-sub); }

/* ===== toast ===== */
#toast-container {
  position: fixed; top: 70px; left: 50%; transform: translateX(-50%);
  z-index: 9999; display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.toast {
  background: rgba(0,0,0,0.78); color: #fff;
  padding: 10px 20px; border-radius: 20px; font-size: 13px;
  animation: fadeInOut 2.2s ease forwards;
  white-space: nowrap;
}
.toast.success { background: rgba(46,125,50,0.9); }
.toast.error { background: rgba(198,40,40,0.9); }
@keyframes fadeInOut {
  0% { opacity: 0; transform: translateY(-8px); }
  15% { opacity: 1; transform: translateY(0); }
  75% { opacity: 1; }
  100% { opacity: 0; }
}

/* ===== 弹窗 ===== */
.modal-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  z-index: 200; display: flex; align-items: center; justify-content: center;
}
.modal-box {
  background: #fff; border-radius: 16px; padding: 24px; width: 88%; max-width: 400px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
}
.modal-title { font-size: 16px; font-weight: 600; margin-bottom: 12px; }
.modal-body { font-size: 14px; color: #555; margin-bottom: 20px; }
.modal-actions { display: flex; gap: 12px; justify-content: flex-end; }

/* ===== WS状态点 ===== */
.ws-dot {
  width: 8px; height: 8px; border-radius: 50%;
  display: inline-block; margin-right: 4px;
}
.ws-dot.online { background: #81c784; }
.ws-dot.offline { background: #e57373; }
.ws-badge {
  display: flex; align-items: center; font-size: 12px;
  padding: 3px 10px; border-radius: 12px;
}
.ws-badge.online { background: rgba(76,175,80,0.15); color: #81c784; }
.ws-badge.offline { background: rgba(244,67,54,0.15); color: #e57373; }

/* ===== 响应式：宽屏居中 ===== */
@media (min-width: 600px) {
  .main { max-width: 640px; margin: 0 auto; }
  .navbar { justify-content: center; gap: 0; }
  .navbar-inner { width: 640px; display: flex; align-items: center; justify-content: space-between; }
  .tab-bar { justify-content: center; }
  .tab-bar-inner { width: 640px; display: flex; }
  .tab-item { max-width: none; }
}
