:root {
    --primary: #4F46E5;       /* 主题色：靛蓝 */
    --primary-soft: #EEF2FF;  /* 浅色背景 */
    --text-main: #1F2937;     /* 主文字色 */
    --text-sub: #6B7280;      /* 副文字色 */
    --bg-color: #F9FAFB;      /* 页面背景 */
    --card-bg: rgba(255, 255, 255, 0.85);
    --shadow-card: 0 20px 40px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.01);
    --radius: 24px;
}

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background-color: transparent; 
    margin: 0; padding: 0; min-height: 100vh; color: var(--text-main);
    overflow-x: hidden; -webkit-tap-highlight-color: transparent;
}

/* =========================================
   1. 🌦️ 动态天气背景层 (同步修复版)
   ========================================= */

/* 1. 基础背景容器 */
#weather-bg {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    z-index: -2; 
    transition: background 1.5s ease-in-out; /* 让切换更平滑 */
}

/* 2. 状态映射 */
.default-bg { background: linear-gradient(to bottom, #F3F4F6, #D1D5DB) !important; }

/* ☀️ 晴天 */
.sunny-bg { 
    background: linear-gradient(120deg, #2980b9, #6dd5fa, #ffffff) !important; 
    background-size: 200% 200%;
    animation: gradientMove 15s ease infinite;
}

/* ☁️ 多云 */
.cloudy-bg { background: linear-gradient(to bottom, #757F9A, #D7DDE8) !important; }

/* 🌫️ 雾/霾 */
.foggy-bg { background: linear-gradient(to bottom, #cfd9df, #e2ebf0) !important; }

/* 🌧️ 雨 */
.rainy-bg { background: linear-gradient(to bottom, #203a43, #2c5364) !important; }

/* ❄️ 雪 */
.snowy-bg { background: linear-gradient(to bottom, #83a4d4, #b6fbff) !important; }

/* ⛈️ 雷暴 */
.thunder-bg { background: linear-gradient(to bottom, #1a1a2e, #16213e) !important; }

/* 闪电动画 */
.lightning-anim { animation: lightning-flash 5s infinite; }
@keyframes lightning-flash {
    0%, 95%, 98% { background: transparent; }
    96%, 99% { background: rgba(255, 255, 255, 0.2); }
}

@keyframes gradientMove {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

#weather-canvas {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    z-index: -1; pointer-events: none; 
}

.container {
    background: transparent;
    max-width: 900px; margin: 0 auto; padding: 20px;
    padding-top: max(20px, env(safe-area-inset-top));
    padding-bottom: 120px; 
    display: flex; flex-direction: column; gap: 24px;
}

/* =========================================
   2. 顶部 Header & 功能区
   ========================================= */
.main-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 10px;
}
.header-left { display: flex; flex-direction: column; gap: 6px; }
.header-left h1 { font-size: 28px; font-weight: 800; margin: 0; line-height: 1; color: var(--text-main); }

.weather-pill {
    display: inline-flex; align-items: center; gap: 6px;
    background: rgba(255, 255, 255, 0.8); backdrop-filter: blur(8px);
    color: #2563EB; padding: 4px 12px; border-radius: 20px;
    font-size: 12px; font-weight: 700; cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    width: fit-content; transition: transform 0.2s; white-space: nowrap;
}
.weather-pill:active { transform: scale(0.95); }
.spin { animation: spin 1s infinite linear; }

.top-actions { display: flex; gap: 10px; align-items: center; }
.icon-btn { 
    position: relative; width: 38px; height: 38px; 
    background: rgba(255, 255, 255, 0.9); border-radius: 12px; 
    display: flex; align-items: center; justify-content: center;
    color: #374151; box-shadow: 0 2px 5px rgba(0,0,0,0.05); cursor: pointer;
    transition: transform 0.2s; border: 1px solid rgba(255,255,255,0.5);
    text-decoration: none;
}
.icon-btn:active { transform: scale(0.9); }
.icon-btn.logged-in { border: 2px solid var(--primary); color: var(--primary); background: var(--primary-soft); }

.notif-dot {
    position: absolute; top: -2px; right: -2px; width: 10px; height: 10px; 
    background: #EF4444; border: 2px solid #fff; border-radius: 50%;
    display: none; 
}
.notif-dot.active { display: block; }

/* =========================================
   3. 📝 待办事项
   ========================================= */
.todo-section {
    background: rgba(255, 255, 255, 0.85); backdrop-filter: blur(10px);
    border-radius: 20px; padding: 16px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05); 
    border: 1px solid rgba(255,255,255,0.6);
}
.todo-header {
    font-size: 16px; font-weight: 700; margin-bottom: 12px; color: var(--text-main);
    display: flex; justify-content: space-between; align-items: center;
}
.todo-count { background: #EEF2FF; color: var(--primary); padding: 2px 8px; border-radius: 10px; font-size: 12px; margin-left: 8px;}

.sync-badge { font-size: 11px; padding: 2px 8px; border-radius: 6px; font-weight: 600; display:flex; align-items:center; gap:4px; }
.sync-badge.guest { background: #F3F4F6; color: #9CA3AF; }
.sync-badge.online { background: #DCFCE7; color: #166534; }

.todo-input-row { display: flex; gap: 8px; margin-bottom: 12px; }
.todo-input-row input {
    flex: 1; background: rgba(255,255,255,0.8); border: 1px solid #E5E7EB;
    padding: 10px 14px; border-radius: 12px; font-size: 14px; outline: none;
    transition: border-color 0.2s;
}
.todo-input-row input:focus { border-color: var(--primary); }
.todo-input-row button {
    background: var(--primary); color: white; border: none; width: 40px; border-radius: 12px;
    cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 20px;
}

.todo-list { display: flex; flex-direction: column; gap: 8px; max-height: 200px; overflow-y: auto; }
.todo-item {
    display: flex; align-items: center; gap: 10px; padding: 8px 0;
    border-bottom: 1px dashed rgba(0,0,0,0.05); animation: fadeIn 0.3s ease;
}
.todo-item:last-child { border-bottom: none; }
.todo-check {
    width: 20px; height: 20px; border-radius: 6px; border: 2px solid #D1D5DB;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    color: white; transition: all 0.2s; flex-shrink: 0;
}
.todo-item.done .todo-check { background: #10B981; border-color: #10B981; }
.todo-text { flex: 1; font-size: 14px; color: #374151; transition: all 0.2s; }
.todo-item.done .todo-text { text-decoration: line-through; color: #9CA3AF; }
.todo-del { color: #EF4444; opacity: 0; cursor: pointer; padding: 4px; transition: opacity 0.2s; }
.todo-item:hover .todo-del { opacity: 1; }

/* =========================================
   4. 搜索与浏览
   ========================================= */
.search-container { position: sticky; top: 20px; z-index: 50; }
.search-box {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    border-radius: 20px; padding: 4px; display: flex; align-items: center;
    box-shadow: 0 15px 30px rgba(0,0,0,0.08); border: 1px solid rgba(255,255,255,0.5);
}
.search-icon { padding: 12px 16px; color: #6B7280; font-size: 20px; }
input { border: none; background: transparent; flex-grow: 1; font-size: 16px; outline: none; padding: 14px 0; color: var(--text-main); }
.clear-btn { padding: 12px 16px; color: #D1D5DB; cursor: pointer; font-size: 18px; display: none; transition: color 0.2s; }
.clear-btn.show { display: block; }

.category-scroll {
    display: flex; gap: 10px; overflow-x: auto; padding: 4px 4px 16px 4px;
    margin-bottom: 10px; -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.category-scroll::-webkit-scrollbar { display: none; }
.cat-chip {
    white-space: nowrap; padding: 8px 16px; border-radius: 99px;
    background: white; border: 1px solid #e5e7eb; color: #6b7280;
    font-size: 14px; font-weight: 600; cursor: pointer; transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}
.cat-chip.active {
    background: var(--primary); color: white; border-color: var(--primary);
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.3);
}

.browse-section { animation: fadeIn 0.5s ease; }
.browse-header { font-size: 18px; font-weight: 800; margin-bottom: 16px; display:flex; align-items:center; justify-content: space-between; gap:8px;}

.browse-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 12px;
    padding-bottom: 20px;
}

.mini-card {
    position: relative;
    background: white; 
    border-radius: 16px; 
    overflow: hidden;
    border: 1px solid #f3f4f6; 
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.03); 
    transition: transform 0.2s, border-color 0.2s, background-color 0.2s;
    display: flex; 
    flex-direction: column;
    aspect-ratio: 0.8;
}
.mini-card:active { transform: scale(0.96); }

.mini-card[style*="border: 2px solid"] {
    border-color: var(--primary) !important;
    background-color: #eef2ff !important;
}

.mc-img-box {
    width: 100%;
    flex: 1;
    background: #f9fafb; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    overflow: hidden; 
    position: relative;
    min-height: 80px;
}
.mc-img-box img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s ease; }
.mini-card:hover .mc-img-box img { transform: scale(1.05); }

.mc-content { padding: 10px; background: white; }
.mc-title { 
    font-size: 14px; 
    font-weight: 700; 
    color: #1f2937; 
    margin-bottom: 4px; 
    white-space: nowrap; 
    overflow: hidden; 
    text-overflow: ellipsis; 
}
.mc-loc { font-size: 11px; color: #9ca3af; display: flex; align-items: center; gap: 4px; }

.mc-badge { 
    position: absolute; 
    bottom: 4px; 
    right: 4px; 
    background: rgba(255,255,255,0.9); 
    backdrop-filter: blur(4px);
    padding: 2px 6px; 
    border-radius: 4px; 
    font-size: 10px; 
    font-weight: bold; 
    color: #F59E0B; 
    box-shadow: 0 2px 4px rgba(0,0,0,0.1); 
}

.hidden-mode { display: none !important; }

/* 搜索结果 */
.result-list { display: flex; flex-direction: column; gap: 12px; }
.result-item {
    background: var(--card-bg); border-radius: var(--radius);
    padding: 16px 20px; display: flex; align-items: center; gap: 16px;
    cursor: pointer; border: 1px solid rgba(255,255,255,0.6);
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
    animation: fadeIn 0.4s ease forwards;
}
.result-item:active { transform: scale(0.98); background: #fff; }
.icon-wrapper { width: 48px; height: 48px; background: var(--primary-soft); color: var(--primary); border-radius: 16px; display: flex; align-items: center; justify-content: center; font-size: 22px; flex-shrink: 0; }
.btn-show-all {
    width: 100%; padding: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white; border: none; border-radius: 16px; font-weight: 700; font-size: 15px; cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 12px;
    box-shadow: 0 4px 12px rgba(118, 75, 162, 0.3); transition: transform 0.2s;
}
.btn-show-all:active { transform: scale(0.97); }

/* =========================================
   5. 地图区域
   ========================================= */
.map-section {
    background: #fff; border-radius: var(--radius); overflow: hidden;
    box-shadow: var(--shadow-card); opacity: 0; height: 0;
    transform: scale(0.98); transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative; border: 1px solid #eee; margin-bottom: 40px;
}
.map-section.active { opacity: 1; height: auto; transform: scale(1); margin-top: 10px; }
.map-header { padding: 16px 24px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #f0f0f0; background: #fff; z-index: 2; position: relative; }
.map-title { font-weight: 800; font-size: 18px; }
.close-map { color: var(--text-sub); background: #F3F4F6; width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; }

.map-viewport {
    position: relative; width: 100%; height: 60vh; min-height: 400px;
    background: #f8fafc; overflow: hidden; cursor: grab;
    display: flex; justify-content: center; align-items: center;
    touch-action: none; 
}
.map-viewport:active { cursor: grabbing; }

.panzoom-element {
    position: relative; width: 100%; height: 100%;
    display: flex; justify-content: center; align-items: center;
    touch-action: none; padding: 40px; box-sizing: border-box;
}

.map-wrapper { position: relative; display: inline-block; vertical-align: middle; }
.floor-plan { display: block; max-width: 100%; max-height: 100%; width: auto; height: auto; pointer-events: none; }

.zoom-controls {
    position: absolute; bottom: 20px; right: 20px;
    display: flex; flex-direction: column; gap: 8px; z-index: 100;
}
.zoom-btn {
    width: 40px; height: 40px; background: #fff; color: var(--text-main);
    border-radius: 12px; display: flex; align-items: center; justify-content: center;
    font-size: 20px; cursor: pointer; box-shadow: 0 4px 12px rgba(0,0,0,0.1); transition: all 0.2s;
}

.dynamic-pin, .target-pin {
    position: absolute; z-index: 10; cursor: pointer; pointer-events: auto;
    display: flex; flex-direction: column; align-items: center;
    animation: dropIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform: translate(-50%, -100%); 
}
.pin-icon { font-size: 36px; filter: drop-shadow(0 4px 6px rgba(0,0,0,0.3)); line-height: 1; margin-bottom: -2px; }
.pin-bubble { background: #1F2937; color: #fff; padding: 6px 12px; border-radius: 8px; font-size: 13px; font-weight: 600; margin-bottom: 2px; white-space: nowrap; box-shadow: 0 4px 15px rgba(0,0,0,0.2); position: relative; }
.pin-bubble::after { content: ''; position: absolute; bottom: -5px; left: 50%; transform: translateX(-50%); border-width: 5px 5px 0; border-style: solid; border-color: #1F2937 transparent transparent transparent; }
.pin-ripple { position: absolute; bottom: 0; left: 50%; transform: translateX(-50%); width: 20px; height: 10px; background: rgba(239, 68, 68, 0.5); border-radius: 50%; z-index: -1; animation: ripple-scale 1.5s infinite; }
@keyframes dropIn { 0% { opacity: 0; transform: translate(-50%, -200%); } 100% { opacity: 1; } }
@keyframes ripple-scale { 0% { transform: translateX(-50%) scale(0.5); opacity: 1; } 100% { transform: translateX(-50%) scale(2); opacity: 0; } }
.cluster-anchor { position: absolute; width: 12px; height: 12px; background: rgba(79, 70, 229, 0.3); border: 2px solid var(--primary); border-radius: 50%; transform: translate(-50%, -50%); z-index: 4; }

/* =========================================
   6. 弹窗 Modal (通用与详情页)
   ========================================= */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(8px);
    z-index: 200; display: none; opacity: 0; transition: opacity 0.3s;
    justify-content: center; align-items: center; padding: 20px; box-sizing: border-box;
}
.modal-overlay.active { display: flex; opacity: 1; }

.modal-card {
    background: white; width: 100%; max-width: 400px;
    border-radius: 24px; overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    transform: translateY(20px); transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex; flex-direction: column; max-height: 80vh;
    position: relative; /* 关键：为绝对定位的按钮提供参照 */
}
.modal-overlay.active .modal-card { transform: translateY(0); }

/* =========================================
   ✨ 详情页顶部按钮组 (左上角对齐) - 新增
   ========================================= */
.modal-top-actions {
    position: absolute;
    top: 16px;
    left: 16px;
    z-index: 20; /* 确保浮在图片上面 */
    display: flex;
    gap: 12px;   /* 按钮间距 */
}

/* 统一的圆形按钮样式 */
.action-circle-btn {
    width: 40px;  /* 强制宽度 */
    height: 40px; /* 强制高度 */
    border-radius: 50%; /* 正圆 */
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(0,0,0,0.05);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.1s, background 0.2s;
    padding: 0; 
}

.action-circle-btn i {
    font-size: 20px;
    color: #374151; /* 深灰色图标 */
}

.action-circle-btn:active {
    transform: scale(0.92); /* 点击微缩 */
    background: #f3f4f6;
}

/* 兼容旧的关闭按钮样式 (如果其他弹窗还在用) */
.modal-close-btn { position: absolute; top: 16px; right: 16px; width: 32px; height: 32px; background: rgba(255,255,255,0.8); backdrop-filter: blur(4px); border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; color: #4b5563; font-size: 18px; transition: background 0.2s; }

/* 详情页其他内容 */
.modal-image-area { width: 100%; height: 250px; background: #f3f4f6; flex-shrink: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; position: relative; }
.modal-image-area img { width: 100%; height: 100%; object-fit: cover; }
.modal-no-image { color: #9ca3af; font-size: 14px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.modal-content { padding: 24px; overflow-y: auto; display: flex; flex-direction: column;}
.modal-title { font-size: 22px; font-weight: 800; margin: 0 0 4px 0; color: var(--text-main); }
.modal-meta { display: flex; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.modal-tag { background: var(--primary-soft); color: var(--primary); padding: 4px 10px; border-radius: 6px; font-size: 12px; font-weight: 600; display: flex; align-items: center; gap: 4px; }
.modal-tag.warning { background: #FEF3C7; color: #D97706; }
.modal-section-title { font-size: 12px; font-weight: 700; color: #9ca3af; text-transform: uppercase; margin-bottom: 8px; }
.modal-notes { background: #f9fafb; padding: 12px; border-radius: 12px; font-size: 14px; color: #4b5563; line-height: 1.6; min-height: 40px; margin-bottom: 10px; white-space: pre-wrap; border: 1px solid #f3f4f6;}

/* 详情页图片优化 */
.modal-img {
    width: 100%;
    height: 220px; 
    object-fit: cover; 
    border-radius: 16px;
    margin-bottom: 16px;
    background-color: #f3f4f6; 
    border: 1px solid #e5e7eb;
    display: block;
}

/* 详情页信息行 */
.modal-meta-row { display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.meta-item { display: flex; align-items: center; gap: 6px; font-size: 13px; color: #4B5563; background: #F3F4F6; padding: 6px 10px; border-radius: 8px; font-weight: 600; }
.meta-item i { color: #6B7280; font-size: 15px; }

/* 详情页操作按钮 */
.modal-actions { margin-top: 20px; display: flex; gap: 10px; }
.modal-actions .btn-del {
    width: 100%; padding: 12px; background-color: #FEF2F2; color: #DC2626; border: 1px solid #FECACA; border-radius: 12px; font-weight: 700; font-size: 14px; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 6px; transition: background 0.2s;
}
.modal-actions .btn-del:active { background-color: #FEE2E2; }

/* =========================================
   7. ➕ 添加物品/表单 相关样式
   ========================================= */
.form-group { margin-bottom: 16px; display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 13px; font-weight: 700; color: #4B5563; }
.form-input {
    padding: 12px; border: 1px solid #E5E7EB; border-radius: 12px;
    font-size: 15px; outline: none; background: #F9FAFB;
    transition: border-color 0.2s; font-family: inherit;
}
.form-input:focus { border-color: var(--primary); background: white; }
.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; }

.image-upload-box {
    width: 100%; height: 160px; border: 2px dashed #E5E7EB;
    border-radius: 16px; display: flex; align-items: center; justify-content: center;
    cursor: pointer; background: #F9FAFB; position: relative;
    overflow: hidden; margin-bottom: 8px;
}
.image-upload-box:hover { border-color: var(--primary); }

.btn-ai-scan {
    width: 100%; padding: 8px; background: #EEF2FF;
    color: var(--primary); border: 1px solid #C7D2FE;
    border-radius: 8px; font-size: 13px; font-weight: 600;
    cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 6px;
}
.fab-add {
    position: fixed; bottom: 30px; right: 30px;
    width: 60px; height: 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 32px; box-shadow: 0 10px 25px rgba(118, 75, 162, 0.4);
    cursor: pointer; z-index: 99; transition: transform 0.2s;
    text-decoration: none; 
}
.fab-add:active { transform: scale(0.9); }

/* =========================================
   🛠️ 强制对齐的按钮容器样式 (编辑/添加页底部)
   ========================================= */
/* 专门用来包裹两个按钮的容器 */
.action-buttons-wrapper {
    display: flex !important;       /* 强制使用 Flex 布局 */
    flex-direction: row !important; /* 强制横向排列 */
    align-items: stretch;           /* 高度拉伸一致 */
    justify-content: space-between; 
    gap: 12px;                      /* 按钮间距 */
    width: 100%;                    /* 占满父容器 */
    margin-top: 24px;
}

/* 所有的按钮都强制填满自己的格子 */
.action-buttons-wrapper button {
    height: 44px !important;
    margin: 0 !important;
    border-radius: 10px !important;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 🔙 取消按钮：占 1 份宽度，浅灰色 */
.btn-secondary-cancel {
    flex: 1; 
    background-color: #f3f4f6;
    color: #4b5563;
    border: 1px solid #e5e7eb !important;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-secondary-cancel:hover { background-color: #e5e7eb; color: #1f2937; transform: translateY(-1px); }
.btn-secondary-cancel:active { background-color: #d1d5db; transform: translateY(0); }
.btn-secondary-cancel i { font-size: 18px; margin-right: 4px; color: #6b7280; }

/* ✅ 提交按钮：占 2 份宽度 (更宽)，蓝色 */
.action-buttons-wrapper > button[type="submit"] {
    flex: 2; 
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: white;
    border: none !important;
    font-weight: 600;
    box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.2);
}
#addItemForm button[type="submit"]:active { transform: scale(0.98); }


/* =========================================
   8. 🐱 看板娘
   ========================================= */
.mascot-container {
    position: fixed; bottom: 165px; right: 32px; z-index: 90;
    display: flex; flex-direction: column; align-items: flex-end;
    pointer-events: none; 
}
.mascot-avatar {
    width: 50px; height: 50px; background: white; border-radius: 50%;
    font-size: 30px; display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1); cursor: pointer;
    pointer-events: auto; 
    transition: transform 0.2s; border: 2px solid white;
    animation: float 3s infinite ease-in-out;
}
.mascot-avatar:active { transform: scale(0.9); }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
.mascot-bubble {
    background: white; padding: 12px 16px;
    border-radius: 16px 16px 4px 16px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    margin-bottom: 8px; max-width: 220px;
    font-size: 13px; color: #374151; line-height: 1.5;
    position: relative; pointer-events: auto;
    opacity: 0; transform: translateY(10px) scale(0.9);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    visibility: hidden;
}
.mascot-bubble.show { opacity: 1; transform: translateY(0) scale(1); visibility: visible; }
.bubble-close {
    position: absolute; top: -5px; left: -5px;
    width: 18px; height: 18px; background: #ef4444; color: white;
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-size: 12px; cursor: pointer; border: 2px solid white;
}

/* =========================================
   9. 🔐 登录/注册
   ========================================= */
.auth-card { padding: 30px; max-width: 360px; }
.auth-body { display: flex; flex-direction: column; gap: 16px; }
.input-group {
    position: relative; background: #F9FAFB; border-radius: 12px; border: 1px solid #E5E7EB;
    display: flex; align-items: center; padding: 2px 12px;
    transition: all 0.3s ease;
}
.input-group:focus-within {
    border-color: #6366F1 !important;
    background: #fff !important;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}
.input-group i { color: #9CA3AF; font-size: 18px; margin-right: 8px; }
.input-group:focus-within i { color: #6366F1; }
.input-group input { border: none; background: transparent; padding: 12px 0; flex: 1; outline: none; color: #1F2937; font-size: 15px; }

.btn-primary-auth {
    width: 100%; padding: 14px 0; margin-top: 20px;
    display: flex; align-items: center; justify-content: center; gap: 8px; 
    background: linear-gradient(135deg, #6366F1 0%, #4F46E5 100%);
    color: white; border: none; border-radius: 12px; font-size: 16px; font-weight: 700;
    letter-spacing: 1px; cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}
.btn-primary-auth:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(79, 70, 229, 0.4); filter: brightness(1.1); }
.btn-primary-auth:active { transform: translateY(0); filter: brightness(0.9); }
.auth-switch { text-align: center; font-size: 14px; margin-top: 8px; }
.auth-link { color: var(--primary); font-weight: 600; cursor: pointer; margin-left: 4px; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.spin-icon { animation: spin 1s linear infinite; display: inline-block; margin-right: 6px; vertical-align: middle; }

/* =========================================
   10. 专用弹窗样式
   ========================================= */
.notif-modal-content, .recipe-modal-content, .med-modal-content { padding: 0 !important; background: #f9fafb; max-height: 70vh; display: flex; flex-direction: column; }
.notif-header, .recipe-header, .med-header { padding: 20px 24px; background: white; border-bottom: 1px solid #f3f4f6; position: sticky; top: 0; z-index: 10; display: flex; justify-content: space-between; align-items: center; }
.notif-title, .recipe-header h3, .med-header h3 { font-size: 18px; font-weight: 800; margin: 0; display: flex; align-items: center; gap: 8px; }
.notif-count-badge { background: #EF4444; color: white; padding: 2px 8px; border-radius: 99px; font-size: 12px; }
.notif-list, .recipe-body, .med-body { padding: 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.notif-item { background: white; border-radius: 16px; padding: 16px; border: 1px solid #e5e7eb; display: flex; gap: 12px; align-items: flex-start; box-shadow: 0 2px 4px rgba(0,0,0,0.02); cursor: pointer; transition: transform 0.1s; }
.notif-item:active { transform: scale(0.98); background: #f9fafb; }
.notif-icon-box { width: 40px; height: 40px; border-radius: 10px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 20px; }
.bg-red { background: #FEF2F2; color: #EF4444; } 
.bg-orange { background: #FFFBEB; color: #F59E0B; } 
.notif-text { flex: 1; }
.notif-name { font-weight: 700; font-size: 15px; color: #1f2937; margin-bottom: 4px; }
.notif-desc { font-size: 13px; color: #6b7280; display: flex; flex-direction: column; gap: 2px;}
.notif-date { font-weight: 600; font-size: 12px; }
.text-expired { color: #EF4444; }
.text-soon { color: #D97706; }
.notif-empty { text-align: center; padding: 40px 20px; color: #9ca3af; }

.recipe-modal-content { background: #FFFBEB; border: 1px solid #FCD34D; }
.recipe-header { background: #F59E0B; color: white; }
.ingredient-chips-box { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; padding-bottom: 20px; border-bottom: 1px dashed #FCD34D; }
.ing-chip { font-size: 12px; background: white; color: #D97706; padding: 4px 10px; border-radius: 20px; border: 1px solid #FCD34D; }
.recipe-loading { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 0; color: #D97706; }
.recipe-loading i { font-size: 48px; margin-bottom: 16px; animation: spin 2s infinite linear; }
.recipe-content h3 { color: #B45309; margin-top: 0; font-size: 18px; }
.recipe-content strong { color: #92400E; }

.med-modal-content { background: #F0F9FF; border: 1px solid #BAE6FD; }
.med-header { background: #0EA5E9; color: white; }
.med-search-box { display: flex; gap: 8px; margin-bottom: 20px; }
.med-input { flex: 1; padding: 12px; border: 1px solid #BAE6FD; border-radius: 12px; outline: none; font-size: 15px; }
.med-input:focus { border-color: #0EA5E9; box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.2); }
.btn-ask-med { background: #0EA5E9; color: white; border: none; padding: 0 20px; border-radius: 12px; font-weight: 700; cursor: pointer; display: flex; align-items: center; gap: 6px; }
.med-content h3 { color: #0369A1; margin-top: 16px; margin-bottom: 8px; font-size: 17px; border-left: 4px solid #0EA5E9; padding-left: 8px; }
.med-content strong { color: #0C4A6E; }
.med-loading { text-align: center; color: #0EA5E9; padding: 40px; }
.med-loading i { font-size: 32px; animation: spin 1.5s infinite linear; display: inline-block; margin-bottom: 10px; }


/* =========================================
   11. 新增功能 (批量/编辑/子物品)
   ========================================= */

/* 底部批量操作栏 */
#batchActionBar {
    position: fixed; bottom: 0; left: 0; width: 100%;
    background: white; padding: 16px 24px;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
    display: none; /* JS控制 */
    z-index: 200; justify-content: space-between; align-items: center;
    box-sizing: border-box; animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    border-top: 1px solid #f3f4f6;
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

/* =========================================
   📦 容器子物品列表美化 (Card-in-Card 风格)
   ========================================= */

/* 1. 外层浅灰色容器 */
.sub-items-wrapper {
    background-color: #F3F4F6; /* 浅灰底色 */
    border-radius: 16px;       /* 大圆角 */
    padding: 16px;             /* 内边距 */
    margin-top: 16px;
    border: 1px solid #E5E7EB;
}

/* 2. 头部区域 (标题 + 管理按钮) */
.sub-items-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.sub-section-title {
    font-size: 13px;
    font-weight: 700;
    color: #6B7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-manage-sub {
    font-size: 13px;
    color: #4F46E5;
    background: white;
    padding: 4px 10px;
    border-radius: 20px;
    border: 1px solid #E5E7EB;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.btn-manage-sub:active {
    transform: scale(0.95);
    background: #EEF2FF;
}

/* 3. 子物品列表容器 */
.sub-items-list-container {
    display: flex;
    flex-direction: column;
    gap: 8px; /* 物品之间的间距 */
}

/* 4. 单个子物品卡片 (白色小胶囊) */
.sub-item-card {
    background: white;
    border-radius: 10px;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid transparent; /* 预留边框 */
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
    transition: all 0.2s;
}

.sub-item-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

/* 批量模式下的选中样式 */
.sub-item-card.is-selected {
    border-color: #4F46E5;
    background-color: #EEF2FF;
}

/* 5. 物品内容排版 */
.sub-item-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sub-item-name {
    font-size: 14px;
    font-weight: 600;
    color: #1F2937;
    cursor: pointer;
}

.sub-item-meta {
    font-size: 11px;
    color: #9CA3AF;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

/* 6. 小标签 (备注/过期) */
.mini-tag {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 6px;
    border-radius: 4px;
    background: #F9FAFB;
    border: 1px solid #F3F4F6;
}
.mini-tag.expiry {
    color: #EF4444;
    background: #FEF2F2;
    border-color: #FEE2E2;
}

/* 7. 删除按钮 (底部) */
.btn-delete-sub-batch {
    width: 100%;
    margin-top: 12px;
    background: #EF4444;
    color: white;
    border: none;
    padding: 10px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    font-size: 13px;
    display: none; /* 默认隐藏 */
    align-items: center;
    justify-content: center;
    gap: 6px;
    box-shadow: 0 4px 10px rgba(239, 68, 68, 0.2);
}

/* 户型图列表 */
.plan-item { display: flex; align-items: center; padding: 10px; border-bottom: 1px solid #f0f0f0; background: white; border-radius: 8px; margin-bottom: 8px; border: 1px solid transparent;}
.plan-item.active { background-color: #e6f7ff; border-color: #1890ff; }
.plan-thumb { width: 50px; height: 50px; object-fit: cover; border-radius: 4px; margin-right: 12px; background: #eee; }
.plan-info { flex: 1; }
.plan-name { font-weight: bold; font-size: 14px; }
.tag-active { font-size: 12px; color: #1890ff; background: #e6f7ff; padding: 2px 6px; border-radius: 4px; }
.plan-actions { display: flex; gap: 8px; }
.btn-mini { padding: 4px 8px; font-size: 12px; border-radius: 4px; cursor: pointer; border: none; color: white; }
.btn-switch { background: #3b82f6; }
.btn-del { background: #ef4444; }
.upload-section { background: #f9f9f9; padding: 15px; border-radius: 8px; }

/* 移动端适配 */
@media screen and (max-width: 768px) {
    .pin-icon { font-size: 24px; }
    .pin-bubble { font-size: 11px; padding: 4px 8px; margin-bottom: 0; }
    .pin-ripple { width: 14px; height: 7px; }
    .modal-card { max-width: 90%; }
}
/* 美化滚动条 (Webkit核心浏览器: Chrome, Safari, Edge) */
.modal-content::-webkit-scrollbar {
    width: 6px; /* 滚动条变细 */
}

.modal-content::-webkit-scrollbar-track {
    background: transparent; 
}

.modal-content::-webkit-scrollbar-thumb {
    background-color: #d1d5db; /* 浅灰色滑块 */
    border-radius: 20px;       /* 圆角 */
}

.modal-content::-webkit-scrollbar-thumb:hover {
    background-color: #9ca3af; /* 悬停变深 */
}
/* =========================================
   🔔 推送开关样式 (iOS Style)
   ========================================= */
.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #F9FAFB;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid #E5E7EB;
}

.icon-box-sm {
    width: 32px; height: 32px;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
}

/* 开关容器 */
.switch-toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

/* 隐藏默认 checkbox */
.switch-toggle input { 
    opacity: 0;
    width: 0;
    height: 0;
}

/* 滑块 */
.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #E5E7EB; /* 关闭时的灰色 */
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* 开启状态 */
input:checked + .slider {
    background-color: #4F46E5; /* 主题色 */
}

input:checked + .slider:before {
    transform: translateX(20px);
}