/* styles.css - 幸福家厨 UI 设计系统与小程序视觉效果 */

:root {
  --primary: #FF6B35;
  --primary-light: #FFEBE5;
  --primary-dark: #D84A1B;
  --secondary: #F7B801;
  --accent: #4ECDC4;
  --bg-warm: #FFFBF5;
  --card-bg: #FFFFFF;
  --text-main: #2C1E21;
  --text-muted: #8C7C83;
  --border-color: #F0E6DF;
  --shadow-sm: 0 4px 12px rgba(255, 107, 53, 0.08);
  --shadow-lg: 0 12px 32px rgba(44, 30, 33, 0.15);
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 8px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  background: #1E1E24;
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px 0;
}

/* 微信小程序真机仿真外框 (Desktop Preview Shell) */
.phone-container {
  width: 100%;
  max-width: 430px;
  height: 880px;
  background: var(--bg-warm);
  border-radius: 44px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.4), inset 0 0 0 12px #2D2D35;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* 小程序顶部状态栏 & 微信三点胶囊按钮 */
.mini-header {
  height: 88px;
  padding-top: 38px;
  padding-left: 20px;
  padding-right: 20px;
  background: linear-gradient(180deg, #FFFFFF 0%, rgba(255, 251, 245, 0.95) 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(240, 230, 223, 0.6);
  z-index: 10;
  backdrop-filter: blur(10px);
}

.mini-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
}

.mini-title .home-icon {
  font-size: 22px;
}

/* 微信胶囊按钮仿真 */
.wx-capsule {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.1);
  padding: 5px 12px;
  border-radius: 20px;
}

.wx-dots {
  display: flex;
  gap: 3px;
}

.wx-dot {
  width: 4px;
  height: 4px;
  background: #333;
  border-radius: 50%;
}

.wx-circle-icon {
  width: 14px;
  height: 14px;
  border: 2px solid #333;
  border-radius: 50%;
  margin-left: 4px;
}

/* 应用大主体 */
.app-body {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 100px;
  scroll-behavior: smooth;
}

.app-body::-webkit-scrollbar {
  display: none;
}

/* 家庭成员 Banner */
.family-banner {
  background: linear-gradient(135deg, #FF6B35 0%, #FF9F1C 100%);
  color: #FFF;
  padding: 16px 20px 20px 20px;
  border-bottom-left-radius: 24px;
  border-bottom-right-radius: 24px;
  box-shadow: var(--shadow-sm);
}

.family-header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.current-user-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 42px;
  height: 42px;
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(4px);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  border: 2px solid rgba(255, 255, 255, 0.5);
}

.user-name-role {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 16px;
  font-weight: 700;
}

.user-role-badge {
  font-size: 11px;
  background: rgba(0, 0, 0, 0.15);
  padding: 2px 8px;
  border-radius: 10px;
  display: inline-block;
  margin-top: 2px;
}

/* 掌勺/吃货视角切换按钮 */
.chef-mode-btn {
  background: rgba(255, 255, 255, 0.95);
  color: var(--primary-dark);
  border: none;
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s;
}

.chef-mode-btn:active {
  transform: scale(0.95);
}

/* 家庭成员快选 Pills */
.family-member-list {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-top: 4px;
}

.family-member-list::-webkit-scrollbar { display: none; }

.member-chip {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 13px;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 4px;
}

.member-chip.active {
  background: #FFFFFF;
  color: var(--primary-dark);
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

/* "今天吃什么？" 大转盘入口 Card */
.lucky-wheel-card {
  margin: 16px 20px;
  background: linear-gradient(135deg, #2C1E21 0%, #4A3338 100%);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(44, 30, 33, 0.25);
  position: relative;
  overflow: hidden;
  transition: transform 0.2s;
}

.lucky-wheel-card:active {
  transform: scale(0.98);
}

.wheel-card-text h3 {
  font-size: 17px;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--secondary);
}

.wheel-card-text p {
  font-size: 12px;
  color: #D3C5C7;
  margin-top: 4px;
}

.wheel-spin-badge {
  background: linear-gradient(135deg, #FF6B35 0%, #F7B801 100%);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  color: #FFF;
  box-shadow: 0 4px 12px rgba(255, 107, 53, 0.4);
}

/* 菜品搜索栏 */
.search-box {
  margin: 0 20px 16px 20px;
  background: #FFFFFF;
  border-radius: 20px;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.search-box input {
  border: none;
  outline: none;
  width: 100%;
  font-size: 14px;
  background: transparent;
  color: var(--text-main);
}

/* 分类 Tab 横向滚动 */
.category-bar {
  display: flex;
  gap: 8px;
  padding: 0 20px 12px 20px;
  overflow-x: auto;
}

.category-bar::-webkit-scrollbar { display: none; }

.cat-btn {
  background: #FFFFFF;
  border: 1px solid var(--border-color);
  padding: 8px 14px;
  border-radius: 18px;
  font-size: 13px;
  white-space: nowrap;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.cat-btn.active {
  background: var(--primary);
  color: #FFFFFF;
  border-color: var(--primary);
  font-weight: 700;
  box-shadow: 0 4px 10px rgba(255, 107, 53, 0.25);
}

/* 菜品列表 */
.dishes-grid {
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.dish-card {
  background: #FFFFFF;
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  gap: 14px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  position: relative;
  transition: transform 0.2s;
}

.dish-card:hover {
  transform: translateY(-2px);
}

.dish-img {
  width: 100px;
  height: 100px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
}

.dish-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.dish-title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.dish-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
}

.dish-tag-badge {
  font-size: 10px;
  background: var(--primary-light);
  color: var(--primary-dark);
  padding: 2px 6px;
  border-radius: 6px;
  font-weight: 600;
}

.dish-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
  margin: 4px 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.dish-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
}

.dish-stats {
  font-size: 11px;
  color: #999;
  display: flex;
  gap: 8px;
}

.add-dish-btn {
  background: var(--primary);
  color: #FFFFFF;
  border: none;
  padding: 6px 14px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s, background 0.15s;
  display: flex;
  align-items: center;
  gap: 4px;
}

.add-dish-btn:active {
  transform: scale(0.92);
}

/* 底部悬浮购物车 Bar */
.cart-floating-bar {
  position: absolute;
  bottom: 24px;
  left: 20px;
  right: 20px;
  height: 60px;
  background: #2C1E21;
  border-radius: 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px 0 20px;
  color: #FFFFFF;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  z-index: 50;
  cursor: pointer;
}

.cart-left-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cart-icon-wrapper {
  position: relative;
  font-size: 26px;
}

.cart-badge {
  position: absolute;
  top: -6px;
  right: -8px;
  background: var(--primary);
  color: #FFF;
  font-size: 11px;
  font-weight: 800;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #2C1E21;
}

.cart-text-details {
  display: flex;
  flex-direction: column;
}

.cart-dish-count {
  font-size: 15px;
  font-weight: 700;
}

.cart-subtext {
  font-size: 11px;
  color: #B0A0A5;
}

.cart-action-btn {
  background: linear-gradient(135deg, #FF6B35 0%, #F7B801 100%);
  color: #FFF;
  border: none;
  padding: 10px 20px;
  border-radius: 22px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(255, 107, 53, 0.4);
}

/* 通用 Modal 遮罩层 */
.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-sheet {
  background: var(--bg-warm);
  border-top-left-radius: 28px;
  border-top-right-radius: 28px;
  padding: 24px 20px 30px 20px;
  max-height: 80%;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

.modal-overlay.active .modal-sheet {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
}

.close-btn {
  background: rgba(0,0,0,0.06);
  border: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 大转盘专属 Modal */
.wheel-modal-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.wheel-canvas-container {
  position: relative;
  width: 280px;
  height: 280px;
  margin: 10px 0 20px 0;
}

#wheelCanvas {
  width: 280px;
  height: 280px;
  border-radius: 50%;
  box-shadow: 0 0 20px rgba(255, 107, 53, 0.4), 0 0 0 8px #FF6B35;
}

.wheel-pointer {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  width: 32px;
  height: 38px;
  z-index: 10;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.3));
}

.spin-start-btn {
  width: 100%;
  background: linear-gradient(135deg, #FF6B35 0%, #FF9F1C 100%);
  color: #FFF;
  border: none;
  padding: 14px;
  border-radius: 24px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(255, 107, 53, 0.4);
  transition: transform 0.15s;
}

.spin-start-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* 抽中结果特效 */
.winner-popup {
  background: #FFF;
  border-radius: 20px;
  padding: 16px;
  margin-top: 14px;
  width: 100%;
  border: 2px dashed var(--secondary);
  animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.winner-dish-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--primary-dark);
  margin-bottom: 8px;
}

/* 口味定制 modal 选项 */
.custom-section {
  margin-bottom: 16px;
}

.custom-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.custom-options-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.opt-btn {
  background: #FFF;
  border: 1px solid var(--border-color);
  padding: 6px 14px;
  border-radius: 14px;
  font-size: 13px;
  cursor: pointer;
}

.opt-btn.selected {
  background: var(--primary-light);
  color: var(--primary-dark);
  border-color: var(--primary);
  font-weight: 700;
}

/* 买菜清单列表 */
.grocery-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px dashed var(--border-color);
  font-size: 14px;
}

.grocery-item label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.grocery-amount {
  font-weight: 700;
  color: var(--primary-dark);
}

/* 掌勺大厨视角与订单卡片 */
.chef-order-card {
  background: #FFF;
  border-radius: 16px;
  padding: 14px;
  margin-bottom: 12px;
  border-left: 4px solid var(--primary);
  box-shadow: var(--shadow-sm);
}

.chef-order-user {
  display: flex;
  justify-content: space-between;
  font-weight: 700;
  margin-bottom: 6px;
}

.chef-order-dishes {
  font-size: 13px;
  color: #555;
  margin-bottom: 8px;
  line-height: 1.5;
}

.badge-compliment {
  background: #FFF9E6;
  color: #B7791F;
  border: 1px solid #F6E05E;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  display: inline-block;
  margin-right: 6px;
  margin-top: 4px;
}
