/**
 * common.css —— 全站共享样式合并包（原 style.css + menu.css + bottom-nav.css + add-food-modal.css）
 * 2026-07-28 合并，目的是减少每个页面的 HTTP 请求数；这4个文件本来就每页都加载、内容完全一样，
 * 合并零成本。按来源文件分区块，各区块内部结构未改动。
 */

/* ============================================================
 * 区块一：原 style.css —— 全局基础样式（按钮/表单/消息提示/表格/徽章等）
 * ============================================================ */
/**
 * 冰箱食材管理系统 - 全局样式
 * 
 * 移动端优先，响应式设计
 */

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

/* 自定义背景图上叠的遮罩色：跟皮肤（data-skin）无关，只看深浅模式，
   服务端直出的 <style>（includes/bg_style.php）和 js/common.js 的实时预览
   共用这一个变量，深浅模式切换靠 CSS 属性选择器自动反应，不需要 JS 重新赋值 */
html[data-theme="dark"]  { --bg-scrim: rgba(0, 0, 0, .45); }
html[data-theme="light"] { --bg-scrim: rgba(255, 255, 255, .45); }

body {
    font-family: var(--font-family);
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    background-color: var(--bg-secondary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* iOS/iPadOS Safari 日期输入框原生样式会额外撑宽，统一用 CSS box model */
input[type="date"] {
    -webkit-appearance: none;
    appearance: none;
}

/* ==================== 表单样式 ==================== */
.form-group {
    margin-bottom: 20px;
}

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

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="email"],
.form-group input[type="number"],
.form-group input[type="date"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

/* ==================== 工具栏筛选控件（全站统一） ==================== */
.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    margin-right: 8px;
    cursor: pointer;
}

/* ==================== 按钮样式 ==================== */
.btn {
    display: inline-block;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

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

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background-color: #1d4ed8;
}

.btn-success {
    background-color: var(--success-color);
    color: white;
}

.btn-success:hover:not(:disabled) {
    background-color: #059669;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background-color: #dc2626;
}

.btn-warning {
    background-color: var(--warning-color);
    color: white;
}

.btn-warning:hover:not(:disabled) {
    background-color: #d97706;
}

.btn-info {
    background-color: var(--info-color);
    color: white;
}

.btn-info:hover:not(:disabled) {
    background-color: #0891b2;
}

.btn-secondary {
    background-color: var(--text-secondary);
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background-color: #4b5563;
}

.btn-block {
    width: 100%;
    display: block;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}

.btn-lg {
    padding: 16px 32px;
    font-size: 16px;
}

/* 通用：列表页操作按钮横向排列不换行（页面使用 .action-buttons 时生效） */
.action-buttons {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    flex-wrap: nowrap;
    white-space: nowrap;
}

.action-buttons .btn {
    flex: 0 0 auto;
}

/* 通用：表格"操作"列（编辑/删除）在各端保持一行 */
th.col-actions,
td.col-actions {
    width: 160px;
    white-space: nowrap;
}

/* ==================== 消息提示 ==================== */
.error-message,
.success-message,
.info-message {
    padding: 12px;
    border-radius: var(--border-radius);
    margin-top: 15px;
    font-size: 14px;
}

.error-message {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.success-message {
    background-color: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.info-message {
    background-color: #dbeafe;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

/* 浮动消息容器：z-index 必须高于全站所有弹窗/遮罩（目前最高是图片预览的 99999），
   提示信息不管在哪个弹窗上弹出都要盖在最上面，不能被弹窗挡住 */
.message-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 100000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.message {
    padding: 12px 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    font-size: 14px;
    min-width: 200px;
    max-width: 400px;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s;
    pointer-events: none; /* 纯视觉提示，点击穿透到下面的元素，不阻挡操作 */
}

.message--show {
    opacity: 1;
    transform: translateX(0);
}

.message--success {
    background-color: #d1fae5;
    color: #065f46;
    border-left: 4px solid var(--success-color);
}

.message--error {
    background-color: #fee2e2;
    color: #991b1b;
    border-left: 4px solid var(--danger-color);
}

.message--warning {
    background-color: #fef3c7;
    color: #92400e;
    border-left: 4px solid var(--warning-color);
}

.message--info {
    background-color: #dbeafe;
    color: #1e40af;
    border-left: 4px solid var(--info-color);
}

/* ==================== 加载/空状态占位文字（全站共用） ==================== */
.loading-spinner {
    text-align: center; padding: 40px; color: var(--text-light, #9ca3af);
}

/* ==================== 容器布局 ==================== */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* ==================== 表格样式 ==================== */
.table-container {
    width: 100%;
    overflow-x: auto;
    background: var(--bg-primary);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
}

table {
    width: 100%;
    border-collapse: collapse;
}

table th,
table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

table th {
    background-color: var(--bg-secondary);
    font-weight: 600;
    color: var(--text-primary);
}

table tr:hover {
    background-color: var(--bg-secondary);
}

/* ==================== 状态徽章 ==================== */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge-info {
    background: #dbeafe;
    color: #1e40af;
}

.badge-secondary {
    background: #f3f4f6;
    color: #6b7280;
}

/* ==================== 响应式设计 ==================== */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .message-container {
        right: 10px;
        left: 10px;
    }
    
    .message {
        max-width: 100%;
    }
    
    table {
        font-size: 13px;
    }
    
    table th,
    table td {
        padding: 8px;
    }
}

/* ==================== 加载状态 ==================== */
.loading {
    position: relative;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to {
        transform: translateY(-50%) rotate(360deg);
    }
}

/* ==================== 工具类 ==================== */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.mt-10 {
    margin-top: 10px;
}

.mt-20 {
    margin-top: 20px;
}

.mb-10 {
    margin-bottom: 10px;
}

.mb-20 {
    margin-bottom: 20px;
}

.hidden {
    display: none !important;
}

/* ==================== 日期时间（两行） ==================== */
.dt-2line {
    line-height: 1.2;
}
.dt-2line__date {
    font-weight: 700;
}
.dt-2line__time {
    color: #6b7280;
    font-size: 12px;
    margin-top: 4px;
}

/* ==================== 消息提示样式 ==================== */
.message-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 100000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 400px;
    pointer-events: none;
}

.message {
    padding: 16px 20px;
    border-radius: 8px;
    pointer-events: none; /* 纯视觉提示，点击穿透到下面的元素，不阻挡操作 */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    color: white;
    font-size: 14px;
    font-weight: 500;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 250px;
}

.message::before {
    content: '';
    font-size: 18px;
}

.message--show {
    opacity: 1;
    transform: translateX(0);
}

.message--success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.message--success::before {
    content: '✓';
}

.message--error {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.message--error::before {
    content: '✕';
}

.message--warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.message--warning::before {
    content: '⚠';
}

.message--info {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

.message--info::before {
    content: 'ℹ';
}

/* 移动端优化 - 移除媒体查询，应用到所有屏幕 */
.message-container {
    left: 10px;
    right: 10px;
    max-width: none;
}

.message {
    min-width: auto;
}

/* 食材列表显示规则由 bottom-nav.css 统一管理 */

.dark-mode-btn {
    position: fixed;
    top: 12px;
    right: 58px;
    z-index: 9990;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid rgba(0,0,0,0.08);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: background 0.3s, transform 0.15s, box-shadow 0.2s;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    color: #374151;
    padding: 0;
}

.dark-mode-btn:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.dark-mode-btn:active {
    transform: scale(0.9);
}

/* ==================== 主题（皮肤）切换下拉——放在深浅模式按钮右侧 ==================== */
.skin-switch-btn {
    position: fixed;
    top: 12px;
    right: 12px;
    z-index: 9990;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid rgba(0,0,0,0.08);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: background 0.3s, transform 0.15s, box-shadow 0.2s;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    color: #374151;
    padding: 0;
    font-size: 16px;
}

.skin-switch-btn:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.skin-switch-btn:active {
    transform: scale(0.9);
}

.skin-switch-menu {
    position: fixed;
    top: 56px;
    right: 12px;
    z-index: 9991;
    min-width: 168px;
    background: var(--bg-primary, #fff);
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
    padding: 6px;
    display: none;
}

.skin-switch-menu.open {
    display: block;
}

.skin-switch-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 8px;
    font-size: 13px;
    color: var(--text-primary, #111827);
    cursor: pointer;
    white-space: nowrap;
}

.skin-switch-item:hover {
    background: var(--bg-secondary, #f3f4f6);
}

.skin-switch-item.active {
    color: var(--primary-color, #3b82f6);
    font-weight: 700;
}

.skin-switch-item .skin-switch-check {
    opacity: 0;
    font-size: 12px;
}

.skin-switch-item.active .skin-switch-check {
    opacity: 1;
}

/* ==================== 弹窗层级：高于底部导航（z-index 1000） ==================== */
.modal,
.add-food-modal {
    z-index: 1001 !important;
}


/* ============================================================
 * 区块二：原 menu.css —— 全局布局与通用组件（含通用模态框基础款）
 * ============================================================ */
/**
 * 全局布局与通用组件样式
 */

/* ==================== 全局重置 ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Microsoft YaHei", sans-serif;
    background: var(--bg-secondary, #f5f5f5);
    min-height: 100vh;
}

/* ==================== 主内容区 ==================== */
.main-wrapper {
    min-height: 100vh;
}

/* ==================== 内容容器 ==================== */
.container {
    padding: 15px;
    max-width: 1400px;
}

.page {
    padding: 15px;
    max-width: 1200px;
}

.page__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-top: 20px;
}

.page__title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary, #1f2937);
}

/* ==================== 统计卡片 ==================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--bg-primary, white);
    padding: 16px;
    border-radius: var(--card-radius, 8px);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border-left: 4px solid;
}

.stat-card.blue   { border-left-color: #3b82f6; }
.stat-card.pink   { border-left-color: #e211f1; }
.stat-card.orange { border-left-color: #f59e0b; }
.stat-card.green  { border-left-color: #10b981; }
.stat-card.purple { border-left-color: #8b5cf6; }
.stat-card.red    { border-left-color: #ef4444; }

.stat-card h3 {
    font-size: 13px;
    color: var(--text-secondary, #6b7280);
    margin-bottom: 8px;
    font-weight: 500;
}

.stat-card .value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary, #1f2937);
}

.stat-card .sub-value {
    font-size: 12px;
    color: var(--text-secondary, #6b7280);
    margin-top: 6px;
}

/* ==================== 内容网格 ==================== */
.content-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    margin-bottom: 16px;
}

.content-card {
    background: var(--bg-primary, white);
    border-radius: var(--card-radius, 8px);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    padding: 16px;
}

.content-card h2 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-primary, #1f2937);
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border-color, #e5e7eb);
}

.data-list { list-style: none; padding: 0; margin: 0; }

.data-item {
    padding: 10px 0;
    border-bottom: 1px solid var(--bg-tertiary, #f3f4f6);
}

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

.item-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
}

.item-name    { font-weight: 600; color: var(--text-primary, #1f2937); }
.item-details { font-size: 13px; color: var(--text-secondary, #6b7280); margin-top: 4px; }

.loading {
    text-align: center;
    padding: 20px;
    color: var(--text-light, #9ca3af);
}

/* ==================== 通用模态框（基础款，foods.css/shopping-list.css 各自只保留跟这份不同的部分） ==================== */
.modal {
    display: none; position: fixed; z-index: 1000;
    left: 0; top: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    overflow-y: auto;
    padding: 20px 16px;
    box-sizing: border-box;
}
.modal-content {
    background: var(--bg-primary, #fff); margin: 0 auto; padding: 0;
    border-radius: 8px; max-width: 500px; width: 100%;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}
.modal-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 18px 24px; border-bottom: 1px solid var(--border-color, #e5e7eb);
}
.modal-header h2 { font-size: 18px; font-weight: 700; margin: 0; }
.modal-close {
    font-size: 26px; cursor: pointer; color: var(--text-light, #9ca3af);
    background: none; border: none; line-height: 1;
}
.modal-close:hover { color: var(--text-primary, #1f2937); }
.modal-body { padding: 24px; }

/* ============================================================
 * 区块三：原 bottom-nav.css —— 底部导航栏 + 全局布局覆盖
 * ============================================================ */
/**
 * 底部导航栏 + 全局布局（统一模式，手机电脑一致）
 */

/* ==================== 底部导航栏 ==================== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 70px;
    background: var(--bg-primary, #ffffff);
    border-top: 1px solid var(--border-color, #e5e7eb);
    box-shadow: var(--shadow-nav, 0 -2px 10px rgba(0, 0, 0, 0.08));
    z-index: 1000;
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 8px 10px 12px;
}

.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--text-light, #9ca3af);
    transition: color 0.2s;
    padding: 8px 5px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.bottom-nav-item:hover { color: var(--text-secondary, #6b7280); }
.bottom-nav-item.active { color: var(--brand-color, #6aaa64); }

.bottom-nav-item svg {
    width: 25px;
    height: 25px;
    margin-bottom: 4px;
    stroke-width: 2;
}

.bottom-nav-item .nav-label {
    font-size: 12px;
    font-weight: 500;
    line-height: 1;
}

/* 中间大加号按钮 */
.bottom-nav-add {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 58px;
    height: 58px;
    background: linear-gradient(135deg, var(--brand-color, #6aaa64) 0%, var(--brand-color-strong, #5a9a54) 100%);
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(106, 170, 100, 0.4);
    margin: 0 15px;
    cursor: pointer;
    border: none;
    position: relative;
    top: -15px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.2s, box-shadow 0.2s;
}

.bottom-nav-add:hover  { transform: scale(1.05); box-shadow: 0 6px 16px rgba(106, 170, 100, 0.5); }
.bottom-nav-add:active { transform: scale(0.95); }

.bottom-nav-add svg {
    width: 30px;
    height: 30px;
    color: #ffffff;
    stroke-width: 2.5;
}

/* 为底部导航腾出空间——只在 .main-wrapper 上留一份就够：它自己还带着 min-height:100vh，
   border-box 下 padding 会被这个 100vh 封顶，内容再少也刚好撑满一屏。body 之前也重复留了
   一份 70px，但 body 的 min-height:100vh 是"内容(main-wrapper, 已经=100vh)+这份 padding"
   算出来的、封不住自己这份 padding，于是永远比一屏多出 70px 空白可滚——这就是内容明明没
   多少却还能上下滚动的原因，去掉 body 这份重复的就好。 */
.main-wrapper { padding-bottom: 70px; }

/* ==================== 全局布局覆盖 ==================== */
/* 无侧边栏、无顶部 header，内容直接从顶部开始 */
.sidebar { display: none !important; }
.header  { display: none !important; }

.main-wrapper {
    margin-left: 0 !important;
    margin-top: 0 !important;
}

/* 页面标题区 */
.page__header {
    margin-bottom: 16px;
    padding-top: 20px;
}

/* 隐藏页面右上角添加按钮（用底部大加号代替）——按专门的标记class隐藏，
   不能按 .btn-primary 笼统匹配，否则会连带藏掉页头里其他跟"新增"无关、
   只是同样用主色样式的按钮（曾经误伤过食谱页的"推荐食谱"按钮） */
.page__header .page-header-add-btn { display: none; }

/* ==================== 分类标签栏 ==================== */
.category-tabs {
    display: flex;
    gap: 8px;
    padding: 12px 15px;
    background: var(--bg-primary, #ffffff);
    border-radius: var(--card-radius, 0);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-bottom: 1px solid var(--bg-tertiary, #f3f4f6);
    position: sticky;
    top: 0;
    z-index: 100;
    scrollbar-width: none;
}

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

@media (hover: hover) {
    .category-tabs { scrollbar-width: thin; scrollbar-color: #d1d5db transparent; }
    .category-tabs::-webkit-scrollbar { display: block; height: 3px; }
    .category-tabs::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }
}

.category-tab {
    padding: 7px 16px;
    border-radius: var(--pill-radius, 20px);
    background: var(--bg-tertiary, #f3f4f6);
    color: var(--text-secondary, #6b7280);
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    border: none;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.2s, color 0.2s;
}

.category-tab:hover  { background: var(--border-color, #e5e7eb); }
.category-tab.active { background: var(--brand-color, #6aaa64); color: #ffffff; }


/* ==================== 分类子标签栏 ==================== */
.category-sub-tabs {
    display: flex;
    gap: 6px;
    padding: 8px 15px;
    background: var(--bg-tertiary, #f3f4f6);
    border-radius: var(--card-radius, 0);
    margin-bottom: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-bottom: 1px solid var(--border-color, #e5e7eb);
    scrollbar-width: none;
}

.category-sub-tabs::-webkit-scrollbar { display: none; }

@media (hover: hover) {
    .category-sub-tabs { scrollbar-width: thin; scrollbar-color: #c7c7c7 transparent; }
    .category-sub-tabs::-webkit-scrollbar { display: block; height: 3px; }
    .category-sub-tabs::-webkit-scrollbar-thumb { background: #c7c7c7; border-radius: 3px; }
}

.category-sub-tab {
    padding: 5px 12px;
    border-radius: var(--pill-radius, 6px);
    background: var(--border-color, #e5e7eb);
    color: var(--text-secondary, #6b7280);
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    border: none;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.15s, color 0.15s;
}
.category-sub-tab:hover  { background: #d1d5db; color: #374151; }
.category-sub-tab.active { background: var(--tab-color, #3b82f6); color: #ffffff; }


/* ==================== 分页 ==================== */
.pagination {
    padding: 15px;
    text-align: center;
    background: var(--bg-primary, #ffffff);
    border-radius: var(--card-radius, 0);
    margin-top: 8px;
    border-top: 1px solid var(--bg-tertiary, #f3f4f6);
}


/* ==================== 食材列表：始终使用行列式 ==================== */
/* 桌面表格永远隐藏 */
.content-card .table { display: none !important; }
.table                { display: none !important; }

/* 行列式列表始终显示 */
.food-list-mobile { display: block !important; overflow: visible; }
.food-table-inner { width: 100%; }


/* ============================================================
 * 区块四：原 add-food-modal.css —— 添加/编辑食材弹窗组件（5个页面共用）
 * ============================================================ */
/**
 * 添加/编辑食材模态框组件样式（被 foods/recipes/settings/shopping-list/statistics 五个页面共用）
 */

.add-food-modal { display:none; position:fixed; z-index:1000; left:0; top:0; width:100%; height:100%; background:rgba(0,0,0,0.5); animation:fadeIn 0.2s; }
@keyframes fadeIn { from{opacity:0} to{opacity:1} }
.add-food-modal-content { background:var(--bg-primary, #fff); margin:50px auto; padding:0; border-radius:8px; max-width:600px; max-height:90vh; overflow-y:auto; box-shadow:0 4px 6px rgba(0,0,0,0.1); animation:slideDown 0.3s; }
@keyframes slideDown { from{transform:translateY(-50px);opacity:0} to{transform:translateY(0);opacity:1} }
.add-food-modal-header { display:flex; justify-content:space-between; align-items:center; padding:20px 30px; border-bottom:1px solid var(--border-color, #e5e7eb); }
.add-food-modal-header h2 { font-size:20px; font-weight:700; margin:0; }
.add-food-modal-close { font-size:28px; cursor:pointer; color:var(--text-light, #9ca3af); line-height:1; background:none; border:none; }
.add-food-modal-close:hover { color:var(--text-primary, #1f2937); }
.add-food-modal-body { padding:30px; }
.barcode-input-row { display:flex; gap:8px; align-items:center; }
.barcode-input-row input { flex:1; }
.barcode-input-row .btn { white-space:nowrap; flex-shrink:0; }
/* .form-row 之前一直没有实际布局样式，所有"两列一行"的字段其实都是纵向堆叠的，这里补上 */
.form-row { display:flex; gap:12px; }
.form-row .form-group { flex:1; min-width:0; }
@media (max-width:480px) {
    .form-row { flex-direction:column; gap:0; }
}
@media (max-width:768px) {
    .add-food-modal-content { margin:20px; max-width:calc(100% - 40px); }
    .add-food-modal-body { padding:20px; }
}
/* is_homemade 复选框行 */
.form-check-row { display:flex; align-items:center; gap:8px; margin-bottom:4px; }
.form-check-row input[type=checkbox] { width:16px; height:16px; cursor:pointer; }
.form-check-row label { cursor:pointer; font-size:14px; }
/* 条码/名称匹配拦截横幅 */
#globalBarcodeBanner {
    display: none;
    background: #ecfdf5;
    border: 1px solid #6ee7b7;
    border-radius: 6px;
    padding: 10px 14px;
    margin-bottom: 14px;
    font-size: 13px;
    color: #065f46;
    line-height: 1.6;
}
#globalBarcodeBanner .banner-title {
    font-weight: 600;
    margin-bottom: 2px;
}
#globalBarcodeBanner .banner-detail {
    color: #047857;
    font-size: 12px;
    margin-bottom: 8px;
}
#globalBarcodeBanner .banner-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 4px;
}
#globalBannerBuyBtn {
    font-size: 13px;
    padding: 5px 14px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    background: #10b981;
    color: #fff;
    font-weight: 600;
    white-space: nowrap;
}
#globalBannerBuyBtn:hover { background: #059669; }
#globalBannerNewBtn {
    font-size: 12px;
    color: var(--text-secondary, #6b7280);
    background: none;
    border: none;
    cursor: pointer;
    text-decoration: underline;
    padding: 2px 0;
    white-space: nowrap;
}
#globalBannerNewBtn:hover { color: var(--text-primary, #1f2937); }
/* 自动填充高亮动画 */
.autofill-highlight {
    animation: autofillPulse 1.2s ease;
}
@keyframes autofillPulse {
    0%   { background-color: #d1fae5; }
    60%  { background-color: #d1fae5; }
    100% { background-color: transparent; }
}
/* Typeahead 下拉 */
.typeahead-wrap { position: relative; }
#globalNameSuggestions {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 2000;
    background: var(--bg-primary, #fff);
    border: 1px solid #d1d5db;
    border-top: none;
    border-radius: 0 0 6px 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    max-height: 260px;
    overflow-y: auto;
}
.suggestion-item {
    padding: 9px 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--bg-tertiary, #f3f4f6);
    transition: background 0.1s;
}
.suggestion-item:last-child { border-bottom: none; }
.suggestion-item:hover,
.suggestion-item.active { background: #eff6ff; }
.suggestion-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary, #111827);
    margin-bottom: 2px;
}
.suggestion-name mark {
    background: #fef9c3;
    color: #92400e;
    padding: 0 1px;
    border-radius: 2px;
    font-weight: 700;
}
.suggestion-meta {
    font-size: 11px;
    color: var(--text-light, #9ca3af);
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.suggestion-meta span { white-space: nowrap; }
.suggestion-empty {
    padding: 12px;
    text-align: center;
    font-size: 13px;
    color: var(--text-light, #9ca3af);
}
/* 单位换算提示行 */
#globalUnitConversionRow {
    display: none;
    background: #fffbeb;
    border: 1px solid #fcd34d;
    border-radius: 6px;
    padding: 10px 14px;
    margin-top: -4px;
    margin-bottom: 12px;
    font-size: 13px;
    color: #92400e;
}
#globalUnitConversionRow label { font-weight: 600; display: block; margin-bottom: 6px; }
#globalUnitConversionRow .conv-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
#globalUnitConversionRow input[type=number] { width: 100px; padding: 4px 8px; border: 1px solid #fcd34d; border-radius: 4px; font-size: 13px; }
#globalUnitConversionRow .conv-hint { font-size: 11px; color: #b45309; margin-top: 4px; }

/* ===== 保质期 / 过期日期 并排 ===== */
.shelf-expiry-row { display:flex; align-items:flex-end; gap:8px; }
.shelf-expiry-row .form-group { flex:1; margin-bottom:0; }
.shelf-expiry-or { flex-shrink:0; font-size:12px; color:var(--text-secondary,#9ca3af); padding-bottom:14px; }

/* ===== 字段小提示（分类/存储区域/单位）：跟在 label 文字后同一行，不占额外空间 ===== */
.field-hint { font-size:11px; font-weight:400; color:var(--text-secondary,#9ca3af); margin-left:4px; white-space:nowrap; }

/* ===== 弹窗内价格对比区块 ===== */
#globalPriceSection {
    display: none;
    margin-top: 16px;
    border-top: 1px dashed #e5e7eb;
    padding-top: 14px;
}
.gps-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 10px;
}
.gps-title {
    font-size: 13px; font-weight: 600; color: #374151;
}
.gps-add-toggle {
    font-size: 12px; color: #2563eb; cursor: pointer;
    text-decoration: underline; background: none; border: none; padding: 0;
}
.gps-add-toggle:hover { color: #1d4ed8; }
.gps-record-row {
    display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
    padding: 7px 10px; border-radius: var(--card-radius, 6px); margin-bottom: 5px;
    border: 1px solid var(--border-color, #e5e7eb); background: var(--bg-secondary, #f9fafb); font-size: 13px;
}
.gps-record-row.cheapest { border-color: #6ee7b7; background: #ecfdf5; }
.gps-record-row.wanted   { border-color: #93c5fd; background: #eff6ff; }
.gps-store  { font-weight: 600; flex: 1; min-width: 70px; color: var(--text-primary, #1f2937); }
.gps-price  { font-weight: 700; color: var(--text-primary, #1f2937); }
.gps-price.cheapest { color: #059669; }
/* .cheapest/.wanted 背景固定用浅色底（不跟主题变量走），深色模式下 --text-primary 会变浅色，
   浅底配浅字看不清——这两行强制文字用深色，配合固定的浅色底自成一套，不受主题影响 */
.gps-record-row.cheapest .gps-store,
.gps-record-row.wanted   .gps-store,
.gps-record-row.wanted   .gps-price { color: #1f2937; }
.gps-unit   { font-size: 11px; color: var(--text-light, #9ca3af); }
.gps-memo   { font-size: 11px; color: var(--text-secondary, #6b7280); width: 100%; }
.gps-cheap-badge {
    font-size: 10px; padding: 1px 5px; border-radius: 3px;
    background: #d1fae5; color: #065f46; margin-left: 3px;
}
.gps-want-btn {
    font-size: 11px; padding: 2px 7px; border-radius: 4px;
    border: 1px solid #d1d5db; cursor: pointer; background: var(--bg-primary, white);
    transition: all 0.15s; white-space: nowrap; margin-left: auto;
}
.gps-want-btn.active { background: #2563eb; color: white; border-color: #2563eb; }
.gps-want-btn:hover:not(.active) { background: #eff6ff; border-color: #93c5fd; }
.gps-row-actions { display: flex; gap: 3px; }
.gps-add-form {
    display: none; background: var(--bg-secondary, #f9fafb); border-radius: 6px;
    padding: 12px; border: 1px dashed #d1d5db; margin-top: 8px;
}
.gps-add-form.open { display: block; }

/* ===== 店铺名自动完成下拉 ===== */
.store-ac-wrap { position: relative; }
.store-ac-drop {
    display: none; position: absolute; top: 100%; left: 0; right: 0;
    z-index: 4000; background: var(--bg-primary, #fff); border: 1px solid #d1d5db;
    border-top: none; border-radius: 0 0 6px 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    max-height: 180px; overflow-y: auto;
}
.store-ac-item {
    padding: 8px 12px; cursor: pointer; font-size: 13px;
    border-bottom: 1px solid var(--bg-tertiary, #f3f4f6);
}
.store-ac-item:last-child { border-bottom: none; }
.store-ac-item:hover,
.store-ac-item.active { background: #eff6ff; }
.store-ac-item mark { background: #fef9c3; color: #92400e; padding: 0 1px; border-radius: 2px; font-weight: 700; }

/* ===== 品牌 → 分店 懒加载选择 ===== */
.branch-chip-wrap { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.branch-chip {
    padding: 4px 10px; border-radius: 999px; font-size: 12px; cursor: pointer;
    border: 1px solid #d1d5db; background: #f9fafb; color: #374151;
}
.branch-chip:hover { background: #eff6ff; border-color: #93c5fd; }
.branch-chip.active { background: var(--primary-color, #3b82f6); border-color: var(--primary-color, #3b82f6); color: #fff; }
.branch-chip.add-new { border-style: dashed; color: #6b7280; }
.branch-new-input-wrap { display: flex; gap: 4px; align-items: center; margin-top: 6px; }
.branch-new-input-wrap input { flex: 1; padding: 4px 8px; font-size: 12px; }
.branch-hint-link { font-size: 11px; color: #6b7280; cursor: pointer; text-decoration: underline; }
