/**
 * 博淼旅游管理系统 - 公共基础样式
 * 定义全局 CSS 变量、Reset、通用组件样式
 * 所有页面通过 <link rel="stylesheet" href="../css/base.css"> 引入
 */

/* ===== 设计令牌 ===== */
:root {
  /* 主色 */
  --bm-primary: #2563eb;
  --bm-primary-hover: #1d4ed8;
  --bm-primary-light: #eff6ff;
  --bm-primary-shadow: rgba(37, 99, 235, 0.18);

  /* 中性色 */
  --bm-navy: #0f172a;
  --bm-slate-900: #1e293b;
  --bm-slate-700: #334155;
  --bm-slate-500: #64748b;
  --bm-slate-400: #94a3b8;
  --bm-slate-300: #cbd5e1;
  --bm-slate-200: #e2e8f0;
  --bm-slate-100: #f1f5f9;
  --bm-slate-50: #f8fafc;
  --bm-white: #ffffff;

  /* 语义色 */
  --bm-green: #10b981;
  --bm-green-light: #d1fae5;
  --bm-amber: #f59e0b;
  --bm-amber-light: #fef3c7;
  --bm-blue: #3b82f6;
  --bm-blue-light: #dbeafe;
  --bm-red: #ef4444;
  --bm-red-light: #fee2e2;
  --bm-purple: #8b5cf6;

  /* 布局 */
  --bm-sidebar-w: 260px;
  --bm-header-h: 60px;

  /* 圆角 */
  --bm-radius: 12px;
  --bm-radius-sm: 8px;
  --bm-radius-lg: 16px;

  /* 阴影 */
  --bm-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --bm-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
  --bm-shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.1);

  /* 动画 */
  --bm-ease: 0.2s ease;

  /* 字体 */
  --bm-font: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  --bm-font-mono: 'SF Mono', 'Cascadia Code', 'Courier New', monospace;
}

/* ===== Reset ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--bm-font);
  background: var(--bm-slate-50);
  color: var(--bm-slate-900);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--bm-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

:focus-visible {
  outline: 2px solid var(--bm-primary);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ===== 通用工具类 ===== */
.bm-mono { font-family: var(--bm-font-mono); }
.bm-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bm-nowrap { white-space: nowrap; }
.bm-center { text-align: center; }
.bm-hidden { display: none !important; }
.bm-sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* 间距 */
.bm-mt-sm { margin-top: 8px; }
.bm-mt-md { margin-top: 16px; }
.bm-mt-lg { margin-top: 24px; }
.bm-mb-sm { margin-bottom: 8px; }
.bm-mb-md { margin-bottom: 16px; }
.bm-mb-lg { margin-bottom: 24px; }

/* Flex */
.bm-flex { display: flex; }
.bm-flex-center { display: flex; align-items: center; justify-content: center; }
.bm-flex-between { display: flex; align-items: center; justify-content: space-between; }
.bm-gap-sm { gap: 8px; }
.bm-gap-md { gap: 12px; }
.bm-gap-lg { gap: 16px; }

/* ===== 通用按钮 ===== */
.bm-btn {
  padding: 8px 16px;
  border: none;
  border-radius: var(--bm-radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--bm-font);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all var(--bm-ease);
  line-height: 1.4;
}

.bm-btn-primary { background: var(--bm-primary); color: var(--bm-white); }
.bm-btn-primary:hover { background: var(--bm-primary-hover); transform: translateY(-1px); box-shadow: 0 4px 12px var(--bm-primary-shadow); }

.bm-btn-success { background: var(--bm-green); color: var(--bm-white); }
.bm-btn-success:hover { background: #059669; transform: translateY(-1px); }

.bm-btn-danger { background: var(--bm-red); color: var(--bm-white); }
.bm-btn-danger:hover { background: #dc2626; }

.bm-btn-ghost { background: var(--bm-slate-100); color: var(--bm-slate-700); }
.bm-btn-ghost:hover { background: var(--bm-slate-200); }

.bm-btn-sm { padding: 6px 12px; font-size: 12px; }
.bm-btn-lg { padding: 10px 24px; font-size: 14px; }

.bm-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; box-shadow: none !important; }

/* ===== 通用输入 ===== */
.bm-input,
.bm-select,
.bm-textarea {
  padding: 8px 12px;
  border: 1px solid var(--bm-slate-200);
  border-radius: var(--bm-radius-sm);
  font-size: 13px;
  font-family: var(--bm-font);
  color: var(--bm-slate-900);
  background: var(--bm-white);
  transition: border-color var(--bm-ease), box-shadow var(--bm-ease);
  outline: none;
}

.bm-input:focus,
.bm-select:focus,
.bm-textarea:focus {
  border-color: var(--bm-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}

.bm-textarea { resize: vertical; min-height: 80px; }

/* ===== 通用卡片 ===== */
.bm-card {
  background: var(--bm-white);
  border-radius: var(--bm-radius);
  box-shadow: var(--bm-shadow-sm);
  border: 1px solid var(--bm-slate-200);
  padding: 20px;
  transition: transform var(--bm-ease), box-shadow var(--bm-ease);
}

.bm-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--bm-shadow);
}

/* ===== 通用徽章 ===== */
.bm-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.bm-badge-pending { background: var(--bm-amber-light); color: var(--bm-amber); }
.bm-badge-progress { background: var(--bm-blue-light); color: var(--bm-blue); }
.bm-badge-done { background: var(--bm-green-light); color: var(--bm-green); }
.bm-badge-default { background: var(--bm-slate-100); color: var(--bm-slate-500); }
.bm-badge-danger { background: var(--bm-red-light); color: var(--bm-red); }

/* ===== 通用空状态 ===== */
.bm-empty {
  text-align: center;
  padding: 60px 20px;
}

.bm-empty i {
  font-size: 48px;
  color: var(--bm-slate-300);
  margin-bottom: 16px;
  display: block;
}

.bm-empty p {
  font-size: 15px;
  color: var(--bm-slate-400);
  font-weight: 500;
}

/* ===== 通用加载 ===== */
.bm-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  gap: 12px;
  color: var(--bm-slate-400);
  font-size: 14px;
}

/* ===== 通用模态框底层 ===== */
.bm-modal-mask {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bm-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
}

.bm-modal-box {
  position: relative;
  background: var(--bm-white);
  border-radius: var(--bm-radius-lg);
  width: 92%;
  max-width: 880px;
  max-height: 88vh;
  box-shadow: var(--bm-shadow-lg);
  display: flex;
  flex-direction: column;
  z-index: 1001;
}

/* ===== 通用 Toast ===== */
.bm-toast {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  padding: 10px 24px;
  border-radius: var(--bm-radius-sm);
  font-size: 14px;
  font-weight: 500;
  z-index: 10000;
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
}

.bm-toast.visible { opacity: 1; transform: translateX(-50%) translateY(0); }
.bm-toast-success { background: var(--bm-green); color: var(--bm-white); }
.bm-toast-error { background: var(--bm-red); color: var(--bm-white); }
.bm-toast-info { background: var(--bm-slate-900); color: var(--bm-white); }

/* ===== 响应式断点 ===== */
@media (max-width: 768px) {
  :root {
    --bm-sidebar-w: 0px;
  }
}
