/* 推薪客H5移动端框架 v2.0 - 统一移动端 */
:root {
  --primary: #4F46E5;
  --primary-light: #818cf8;
  --primary-dark: #3730a3;
  --primary-50: #eef2ff;
  --primary-100: #e0e7ff;
  --success: #10b981;
  --success-50: #d1fae5;
  --warning: #f59e0b;
  --warning-50: #fef3c7;
  --danger: #ef4444;
  --danger-50: #fee2e2;
  --info: #3b82f6;
  --info-50: #dbeafe;
  --bg: #f5f5f7;
  --bg-card: #ffffff;
  --text: #1f2937;
  --text-secondary: #6b7280;
  --border: #e5e7eb;
  --border-light: #f3f4f6;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  --header-h: 46px;
  --tab-h: 50px;
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.04);
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.12);
  --transition: 0.2s ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Helvetica Neue', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding-top: var(--header-h);
  padding-bottom: calc(var(--tab-h) + var(--safe-bottom));
  min-height: 100vh;
}
body.no-tabbar { padding-bottom: 0; }

/* ========== Header ========== */
.h5-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--header-h);
  padding-top: var(--safe-top);
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  padding: 0 8px;
}
.h5-header .back {
  width: 40px; height: 40px; display: flex; align-items: center; justify-content: center;
  font-size: 22px; cursor: pointer; border: none; background: none; color: #fff; flex-shrink: 0;
  border-radius: 8px; transition: background var(--transition);
}
.h5-header .back:active { background: rgba(255,255,255,0.15); }
.h5-header .title {
  flex: 1; text-align: center; font-size: 16px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin: 0 4px;
}
.h5-header .right { flex-shrink: 0; display: flex; gap: 2px; }
.h5-header .right button {
  width: 40px; height: 40px; display: flex; align-items: center; justify-content: center;
  border: none; background: none; color: #fff; font-size: 18px; cursor: pointer;
  border-radius: 8px; transition: background var(--transition);
}
.h5-header .right button:active { background: rgba(255,255,255,0.15); }

/* Header variants */
.h5-header.transparent { background: transparent; color: var(--text); }
.h5-header.transparent .back { color: var(--text); }
.h5-header.transparent .right button { color: var(--text); }
.h5-header.white { background: #fff; color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.h5-header.white .back { color: var(--text); }
.h5-header.white .right button { color: var(--text); }

/* ========== Tab Bar ========== */
.h5-tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
  height: calc(var(--tab-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: #fff;
  display: flex;
  border-top: 1px solid var(--border);
  box-shadow: 0 -1px 6px rgba(0,0,0,0.04);
}
.h5-tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 10px; color: var(--text-secondary); text-decoration: none; gap: 1px; padding: 4px 0;
  transition: color var(--transition); position: relative;
}
.h5-tabbar a .icon { font-size: 22px; line-height: 1.2; }
.h5-tabbar a.active { color: var(--primary); font-weight: 500; }
.h5-tabbar a .badge {
  position: absolute; top: 2px; right: 50%; margin-right: -18px;
  background: var(--danger); color: #fff;
  font-size: 10px; padding: 0 5px; border-radius: 8px; min-width: 16px; height: 16px;
  text-align: center; line-height: 16px; font-weight: 600;
}

/* ========== Content Area ========== */
.h5-content { padding: 8px 12px; }
.h5-content.compact { padding: 6px 10px; }

/* ========== Card ========== */
.h5-card {
  background: var(--bg-card); border-radius: var(--radius);
  padding: 14px; margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
}
.h5-card-title {
  font-size: 15px; font-weight: 600; margin-bottom: 10px;
  display: flex; justify-content: space-between; align-items: center;
}
.h5-card-more { font-size: 12px; color: var(--primary); text-decoration: none; }

/* List item */
.h5-list-item {
  display: flex; align-items: center; padding: 12px 0;
  border-bottom: 1px solid var(--border); cursor: pointer; transition: background var(--transition);
}
.h5-list-item:last-child { border-bottom: none; }
.h5-list-item:active { background: var(--border-light); margin: 0 -14px; padding: 12px 14px; }
.h5-list-item .label { flex: 1; font-size: 14px; }
.h5-list-item .value { font-size: 13px; color: var(--text-secondary); }
.h5-list-item .arrow { color: #ccc; margin-left: 4px; font-size: 14px; }
.h5-list-item .icon-left { width: 32px; height: 32px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; margin-right: 12px; flex-shrink: 0; }

/* ========== Grid ========== */
.h5-grid { display: grid; gap: 8px; padding: 2px 0; }
.h5-grid-4 { grid-template-columns: repeat(4, 1fr); }
.h5-grid-3 { grid-template-columns: repeat(3, 1fr); }
.h5-grid-2 { grid-template-columns: repeat(2, 1fr); }
.h5-grid-5 { grid-template-columns: repeat(5, 1fr); }

.h5-grid-item {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 12px 4px; cursor: pointer; border-radius: var(--radius-sm);
  transition: background var(--transition);
}
.h5-grid-item:active { background: var(--border-light); }
.h5-grid-item .icon {
  width: 44px; height: 44px; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center; font-size: 22px;
}
.h5-grid-item .label { font-size: 11px; color: var(--text-secondary); text-align: center; }

/* ========== Buttons ========== */
.h5-btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 42px; padding: 0 20px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 500; border: none; cursor: pointer;
  transition: all var(--transition); gap: 6px;
  width: 100%; text-decoration: none;
}
.h5-btn:active { transform: scale(0.97); opacity: 0.9; }
.h5-btn-primary { background: var(--primary); color: #fff; }
.h5-btn-success { background: var(--success); color: #fff; }
.h5-btn-warning { background: var(--warning); color: #fff; }
.h5-btn-danger { background: var(--danger); color: #fff; }
.h5-btn-outline {
  background: transparent; border: 1.5px solid var(--primary); color: var(--primary);
}
.h5-btn-ghost { background: var(--border-light); color: var(--text); }
.h5-btn-sm { height: 34px; padding: 0 14px; font-size: 13px; width: auto; }
.h5-btn-lg { height: 48px; font-size: 16px; }
.h5-btn-block { width: 100%; }
.h5-btn-inline { width: auto; display: inline-flex; }

/* ========== Form ========== */
.h5-field { margin-bottom: 14px; }
.h5-field label {
  display: block; font-size: 13px; color: var(--text-secondary);
  margin-bottom: 5px; font-weight: 500;
}
.h5-field input, .h5-field select, .h5-field textarea {
  width: 100%; height: 44px; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); padding: 0 12px; font-size: 14px;
  color: var(--text); background: var(--bg-card);
  outline: none; transition: border-color var(--transition);
  -webkit-appearance: none; appearance: none;
}
.h5-field input:focus, .h5-field select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-50); }
.h5-field textarea { height: 88px; padding: 10px 12px; resize: vertical; }
.h5-field .h5-input-append { position: relative; }
.h5-field .h5-input-append input { padding-right: 80px; }
.h5-field .h5-input-append .append {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  font-size: 12px; color: var(--primary); cursor: pointer; padding: 4px 8px;
}
.h5-field-error { border-color: var(--danger) !important; }
.h5-field-error-text { font-size: 12px; color: var(--danger); margin-top: 4px; }

/* ========== Tag/Badge ========== */
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; font-size: 11px; border-radius: 12px;
  background: var(--border-light); color: var(--text-secondary);
}
.tag-primary { background: var(--primary-50); color: var(--primary); }
.tag-success { background: var(--success-50); color: var(--success); }
.tag-warning { background: var(--warning-50); color: #92400e; }
.tag-danger { background: var(--danger-50); color: var(--danger); }

/* ========== Filter Bar ========== */
.h5-filter {
  display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 10px;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.h5-filter::-webkit-scrollbar { display: none; }
.h5-filter .tag {
  padding: 6px 14px; border-radius: 16px; font-size: 12px; white-space: nowrap;
  border: 1px solid var(--border); background: var(--bg-card); cursor: pointer;
  flex-shrink: 0; transition: all var(--transition);
}
.h5-filter .tag:active { transform: scale(0.95); }
.h5-filter .tag.active {
  border-color: var(--primary); color: var(--primary);
  background: var(--primary-50); font-weight: 500;
}

/* ========== Input Group ========== */
.h5-input-group {
  display: flex; gap: 8px; align-items: center;
  background: var(--bg-card); border: 1.5px solid var(--border);
  border-radius: var(--radius); padding: 0 12px; height: 42px;
}
.h5-input-group input {
  flex: 1; border: none; outline: none; font-size: 14px;
  background: transparent; height: 100%;
}
.h5-input-group .icon { color: var(--text-secondary); font-size: 16px; }

/* ========== Status ========== */
.status-pending { color: var(--warning); }
.status-active { color: var(--success); }
.status-inactive { color: var(--text-secondary); }
.status-rejected { color: var(--danger); }
.status-interviewing { color: var(--info); }

/* ========== Loading / Empty / Error ========== */
.h5-state { text-align: center; padding: 60px 20px; color: var(--text-secondary); }
.h5-state .icon { font-size: 48px; margin-bottom: 12px; opacity: 0.5; }
.h5-state .text { font-size: 14px; }
.h5-state .sub { font-size: 12px; margin-top: 4px; opacity: 0.7; }
.h5-state .action { margin-top: 16px; }

.h5-skeleton {
  background: linear-gradient(90deg, var(--border) 25%, #f0f0f0 50%, var(--border) 75%);
  background-size: 200% 100%; animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm); height: 16px; margin-bottom: 8px;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ========== Load More ========== */
.h5-loadmore { text-align: center; padding: 16px; color: var(--text-secondary); font-size: 13px; cursor: pointer; }

/* ========== Banner / Hero ========== */
.h5-banner {
  position: relative; overflow: hidden; border-radius: var(--radius);
  margin: 8px 0; cursor: pointer;
}
.h5-banner .bg {
  padding: 24px 20px; border-radius: var(--radius);
}
.h5-banner .title { font-size: 18px; font-weight: 700; }
.h5-banner .sub { font-size: 12px; margin-top: 4px; opacity: 0.9; }

/* ========== Divider ========== */
.h5-divider {
  display: flex; align-items: center; gap: 10px; margin: 16px 0;
  color: var(--text-secondary); font-size: 12px;
}
.h5-divider::before, .h5-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

/* ========== Toast ========== */
.h5-toast {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.78); color: #fff; padding: 14px 24px;
  border-radius: var(--radius); font-size: 14px; z-index: 9999;
  text-align: center; max-width: 80vw; animation: toastIn 0.25s ease;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, -50%) scale(0.9); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }

/* ========== Modal / Bottom Sheet ========== */
.h5-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 500;
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.h5-sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 501;
  background: #fff; border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 20px; padding-bottom: calc(20px + var(--safe-bottom));
  animation: sheetUp 0.3s ease;
  max-height: 70vh; overflow-y: auto;
}
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.h5-sheet .handle {
  width: 36px; height: 4px; background: var(--border);
  border-radius: 2px; margin: -8px auto 12px;
}

/* ========== Avatar ========== */
.h5-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; background: var(--border-light); color: var(--text-secondary);
  flex-shrink: 0; overflow: hidden;
}
.h5-avatar img { width: 100%; height: 100%; object-fit: cover; }
.h5-avatar-sm { width: 32px; height: 32px; font-size: 14px; }
.h5-avatar-lg { width: 56px; height: 56px; font-size: 24px; }
.h5-avatar-xl { width: 72px; height: 72px; font-size: 32px; }

/* ========== Pull Refresh ========== */
.h5-pull-indicator {
  text-align: center; padding: 16px; color: var(--text-secondary);
  font-size: 13px; transition: opacity 0.2s;
}

/* ========== Badge Dot ========== */
.h5-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--danger); vertical-align: middle;
}

/* ========== Steps ========== */
.h5-steps { display: flex; gap: 0; padding: 12px 0; }
.h5-steps .step { flex: 1; text-align: center; font-size: 12px; color: var(--text-secondary); position: relative; }
.h5-steps .step::after { content: ''; position: absolute; top: 12px; left: 50%; width: 100%; height: 2px; background: var(--border); }
.h5-steps .step:last-child::after { display: none; }
.h5-steps .step.active { color: var(--primary); font-weight: 500; }
.h5-steps .step.active::after { background: var(--primary); }
.h5-steps .step .num {
  width: 24px; height: 24px; border-radius: 50%; display: inline-flex;
  align-items: center; justify-content: center; font-size: 12px;
  background: var(--border); color: var(--text-secondary); margin-bottom: 4px;
}
.h5-steps .step.active .num { background: var(--primary); color: #fff; }
.h5-steps .step.done .num { background: var(--success); color: #fff; }
.h5-steps .step.done::after { background: var(--success); }

/* ========== Tabs ========== */
.h5-tabs { display: flex; border-bottom: 1px solid var(--border); }
.h5-tabs .tab {
  flex: 1; text-align: center; padding: 10px 0; font-size: 14px;
  color: var(--text-secondary); cursor: pointer; border-bottom: 2px solid transparent;
  transition: all var(--transition);
}
.h5-tabs .tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 500; }

/* ========== Swipe ========== */
.h5-swipe { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.h5-swipe::-webkit-scrollbar { display: none; }
.h5-swipe-inner { display: flex; gap: 10px; }

/* ========== Utilities ========== */
.h5-flex { display: flex; }
.h5-flex-col { flex-direction: column; }
.h5-flex-wrap { flex-wrap: wrap; }
.h5-flex-1 { flex: 1; }
.h5-flex-center { align-items: center; justify-content: center; }
.h5-flex-between { display: flex; justify-content: space-between; align-items: center; }
.h5-gap-4 { gap: 4px; }
.h5-gap-6 { gap: 6px; }
.h5-gap-8 { gap: 8px; }
.h5-gap-10 { gap: 10px; }
.h5-gap-12 { gap: 12px; }
.h5-gap-16 { gap: 16px; }
.h5-text-center { text-align: center; }
.h5-text-secondary { color: var(--text-secondary); font-size: 12px; }
.h5-text-sm { font-size: 12px; line-height: 1.4; }
.h5-text-xs { font-size: 11px; line-height: 1.3; }
.h5-text-lg { font-size: 16px; }
.h5-text-xl { font-size: 18px; font-weight: 600; }
.h5-text-muted { color: #9ca3af; }
.h5-mt-4 { margin-top: 4px; }
.h5-mt-8 { margin-top: 8px; }
.h5-mt-12 { margin-top: 12px; }
.h5-mt-16 { margin-top: 16px; }
.h5-mb-8 { margin-bottom: 8px; }
.h5-mb-16 { margin-bottom: 16px; }
.h5-p-16 { padding: 16px; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.h5-w-full { width: 100%; }
.h5-rounded { border-radius: var(--radius); }
.h5-rounded-full { border-radius: 999px; }
.h5-shadow { box-shadow: var(--shadow); }
.h5-relative { position: relative; }
.h5-overflow-hidden { overflow: hidden; }

/* ========== Safe Area ========== */
.h5-safe-top { padding-top: var(--safe-top); }
.h5-safe-bottom { padding-bottom: var(--safe-bottom); }

/* ========== Dark mode support ========== */
@media (prefers-color-scheme: dark) {
  :root { --bg: #1a1a2e; --bg-card: #16213e; --text: #e5e7eb; --text-secondary: #9ca3af; --border: #374151; --border-light: #1f2937; }
  .h5-tabbar { background: var(--bg-card); }
  .h5-header.white { background: var(--bg-card); }
}

/* ========== Responsive ========== */
@media (max-width: 360px) {
  .h5-grid-4 { grid-template-columns: repeat(3, 1fr); }
  .h5-card { padding: 12px; }
  .h5-content { padding: 6px 10px; }
}
@media (min-width: 600px) {
  body { max-width: 480px; margin: 0 auto; }
  .h5-header, .h5-tabbar { max-width: 480px; left: 50%; transform: translateX(-50%); }
}
