body { 
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; 
}

/* =========================================
   电脑端 (Desktop) 覆盖样式
   ========================================= */
@media (min-width: 768px) {
    .product-card-desktop img { transition: transform 0.3s; }
    .product-card-desktop:hover img { transform: scale(1.05); }
}

/* =========================================
   手机端 (Mobile) 专属样式
   ========================================= */
@media (max-width: 767.98px) {
    body { 
        background-color: #fff;
        padding-bottom: 75px; /* 给底部导航栏留出空间 */
    }
    /* =========================================
   手机端全局留白调整
   ========================================= */
@media (max-width: 767.98px) {
    /* 给普通页面的主要 container 增加左右边距 */
    main.container {
        padding-left: 16px !important;
        padding-right: 16px !important;
    }

    /* 让原本内部带 mx-n3（负边距）的模块恢复正常，避免贴边 */
    .mx-n3 {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    /* 确保瀑布流不受影响（只有产品网格保持满屏） */
    .product-grid {
        margin-left: -16px;
        margin-right: -16px;
        padding: 10px 16px;
    }
}
    /* 隐藏桌面滚动条 */
    ::-webkit-scrollbar { display: none; }
    html { scrollbar-width: none; }

    /* 顶部搜索栏 */
    .app-top-bar {
        padding: 10px 15px 5px;
        background: #fff;
        position: sticky;
        top: 0;
        z-index: 1020;
    }
    .app-search-box {
        background: #f5f5f5;
        border-radius: 12px;
        display: flex;
        align-items: center;
        padding: 10px 15px;
        color: #666;
    }
    .app-search-box input {
        border: none;
        background: transparent;
        width: 100%;
        outline: none;
        margin-left: 10px;
        font-size: 15px;
    }

    /* 胶囊横滑栏 */
    .pill-scroll {
        display: flex;
        overflow-x: auto;
        gap: 10px;
        padding: 10px 15px;
        scrollbar-width: none;
        background: #fff;
        border-bottom: 1px solid #f0f0f0;
    }
    .pill-btn {
        white-space: nowrap;
        padding: 8px 16px;
        border-radius: 20px;
        border: 1px solid #ddd;
        color: #333;
        text-decoration: none;
        font-size: 14px;
        font-weight: 500;
        background: #fff;
    }
    .pill-btn.active { border-color: #00c2a8; color: #00c2a8; }

    /* App 双列网格 */
    .product-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        padding: 10px 15px;
    }
    .product-card {
        background: transparent;
        border: none;
        position: relative;
        text-decoration: none;
        color: inherit;
    }
    .product-img-wrap {
        position: relative;
        width: 100%;
        aspect-ratio: 3/4;
        border-radius: 12px;
        overflow: hidden;
        background: #f5f5f5;
    }
    .product-img-wrap img { width: 100%; height: 100%; object-fit: cover; }
    
    .fav-btn {
        position: absolute;
        bottom: 8px;
        right: 8px;
        background: rgba(255, 255, 255, 0.9);
        border-radius: 50%;
        height: 32px;
        padding: 0 8px;
        display: flex;
        align-items: center;
        justify-content: center;
        color: #333;
        border: none;
        font-size: 1.1rem;
    }
    .fav-btn.active { color: #e74c3c; }
    
    .product-info { padding-top: 8px; }
    .product-brand { font-size: 13px; color: #666; }
    .product-title { font-size: 14px; font-weight: 400; color: #111; margin-bottom: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
    .product-price { font-size: 15px; font-weight: 500; color: #111; }

    /* 底部 Tab 导航 */
    .bottom-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        background: #fff;
        border-top: 1px solid #eee;
        display: flex;
        justify-content: space-around;
        align-items: center;
        padding: 8px 0 15px;
        z-index: 1030;
    }
    .bottom-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        text-decoration: none;
        color: #777;
        font-size: 11px;
        gap: 4px;
    }
    .bottom-nav-item i { font-size: 1.4rem; }
    .bottom-nav-item.active { color: #00c2a8; }

    /* 隐藏电脑版的容器边距 */
        /* 页面通用边距 */
    main { 
        padding-left: 0 !important; 
        padding-right: 0 !important; 
    }
    
    /* 表单页面的专属边距 (解决贴边问题) */
    .app-form-container {
        padding-left: 16px !important;
        padding-right: 16px !important;
        padding-top: 10px;
        padding-bottom: 20px;
    }

    /* 让输入框变得圆润一点，更符合 App 风格 */
    .app-form-container .form-control,
    .app-form-container .form-select {
        border-radius: 10px;
        padding: 12px 16px;
        border-color: #e5e5e5;
        background-color: #fff;
        font-size: 15px;
    }
    
    .app-form-container .form-label {
        font-weight: 500;
        color: #333;
        margin-bottom: 8px;
    }

    /* 手机端隐藏输入框的默认蓝框聚焦，改为青绿色 */
    .app-form-container .form-control:focus,
    .app-form-container .form-select:focus {
        border-color: #00c2a8;
        box-shadow: 0 0 0 0.2rem rgba(0, 194, 168, 0.15);
    }
}

/* =========================================
   通用组件 (Hashtag、聊天框)
   ========================================= */
.chat-box { 
    background: #fff; 
    overflow-y: auto; 
    padding: 1rem; 
    display: flex;
    flex-direction: column;
}
.msg { 
    max-width: 80%; 
    padding: .5rem .8rem; 
    border-radius: .8rem; 
    margin-bottom: .5rem; 
    word-wrap: break-word;
    font-size: 15px;
}
/* 替换为截图里的墨绿色 */
.msg-me { 
    margin-left: auto; 
    background: #007b83 !important; 
    color: #fff; 
    border-bottom-right-radius: 0; /* 右下角变尖，更像聊天气泡 */
}
.msg-other { 
    background: #f1f1f1 !important; 
    color: #111; 
    border: none !important; 
    border-bottom-left-radius: 0; /* 左下角变尖 */
}

/* 聊天图片样式 */
.chat-image {
    max-width: 200px;
    border-radius: 8px;
    display: block;
    margin-bottom: 5px;
    cursor: pointer;
    transition: opacity 0.2s;
}
.chat-image:hover { opacity: 0.9; }

/* 电脑端聊天框固定高度 */
@media (min-width: 768px) {
    .chat-box {
        height: 500px; 
        border-radius: 12px !important;
        border: 1px solid #eee;
    }
}

/* 手机端聊天框自动撑开，输入框固定 */
@media (max-width: 767.98px) {
    .chat-box {
        border-radius: 0 !important;
        min-height: calc(100vh - 380px); /* 适配手机高度 */
    }
    #chatForm {
        position: sticky;
        bottom: 65px; /* 避开底部导航栏 */
        z-index: 100;
    }
}

.hashtag {
  display: inline-block; color: #00c2a8; background: rgba(0, 194, 168, .08);
  padding: 0 4px; border-radius: 4px; font-weight: 500; text-decoration: none;
}
.hashtag:hover { background: rgba(0, 194, 168, .18); color: #009f8a; }
.msg-me .hashtag { color: #fff; background: rgba(255, 255, 255, .2); }
@media (max-width: 767.98px) {
    /* 强制给所有页面增加左右 16px 的内边距 */
    .app-page-padding {
        padding-left: 16px !important;
        padding-right: 16px !important;
    }

    /* 修复底部按钮被 Tab 栏挡住的问题：给所有页面底部留出 90px 空间 */
    main {
        padding-bottom: 90px !important; 
    }

    /* 手机端输入框美化 */
    .form-control, .form-select {
        border-radius: 10px;
        padding: 12px 16px;
        font-size: 16px; /* 防止 iOS 点击自动放大 */
        border: 1px solid #e5e5e5;
    }
}
@media (max-width: 767.98px) {
    /* 底部操作栏背景与阴影 */
    .bottom-action-bar {
        position: fixed; 
        bottom: 0; 
        left: 0; 
        width: 100%;
        background: #fff; 
        padding: 12px 16px; 
        box-shadow: 0 -4px 12px rgba(0,0,0,0.06); 
        z-index: 1050;
        display: flex; 
        gap: 10px; 
        align-items: center;
        border-top-left-radius: 20px;
        border-top-right-radius: 20px;
    }

    /* 适配苹果底部安全区 */
    .pb-safe {
        padding-bottom: calc(12px + env(safe-area-inset-bottom)) !important;
    }

    /* 给页面主体增加底部内边距，防止内容被悬浮栏遮挡 */
    main.container {
        padding-bottom: 100px !important;
    }
}

/* 💡 核心：在商品详情页隐藏原本底部固定的 App Tab 导航 */
/* 通过 JS 自动给当前页面 body 打标签来实现，避免样式冲突 */
body.hide-bottom-nav .bottom-nav {
    display: none !important;
}
/* =========================================
   强制修复移动端（包含 Safari）贴边问题
   ========================================= */
@media screen and (max-width: 767.98px) {
    /* 强制给所有包含 container 的父级增加内边距 */
    body > main,
    body > .container,
    body > .container-fluid,
    main.container,
    .app-page-padding {
        padding-left: 16px !important;
        padding-right: 16px !important;
        overflow-x: hidden !important; /* 防止撑破屏幕 */
    }

    /* 强制清除 Bootstrap row 带来的负边距，这是导致贴边的罪魁祸首 */
    .row {
        margin-left: -8px !important;
        margin-right: -8px !important;
    }
    .row > [class*="col-"] {
        padding-left: 8px !important;
        padding-right: 8px !important;
    }

    /* 确保卡片、表单控件不会被外部挤压 */
    .card,
    .form-control,
    .form-select,
    .list-group {
        border-radius: 12px;
    }
}
/* 聊天页面专用排版 */
@media (max-width: 767.98px) {
    /* 让整个聊天区域撑满屏幕 */
    .chat-box {
        overflow-y: auto;
        display: flex;
        flex-direction: column;
    }
    
    /* 针对全面屏手机底部安全区增加内边距 */
    .sticky-bottom {
        padding-bottom: calc(10px + env(safe-area-inset-bottom)) !important;
    }
}
/* 聊天里的链接样式（适配深色和浅色气泡） */
.chat-message a, .msg a {
    color: #fff !important;
    text-decoration: underline;
    font-weight: bold;
    word-break: break-all; /* 防止长链接撑破气泡 */
}
/* 对方发的消息（浅灰底色），链接用主题青色 */
.msg-other a {
    color: #007b83 !important;
}
/* 如果是系统提示中的独立链接 */
.chat-message a:hover, .msg a:hover {
    opacity: 0.8;
}