/* 如雅堂菜谱生成系统 - 基础样式 */
:root {
  --color-primary: #B8252B;       /* 朱红主色 */
  --color-primary-dark: #8B1A1A;
  --color-primary-light: #D85860;
  --color-gold: #C9A063;          /* 烫金 */
  --color-gold-dark: #8B6F3D;
  --color-cream: #F5EFE0;         /* 米色背景 */
  --color-cream-dark: #E8DCC0;
  --color-ink: #2C2620;           /* 墨色文字 */
  --color-ink-light: #5C524A;
  --color-mute: #998B7E;
  --color-line: #D8CFBE;
  --color-success: #4A7C4A;
  --color-danger: #C04040;
  --color-warning: #D4A256;

  --shadow-sm: 0 1px 2px rgba(0,0,0,.04), 0 1px 4px rgba(0,0,0,.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,.06), 0 2px 4px rgba(0,0,0,.04);
  --shadow-lg: 0 10px 30px rgba(0,0,0,.10), 0 4px 8px rgba(0,0,0,.04);

  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 16px;

  --font-cn: "STKaiti","KaiTi","楷体","Songti SC","STSong","SimSun",serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;

  --header-h: 56px;
  --tabbar-h: 60px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--color-ink);
  background: var(--color-cream);
  background-image:
    radial-gradient(circle at 20% 0%, rgba(184,37,43,.04), transparent 50%),
    radial-gradient(circle at 80% 100%, rgba(201,160,99,.06), transparent 50%);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  user-select: none;
  overflow-x: hidden;
}
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; padding: 0; }

a { color: var(--color-primary); text-decoration: none; }

/* 滚动条 */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: rgba(184,37,43,.2); border-radius: 3px; }
::-webkit-scrollbar-track { background: transparent; }

/* 通用布局 */
.app {
  max-width: 720px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: #fff;
  box-shadow: 0 0 30px rgba(0,0,0,.06);
  position: relative;
}

/* 顶栏 */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  color: #fff;
  display: flex;
  align-items: center;
  padding: 0 14px;
  box-shadow: var(--shadow-md);
}
.app-header .logo {
  width: 36px; height: 36px;
  border-radius: 6px;
  background: #fff;
  display: flex; align-items: center; justify-content: center;
  margin-right: 10px;
  flex-shrink: 0;
}
.app-header .logo img { width: 100%; height: 100%; border-radius: 6px; }
.app-header .title {
  font-family: var(--font-cn);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 2px;
  flex: 1;
  line-height: 1;
}
.app-header .title small {
  display: block;
  font-family: var(--font-sans);
  font-size: 10px;
  opacity: .85;
  margin-top: 2px;
  letter-spacing: 4px;
  font-weight: 400;
}
.app-header .actions { display: flex; gap: 6px; }
.app-header .actions button {
  width: 36px; height: 36px;
  border-radius: 8px;
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  transition: background .2s;
}
.app-header .actions button:hover { background: rgba(255,255,255,.15); }

/* 主区 */
.app-main {
  flex: 1;
  padding: 14px;
  padding-bottom: calc(var(--tabbar-h) + 20px);
  overflow-y: auto;
}

/* 底部Tab */
.app-tabbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  max-width: 720px;
  margin: 0 auto;
  height: var(--tabbar-h);
  background: #fff;
  border-top: 1px solid var(--color-line);
  display: flex;
  z-index: 100;
  box-shadow: 0 -2px 12px rgba(0,0,0,.04);
}
.app-tabbar a {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 2px;
  font-size: 11px;
  color: var(--color-mute);
  transition: color .2s;
}
.app-tabbar a.active { color: var(--color-primary); }
.app-tabbar a .ic { font-size: 22px; line-height: 1; }
.app-tabbar a .label { font-size: 10px; }

/* 卡片 */
.card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 14px;
  margin-bottom: 12px;
  border: 1px solid rgba(0,0,0,.03);
}
.card-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 15px; font-weight: 600;
  color: var(--color-ink);
  margin-bottom: 12px;
  font-family: var(--font-cn);
}
.card-title::before {
  content: "";
  display: block;
  width: 3px; height: 14px;
  background: var(--color-primary);
  border-radius: 2px;
}

/* 表单 */
.form-group { margin-bottom: 14px; }
.form-label {
  display: block;
  font-size: 12px;
  color: var(--color-ink-light);
  margin-bottom: 6px;
  font-weight: 500;
}
.form-input, .form-textarea, .form-select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-sm);
  background: #fff;
  font-size: 14px;
  color: var(--color-ink);
  transition: border-color .2s, box-shadow .2s;
  outline: none;
  -webkit-appearance: none;
}
.form-input:focus, .form-textarea:focus, .form-select:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(184,37,43,.08);
}
.form-textarea { resize: vertical; min-height: 60px; }
.form-row { display: flex; gap: 10px; }
.form-row .form-group { flex: 1; }

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  transition: all .2s;
  white-space: nowrap;
  border: 1px solid transparent;
}
.btn-primary {
  background: var(--color-primary);
  color: #fff;
}
.btn-primary:active { background: var(--color-primary-dark); }
.btn-secondary {
  background: #fff;
  color: var(--color-primary);
  border-color: var(--color-primary);
}
.btn-ghost {
  background: transparent;
  color: var(--color-ink-light);
}
.btn-danger {
  background: var(--color-danger);
  color: #fff;
}
.btn-gold {
  background: linear-gradient(135deg, var(--color-gold) 0%, var(--color-gold-dark) 100%);
  color: #fff;
}
.btn-block { display: flex; width: 100%; }
.btn-lg { padding: 14px 20px; font-size: 16px; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-icon {
  width: 36px; height: 36px;
  padding: 0;
  border-radius: 50%;
}

/* 标签 */
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 500;
  background: rgba(184,37,43,.08);
  color: var(--color-primary);
  margin-right: 4px;
}
.tag-gold { background: rgba(201,160,99,.15); color: var(--color-gold-dark); }
.tag-blue { background: rgba(91,123,156,.15); color: #3D5C7B; }
.tag-green { background: rgba(74,124,74,.15); color: var(--color-success); }
.tag-mute { background: rgba(0,0,0,.05); color: var(--color-mute); }

/* Toast */
.toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,.85);
  color: #fff;
  padding: 10px 18px;
  border-radius: 22px;
  font-size: 13px;
  z-index: 9999;
  animation: toastIn .2s ease;
  pointer-events: none;
  max-width: 80%;
  text-align: center;
}
.toast.success { background: var(--color-success); }
.toast.error   { background: var(--color-danger); }
.toast.warn    { background: var(--color-warning); color: #fff; }
@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, 10px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* Modal */
.modal-mask {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  animation: fadeIn .2s ease;
}
.modal {
  background: #fff;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  display: flex; flex-direction: column;
  overflow: hidden;
  animation: modalIn .25s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn { from { opacity: 0; transform: scale(.95) translateY(10px); } to { opacity: 1; transform: scale(1) translateY(0); } }
.modal-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--color-line);
  display: flex; align-items: center; justify-content: space-between;
  font-size: 15px; font-weight: 600;
}
.modal-close {
  width: 28px; height: 28px;
  border-radius: 50%;
  color: var(--color-mute);
  font-size: 18px;
  display: flex; align-items: center; justify-content: center;
}
.modal-body { padding: 18px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--color-line);
  display: flex; gap: 10px; justify-content: flex-end;
}

/* 预览弹窗（菜单画布） */
.modal-mask.preview-modal { padding: 10px; }
.modal-mask.preview-modal .modal {
  max-width: 540px;
  max-height: 92vh;
  background: #F5EFE0;
}
.modal-mask.preview-modal .modal-body {
  padding: 14px;
  background: #F5EFE0;
}
.preview-wrap { display: flex; justify-content: center; }
.preview-wrap .menu-canvas { width: 100%; max-width: 480px; box-shadow: 0 4px 18px rgba(0,0,0,.15); }

/* 空状态 */
.empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--color-mute);
}
.empty .ic { font-size: 48px; margin-bottom: 10px; opacity: .4; }
.empty .tip { font-size: 13px; }

/* 工具类 */
.flex { display: flex; }
.flex-1 { flex: 1; }
.flex-col { display: flex; flex-direction: column; }
.gap-4 { gap: 4px; } .gap-6 { gap: 6px; } .gap-8 { gap: 8px; } .gap-10 { gap: 10px; } .gap-12 { gap: 12px; }
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-mute   { color: var(--color-mute); }
.text-primary { color: var(--color-primary); }
.text-gold { color: var(--color-gold-dark); }
.text-sm { font-size: 12px; }
.text-lg { font-size: 16px; }
.text-xl { font-size: 18px; }
.font-cn { font-family: var(--font-cn); }
.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; }
.hidden { display: none !important; }

/* 加载 */
.spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .8s linear infinite;
  display: inline-block;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 分隔 */
.divider {
  height: 1px;
  background: var(--color-line);
  margin: 14px 0;
}

/* 列表项 */
.list-item {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--color-line);
}
.list-item:last-child { border-bottom: none; }
.list-item .ic {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: var(--color-cream);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  color: var(--color-primary);
  flex-shrink: 0;
}
.list-item .body { flex: 1; min-width: 0; }
.list-item .body .name { font-size: 14px; font-weight: 500; }
.list-item .body .meta { font-size: 11px; color: var(--color-mute); margin-top: 2px; }
.list-item .actions { display: flex; gap: 6px; }
.list-item .actions button {
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 6px;
  background: var(--color-cream);
  color: var(--color-ink-light);
}
.list-item .actions button.del { color: var(--color-danger); background: rgba(192,64,64,.08); }

/* Tabs */
.tabs {
  display: flex;
  gap: 4px;
  background: var(--color-cream);
  padding: 4px;
  border-radius: var(--radius);
  margin-bottom: 12px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 1;
  min-width: max-content;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  text-align: center;
  color: var(--color-ink-light);
  transition: all .2s;
  white-space: nowrap;
}
.tab.active {
  background: #fff;
  color: var(--color-primary);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

/* 搜索框 */
.search {
  position: relative;
  margin-bottom: 12px;
}
.search input {
  width: 100%;
  padding: 10px 12px 10px 36px;
  border: 1px solid var(--color-line);
  border-radius: 22px;
  background: var(--color-cream);
  font-size: 14px;
  outline: none;
  transition: all .2s;
}
.search input:focus { background: #fff; border-color: var(--color-primary); }
.search::before {
  content: "🔍";
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  opacity: .6;
}

/* 房间/人数选择 */
.choice-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.choice {
  padding: 10px 4px;
  border: 1px solid var(--color-line);
  border-radius: 8px;
  background: #fff;
  font-size: 13px;
  text-align: center;
  color: var(--color-ink-light);
  transition: all .15s;
}
.choice.active {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
  font-weight: 600;
}
.choice.small { padding: 6px 4px; font-size: 12px; }

/* 菜品选择面板 */
.dish-panel { background: #fff; border-radius: var(--radius); padding: 10px; }
.dish-row { display: flex; flex-wrap: wrap; gap: 6px; }
.dish-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 6px 10px;
  background: var(--color-cream);
  border: 1px solid transparent;
  border-radius: 16px;
  font-size: 12px;
  color: var(--color-ink);
  transition: all .15s;
  max-width: 100%;
}
.dish-chip .x { opacity: .4; font-size: 14px; line-height: 1; }
.dish-chip .x:hover { opacity: 1; }

/* 已选菜品 */
.selected-list { display: flex; flex-direction: column; gap: 6px; }
.selected-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  background: var(--color-cream);
  border-radius: 8px;
}
.selected-item .name { flex: 1; font-size: 13px; }
.selected-item .cat { font-size: 10px; padding: 2px 6px; background: #fff; border-radius: 4px; color: var(--color-mute); }
.selected-item .move { display: flex; gap: 2px; }
.selected-item .move button {
  width: 22px; height: 22px;
  background: #fff;
  border-radius: 4px;
  color: var(--color-ink-light);
  font-size: 12px;
}

/* 主题选择 */
.theme-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.theme-card {
  border: 2px solid var(--color-line);
  border-radius: 10px;
  padding: 8px;
  background: #fff;
  text-align: center;
  transition: all .2s;
  position: relative;
  overflow: hidden;
}
.theme-card.active {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(184,37,43,.1);
}
.theme-card .preview {
  height: 90px;
  border-radius: 6px;
  margin-bottom: 6px;
  background-size: cover;
  background-position: center;
  position: relative;
  overflow: hidden;
}
.theme-card .name { font-size: 12px; font-weight: 500; }
