/* ========================================
   自助挪车系统 - 后台管理样式
   配色：蓝白主题
======================================== */
:root {
  --primary: #1a6fe8;
  --primary-dark: #1456c0;
  --primary-light: #e8f1ff;
  --sidebar-w: 220px;
  --header-h: 56px;
  --white: #ffffff;
  --bg: #f0f4fa;
  --card-bg: #ffffff;
  --text: #1a2340;
  --text-sub: #6c7a99;
  --border: #e2e8f0;
  --success: #28a745;
  --danger: #dc3545;
  --warning: #f0a500;
  --info: #17a2b8;
  --radius: 10px;
  --shadow: 0 2px 12px rgba(26,111,232,0.08);
  --shadow-md: 0 4px 20px rgba(26,111,232,0.12);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body { font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--primary); text-decoration: none; }
button { cursor: pointer; }
input, textarea, select { font-family: inherit; }

/* ─── 登录页 ──────────────────────────────────────── */
.login-body { background: linear-gradient(135deg, #0d2d6e 0%, #1a6fe8 60%, #4da8ff 100%); min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.login-bg { width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100vh; }
.login-card { background: var(--white); border-radius: 20px; width: 400px; box-shadow: 0 12px 48px rgba(0,0,0,0.18); overflow: hidden; }
.login-logo { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); padding: 36px 40px; text-align: center; color: var(--white); }
.logo-icon { font-size: 48px; margin-bottom: 12px; }
.login-logo h1 { font-size: 22px; font-weight: 800; margin-bottom: 4px; }
.login-logo p { font-size: 14px; opacity: 0.85; }
.login-form { padding: 32px 32px 28px; }
.form-item { display: flex; align-items: center; border: 1.5px solid var(--border); border-radius: 10px; margin-bottom: 16px; overflow: hidden; background: #fafbfd; transition: border-color 0.2s; }
.form-item:focus-within { border-color: var(--primary); background: var(--white); box-shadow: 0 0 0 3px rgba(26,111,232,0.1); }
.fi-icon { padding: 0 14px; color: var(--text-sub); font-size: 16px; }
.form-item input { flex: 1; border: none; background: transparent; padding: 13px 14px 13px 4px; font-size: 15px; }
.form-item input:focus { outline: none; }
.btn-login { width: 100%; background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: var(--white); border: none; border-radius: 10px; padding: 14px; font-size: 16px; font-weight: 700; letter-spacing: 4px; transition: opacity 0.2s; margin-top: 4px; }
.btn-login:hover { opacity: 0.9; }
.btn-login:disabled { opacity: 0.6; cursor: not-allowed; }
.login-hint { text-align: center; color: var(--text-sub); font-size: 12px; margin-top: 14px; }
.login-footer { color: rgba(255,255,255,0.55); font-size: 13px; margin-top: 28px; }

/* ─── 布局 ────────────────────────────────────────── */
.sidebar { position: fixed; top: 0; left: 0; width: var(--sidebar-w); height: 100vh; background: linear-gradient(180deg, #0d2d6e 0%, #1456c0 100%); overflow-y: auto; transition: width 0.25s; z-index: 200; display: flex; flex-direction: column; }
.sidebar.collapsed { width: 60px; }
.sidebar.collapsed .nav-label, .sidebar.collapsed .s-logo-text { display: none; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 14px 0; }
.sidebar.collapsed .nav-icon { margin-right: 0; }
.sidebar-logo { padding: 20px 16px 16px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid rgba(255,255,255,0.1); flex-shrink: 0; }
.s-logo-img { width: 36px; height: 36px; border-radius: 8px; object-fit: contain; flex-shrink: 0; }
.s-logo-text { color: var(--white); font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; }
.sidebar-nav { flex: 1; padding: 10px 0; }
.nav-item { display: flex; align-items: center; padding: 12px 18px; color: rgba(255,255,255,0.78); transition: background 0.2s, color 0.2s; white-space: nowrap; }
.nav-item:hover { background: rgba(255,255,255,0.1); color: var(--white); }
.nav-item.active { background: rgba(255,255,255,0.18); color: var(--white); font-weight: 700; border-left: 3px solid #7ab8ff; }
.nav-icon { font-size: 16px; margin-right: 10px; flex-shrink: 0; }
.nav-label { font-size: 14px; }
.main-wrap { margin-left: var(--sidebar-w); min-height: 100vh; transition: margin-left 0.25s; display: flex; flex-direction: column; }
.main-wrap.sidebar-collapsed { margin-left: 60px; }
.a-header { position: sticky; top: 0; z-index: 100; height: var(--header-h); background: var(--white); border-bottom: 1px solid var(--border); display: flex; align-items: center; padding: 0 20px; gap: 14px; box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
.sidebar-toggle { background: none; border: none; font-size: 20px; color: var(--text-sub); padding: 6px; border-radius: 6px; transition: background 0.2s; }
.sidebar-toggle:hover { background: var(--primary-light); color: var(--primary); }
.a-header-title { flex: 1; font-size: 16px; font-weight: 700; color: var(--text); }
.a-header-right { display: flex; align-items: center; gap: 10px; }
.admin-name { color: var(--text-sub); font-size: 13px; }
.btn-logout { background: none; border: 1px solid var(--danger); color: var(--danger); padding: 6px 14px; border-radius: 6px; font-size: 13px; transition: background 0.2s; }
.btn-logout:hover { background: var(--danger); color: var(--white); }
.page-content { flex: 1; padding: 20px; }

/* ─── 卡片 ────────────────────────────────────────── */
.card { background: var(--card-bg); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 20px; }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.card-title { font-size: 16px; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 8px; }
.card-title::before { content: ''; display: inline-block; width: 4px; height: 16px; background: var(--primary); border-radius: 2px; }

/* ─── 统计卡片 ────────────────────────────────────── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card { background: var(--card-bg); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); display: flex; align-items: center; gap: 16px; transition: box-shadow 0.2s; border-left: 4px solid var(--primary); }
.stat-card:hover { box-shadow: var(--shadow-md); }
.stat-card.sc-success { border-left-color: var(--success); }
.stat-card.sc-warning { border-left-color: var(--warning); }
.stat-card.sc-danger  { border-left-color: var(--danger); }
.stat-card.sc-info    { border-left-color: var(--info); }
.stat-icon { width: 52px; height: 52px; border-radius: 12px; background: var(--primary-light); display: flex; align-items: center; justify-content: center; font-size: 24px; flex-shrink: 0; }
.sc-success .stat-icon { background: #d4edda; }
.sc-warning .stat-icon { background: #fff3cd; }
.sc-danger .stat-icon  { background: #f8d7da; }
.sc-info .stat-icon    { background: #d1ecf1; }
.stat-info .stat-num { font-size: 28px; font-weight: 800; color: var(--text); line-height: 1; }
.stat-info .stat-label { font-size: 13px; color: var(--text-sub); margin-top: 4px; }

/* ─── 表格 ────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th { background: #f8faff; color: var(--text-sub); font-weight: 600; padding: 12px 14px; text-align: left; border-bottom: 2px solid var(--border); white-space: nowrap; }
tbody td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:hover { background: #f8faff; }
tbody tr:last-child td { border-bottom: none; }

/* ─── 搜索栏 ──────────────────────────────────────── */
.search-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.search-bar input, .search-bar select { height: 36px; border: 1.5px solid var(--border); border-radius: 7px; padding: 0 12px; font-size: 13px; background: var(--white); min-width: 140px; }
.search-bar input:focus, .search-bar select:focus { outline: none; border-color: var(--primary); }
.search-bar .btn { height: 36px; padding: 0 16px; }

/* ─── 按钮 ────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: 5px; padding: 7px 16px; border-radius: 7px; font-size: 13px; font-weight: 600; border: none; cursor: pointer; transition: opacity 0.15s, transform 0.1s; white-space: nowrap; }
.btn:active { transform: scale(0.97); }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: var(--white); }
.btn-success { background: var(--success); color: var(--white); }
.btn-danger  { background: var(--danger);  color: var(--white); }
.btn-warning { background: var(--warning); color: var(--white); }
.btn-info    { background: var(--info);    color: var(--white); }
.btn-outline { background: transparent; border: 1.5px solid var(--primary); color: var(--primary); }
.btn-sm  { padding: 4px 10px; font-size: 12px; }
.btn-lg  { padding: 11px 24px; font-size: 15px; }
.btn-block { width: 100%; justify-content: center; }

/* ─── 表单 ────────────────────────────────────────── */
.form-row { display: flex; gap: 16px; flex-wrap: wrap; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 7px; }
.form-group .required { color: var(--danger); }
.form-control { display: block; width: 100%; height: 38px; border: 1.5px solid var(--border); border-radius: 7px; padding: 0 12px; font-size: 14px; background: var(--white); transition: border-color 0.2s, box-shadow 0.2s; }
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,111,232,0.1); }
textarea.form-control { height: auto; padding: 10px 12px; resize: vertical; min-height: 80px; }
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%236c7a99'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 30px; }
.form-inline { display: flex; align-items: center; gap: 10px; }

/* ─── 分页 ────────────────────────────────────────── */
.pagination { display: flex; justify-content: flex-end; align-items: center; gap: 6px; margin-top: 16px; }
.pagination .pg-btn { min-width: 32px; height: 32px; border: 1.5px solid var(--border); border-radius: 6px; background: var(--white); font-size: 13px; color: var(--text); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.2s; }
.pagination .pg-btn:hover { border-color: var(--primary); color: var(--primary); }
.pagination .pg-btn.active { background: var(--primary); border-color: var(--primary); color: var(--white); }
.pagination .pg-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.pg-info { font-size: 13px; color: var(--text-sub); }

/* ─── 徽章 ────────────────────────────────────────── */
.badge { display: inline-block; padding: 3px 10px; border-radius: 10px; font-size: 12px; font-weight: 600; }
.badge-primary   { background: var(--primary-light); color: var(--primary); }
.badge-success   { background: #d4edda; color: #155724; }
.badge-warning   { background: #fff3cd; color: #856404; }
.badge-danger    { background: #f8d7da; color: #721c24; }
.badge-info      { background: #d1ecf1; color: #0c5460; }
.badge-secondary { background: #e2e3e5; color: #383d41; }

/* ─── 弹窗 ────────────────────────────────────────── */
.a-modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.45); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 20px; }
.a-modal { background: var(--white); border-radius: 14px; width: 100%; max-width: 560px; box-shadow: 0 12px 48px rgba(0,0,0,0.15); overflow: hidden; }
.a-modal-header { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); padding: 16px 20px; display: flex; align-items: center; justify-content: space-between; color: var(--white); font-size: 15px; font-weight: 700; }
.a-modal-close { background: none; border: none; color: rgba(255,255,255,0.8); font-size: 18px; cursor: pointer; padding: 2px 6px; }
.a-modal-close:hover { color: var(--white); }
.a-modal-body { padding: 20px; max-height: 500px; overflow-y: auto; }
.a-modal-footer { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* ─── Toast ──────────────────────────────────────── */
.a-toast { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); background: rgba(20,30,50,0.88); color: var(--white); padding: 10px 24px; border-radius: 20px; font-size: 14px; z-index: 9999; white-space: nowrap; backdrop-filter: blur(8px); animation: fadeInDown 0.25s ease; }
.a-toast-success { background: rgba(40,167,69,0.92); }
.a-toast-error   { background: rgba(220,53,69,0.92); }
.a-toast-info    { background: rgba(23,162,184,0.92); }
@keyframes fadeInDown { from { opacity: 0; transform: translateX(-50%) translateY(-10px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }

/* ─── 图表占位 ───────────────────────────────────── */
.chart-wrap { height: 280px; display: flex; align-items: flex-end; gap: 6px; padding: 10px 0 0; }
.chart-bar-group { display: flex; flex-direction: column; align-items: center; flex: 1; gap: 4px; }
.chart-bar { width: 100%; background: linear-gradient(180deg, var(--primary), var(--primary-dark)); border-radius: 4px 4px 0 0; min-height: 2px; transition: height 0.5s ease; }
.chart-label { font-size: 11px; color: var(--text-sub); text-align: center; white-space: nowrap; }

/* ─── 其他工具 ───────────────────────────────────── */
.empty-tip { text-align: center; padding: 40px 20px; color: var(--text-sub); font-size: 14px; }
.flex { display: flex; }
.flex-1 { flex: 1; }
.gap-10 { gap: 10px; }
.mb-16 { margin-bottom: 16px; }
.mt-16 { margin-top: 16px; }
.text-sub { color: var(--text-sub); }
.text-sm { font-size: 12px; }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; }
.dot-success { background: var(--success); }
.dot-danger  { background: var(--danger); }
.dot-warning { background: var(--warning); }

/* ─── 数据库管理 ─────────────────────────────────── */
.sql-editor { width: 100%; min-height: 120px; font-family: 'Courier New', monospace; font-size: 14px; padding: 12px; border: 1.5px solid var(--border); border-radius: 8px; resize: vertical; }
.sql-result { max-height: 400px; overflow: auto; border: 1px solid var(--border); border-radius: 8px; margin-top: 12px; }
.table-count { background: var(--primary-light); color: var(--primary); padding: 2px 8px; border-radius: 4px; font-size: 12px; margin-left: 6px; }

/* ─── 响应式 ─────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.mobile-open { transform: translateX(0); }
  .main-wrap { margin-left: 0; }
  .main-wrap.sidebar-collapsed { margin-left: 0; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .login-card { width: 90%; max-width: 400px; }
}
