/* ================================================================
   八千翼机票销售 - 管理后台 H5 样式
   简洁 · 专业 · 克制
   ================================================================ */

:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --danger: #ef4444;
  --success: #10b981;
  --warning: #f59e0b;
  --bg: #f1f5f9;
  --card-bg: #ffffff;
  --text: #1e293b;
  --text-secondary: #64748b;
  --border: #e2e8f0;
  --radius: 8px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ========== Reset & Base ========== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding-bottom: calc(60px + var(--safe-bottom));
  line-height: 1.6;
}

/* ========== 顶部导航栏 ========== */
.nav-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #1e293b;
  color: #fff;
  padding: 0 16px;
  display: flex;
  align-items: center;
  height: 48px;
  gap: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  white-space: nowrap;
  border-bottom: 1px solid #334155;
}

.nav-bar::-webkit-scrollbar { display: none; }

.nav-bar .brand {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  margin-right: 16px;
  flex-shrink: 0;
  letter-spacing: 0.5px;
}

.nav-bar a {
  color: #94a3b8;
  text-decoration: none;
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 6px;
  flex-shrink: 0;
  transition: all 0.15s;
}

.nav-bar a:hover,
.nav-bar a.active {
  color: #fff;
  background: rgba(255,255,255,0.08);
}

.nav-bar .logout {
  margin-left: auto;
  cursor: pointer;
  color: #64748b;
  font-size: 13px;
  flex-shrink: 0;
  padding: 6px 8px;
  transition: color 0.15s;
}

.nav-bar .logout:hover { color: var(--danger); }

/* ========== 底部标签栏（移动端） ========== */
.tab-bar { display: none; }

@media (max-width: 768px) {
  .nav-bar { display: none; }

  .tab-bar {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: #fff;
    border-top: 1px solid var(--border);
    padding-bottom: var(--safe-bottom);
    height: calc(52px + var(--safe-bottom));
  }

  .tab-bar a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 11px;
    gap: 2px;
    transition: color 0.15s;
  }

  .tab-bar a .tab-icon { font-size: 20px; }
  .tab-bar a.active { color: var(--primary); font-weight: 600; }
}

/* ========== 主容器 ========== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px;
}

@media (min-width: 768px) {
  .container { padding: 20px 24px; }
}

/* ========== 卡片 ========== */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}

@media (min-width: 768px) {
  .card { padding: 20px; margin-bottom: 16px; }
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text);
}

/* ========== 统计卡片 ========== */
.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

@media (min-width: 480px) {
  .stat-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
}

.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
}

.stat-card .label {
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-card .value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
}

.stat-card .value.green { color: var(--success); }
.stat-card .value.orange { color: var(--warning); }
.stat-card .value.red { color: var(--danger); }

@media (min-width: 768px) {
  .stat-card .value { font-size: 28px; }
}

/* ========== 筛选栏 ========== */
.filter-bar {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.filter-bar label {
  display: flex;
  flex-direction: column;
  font-size: 12px;
  color: var(--text-secondary);
  gap: 4px;
  flex: 1 1 auto;
  min-width: 80px;
}

.filter-bar label input,
.filter-bar label select { width: 100%; }

/* ========== 表单元素 ========== */
input, select, button, textarea { font-family: inherit; }

input[type="text"],
input[type="number"],
input[type="date"],
input[type="password"],
input[type="search"],
input[type="tel"],
input[type="email"],
select {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  outline: none;
  background: #fff;
  transition: border-color 0.15s;
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
}

@media (min-width: 768px) {
  input[type="text"],
  input[type="number"],
  input[type="date"],
  input[type="password"],
  input[type="search"],
  input[type="tel"],
  input[type="email"],
  select { padding: 7px 10px; font-size: 13px; }
}

input:focus, select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

/* ========== 按钮 ========== */
.btn {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  background: #fff;
  transition: all 0.15s;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  touch-action: manipulation;
  min-height: 36px;
  color: var(--text);
}

.btn:active { opacity: 0.8; }

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-hover); }

.btn-danger {
  border-color: var(--danger);
  color: var(--danger);
}
.btn-danger:hover { background: #fef2f2; }

.btn-success {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}
.btn-success:hover { background: #059669; }

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
  min-height: 30px;
}

.btn-block { width: 100%; }

/* ========== 定价规则卡片 ========== */
.rule-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 10px;
  position: relative;
}

.rule-card .rule-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
}

.rule-card .rule-scope {
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.rule-card .rule-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.rule-card .rule-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 16px;
  font-size: 13px;
}

.rule-card .rule-detail-item {
  display: flex;
  flex-direction: column;
}

.rule-card .rule-detail-label {
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: 1px;
}

.rule-card .rule-detail-value {
  font-weight: 500;
  color: var(--text);
}

.rule-card .rule-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
}

/* ========== 作用域卡片选择 ========== */
.scope-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 6px;
  border: 2px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s;
  font-size: 13px;
  background: #fff;
}

.scope-card:active { transform: scale(0.97); }
.scope-card.active {
  border-color: var(--primary);
  background: var(--primary-light);
}

/* ========== 数据表格 ========== */
.table-wrapper {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -16px;
  padding: 0 16px;
}

@media (min-width: 768px) {
  .table-wrapper { margin: 0; padding: 0; }
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 600px;
}

.data-table th {
  background: #f8fafc;
  padding: 10px 10px;
  text-align: left;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  font-size: 12px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.data-table td {
  padding: 10px 10px;
  border-bottom: 1px solid #f1f5f9;
  color: var(--text);
}

.data-table tr:hover td { background: #f8fafc; }

/* ========== 分页 ========== */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  font-size: 13px;
  color: var(--text-secondary);
  flex-wrap: wrap;
}

.pagination .page-info { font-size: 12px; }

/* ========== 登录页 ========== */
.login-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
  padding: 20px;
}

.login-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 36px 28px;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.12);
}

.login-card h1 {
  font-size: 20px;
  text-align: center;
  margin-bottom: 4px;
  font-weight: 700;
  color: var(--text);
}

.login-card .subtitle {
  text-align: center;
  color: var(--text-secondary);
  margin-bottom: 28px;
  font-size: 13px;
}

.login-card .form-group { margin-bottom: 18px; }
.login-card label { display: block; margin-bottom: 5px; font-size: 13px; font-weight: 500; color: var(--text); }
.login-card input { width: 100%; }
.login-card .btn { width: 100%; margin-top: 4px; font-size: 14px; min-height: 44px; }

/* ========== 弹窗 ========== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 200;
  display: flex;
  justify-content: center;
  align-items: flex-end;
}

@media (min-width: 768px) {
  .modal-overlay { align-items: center; }
}

.modal {
  background: #fff;
  border-radius: 12px 12px 0 0;
  padding: 20px 16px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
}

@media (min-width: 768px) {
  .modal {
    border-radius: var(--radius);
    max-width: 480px;
    padding: 24px;
  }
}

.modal h3 { font-size: 16px; font-weight: 600; margin-bottom: 16px; }

.modal .form-group { margin-bottom: 14px; }
.modal label { display: block; margin-bottom: 4px; font-size: 12px; color: var(--text-secondary); }
.modal input, .modal select { width: 100%; }

.modal .hint {
  background: var(--primary-light);
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 14px;
  font-size: 12px;
  color: var(--primary);
  line-height: 1.5;
}

.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 18px;
  position: sticky;
  bottom: 0;
  background: #fff;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

/* ========== Badge / 标签 ========== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
}

.badge-success { background: #ecfdf5; color: #059669; }
.badge-warning { background: #fffbeb; color: #d97706; }
.badge-error   { background: #fef2f2; color: var(--danger); }
.badge-info    { background: var(--primary-light); color: var(--primary); }

/* 航线标签专用 */
.tag-hot {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
  background: #fef2f2;
  color: var(--danger);
}

.tag-cold {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
  background: var(--primary-light);
  color: var(--primary);
}

.tag-normal {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
  background: #f1f5f9;
  color: var(--text-secondary);
}

/* ========== 空状态 ========== */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-secondary);
  font-size: 14px;
}

.empty-state .empty-icon { font-size: 40px; margin-bottom: 10px; opacity: 0.4; }

/* ========== Toast ========== */
.toast {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 9999;
  animation: toastIn 0.25s ease;
  max-width: 90vw;
  text-align: center;
  border: 1px solid;
}

.toast-error   { background: #fef2f2; border-color: #fecaca; color: var(--danger); }
.toast-success { background: #ecfdf5; border-color: #a7f3d0; color: #059669; }

@keyframes toastIn {
  from { transform: translateX(-50%) translateY(-16px); opacity: 0; }
  to   { transform: translateX(-50%) translateY(0); opacity: 1; }
}

/* ========== 页面标题 ========== */
h2 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 14px;
  color: var(--text);
}

@media (min-width: 768px) {
  h2 { font-size: 18px; }
}

/* ========== 内联面板（日期范围/选项卡） ========== */
.panel-inline {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.panel-inline label {
  display: flex;
  flex-direction: column;
  font-size: 12px;
  color: var(--text-secondary);
  gap: 4px;
  flex: 1 1 auto;
  min-width: 100px;
}
