/* ============================================================
   全局基调 (Apple-style System Minimalism)
   ============================================================ */
html, body {
  background-color: #FBF9F6;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: #1C1C1E;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: rgba(0,0,0,0);
  touch-action: manipulation;
  height: 100vh;
  overflow: hidden;
}

* {
  -webkit-tap-highlight-color: rgba(0,0,0,0);
}

/* ============================================================
   全局容器 (Containers)
   ============================================================ */
#view-login {
  max-width: 480px;
  width: 100%;
  margin: 40px auto;
  background: #FFFFFF;
  border-radius: 16px;
  padding: 32px 24px;
  box-sizing: border-box;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05); /* 极轻阴影 */
}

/* 大厨视图全屏独立布局 */
.chef-view {
  width: 100%;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: #FBF9F6;
  overflow: hidden;
}

.chef-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  height: 44px;
  box-sizing: border-box;
  background: #FFFFFF;
  flex-shrink: 0;
  border-bottom: 1px solid #E5E5EA;
}

.chef-container {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px;
  padding-bottom: 60px;
}

/* ============================================================
   排版 (Typography)
   ============================================================ */
h2, h3 {
  color: #000;
  margin-top: 0;
}
h2 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 24px;
  text-align: center;
}
hr {
  border: 0;
  height: 1px;
  background: #E5E5EA;
  margin: 24px 0;
}

/* ============================================================
   交互组件 (Inputs & Selects)
   ============================================================ */
input[type="text"], select {
  width: 100%;
  padding: 14px 16px;
  margin-bottom: 16px;
  border: 1px solid #E5E5EA;
  border-radius: 12px;
  background: #F2F2F7;
  font-size: 16px;
  color: #1C1C1E;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.2s, background-color 0.2s;
}
input[type="text"]:focus, select:focus {
  background: #FFFFFF;
  border-color: #FF4757;
}

/* ============================================================
   按钮通用 (Buttons)
   ============================================================ */
button {
  border: none;
  border-radius: 12px;
  padding: 12px 24px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  background: #F2F2F7;
  color: #1C1C1E;
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), background-color 0.2s ease;
  margin: 4px;
}
button:active {
  transform: scale(0.94);
  background: #E5E5EA;
}

#btn-login, #btn-add-dish {
  background: #FF4757;
  color: white;
  width: 100%;
  padding: 16px;
  margin-top: 12px;
  border-radius: 16px;
  font-size: 17px;
  margin-left: 0;
  margin-right: 0;
}
#btn-login:active, #btn-add-dish:active {
  background: #D63031;
}

/* ============================================================
   食客视图：海底捞双列主布局 (Diner Layout)
   ============================================================ */
#view-diner {
  width: 100%;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: #FBF9F6;
  overflow: hidden; /* 防止最外层滚动，交由内部模块滚动 */
}

/* 右侧顶部横栏 */
.top-profile-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  height: 50px;
  box-sizing: border-box;
  background: #FFFFFF;
  flex-shrink: 0;
  border-bottom: 1px solid #E5E5EA;
}

/* 左右分栏核心容器 */
.layout-haidilao {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* 左侧栏 (Sidebar) */
.sidebar-nav {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 115px;
  background: #F3EFE9;
  overflow-y: auto;
  flex-shrink: 0;
  z-index: 10;
}
.sidebar-nav button {
  width: 100%;
  margin: 0;
  padding: 20px 6px;
  border-radius: 0;
  background: transparent;
  color: #666;
  font-size: 14px;
  font-weight: normal;
  text-align: center;
  border-left: 3px solid transparent; /* 预留激活边框位置 */
  border-bottom: 1px solid #E5E5EA;
  transition: all 0.2s ease-in-out;
  white-space: nowrap;
}
.sidebar-nav button.active-tag {
  background: #FFFFFF;
  color: #000000;
  font-weight: 600;
  border-left: 3px solid #FF4757;
}

/* 右侧主展区 (Main Content) */
.main-content {
  position: fixed;
  top: 0;
  left: 115px;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  background-color: #FBF9F6 !important;
  overflow: hidden;
}

/* 顶部做法二级标签栏 */
.sub-tag-bar {
  padding: 12px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid #E5E5EA;
  white-space: nowrap;
  overflow-x: auto;
  flex-shrink: 0;
  z-index: 10;
}
/* 隐藏原生滚动条 */
.sub-tag-bar::-webkit-scrollbar {
  display: none;
}
.sub-tag-bar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.sub-tag-bar button {
  display: inline-block;
  margin: 0 4px 0 0;
  padding: 6px 14px;
  border-radius: 16px; /* 高度压缩的胶囊 */
  background: #F2F2F7;
  color: #8E8E93;
  font-size: 13px;
  font-weight: 500;
}
.sub-tag-bar button.active-tag {
  background: #FF4757;
  color: #FFFFFF;
}

/* 菜谱长列表 */
.dish-list-container {
  flex: 1;
  overflow-y: scroll;
  -webkit-overflow-scrolling: touch;
  padding: 12px 16px 120px 16px;
  background-color: #FBF9F6 !important;
}

/* 菜谱卡片 */
.dish-card {
  background: #FFFFFF;
  border-radius: 12px;
  border: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  padding: 16px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: transform 0.15s ease, background-color 0.2s ease;
  font-weight: 500;
}

.dish-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-drink {
  border-color: rgba(255, 71, 87, 0.1);
}
.card-grain {
  border-color: rgba(255, 200, 0, 0.1);
}
.card-dessert {
  border-color: rgba(255, 105, 180, 0.12);
}

/* 右置加号按钮 (数量为 0 时) */
.add-dish-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #E5E7EB;
  color: #6B7280;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  padding: 0;
  margin: 0;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  flex-shrink: 0;
}
.add-dish-btn:active {
  transform: scale(0.94);
}

/* 计数器组合组件 (数量 > 0 时) */
.counter-wrapper {
  display: flex;
  align-items: center;
  background: #F2F2F7;
  border-radius: 14px;
  height: 28px;
  overflow: hidden;
  flex-shrink: 0;
}

.counter-btn {
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: #1C1C1E;
  font-size: 16px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  margin: 0;
  transition: background-color 0.2s ease, transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.counter-btn:active {
  background: #E5E5EA;
  transform: scale(0.94);
}

.counter-value {
  min-width: 20px;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: #1C1C1E;
}

/* ============================================================
   大厨面板特定样式
   ============================================================ */
#add-dish-form {
  background: #F7F8FA;
  border-radius: 16px;
  padding: 20px;
  border: 1px solid #E5E5EA;
  margin-bottom: 24px;
}
.order-card {
  background: #F7F8FA;
  border-radius: 16px;
  border: 1px solid #E5E5EA;
  padding: 16px;
  margin-bottom: 16px;
  line-height: 1.6;
}
.order-card .btn-order-action {
  width: 100%;
  padding: 10px 0;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 0;
  margin-left: 0;
}

.order-card .btn-pending {
  background: linear-gradient(135deg, #FF6B4A 0%, #FF4757 100%) !important;
  color: #FFFFFF !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  border: none;
  box-shadow: 0 4px 12px rgba(255, 71, 87, 0.2);
}

.order-card .btn-processing {
  background: transparent;
  border: 1px solid #FF4757;
  color: #FF4757;
}

.history-order {
  opacity: 0.65;
}

/* ============================================================
   其他提示信息
   ============================================================ */
#login-error, #chef-message, #diner-message {
  text-align: center;
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 16px;
  font-size: 14px;
}
#login-error {
  color: #FF3B30;
  background: rgba(255, 59, 48, 0.1);
}
#chef-message, #diner-message {
  color: #FF4757;
  background: rgba(255, 71, 87, 0.1);
}

/* 大厨端小红点 */
#order-badge {
  color: #FF3B30;
}

/* ============================================================
   食客视图特定元素 (Submit Bar & Status)
   ============================================================ */
#submit-bar {
  position: fixed;
  bottom: 0;
  left: 115px;
  right: 0;
  z-index: 999;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom)) 16px;
}

.submit-bar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
}

.cart-toggle-btn {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  border-radius: 22px;
  background-color: #F3F1ED;
  color: #1C1C1E;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 0;
  margin: 0;
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.cart-toggle-btn:active {
  transform: scale(0.94);
}

.cart-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #FF3B30;
  color: white;
  font-size: 11px;
  font-weight: bold;
  height: 18px;
  min-width: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  box-shadow: 0 2px 4px rgba(255, 59, 48, 0.3);
}

.direct-submit-btn {
  flex: 1;
  height: 48px;
  border-radius: 24px;
  background: linear-gradient(135deg, #FF6B4A 0%, #FF4757 100%) !important;
  color: #FFFFFF !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  box-shadow: 0 4px 12px rgba(255, 71, 87, 0.2);
  font-size: 16px;
  padding: 0;
  margin: 0;
  letter-spacing: 2px;
  font-weight: 500;
  border: none;
  cursor: pointer;
}
.direct-submit-btn:active {
  background: linear-gradient(135deg, #FF4F2D, #E8293B) !important;
}

/* ============================================================
   购物车动态浮层 (Cart Overlay)
   ============================================================ */
#cart-overlay-wrapper {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  pointer-events: none;
  visibility: hidden;
}

#cart-overlay-wrapper.show {
  pointer-events: auto;
  visibility: visible;
}

#cart-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: opacity 0.25s ease;
}
#cart-overlay-wrapper.show #cart-backdrop {
  opacity: 1;
}

#cart-sheet {
  position: relative;
  background: #FFFFFF;
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom)) 16px;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}
#cart-overlay-wrapper.show #cart-sheet {
  transform: translateY(0);
}

.cart-sheet-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

#cart-items-list {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 16px;
}

.cart-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #F2F2F7;
}

.cart-item-name {
  font-size: 15px;
  font-weight: 500;
}

.cart-remove-btn {
  background: transparent;
  color: #FF3B30;
  font-size: 13px;
  padding: 4px 8px;
  margin: 0;
  box-shadow: none;
}

#btn-logout-diner {
  background: transparent;
  border: 1px solid #D1D1D6;
  color: #8E8E93;
  padding: 2px 8px;
  font-size: 12px;
  border-radius: 12px;
  margin: 0;
  font-weight: normal;
  box-shadow: none;
}

.badge-cooking {
  font-size: 11px;
  color: #8E8E93;
  background: #F2F2F7;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 8px;
  font-weight: normal;
}

/* ==============================
   多规格定制化弹窗 (Spec Modal)
=============================== */
#spec-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
  display: flex;
  align-items: flex-end; /* 底部滑出风格 */
  justify-content: center;
}

.modal-mask {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
}

.modal-content {
  position: relative;
  width: 100%;
  max-height: 80vh;
  background: #FFFFFF;
  border-radius: 24px 24px 0 0;
  padding: 24px;
  box-shadow: 0 -4px 24px rgba(0,0,0,0.1);
  display: flex;
  flex-direction: column;
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal-header {
  margin-bottom: 20px;
}

.modal-body {
  overflow-y: auto;
  margin-bottom: 24px;
}

.spec-group {
  margin-bottom: 20px;
}

.spec-group-title {
  font-size: 14px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 12px;
}

.spec-options-container {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.spec-option-btn {
  background: #F3F4F6;
  color: #374151;
  border: none;
  padding: 8px 16px;
  border-radius: 100px; /* 胶囊状 */
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
  cursor: pointer;
}

.spec-option-btn.active {
  background: #FF4757; /* 系统亮红高亮 */
  color: #FFFFFF;
}

/* 购物车内规格小字 */
.cart-item-specs {
  font-size: 11px;
  color: #8E8E93;
  margin-top: 4px;
  display: block;
}

/* 购物车内规格条目的闪烁高亮 */
@keyframes highlightFlash {
  0% { background-color: transparent; }
  30% { background-color: rgba(255, 71, 87, 0.15); }
  100% { background-color: transparent; }
}

.cart-item.highlight-flash {
  animation: highlightFlash 1.5s ease-out;
  border-radius: 8px; /* 增加一点圆角更好看 */
}

/* ==============================
   下拉刷新 (Pull to Refresh)
=============================== */
.pull-to-refresh-spinner {
  height: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #FFF;
  color: #8E8E93;
  font-size: 12px;
  transition: height 0.3s ease, transform 0.3s ease;
  transform: translateZ(0); /* Hardware acceleration */
}

.pull-to-refresh-spinner.refreshing {
  height: 50px !important;
}

.spinner-icon {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid #E5E7EB;
  border-top-color: #FF4757;
  margin-right: 8px;
}

.pull-to-refresh-spinner.refreshing .spinner-icon {
  animation: rotate 1s linear infinite;
}

@keyframes rotate {
  100% { transform: rotate(360deg); }
}

@keyframes badgeBounce {
  0% { transform: scale(1); }
  50% { transform: scale(1.3); }
  100% { transform: scale(1); }
}
.cart-badge.bump {
  animation: badgeBounce 0.15s ease-out;
}

/* ==============================
   轻量级提示框 (Toast)
=============================== */
.toast-tip {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.8);
  color: #FFFFFF;
  padding: 12px 24px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 500;
  z-index: 2000;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  white-space: nowrap;
}
.toast-tip.show {
  opacity: 1;
}

.empty-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 80px 20px;
  color: #8E8E93;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.5;
}

/* ==============================
   复杂多选表单样式扩展
=============================== */
.spec-category-title {
  font-size: 13px;
  color: #8E8E93;
  margin: 12px 0 8px 0;
  font-weight: normal;
}
.spec-textarea {
  width: 100%;
  height: 80px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid #E5E5EA;
  background: #F2F2F7;
  font-size: 14px;
  box-sizing: border-box;
  resize: none;
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s, background-color 0.2s;
}
.spec-textarea:focus {
  border-color: #FF4757;
  background: #FFFFFF;
}
