/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-attachment: fixed;
    color: #333;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.page {
    display: none;
    min-height: 100vh;
    padding-bottom: 140px;
    animation: fadeIn 0.3s ease-in-out;
    /* 移动端优化 */
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.page.active {
    display: block;
}

/* 登录页 */
.login-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 40px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-header {
    text-align: center;
    color: white;
    margin-bottom: 60px;
    animation: fadeInDown 0.8s ease-out;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-header h1 {
    font-size: 32px;
    margin-bottom: 10px;
}

.login-header p {
    font-size: 16px;
    opacity: 0.9;
}

.login-tip {
    color: white;
    margin-top: 20px;
    font-size: 14px;
    opacity: 0.8;
}

.wechat-icon {
    margin-right: 8px;
}

/* 按钮 */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:active::after {
    width: 300px;
    height: 300px;
}

.btn:active {
    transform: scale(0.96);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #5568d3 0%, #6a3f8f 100%);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
    transform: translateY(-2px);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: #f0f0f0;
    color: #333;
}

.btn-lg {
    padding: 16px 48px;
    font-size: 18px;
    width: 100%;
    max-width: 300px;
}

/* 顶部栏 */
.header {
    background: white;
    padding: 15px 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header h2 {
    font-size: 16px;
    color: #333;
    margin: 0;
    line-height: 1;
}

.header-logo {
    width: 24px !important;
    height: 24px !important;
    border-radius: 4px;
    object-fit: cover;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
    transition: transform 0.3s;
    display: inline-block;
    vertical-align: middle;
}

.header-logo:hover {
    transform: scale(1.1) rotate(5deg);
}

/* 搜索框 */
.search-bar {
    position: relative;
    padding: 12px 15px;
    background: white;
    border-bottom: 1px solid #f0f0f0;
}

#searchInput {
    width: 100%;
    padding: 10px 40px 10px 15px;
    border: 2px solid #e8e8e8;
    border-radius: 25px;
    font-size: 16px; /* 防止iOS缩放 */
    outline: none;
    transition: all 0.3s;
    background: #f8f9fa;
    /* 移动端优化 */
    -webkit-appearance: none;
    appearance: none;
}

#searchInput:focus {
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.search-clear-btn {
    position: absolute;
    right: 25px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    border: none;
    background: #999;
    color: white;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.search-clear-btn:hover {
    background: #666;
    transform: translateY(-50%) scale(1.1);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #667eea;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
}

/* 分类标签 */
.category-tabs {
    display: flex;
    background: white;
    padding: 10px;
    gap: 10px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

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

.tab {
    padding: 8px 16px;
    border-radius: 20px;
    background: #f5f5f5;
    color: #666;
    font-size: 14px;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.3s;
}

.tab.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    transform: scale(1.05);
}

/* 商品列表 */
.product-list {
    padding: 15px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

@media (min-width: 480px) {
    .product-list {
        gap: 15px;
    }
}

@media (min-width: 768px) {
    .product-list {
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
        padding: 20px;
    }
}

.product-card {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    will-change: transform;
    -webkit-tap-highlight-color: transparent;
    /* 移动端触摸优化 */
    touch-action: manipulation;
    -webkit-touch-callout: none;
}

.product-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.product-card:hover::before {
    opacity: 1;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.25);
}

.product-card:active {
    transform: scale(0.96) translateY(0);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    transition: all 0.1s;
}

.product-image {
    width: 100%;
    height: 160px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 56px;
    position: relative;
    overflow: hidden;
}

.product-image::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.2) 0%, transparent 70%);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% {
        transform: translate(-50%, -50%) rotate(0deg);
    }
    100% {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

.product-info {
    padding: 12px;
    position: relative;
    z-index: 1;
}

.product-name {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #333;
    line-height: 1.4;
}

.product-price {
    color: #ff4d4f;
    font-size: 20px;
    font-weight: bold;
    text-shadow: 0 2px 4px rgba(255, 77, 79, 0.2);
    display: flex;
    align-items: baseline;
    gap: 2px;
}

.product-price::before {
    content: '¥';
    font-size: 14px;
}

.product-stock {
    font-size: 11px;
    color: #999;
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.product-stock::before {
    content: '📦';
    font-size: 10px;
}

/* 订单列表 */
.order-tabs {
    display: flex;
    background: white;
    padding: 10px;
    gap: 8px;
    border-bottom: 1px solid #f0f0f0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

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

.order-list {
    padding: 15px;
}

.order-card {
    background: white;
    border-radius: 16px;
    padding: 18px;
    margin-bottom: 15px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transition: all 0.3s;
    animation: slideIn 0.4s ease-out;
    border-left: 4px solid transparent;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.order-card:hover {
    box-shadow: 0 6px 16px rgba(0,0,0,0.15);
    transform: translateY(-2px);
    border-left-color: #667eea;
}

.order-card.status-pending {
    border-left-color: #fa8c16;
}

.order-card.status-paid {
    border-left-color: #1890ff;
}

.order-card.status-completed {
    border-left-color: #52c41a;
}

.order-card.status-cancelled {
    border-left-color: #d9d9d9;
}

.order-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f0f0f0;
    flex-wrap: wrap;
    gap: 8px;
}

.order-number {
    font-size: 13px;
    color: #666;
    font-family: 'Courier New', monospace;
    word-break: break-all;
}

.order-status {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.status-pending {
    background: #fff7e6;
    color: #fa8c16;
}

.status-paid {
    background: #e6f7ff;
    color: #1890ff;
}

.status-completed {
    background: #f6ffed;
    color: #52c41a;
}

.status-cancelled {
    background: #f5f5f5;
    color: #999;
}

.order-product {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
    padding: 10px;
    background: #fafafa;
    border-radius: 10px;
    transition: background 0.3s;
}

.order-card:hover .order-product {
    background: #f5f5f5;
}

.order-product-image {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.order-product-info {
    flex: 1;
}

.order-product-name {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
}

.order-product-quantity {
    font-size: 12px;
    color: #999;
}

.order-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 12px;
    border-top: 1px solid #f0f0f0;
    flex-wrap: wrap;
    gap: 10px;
}

.order-total {
    font-size: 18px;
    color: #ff4d4f;
    font-weight: bold;
    display: flex;
    align-items: baseline;
    gap: 2px;
}

.order-total::before {
    content: '合计:';
    font-size: 13px;
    color: #999;
    font-weight: normal;
}

.order-actions {
    display: flex;
    gap: 8px;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

/* 个人中心 */
.profile-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 35px 25px;
    color: white;
    display: flex;
    align-items: center;
    gap: 18px;
    position: relative;
    overflow: hidden;
}

.profile-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: rotate 20s linear infinite;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.profile-avatar {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: rgba(255,255,255,0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    border: 3px solid rgba(255,255,255,0.3);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    position: relative;
    z-index: 1;
    transition: transform 0.3s;
}

.profile-card:hover .profile-avatar {
    transform: scale(1.05) rotate(5deg);
}

.profile-info {
    flex: 1;
    position: relative;
    z-index: 1;
}

.profile-name {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 6px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.profile-id {
    font-size: 13px;
    opacity: 0.95;
    background: rgba(255,255,255,0.15);
    padding: 4px 10px;
    border-radius: 12px;
    display: inline-block;
}

.menu-list {
    background: white;
    margin-top: 15px;
}

.menu-item {
    display: flex;
    align-items: center;
    padding: 18px 20px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}

.menu-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    transform: scaleY(0);
    transition: transform 0.3s;
}

.menu-item:active {
    background: #f5f5f5;
}

.menu-item:active::before {
    transform: scaleY(1);
}

.menu-icon {
    font-size: 20px;
    margin-right: 12px;
}

.menu-label {
    flex: 1;
    font-size: 15px;
}

.menu-arrow {
    color: #999;
    font-size: 20px;
}

/* 底部导航 */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    display: flex;
    box-shadow: 0 -4px 12px rgba(0,0,0,0.1);
    z-index: 100;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.95);
    /* iPhone X 安全区域 */
    padding-bottom: env(safe-area-inset-bottom);
    padding-bottom: constant(safe-area-inset-bottom);
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 0;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    /* 移动端触摸优化 */
    min-height: 44px;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.nav-item.active {
    color: #667eea;
    transform: scale(1.1);
}

.nav-item:active {
    transform: scale(0.9);
    transition: transform 0.1s;
}

.nav-icon {
    font-size: 24px;
    margin-bottom: 4px;
}

.nav-label {
    font-size: 12px;
}

/* 弹窗 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    transition: opacity 0.3s ease;
}

.modal.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: white;
    border-radius: 20px;
    width: 100%;
    max-width: 450px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: modalSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    will-change: transform;
    /* 移动端优化 */
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #f0f0f0;
}

.modal-header h3 {
    font-size: 18px;
}

.close-btn {
    font-size: 28px;
    color: #999;
    cursor: pointer;
    line-height: 1;
}

.modal-body {
    padding: 20px;
}

.product-detail-image {
    width: 100%;
    height: 200px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 64px;
    margin-bottom: 15px;
}

.product-detail-price {
    font-size: 28px;
    color: #ff4d4f;
    font-weight: bold;
    margin-bottom: 15px;
}

.product-detail-desc {
    font-size: 14px;
    color: #666;
    line-height: 1.8;
    margin-bottom: 20px;
}

.quantity-selector {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.quantity-selector label {
    font-size: 14px;
    color: #666;
}

.qty-btn {
    width: 36px;
    height: 36px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 8px;
    font-size: 20px;
    cursor: pointer;
}

.quantity-selector input {
    width: 60px;
    height: 36px;
    text-align: center;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    /* 移动端优化 */
    -webkit-appearance: none;
    appearance: none;
}

.remark-input {
    margin-bottom: 20px;
}

.remark-input label {
    display: block;
    font-size: 14px;
    color: #666;
    margin-bottom: 8px;
}

.remark-input textarea {
    width: 100%;
    min-height: 80px;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 16px; /* 防止iOS自动缩放 */
    resize: vertical;
    font-family: inherit;
    /* 移动端优化 */
    -webkit-appearance: none;
    appearance: none;
    -webkit-overflow-scrolling: touch;
}

/* 图片上传 */
.image-upload {
    margin-bottom: 20px;
}

.image-upload label {
    display: block;
    font-size: 14px;
    color: #666;
    margin-bottom: 8px;
}

.upload-preview {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 12px;
}

.preview-item {
    position: relative;
    width: 100%;
    padding-top: 100%;
    border-radius: 8px;
    overflow: hidden;
    background: #f5f5f5;
}

.preview-item img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-item .remove-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    background: rgba(0,0,0,0.6);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-item .remove-btn:hover {
    background: rgba(255,0,0,0.8);
}

#imageInput {
    display: none;
}

.upload-tip {
    font-size: 12px;
    color: #999;
    margin-top: 8px;
}

.modal-footer {
    display: flex;
    gap: 12px;
    padding: 20px;
    border-top: 1px solid #f0f0f0;
}

.modal-footer .btn {
    flex: 1;
}

/* 加载状态 */
.loading {
    text-align: center;
    padding: 40px;
    color: #999;
}

/* 骨架屏 */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 8px;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.skeleton-card {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.skeleton-image {
    width: 100%;
    height: 160px;
}

.skeleton-content {
    padding: 12px;
}

.skeleton-title {
    height: 16px;
    margin-bottom: 8px;
    width: 80%;
}

.skeleton-price {
    height: 20px;
    margin-bottom: 6px;
    width: 40%;
}

.skeleton-text {
    height: 12px;
    width: 30%;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.empty-state .icon {
    font-size: 64px;
    margin-bottom: 16px;
}

/* 骨架屏加载效果 */
.skeleton-card {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: 8px;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.skeleton-image {
    width: 100%;
    height: 160px;
}

.skeleton-content {
    padding: 12px;
}

.skeleton-title {
    height: 16px;
    margin-bottom: 8px;
    width: 80%;
}

.skeleton-price {
    height: 20px;
    margin-bottom: 6px;
    width: 40%;
}

.skeleton-text {
    height: 12px;
    width: 60%;
}

/* 下拉刷新提示 */
.pull-refresh {
    text-align: center;
    padding: 10px;
    color: #999;
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.3s;
}

.pull-refresh.visible {
    opacity: 1;
}

.pull-refresh.refreshing {
    color: #667eea;
    animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* 加载指示器 */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(102, 126, 234, 0.2);
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.btn-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn-loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* 优化滚动条 */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.3);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(102, 126, 234, 0.5);
}

/* 平滑滚动 */
html {
    scroll-behavior: smooth;
}

/* 惯性滚动优化 */
.product-list,
.order-list,
.category-tabs {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

/* 全局输入框优化 */
input, textarea, select {
    /* 防止iOS缩放 */
    font-size: 16px;
}

/* 响应式 */
@media (max-width: 768px) {
    .product-list {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        padding: 10px;
    }
    
    .product-image {
        height: 140px;
    }
    
    .product-name {
        font-size: 13px;
    }
    
    .product-price {
        font-size: 18px;
    }
    
    /* 优化手机端间距 */
    .header {
        padding: 12px 15px;
    }
    
    .search-bar {
        margin: 10px 15px;
    }
    
    .category-tabs {
        padding: 8px 15px;
    }
}

/* 小屏幕手机优化 */
@media (max-width: 375px) {
    .product-list {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        padding: 8px;
    }
    
    .product-image {
        height: 120px;
        font-size: 48px;
    }
    
    .product-info {
        padding: 10px;
    }
    
    .product-name {
        font-size: 12px;
    }
    
    .product-price {
        font-size: 16px;
    }
    
    .btn-lg {
        padding: 14px 32px;
        font-size: 16px;
    }
}

/* iPhone X及以上安全区域适配 */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .page {
        padding-bottom: calc(70px + env(safe-area-inset-bottom));
    }
    
    .modal-content {
        max-height: calc(85vh - env(safe-area-inset-bottom));
        margin-bottom: env(safe-area-inset-bottom);
    }
}

/* 横屏模式优化 */
@media (max-height: 500px) and (orientation: landscape) {
    .login-container {
        min-height: auto;
        padding: 20px;
    }
    
    .login-header {
        margin-bottom: 30px;
    }
    
    .modal-content {
        max-height: 90vh;
    }
}

@media (min-width: 769px) {
    .product-list {
        grid-template-columns: repeat(3, 1fr);
    }
    
    body {
        max-width: 768px;
        margin: 0 auto;
        box-shadow: 0 0 20px rgba(0,0,0,0.1);
    }
}
