/**
 * 知其然亲子研学 - H5网站全局样式
 * 主题色: #FF6B35 (橙色)
 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #FF6B35;
    --primary-light: #FF8F66;
    --primary-dark: #E55A28;
    --text: #333;
    --text-light: #666;
    --text-gray: #999;
    --bg: #f5f5f5;
    --bg-white: #fff;
    --border: #eee;
    --danger: #ff4d4f;
    --success: #52c41a;
}

/* ==================== 动画和过渡 ==================== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeOut {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(10px); }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(100%); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-100%); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* 淡入动画 */
.fade-in {
    animation: fadeIn 0.3s ease-out;
}

/* 滑动进入 */
.slide-up {
    animation: slideUp 0.3s ease-out;
}

/* 脉冲效果 */
.pulse {
    animation: pulse 2s infinite;
}

/* 过渡效果 */
.page {
    transition: opacity 0.3s ease;
}

.btn, .action-cart, .action-buy, .cart-submit, .footer-btn {
    transition: all 0.2s ease;
}

.btn:active, .action-cart:active, .action-buy:active {
    transform: scale(0.95);
    opacity: 0.9;
}

/* 购物车项目过渡 */
.cart-item {
    transition: all 0.3s ease;
}

.cart-item:active {
    background: #f9f9f9;
}

/* 商品卡片悬停/触摸效果 */
.goods-grid-item {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.goods-grid-item:active {
    transform: scale(0.98);
}

/* 加载动画 */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 107, 53, 0.3);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 10px;
}

/* Toast 提示动画 */
.global-toast {
    animation: fadeIn 0.3s ease-out;
}

/* 确认对话框动画 */
.confirm-modal {
    animation: fadeIn 0.2s ease-out;
}

.confirm-box {
    animation: slideUp 0.3s ease-out;
}

/* 空状态图标动画 */
.empty-icon {
    animation: pulse 2s infinite;
}

/* 图片加载过渡 */
img {
    transition: opacity 0.3s ease;
}

img[loading="lazy"] {
    opacity: 0;
}

img[loading="lazy"].loaded {
    opacity: 1;
}

/* 滚动条美化 */
::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 2px;
}

/* 安全区域适配 */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .tabbar {
        padding-bottom: env(safe-area-inset-bottom);
    }

    .order-footer, .cart-footer, .bottom-action {
        padding-bottom: calc(12px + env(safe-area-inset-bottom));
    }
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
    :root {
        --text: #e0e0e0;
        --text-light: #aaa;
        --text-gray: #777;
        --bg: #1a1a1a;
        --bg-white: #2a2a2a;
        --border: #3a3a3a;
    }

    body {
        background: var(--bg);
        color: var(--text);
    }
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    font-size: 14px;
    color: var(--text);
    background: var(--bg);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
    display: block;
}

/* 容器 */
.container {
    max-width: 750px;
    margin: 0 auto;
    padding: 0 12px;
}

/* 头部 */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.header-back {
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    cursor: pointer;
    transition: background 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.header-back:active {
    background: rgba(255, 255, 255, 0.35);
}

.header-back::before {
    content: '';
    display: block;
    width: 9px;
    height: 9px;
    border-top: 2.5px solid white;
    border-left: 2.5px solid white;
    transform: rotate(-45deg);
    margin-left: 3px;
}

.header-title {
    font-size: 17px;
    font-weight: 600;
    letter-spacing: 1px;
    flex: 1;
    text-align: center;
}

.header-right {
    min-width: 50px;
    text-align: right;
}

/* 底部导航 */
.tabbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    display: flex;
    border-top: 1px solid var(--border);
    z-index: 100;
    max-width: 750px;
    margin: 0 auto;
}

.tabbar-item {
    flex: 1;
    padding: 8px 0;
    text-align: center;
    font-size: 11px;
    color: var(--text-gray);
}

.tabbar-item.active {
    color: var(--primary);
}

.tabbar-item::before {
    content: '';
    display: block;
    width: 24px;
    height: 24px;
    margin: 0 auto 4px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.tabbar-item.home::before { background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 2.1L2.5 9.6c-.3.3-.4.7-.2 1 .1.4.5.6.9.5h.8V20c0 .6.4 1 1 1h4c.6 0 1-.4 1-1v-5h4v5c0 .6.4 1 1 1h4c.6 0 1-.4 1-1v-8.9h.8c.4 0 .8-.3.9-.6.1-.4 0-.8-.3-1L12 2.1z" fill="%23999" fill-opacity=".2"/><path d="M3 9l9-7 9 7v11a2 2 0 01-2 2H5a2 2 0 01-2-2z" fill="none" stroke="%23999" stroke-width="1.8" stroke-linejoin="round"/><path d="M9 22V12h6v10" fill="none" stroke="%23999" stroke-width="1.8" stroke-linejoin="round"/></svg>'); }
.tabbar-item.home.active::before { background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 2.1L2.5 9.6c-.3.3-.4.7-.2 1 .1.4.5.6.9.5h.8V20c0 .6.4 1 1 1h4c.6 0 1-.4 1-1v-5h4v5c0 .6.4 1 1 1h4c.6 0 1-.4 1-1v-8.9h.8c.4 0 .8-.3.9-.6.1-.4 0-.8-.3-1L12 2.1z" fill="%23FF6B35" fill-opacity=".15"/><path d="M3 9l9-7 9 7v11a2 2 0 01-2 2H5a2 2 0 01-2-2z" fill="none" stroke="%23FF6B35" stroke-width="1.8" stroke-linejoin="round"/><path d="M9 22V12h6v10" fill="none" stroke="%23FF6B35" stroke-width="1.8" stroke-linejoin="round"/></svg>'); }

.tabbar-item.goods::before { background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><rect x="1" y="4" width="22" height="16" rx="2" fill="%23999" fill-opacity=".15"/><rect x="1" y="4" width="22" height="5" rx="2" fill="%23999" fill-opacity=".25"/><rect x="1" y="4" width="22" height="16" rx="2" fill="none" stroke="%23999" stroke-width="1.8"/><line x1="1" y1="9.5" x2="23" y2="9.5" stroke="%23999" stroke-width="1.8"/><line x1="8" y1="13" x2="8" y2="19" stroke="%23999" stroke-width="1.6" stroke-linecap="round"/><line x1="16" y1="13" x2="16" y2="19" stroke="%23999" stroke-width="1.6" stroke-linecap="round"/></svg>'); }
.tabbar-item.goods.active::before { background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><rect x="1" y="4" width="22" height="16" rx="2" fill="%23FF6B35" fill-opacity=".1"/><rect x="1" y="4" width="22" height="5" rx="2" fill="%23FF6B35" fill-opacity=".2"/><rect x="1" y="4" width="22" height="16" rx="2" fill="none" stroke="%23FF6B35" stroke-width="1.8"/><line x1="1" y1="9.5" x2="23" y2="9.5" stroke="%23FF6B35" stroke-width="1.8"/><line x1="8" y1="13" x2="8" y2="19" stroke="%23FF6B35" stroke-width="1.6" stroke-linecap="round"/><line x1="16" y1="13" x2="16" y2="19" stroke="%23FF6B35" stroke-width="1.6" stroke-linecap="round"/></svg>'); }

.tabbar-item.space::before { background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 2l1.5 4.5L18 5l-2.5 4L19 11h-4.5L13 15.5 11.5 11H7l3.5-2L8 5l4.5 1.5z" fill="%23999" fill-opacity=".2"/><path d="M12 2l1.5 4.5L18 5l-2.5 4L19 11h-4.5L13 15.5 11.5 11H7l3.5-2L8 5l4.5 1.5z" fill="none" stroke="%23999" stroke-width="1.8" stroke-linejoin="round"/><circle cx="12" cy="12" r="10" fill="none" stroke="%23999" stroke-width=".8" stroke-dasharray="3 3" opacity=".4"/><circle cx="18" cy="6" r="1.2" fill="%23999" opacity=".4"/><circle cx="5" cy="16" r=".8" fill="%23999" opacity=".3"/></svg>'); }
.tabbar-item.space.active::before { background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 2l1.5 4.5L18 5l-2.5 4L19 11h-4.5L13 15.5 11.5 11H7l3.5-2L8 5l4.5 1.5z" fill="%23FF6B35" fill-opacity=".2"/><path d="M12 2l1.5 4.5L18 5l-2.5 4L19 11h-4.5L13 15.5 11.5 11H7l3.5-2L8 5l4.5 1.5z" fill="none" stroke="%23FF6B35" stroke-width="1.8" stroke-linejoin="round"/><circle cx="12" cy="12" r="10" fill="none" stroke="%23FF6B35" stroke-width=".8" stroke-dasharray="3 3" opacity=".3"/><circle cx="18" cy="6" r="1.2" fill="%23FF6B35" opacity=".35"/><circle cx="5" cy="16" r=".8" fill="%23FF6B35" opacity=".25"/></svg>'); }

.tabbar-item.course::before { background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 3.2L1.6 8 12 12.8 22.4 8z" fill="%23999" fill-opacity=".18"/><path d="M5.6 10.3v5c0 1.5 2.9 2.7 6.4 2.7s6.4-1.2 6.4-2.7v-5" fill="none" stroke="%23999" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"/><path d="M1.6 8L12 3.2 22.4 8 12 12.8z" fill="none" stroke="%23999" stroke-width="1.7" stroke-linejoin="round"/><path d="M22.4 8.2v5.6" fill="none" stroke="%23999" stroke-width="1.6" stroke-linecap="round"/></svg>'); }
.tabbar-item.course.active::before { background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 3.2L1.6 8 12 12.8 22.4 8z" fill="%23FF6B35" fill-opacity=".15"/><path d="M5.6 10.3v5c0 1.5 2.9 2.7 6.4 2.7s6.4-1.2 6.4-2.7v-5" fill="none" stroke="%23FF6B35" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"/><path d="M1.6 8L12 3.2 22.4 8 12 12.8z" fill="none" stroke="%23FF6B35" stroke-width="1.7" stroke-linejoin="round"/><path d="M22.4 8.2v5.6" fill="none" stroke="%23FF6B35" stroke-width="1.6" stroke-linecap="round"/></svg>'); }

.tabbar-item.user::before { background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><circle cx="12" cy="8" r="4" fill="%23999" fill-opacity=".15"/><path d="M4 22c0-4.4 3.6-8 8-8s8 3.6 8 8" fill="%23999" fill-opacity=".1"/><circle cx="12" cy="8" r="4" fill="none" stroke="%23999" stroke-width="1.8"/><path d="M4 22c0-4.4 3.6-8 8-8s8 3.6 8 8" fill="none" stroke="%23999" stroke-width="1.8" stroke-linecap="round"/></svg>'); }
.tabbar-item.user.active::before { background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><circle cx="12" cy="8" r="4" fill="%23FF6B35" fill-opacity=".15"/><path d="M4 22c0-4.4 3.6-8 8-8s8 3.6 8 8" fill="%23FF6B35" fill-opacity=".1"/><circle cx="12" cy="8" r="4" fill="none" stroke="%23FF6B35" stroke-width="1.8"/><path d="M4 22c0-4.4 3.6-8 8-8s8 3.6 8 8" fill="none" stroke="%23FF6B35" stroke-width="1.8" stroke-linecap="round"/></svg>'); }

/* ---- 右下角浮动购物车（首页 / 商品列表 / 商品详情） ----
   注意：这三个页面里 home / goods_list 有底部 tabbar（约 60px 高），
   goods_detail 底部是 .bottom-action（约 90px 高），所以 goods_detail 会在
   自己的 <style> 里把 bottom 覆盖成更大的值，避免遮挡。 */
.cart-float {
    position: fixed;
    right: max(16px, calc((100% - 750px) / 2 + 16px));
    bottom: 78px;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, #FF8A4C 0%, #FF6B35 100%);
    box-shadow: 0 6px 16px rgba(255, 107, 53, 0.38);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 95;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: transform .15s ease;
}
.cart-float:active { transform: scale(.92); }
.cart-float::before {
    content: '';
    display: block;
    width: 26px;
    height: 26px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M2 3h2.6l2.4 12.2a1.8 1.8 0 001.8 1.4h8.7a1.8 1.8 0 001.8-1.4L21 7H5.2" fill="none" stroke="%23fff" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round"/><circle cx="9.5" cy="20" r="1.5" fill="%23fff"/><circle cx="18.5" cy="20" r="1.5" fill="%23fff"/></svg>');
}
.cart-float-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: #fff;
    color: #FF6B35;
    font-size: 11px;
    font-weight: 600;
    line-height: 18px;
    text-align: center;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .18);
    display: none;
}
.cart-float-badge.show { display: block; }

/* 页面容器 */
.page {
    padding-bottom: 70px;
}

/* 卡片 */
.card {
    background: white;
    border-radius: 8px;
    margin: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.card-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 15px;
    font-weight: 500;
}

.card-body {
    padding: 16px;
}

/* 按钮 */
.btn {
    display: inline-block;
    padding: 10px 24px;
    border-radius: 4px;
    font-size: 14px;
    text-align: center;
    border: none;
    cursor: pointer;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:active {
    background: var(--primary-dark);
}

.btn-outline {
    background: white;
    border: 1px solid var(--primary);
    color: var(--primary);
}

.btn-block {
    display: block;
    width: 100%;
}

/* 表单 */
.form-item {
    padding: 12px 16px;
    background: white;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
}

.form-item:last-child {
    border-bottom: none;
}

.form-label {
    width: 80px;
    font-size: 14px;
    color: var(--text);
}

.form-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 14px;
    background: transparent;
}

.form-textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 10px;
    font-size: 14px;
    resize: vertical;
    min-height: 80px;
}

/* 列表 */
.list-item {
    padding: 12px 16px;
    background: white;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
}

.list-item:active {
    background: #f9f9f9;
}

.list-item:last-child {
    border-bottom: none;
}

/* 空状态 */
.empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-gray);
}

.empty-icon {
    font-size: 60px;
    margin-bottom: 16px;
}

.empty-text {
    font-size: 14px;
}

/* 加载更多 */
.load-more {
    text-align: center;
    padding: 16px;
    color: var(--text-gray);
    font-size: 13px;
}

/* 商品卡片 */
.goods-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    padding: 10px;
}

.goods-item {
    background: white;
    border-radius: 8px;
    overflow: hidden;
}

.goods-image {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
}

.goods-info {
    padding: 10px;
}

.goods-name {
    font-size: 13px;
    color: var(--text);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 36px;
    line-height: 18px;
}

.goods-price {
    color: var(--primary);
    font-size: 16px;
    font-weight: bold;
    margin-top: 8px;
}

.goods-price::before {
    content: '¥';
    font-size: 12px;
}

/* 订单卡片 */
.order-item {
    background: white;
    border-radius: 8px;
    margin: 10px;
    overflow: hidden;
}

.order-header {
    padding: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
}

.order-status {
    color: var(--primary);
    font-size: 13px;
}

.order-goods {
    padding: 12px;
}

.order-goods-item {
    display: flex;
    padding: 8px 0;
}

.order-goods-img {
    width: 60px;
    height: 60px;
    border-radius: 4px;
    object-fit: cover;
    margin-right: 10px;
}

.order-goods-info {
    flex: 1;
}

.order-goods-name {
    font-size: 13px;
    color: var(--text);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.order-goods-price {
    color: var(--primary);
    font-size: 14px;
    margin-top: 4px;
}

.order-footer {
    padding: 12px;
    text-align: right;
    border-top: 1px solid var(--border);
}

.order-total {
    font-size: 14px;
    color: var(--text);
}

.order-total strong {
    color: var(--primary);
    font-size: 16px;
}

/* 底部操作栏 */
.bottom-bar {
    position: fixed;
    bottom: 60px;
    left: 0;
    right: 0;
    background: white;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid var(--border);
    max-width: 750px;
    margin: 0 auto;
    z-index: 99;
}

.bottom-bar-price {
    font-size: 18px;
    color: var(--primary);
    font-weight: bold;
}

.bottom-bar-price::before {
    content: '¥';
    font-size: 12px;
}

/* 分类标签 */
.category-tabs {
    display: flex;
    overflow-x: auto;
    background: white;
    padding: 10px 12px;
    gap: 10px;
    -webkit-overflow-scrolling: touch;
}

.category-tab {
    flex-shrink: 0;
    padding: 6px 16px;
    border-radius: 16px;
    font-size: 13px;
    background: #f5f5f5;
    color: var(--text);
}

.category-tab.active {
    background: var(--primary);
    color: white;
}

/* 搜索框 */
.search-box {
    display: flex;
    background: white;
    padding: 10px 12px;
    gap: 10px;
}

.search-input {
    flex: 1;
    height: 36px;
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 0 16px;
    font-size: 13px;
    outline: none;
}

.search-input:focus {
    border-color: var(--primary);
}

/* 轮播图 */
.banner {
    width: 100%;
    aspect-ratio: 16/9;
    overflow: hidden;
}

.banner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 间距工具类 */
.mt-10 { margin-top: 10px; }
.mt-15 { margin-top: 15px; }
.mb-10 { margin-bottom: 10px; }
.mb-15 { margin-bottom: 15px; }
.p-12 { padding: 12px; }
.p-16 { padding: 16px; }

/* 文字工具类 */
.text-primary { color: var(--primary); }
.text-gray { color: var(--text-gray); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.font-bold { font-weight: bold; }
.font-12 { font-size: 12px; }
.font-13 { font-size: 13px; }
.font-14 { font-size: 14px; }
.font-16 { font-size: 16px; }

/* Flex工具类 */
.flex { display: flex; }
.flex-1 { flex: 1; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }

/* ==================== 移动端适配优化 ==================== */

/* 1. 优化触摸目标大小（最小44px） */
.btn, .tabbar-item, .nav-item, .action-cart, .action-buy, 
.cart-submit, .footer-btn, .goods-grid-item, a, button, input, select {
    min-height: 44px;
    min-width: 44px;
}

/* 2. 优化字体大小，确保可读性 */
@media screen and (max-width: 320px) {
    body {
        font-size: 13px;
    }
    
    .goods-title, .goods-name {
        font-size: 13px;
    }
    
    .goods-price {
        font-size: 15px;
    }
}

@media screen and (min-width: 321px) and (max-width: 375px) {
    body {
        font-size: 14px;
    }
}

@media screen and (min-width: 376px) {
    body {
        font-size: 15px;
    }
}

/* 3. 优化间距，适应小屏幕 */
@media screen and (max-width: 375px) {
    .container, .page-container {
        padding: 10px;
    }
    
    .goods-grid {
        gap: 8px;
    }
    
    .tabbar {
        height: 50px;
    }
}

/* 4. 优化图片显示 */
img {
    max-width: 100%;
    height: auto;
}

/* 5. 优化表单元素（防止iOS缩放） */
input, textarea, select {
    font-size: 16px;
}

/* 6. 优化滚动 */
.page, .container {
    -webkit-overflow-scrolling: touch;
    overflow-scrolling: touch;
}

/* 7. 优化动画性能 */
.animated, .fade-in, .slide-up {
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

/* 8. 适配横屏 */
@media screen and (orientation: landscape) {
    .tabbar {
        padding-bottom: 0;
    }
}

/* 9. 适配大屏（平板） */
@media screen and (min-width: 768px) {
    .page {
        max-width: 750px;
        margin: 0 auto;
    }
    
    .goods-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* 10. 优化底部固定按钮 */
.bottom-fixed {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    padding: 10px 15px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
    background: var(--bg-white);
    border-top: 1px solid var(--border);
}

/* 11. 优化安全区域 */
.safe-area-top {
    padding-top: env(safe-area-inset-top);
}

.safe-area-bottom {
    padding-bottom: env(safe-area-inset-bottom);
}

/* 12. 优化触摸反馈 */
.btn:active, a:active, button:active {
    opacity: 0.7;
    transform: scale(0.98);
}

/* 13. 禁用长按弹出菜单 */
img, a, button, .no-select {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* 14. 优化文本选择 */
.text-select {
    -webkit-user-select: text;
    user-select: text;
}

/* 15. 优化页面切换动画 */
.page-enter {
    animation: slideInRight 0.3s ease-out;
}

.page-leave {
    animation: slideOutLeft 0.3s ease-out;
}

@keyframes slideInRight {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

@keyframes slideOutLeft {
    from { transform: translateX(0); }
    to { transform: translateX(-100%); }
}

/* 16. 优化加载状态 */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

/* 17. 优化空状态 */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

/* 18. 隐藏滚动条（移动端） */
::-webkit-scrollbar {
    display: none;
}
.justify-center { justify-content: center; }
