/* style.css - 全局样式 */

:root {
  --bg: #F9F7F4;
  --card-bg: #FFFFFF;
  --text-primary: #1C1A18;
  --text-secondary: #8C8986;
  --text-muted: #B5B2AE;
  --accent: #D4784C;
  --accent-light: rgba(212,120,76,0.08);
  --border: rgba(0,0,0,0.06);
  --input-bg: #F0EEEA;
  --tag-bg: #F3F0EC;
  --safe-bottom: env(safe-area-inset-bottom, 20px);
  --tab-height: 60px;
  --radius: 16px;
  --radius-sm: 10px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

body {
  padding-bottom: calc(var(--tab-height) + var(--safe-bottom));
}

/* ── Page Container ── */
.page {
  display: none;
  min-height: 100vh;
  padding: 16px;
  animation: fadeIn 0.2s ease;
}

.page.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Tab Bar ── */
.tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--tab-height);
  background: rgba(249,247,244,0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 200;
  padding-bottom: var(--safe-bottom);
}

.tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  cursor: pointer;
  padding: 6px 20px;
  transition: color 0.2s;
  color: var(--text-muted);
}

.tab-item.active {
  color: var(--accent);
}

.tab-icon {
  font-size: 22px;
}

.tab-text {
  font-size: 10px;
  font-weight: 500;
}

/* ── Card ── */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.03);
  border: 1px solid var(--border);
}

.card:active {
  background: #F5F2EE;
}

/* ── Button ── */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 44px;
  border: none;
  border-radius: 22px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}

.btn:active {
  opacity: 0.85;
}

.btn-primary {
  background: var(--accent);
  color: #FFFFFF;
}

.btn-secondary {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}

.btn-sm {
  height: 32px;
  font-size: 13px;
  border-radius: 16px;
  padding: 0 16px;
  width: auto;
}

/* ── Input ── */
.input, .textarea {
  width: 100%;
  padding: 12px 14px;
  background: var(--input-bg);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  color: var(--text-primary);
  outline: none;
  font-family: inherit;
}

.input:focus, .textarea:focus {
  box-shadow: 0 0 0 2px var(--accent);
}

.textarea {
  min-height: 100px;
  resize: vertical;
}

.input::placeholder, .textarea::placeholder {
  color: var(--text-muted);
}

/* ── Form ── */
.form-item {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.form-label .required {
  color: var(--accent);
}

/* ── Tag ── */
.tag {
  display: inline-block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--tag-bg);
  padding: 3px 10px;
  border-radius: 14px;
  margin: 2px 4px 2px 0;
}

.tag-accent {
  color: var(--accent);
  background: #FFF5F0;
  font-weight: 600;
}

/* ── Toast ── */
.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(28,26,24,0.85);
  color: #fff;
  font-size: 14px;
  padding: 10px 24px;
  border-radius: 8px;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  white-space: nowrap;
}

.toast.show {
  opacity: 1;
}

/* ── Loading ── */
.loading-mask {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(249,247,244,0.6);
  z-index: 9998;
  align-items: center;
  justify-content: center;
}

.loading-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Empty State ── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.15;
}

.empty-text {
  font-size: 15px;
  color: var(--text-muted);
}

/* ── Header ── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0 16px;
}

.page-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

.back-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 50%;
  background: var(--input-bg);
}

/* ── Modal / Popup ── */
.modal-mask {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(28,26,24,0.6);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 24px;
  width: 85%;
  max-width: 360px;
}

.modal-title {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 12px;
}

.modal-content {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 20px;
}

.modal-actions {
  display: flex;
  gap: 10px;
}

/* ── User Card ── */
.user-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 16px;
  background: var(--card-bg);
  border-radius: var(--radius);
  margin-bottom: 16px;
}

.user-card .avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  background: #E8E4DF;
}

.user-card .user-name {
  font-size: 18px;
  font-weight: 600;
}

.user-card .user-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ── Menu List ── */
.menu-list {
  background: var(--card-bg);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 16px;
}

.menu-item {
  display: flex;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

.menu-item:last-child {
  border-bottom: none;
}

.menu-item:active {
  background: #F5F2EE;
}

.menu-icon {
  font-size: 20px;
  margin-right: 14px;
  width: 28px;
  text-align: center;
}

.menu-text {
  flex: 1;
  font-size: 15px;
}

.menu-arrow {
  color: var(--text-muted);
  font-size: 18px;
}

/* ── City Picker ── */
.city-picker-container {
  display: flex;
  height: 60vh;
  background: var(--card-bg);
  border-radius: var(--radius) var(--radius) 0 0;
}

.province-list {
  width: 35%;
  background: var(--tag-bg);
  overflow-y: auto;
}

.city-list {
  width: 65%;
  overflow-y: auto;
}

.picker-item {
  padding: 14px 16px;
  font-size: 15px;
  color: var(--text-secondary);
  border-left: 3px solid transparent;
  cursor: pointer;
}

.picker-item.active {
  background: var(--card-bg);
  color: var(--text-primary);
  font-weight: 600;
  border-left-color: var(--accent);
}

/* ── Misc ── */
.text-center { text-align: center; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.flex { display: flex; }
.flex-1 { flex: 1; }
.gap-8 { gap: 8px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }

/* ── Location Tab ── */
.location-tab {
  padding: 8px 20px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  cursor: pointer;
}

.location-tab.active {
  background: var(--accent);
  color: #FFFFFF;
  font-weight: 600;
}

/* ── Search Clear ── */
.search-clear {
  font-size: 12px;
  color: var(--text-secondary);
  background: #E8E4DF;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}
