/* ========================================
   闪电下单 · 顾客端样式
   移动端优先 · 活力渐变 · 小程序风格
   ======================================== */

:root {
    --primary: #FF6B35; --primary-light: #FF8C5A; --primary-dark: #E55A2B;
    --accent: #FFB800; --success: #00C853; --danger: #FF1744; --info: #448AFF;
    --bg: #FFF6F2; --bg-card: #FFFFFF; --text: #2D2418;
    --text-secondary: #8B7355; --text-muted: #B8A088; --border: #F0E4D8;
    --shadow-sm: 0 2px 8px rgba(255,107,53,0.06);
    --shadow-md: 0 4px 16px rgba(255,107,53,0.10);
    --radius: 14px; --radius-lg: 20px; --radius-xl: 28px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --header-h: 52px; --tabs-h: 60px;
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; -webkit-tap-highlight-color: transparent; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: var(--bg); color: var(--text); min-height: 100dvh;
    overflow-x: hidden; -webkit-font-smoothing: antialiased;
}

/* ========== 顶部导航 ========== */
.app-header {
    position: sticky; top: 0; z-index: 100;
    display: flex; align-items: center; justify-content: space-between;
    height: var(--header-h); padding: 0 16px;
    background: linear-gradient(135deg, #FF6B35, #FF8C5A, #FFB347);
    box-shadow: 0 4px 20px rgba(255,107,53,0.25);
}
.logo-icon { font-size: 24px; animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.12); } }
.logo-text { font-size: 18px; font-weight: 800; color: #FFF; letter-spacing: 0.5px; }
.header-action { color: #FFF; font-size: 13px; opacity: 0.85; }

/* ========== 页面容器 ========== */
.page-container { padding-bottom: calc(var(--tabs-h) + var(--safe-bottom) + 16px); }
.page { display: none; }
.page.active { display: block; }

/* ========== 分类导航 ========== */
.category-nav {
    display: flex; gap: 8px; padding: 12px 14px;
    overflow-x: auto; scrollbar-width: none; white-space: nowrap;
}
.category-nav::-webkit-scrollbar { display: none; }
.cat-chip {
    flex-shrink: 0; padding: 7px 16px; border-radius: 20px;
    border: 1.5px solid var(--border); background: var(--bg-card);
    color: var(--text-secondary); font-size: 13px; font-weight: 600;
    cursor: pointer; transition: var(--transition);
}
.cat-chip:active { transform: scale(0.95); }
.cat-chip.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-color: transparent; color: #FFF; box-shadow: var(--shadow-sm);
}

/* ========== 菜单网格 ========== */
.menu-grid {
    display: grid; grid-template-columns: repeat(2, 1fr);
    gap: 10px; padding: 0 14px 16px;
}
.menu-item {
    background: var(--bg-card); border-radius: var(--radius);
    padding: 10px; cursor: pointer; transition: var(--transition);
    box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.menu-item:active { transform: scale(0.97); }
.menu-item-img {
    width: 100%; aspect-ratio: 1; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 56px; margin-bottom: 8px;
}
.menu-item-info h3 { font-size: 14px; font-weight: 700; margin-bottom: 2px; line-height: 1.3; }
.menu-item-desc { font-size: 11px; color: var(--text-muted); margin-bottom: 6px; }
.menu-item-bottom { display: flex; align-items: center; justify-content: space-between; }
.menu-item-price { font-size: 17px; font-weight: 800; color: var(--primary); }
.menu-item-price::before { content: '¥'; font-size: 12px; }
.btn-add {
    width: 30px; height: 30px; border-radius: 50%; border: none;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #FFF; font-size: 18px; font-weight: 700; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: var(--transition); box-shadow: 0 2px 8px rgba(255,107,53,0.25);
}
.btn-add:active { transform: scale(0.8); }
.btn-add.in-cart { background: var(--success); }

/* ========== 飞入动画 ========== */
.fly-ball {
    position: fixed; z-index: 300; pointer-events: none;
    font-size: 42px; transition: all 0.55s cubic-bezier(0.25, 0.8, 0.25, 1.2);
}

/* ========== 购物车悬浮按钮 ========== */
.cart-fab {
    position: fixed; right: 16px; bottom: calc(var(--tabs-h) + var(--safe-bottom) + 24px);
    z-index: 80; width: 52px; height: 52px; border-radius: 50%;
    background: linear-gradient(135deg, #333, #555);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    transition: var(--transition);
}
.cart-fab.has-items { background: linear-gradient(135deg, var(--primary), var(--accent)); }
.cart-fab-icon { font-size: 24px; }
.cart-fab-badge {
    position: absolute; top: -2px; right: -2px;
    width: 22px; height: 22px; border-radius: 50%;
    background: var(--danger); color: #FFF; font-size: 11px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid #FFF;
}
.cart-fab-badge[data-count="0"] { display: none; }

/* ========== 订单Tab筛选 ========== */
.order-tabs-inline {
    display: flex; gap: 6px; padding: 10px 14px; overflow-x: auto; scrollbar-width: none;
}
.order-tabs-inline::-webkit-scrollbar { display: none; }
.tab-chip {
    flex-shrink: 0; padding: 6px 14px; border-radius: 16px;
    border: 1.5px solid var(--border); background: var(--bg-card);
    color: var(--text-secondary); font-size: 12px; font-weight: 600;
    cursor: pointer; transition: var(--transition);
}
.tab-chip.active { background: var(--primary); color: #FFF; border-color: transparent; }

.order-list-view { padding: 0 14px; }

/* ========== 订单卡片 ========== */
.order-card {
    background: var(--bg-card); border-radius: var(--radius);
    padding: 14px; margin-bottom: 10px; box-shadow: var(--shadow-sm);
    cursor: pointer; transition: var(--transition);
}
.order-card:active { transform: scale(0.98); }
.order-card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.order-card-number { font-size: 14px; font-weight: 700; }
.order-card-status { font-size: 12px; padding: 2px 10px; border-radius: 10px; font-weight: 600; }
.order-card-status.pending { background: #FFF3E0; color: #E65100; }
.order-card-status.accepted { background: #E3F2FD; color: #1565C0; }
.order-card-status.completed { background: #E8F5E9; color: #2E7D32; }
.order-card-status.cancelled { background: #FFEBEE; color: #C62828; }
.order-card-items { font-size: 12px; color: var(--text-secondary); margin-bottom: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.order-card-bottom { display: flex; justify-content: space-between; align-items: center; }
.order-card-total { font-size: 16px; font-weight: 800; color: var(--primary); }
.order-card-time { font-size: 11px; color: var(--text-muted); }

.empty-state { text-align: center; color: var(--text-muted); padding: 60px 20px; font-size: 15px; line-height: 1.8; }

/* ========== 我的页面 ========== */
.profile-card {
    display: flex; align-items: center; gap: 14px;
    margin: 14px; padding: 18px; background: linear-gradient(135deg, #FFF, #FFF6F2);
    border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
    cursor: pointer; transition: var(--transition);
}
.profile-card:active { transform: scale(0.98); }
.profile-avatar { font-size: 48px; width: 64px; height: 64px; border-radius: 50%; background: var(--bg); display: flex; align-items: center; justify-content: center; }
.profile-info { flex: 1; }
.profile-name { font-size: 18px; font-weight: 700; }
.profile-detail { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.profile-arrow { font-size: 20px; color: var(--text-muted); }

.mine-section-title { font-size: 12px; color: var(--text-muted); padding: 12px 18px 6px; font-weight: 600; }
.mine-menu { margin: 0 14px; background: var(--bg-card); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
.mine-menu-item {
    display: flex; align-items: center; gap: 12px; padding: 14px 16px;
    cursor: pointer; transition: background 0.15s;
    border-bottom: 1px solid #F5F0EB;
}
.mine-menu-item:last-child { border-bottom: none; }
.mine-menu-item:active { background: #FAF5F0; }
.mine-menu-icon { font-size: 20px; }
.mine-menu-label { flex: 1; font-size: 14px; font-weight: 500; }
.mine-menu-count { font-size: 12px; color: var(--primary); background: #FFF0E6; padding: 2px 8px; border-radius: 10px; }
.mine-menu-value { font-size: 12px; color: var(--text-muted); }
.mine-menu-arrow { font-size: 16px; color: #CCC; }

/* ========== 底部Tab ========== */
.bottom-tabs {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
    display: flex; background: var(--bg-card); border-top: 1px solid var(--border);
    padding-bottom: var(--safe-bottom); box-shadow: 0 -4px 16px rgba(0,0,0,0.04);
}
.tab-item {
    flex: 1; display: flex; flex-direction: column; align-items: center;
    gap: 2px; padding: 8px 0; border: none; background: none;
    cursor: pointer; transition: var(--transition); position: relative;
}
.tab-icon { font-size: 22px; }
.tab-label { font-size: 10px; color: var(--text-muted); font-weight: 500; }
.tab-item.active .tab-label { color: var(--primary); font-weight: 700; }
.tab-dot {
    position: absolute; top: 6px; right: calc(50% - 24px);
    width: 8px; height: 8px; border-radius: 50%; background: var(--danger);
}
.tab-dot:not(.show) { display: none; }

/* ========== 弹窗通用 ========== */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.45);
    z-index: 200; opacity: 0; pointer-events: none;
    transition: opacity var(--transition); backdrop-filter: blur(2px);
}
.modal-overlay.active { opacity: 1; pointer-events: auto; }
.modal-sheet {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 210;
    background: var(--bg-card); border-radius: 20px 20px 0 0;
    padding-bottom: calc(16px + var(--safe-bottom));
    max-height: 82dvh; display: flex; flex-direction: column;
    transform: translateY(100%); transition: transform var(--transition);
}
.modal-sheet.active { transform: translateY(0); }
.modal-handle { width: 36px; height: 4px; background: #DDD; border-radius: 2px; margin: 10px auto; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 0 18px 10px; border-bottom: 1px solid var(--border); }
.modal-header h2 { font-size: 17px; font-weight: 700; }
.btn-text { padding: 4px 12px; border-radius: 12px; border: none; background: none; font-size: 13px; cursor: pointer; }
.btn-text.danger { color: var(--danger); }

/* ========== 购物车列表 ========== */
.cart-list { flex: 1; overflow-y: auto; padding: 10px 18px; min-height: 100px; }
.cart-empty { text-align: center; color: var(--text-muted); padding: 36px 0; font-size: 14px; line-height: 1.8; }
.cart-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid #F5F0EB; }
.cart-row-img { width: 44px; height: 44px; border-radius: 10px; background: var(--bg); display: flex; align-items: center; justify-content: center; font-size: 26px; flex-shrink: 0; }
.cart-row-info { flex: 1; min-width: 0; }
.cart-row-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cart-row-price { font-size: 12px; color: var(--primary); font-weight: 700; }
.cart-row-qty { display: flex; align-items: center; gap: 6px; }
.btn-qty {
    width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--border);
    background: var(--bg-card); font-size: 15px; font-weight: 700; cursor: pointer;
    display: flex; align-items: center; justify-content: center; transition: var(--transition);
}
.btn-qty:active { transform: scale(0.8); }
.btn-qty.minus { color: var(--danger); border-color: #FDD; }
.qty-num { font-size: 15px; font-weight: 700; min-width: 22px; text-align: center; }

/* ========== 弹窗底部 ========== */
.modal-footer { padding: 14px 18px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 10px; }
.cart-summary { display: flex; justify-content: space-between; align-items: center; font-size: 15px; font-weight: 600; }
.cart-total-price { font-size: 22px; font-weight: 800; color: var(--primary); }
.btn-primary-full {
    width: 100%; padding: 13px; border-radius: var(--radius); border: none;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #FFF; font-size: 16px; font-weight: 700; cursor: pointer;
    box-shadow: var(--shadow-md); transition: var(--transition);
}
.btn-primary-full:active { transform: scale(0.97); }
.btn-primary-full:disabled { background: #CCC; box-shadow: none; cursor: not-allowed; }
.btn-secondary-full {
    width: 100%; padding: 13px; border-radius: var(--radius); border: none;
    background: var(--bg); color: var(--text-secondary);
    font-size: 15px; font-weight: 600; cursor: pointer; transition: var(--transition);
}

/* ========== 支付弹窗 ========== */
.pay-content { padding: 12px 18px; }
.pay-row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 13px; color: var(--text-secondary); }
.pay-row.total { font-size: 19px; font-weight: 800; color: var(--text); border-top: 1px dashed var(--border); margin-top: 8px; padding-top: 10px; }
.pay-methods { display: flex; gap: 8px; padding: 0 18px 12px; }
.pay-opt {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px;
    padding: 10px 6px; border-radius: var(--radius); border: 2px solid var(--border);
    cursor: pointer; transition: var(--transition); font-size: 11px; color: var(--text-secondary);
}
.pay-opt input { display: none; }
.pay-opt.active { border-color: var(--primary); background: #FFF8F5; color: var(--primary); }
.pay-opt-icon { font-size: 26px; }

/* ========== 订单详情 ========== */
.order-detail-content { flex: 1; overflow-y: auto; padding: 14px 18px; }
.detail-header { text-align: center; padding-bottom: 12px; border-bottom: 1px dashed var(--border); margin-bottom: 12px; }
.detail-number { font-size: 12px; color: var(--text-muted); }
.detail-status { display: inline-block; margin-top: 4px; padding: 3px 12px; border-radius: 12px; font-size: 12px; font-weight: 700; }
.detail-status.pending { background: #FFF3E0; color: #E65100; }
.detail-status.accepted { background: #E3F2FD; color: #1565C0; }
.detail-status.completed { background: #E8F5E9; color: #2E7D32; }
.detail-status.cancelled { background: #FFEBEE; color: #C62828; }
.detail-time { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.detail-item { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid #F5F0EB; font-size: 13px; }
.detail-total { display: flex; justify-content: space-between; padding-top: 10px; margin-top: 8px; border-top: 2px solid var(--text); font-size: 16px; font-weight: 700; }
.detail-pay { text-align: center; margin-top: 8px; font-size: 12px; color: var(--text-muted); }

/* ========== 资料编辑 ========== */
.profile-form { padding: 14px 18px; }
.avatar-picker { display: flex; gap: 8px; flex-wrap: wrap; }
.avatar-option { font-size: 32px; width: 48px; height: 48px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; border: 2px solid transparent; transition: var(--transition); background: var(--bg); }
.avatar-option.selected { border-color: var(--primary); background: #FFF0E6; transform: scale(1.1); }
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.form-input {
    width: 100%; padding: 10px 14px; border-radius: 10px;
    border: 1.5px solid var(--border); font-size: 15px;
    background: var(--bg); outline: none; transition: var(--transition);
}
.form-input:focus { border-color: var(--primary); background: #FFF; }
.gender-picker { display: flex; gap: 8px; }
.gender-option {
    flex: 1; padding: 10px; border-radius: 10px; border: 1.5px solid var(--border);
    background: var(--bg-card); font-size: 13px; cursor: pointer; transition: var(--transition);
}
.gender-option.active { border-color: var(--primary); background: #FFF0E6; color: var(--primary); font-weight: 700; }

/* ========== 收藏列表 ========== */
.fav-list { flex: 1; overflow-y: auto; padding: 10px 18px; }
.fav-empty { text-align: center; color: var(--text-muted); padding: 40px 0; font-size: 14px; }

/* ========== Toast ========== */
.toast {
    position: fixed; top: 72px; left: 50%; transform: translateX(-50%) translateY(-100px);
    z-index: 999; background: rgba(45,36,24,0.88); backdrop-filter: blur(8px);
    color: #FFF; padding: 10px 22px; border-radius: 22px;
    font-size: 13px; font-weight: 600; pointer-events: none;
    opacity: 0; transition: all 0.3s ease; white-space: nowrap;
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.success { background: rgba(0,200,83,0.88); }
.toast.error { background: rgba(255,23,68,0.88); }

/* ========== 滚动条隐藏 ========== */
::-webkit-scrollbar { width: 0; height: 0; }

/* ========== 动效 ========== */
@keyframes fadeInUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
.menu-item { animation: fadeInUp 0.35s ease both; }
.menu-item:nth-child(1) { animation-delay: 0.03s; } .menu-item:nth-child(2) { animation-delay: 0.06s; }
.menu-item:nth-child(3) { animation-delay: 0.09s; } .menu-item:nth-child(4) { animation-delay: 0.12s; }
.menu-item:nth-child(5) { animation-delay: 0.15s; } .menu-item:nth-child(6) { animation-delay: 0.18s; }
.menu-item:nth-child(7) { animation-delay: 0.21s; } .menu-item:nth-child(8) { animation-delay: 0.24s; }

/* ========== 响应式（平板/PC） ========== */
@media (min-width: 640px) {
    .menu-grid { grid-template-columns: repeat(3, 1fr); max-width: 800px; margin: 0 auto; }
    .category-nav { max-width: 800px; margin: 0 auto; }
    .order-list-view { max-width: 640px; margin: 0 auto; }
    .profile-card, .mine-menu, .mine-section-title { max-width: 500px; margin-left: auto; margin-right: auto; }
}

/* ========== 手机验证弹窗 ========== */
.phone-verify-body { padding: 0 24px 16px; }
.phone-hint { text-align: center; color: var(--text-muted); font-size: 13px; margin-bottom: 20px; line-height: 1.6; }
.verify-code-row { display: flex; gap: 10px; align-items: center; }
.verify-code-input { flex: 1; }
.btn-send-code {
    flex-shrink: 0; padding: 11px 16px; background: var(--primary); color: #fff; border: none;
    border-radius: 10px; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap;
    transition: opacity 0.2s;
}
.btn-send-code:disabled { opacity: 0.5; cursor: not-allowed; }
.verify-tip { color: #FF9800; font-size: 11px; margin-top: 4px; text-align: center; }

/* ========== 已下架商品 ========== */
.menu-item.offline { opacity: 0.6; }
.menu-item.offline .menu-item-img { background: #F5F5F5 !important; }
.offline-tag {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.65); color: #fff; font-size: 12px; font-weight: 700;
    padding: 4px 10px; border-radius: 6px; z-index: 2;
}
.offline-text { color: #999; font-size: 11px; }
.offline-badge {
    color: #CCC; font-size: 12px; border: 1px solid #E0E0E0;
    padding: 6px 12px; border-radius: 8px;
}
.cart-row.offline { opacity: 0.55; background: #FFF5F5; border-radius: 8px; }
.offline-warn {
    color: #FF5722; font-size: 11px; font-weight: 600; margin-left: 6px;
    animation: blink 1s ease-in-out infinite;
}
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }
.cart-offline-warning {
    background: #FFF3E0; border: 1px solid #FFB74D; color: #E65100;
    padding: 10px 14px; border-radius: 10px; font-size: 12px; margin-bottom: 12px;
    line-height: 1.6;
}

/* ========== 商品详情页 ========== */
.item-detail-hero {
    width: 100%; height: 220px; display: flex; align-items: center; justify-content: center;
    position: relative; border-radius: 16px 16px 0 0; overflow: hidden;
}
.item-detail-emoji { font-size: 80px; }
.offline-tag.large { font-size: 16px; padding: 8px 20px; border-radius: 10px; }
.item-detail-body { padding: 20px 24px 24px; }
.item-detail-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.item-detail-top h2 { font-size: 22px; font-weight: 700; color: var(--text); }
.item-detail-fav { font-size: 28px; cursor: pointer; transition: transform 0.2s; }
.item-detail-fav:active { transform: scale(1.3); }
.item-detail-desc { color: var(--text-secondary); font-size: 14px; margin-bottom: 12px; line-height: 1.6; }
.item-detail-meta { display: flex; gap: 16px; font-size: 12px; color: var(--text-muted); margin-bottom: 16px; }
.item-detail-price { margin-bottom: 20px; }
.price-big { font-size: 28px; font-weight: 800; color: var(--primary); }
.price-unit { font-size: 14px; color: var(--text-muted); margin-left: 4px; }
.item-detail-actions { display: flex; gap: 16px; align-items: center; }
.detail-qty-row {
    display: flex; align-items: center; gap: 12px; background: var(--border);
    border-radius: 12px; padding: 4px;
}
.detail-qty-btn {
    width: 36px; height: 36px; border-radius: 10px; border: none;
    background: #fff; font-size: 18px; font-weight: 700; color: var(--text);
    cursor: pointer; transition: background 0.2s;
}
.detail-qty-btn:active { background: var(--primary); color: #fff; }
.detail-qty-num { font-size: 18px; font-weight: 700; min-width: 28px; text-align: center; color: var(--text); }
.detail-add-btn { flex: 1; }
.offline-notice {
    background: #FFF3E0; border: 1px solid #FFB74D; color: #E65100;
    padding: 14px; border-radius: 12px; font-size: 14px; text-align: center; font-weight: 600;
}

/* ========== 支付演示提示 ========== */
.pay-demo-hint {
    background: #FFF8E1; border: 1px solid #FFD54F; color: #F57F17;
    padding: 8px 14px; border-radius: 10px; font-size: 12px; text-align: center;
    margin-bottom: 12px;
}
