/* ============================================================
   山野路书 后台管理系统 - 设计系统（shadcn 风格 · 柔和蓝灰 · 低饱和度）
   ============================================================ */
:root {
  --background: 215 28% 97%;
  --foreground: 222 30% 14%;
  --card: 0 0% 100%;
  --card-foreground: 222 30% 14%;
  --primary: 152 32% 40%;
  --primary-foreground: 0 0% 100%;
  --secondary: 150 20% 95%;
  --secondary-foreground: 152 30% 22%;
  --muted: 214 30% 95%;
  --muted-foreground: 215 16% 46%;
  --accent: 150 24% 94%;
  --accent-foreground: 152 32% 22%;
  --destructive: 0 66% 50%;
  --destructive-foreground: 0 0% 100%;
  --border: 214 28% 90%;
  --input: 214 28% 90%;
  --ring: 152 32% 40%;
  --radius: 0.65rem;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

/* ---------- 滚动条 ---------- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: hsl(var(--border)); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: hsl(var(--muted-foreground) / 0.4); }

/* ---------- 基础交互反馈 ---------- */
button { cursor: pointer; font-family: inherit; }
input, textarea, select { font-family: inherit; }
a { color: inherit; text-decoration: none; }

/* ---------- 焦点环 ---------- */
.focus-ring:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px hsl(var(--background)), 0 0 0 4px hsl(var(--ring) / 0.5);
}

/* ---------- 登录页 ---------- */
.login-bg {
  background:
    radial-gradient(1200px 600px at 15% -10%, hsl(152 32% 92% / 0.8), transparent 60%),
    radial-gradient(1000px 500px at 90% 110%, hsl(160 28% 90% / 0.8), transparent 60%),
    hsl(var(--background));
}

/* ---------- 徽标 ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.125rem 0.55rem;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.5;
  white-space: nowrap;
}
.badge-green  { background: hsl(150 60% 92%); color: hsl(150 65% 26%); }
.badge-yellow { background: hsl(45 85% 90%);  color: hsl(40 70% 28%); }
.badge-red    { background: hsl(0 70% 93%);    color: hsl(0 65% 38%); }
.badge-blue   { background: hsl(215 60% 92%);  color: hsl(215 65% 32%); }
.badge-gray   { background: hsl(214 30% 94%);  color: hsl(215 16% 42%); }

/* ---------- 状态点（饱和度） ---------- */
.dot { width: 8px; height: 8px; border-radius: 9999px; display: inline-block; }
.dot-green  { background: hsl(150 65% 45%); }
.dot-yellow { background: hsl(45 90% 50%); }
.dot-red    { background: hsl(0 70% 52%); }
.dot-gray   { background: hsl(215 15% 70%); }

/* ---------- 表格 ---------- */
.table-base { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table-base thead th {
  text-align: left;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
  font-size: 12.5px;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid hsl(var(--border));
  background: hsl(var(--muted) / 0.5);
  white-space: nowrap;
}
.table-base tbody td {
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid hsl(var(--border));
  vertical-align: middle;
}
.table-base tbody tr:last-child td { border-bottom: none; }
.table-base tbody tr:hover { background: hsl(var(--accent) / 0.5); }

/* ---------- 卡片 ---------- */
.card {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  box-shadow: 0 1px 2px hsl(215 30% 50% / 0.04);
}

/* 可点击卡片（仪表盘统计） */
.card-clickable { cursor: pointer; transition: box-shadow 0.15s ease, transform 0.15s ease, border-color 0.15s ease; }
.card-clickable:hover {
  box-shadow: 0 4px 16px hsl(215 30% 50% / 0.12);
  border-color: hsl(var(--ring) / 0.35);
  transform: translateY(-1px);
}

/* ---------- 动画 ---------- */
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.fade-in { animation: fadeIn 0.25s ease; }
@keyframes toastIn { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }
.toast-item { animation: toastIn 0.25s ease; }

/* ---------- 侧边栏 ---------- */
.sidebar-collapsed .sidebar-link span.menu-label,
.sidebar-collapsed .sidebar-section-title,
.sidebar-collapsed .sidebar-brand-text { display: none; }
.sidebar-collapsed .sidebar-link { justify-content: center; padding: 0.55rem 0; }
.sidebar-collapsed .sidebar { width: 64px; }

/* 菜单项激活态 */
#sidebar-nav .menu-item { color: hsl(var(--foreground) / 0.78); }
#sidebar-nav .menu-item:hover { background: hsl(var(--accent)); }
#sidebar-nav .menu-item.active { background: hsl(var(--primary) / 0.12); color: hsl(var(--primary)); font-weight: 500; }

/* ---------- 地图总览 ---------- */
.map-canvas { height: 72vh; }
.map-point-dot {
  width: 18px;
  height: 18px;
  border-radius: 9999px;
  border: 2.5px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
  cursor: pointer;
}
.amap-info-content {
  border-radius: 0.6rem;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.12);
  min-width: 200px;
  font-size: 13px;
}

/* ---------- 简易图表（仪表盘柱状图） ---------- */
.bar { border-radius: 4px 4px 0 0; background: hsl(var(--primary) / 0.75); transition: height 0.4s ease; }

/* ============================================================
   移动端适配（窄屏浏览）
   ============================================================ */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.toolbar-search { width: 13rem; }
.toast-item { max-width: calc(100vw - 2rem); }
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  z-index: 65;
  background: hsl(var(--foreground) / 0.35);
}

@media (max-width: 1023px) {
  #app-view .app-shell { height: 100vh; height: 100dvh; }
  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 70;
    transform: translateX(-100%);
    transition: transform 0.28s ease;
  }
  .sidebar.mobile-open { transform: translateX(0); }
  .table-wrap .table-base td { white-space: nowrap; }
  .toolbar-search { width: 100%; }
  .toolbar-search-wrap { flex: 1 1 10rem; }
  .map-canvas { height: 58vh; }
}
