/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2b7fd4;
    --primary-dark: #1a5a9a;
    --secondary-color: #f5f7fa;
    --text-color: #333;
    --text-light: #666;
    --border-color: #e4e7eb;
    --success-color: #52c41a;
    --warning-color: #faad14;
    --bg-gray: #f0f2f5;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.12);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB',
                'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background-color: var(--bg-gray);
    color: var(--text-color);
    line-height: 1.6;
    padding-bottom: 80px;
    padding-top: env(safe-area-inset-top, 0px);
    font-size: 17px;
}

/* 顶部导航栏 */
.header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo svg {
    width: 28px;
    height: 28px;
}

.site-name {
    font-size: 18px;
    font-weight: 600;
}

.header-tag {
    font-size: 17px;
    opacity: 0.9;
}

.order-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 17px;
    transition: all 0.3s;
}

.order-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* 左侧悬浮按钮 */
.sidebar-float {
    position: fixed;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 99;
}

.float-btn {
    background: var(--primary-color);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 17px;
    writing-mode: horizontal-tb;
    box-shadow: var(--shadow);
    transition: all 0.3s;
}

.float-btn:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}

.float-btn.complaint {
    background: #ff6b6b;
}

.float-btn.complaint:hover {
    background: #ee5a5a;
}

.float-btn.service {
    background: var(--success-color);
}

.float-btn.service:hover {
    background: #3cb615;
}

/* 右侧二维码 */
.qr-float {
    position: fixed;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    z-index: 99;
}

.qr-code {
    background: white;
    padding: 8px;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.qr-code img {
    width: 100px;
    height: 100px;
    display: block;
}

.qr-text {
    font-size: 17px;
    color: var(--text-light);
    background: white;
    padding: 4px 8px;
    border-radius: 4px;
}

/* 主容器 */
.main-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px 4px;
}

/* 卡片通用样式 */
.card {
    background: white;
    border-radius: 10px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.card-header {
    background: white;
    color: #333;
    padding: 12px 16px;
    font-weight: 600;
    font-size: 17px;
    border-bottom: 1px solid var(--border-color);
}

.card-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-title:not(.has-icon)::before {
    content: '';
    width: 4px;
    height: 16px;
    background: var(--primary-color);
    border-radius: 2px;
}

.title-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    fill: #2F88FF !important;
}

/* 商家信息 */
.merchant-details {
    padding: 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 17px;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-light);
}

.info-item .icon {
    font-size: 17px;
}

.verified {
    color: var(--success-color);
    font-weight: 600;
}

.amount {
    color: #ff6b6b;
    font-weight: 600;
}

/* 搜索区域 */
.search-box {
    padding: 16px;
    display: flex;
    gap: 10px;
}

.search-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 17px;
    outline: none;
    transition: border-color 0.3s;
}

.search-input:focus {
    border-color: var(--primary-color);
}

.search-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 17px;
    transition: background 0.3s;
}

.search-btn:hover {
    background: var(--primary-dark);
}

/* 分类标签 */
.category-tabs {
    padding: 12px 16px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.category-tab {
    background: var(--secondary-color);
    padding: 10px 16px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    border: 2px solid transparent;
    position: relative;
}

.category-tab.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

/* 选中状态的对勾图标 */
.category-tab.active::after {
    content: '';
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 14px;
    height: 14px;
    background: white;
    border-radius: 3px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.category-tab.active::before {
    content: '';
    position: absolute;
    bottom: 8px;
    right: 7px;
    width: 6px;
    height: 3px;
    background: transparent;
    border-left: 2px solid var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
    transform: rotate(-45deg);
    z-index: 1;
}

.tab-name {
    font-weight: 600;
    margin-right: 6px;
}

.tab-count {
    font-size: 17px;
    color: var(--text-light);
}

/* 商品网格 */
.product-grid {
    padding: 12px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    max-width: 100%;
    box-sizing: border-box;
}

.product-card {
    background: var(--secondary-color);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    width: 100%;
    min-width: 0;
}

.product-card:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-hover);
}

.product-card.selected {
    border-color: var(--primary-color);
    background: #e8f4fd;
}

/* 选中状态的蓝色三角形对勾 */
.product-card.selected::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 0 28px 28px;
    border-color: transparent transparent var(--primary-color) transparent;
    border-radius: 0 0 6px 0;
}

.product-card.selected::before {
    content: '';
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    z-index: 1;
}

.product-card.hot .product-badge {
    display: block;
}

.product-badge {
    display: none;
    background: linear-gradient(135deg, #ff6b6b, #ee5a5a);
    color: white;
    font-size: 17px;
    padding: 2px 6px;
    border-radius: 4px;
    margin-bottom: 6px;
}

.product-name {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-color);
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap !important;
    display: block;
    width: 100%;
    max-height: 1.4em;
}

.product-price {
    color: #ff6b6b;
    font-weight: 700;
    font-size: 17px;
    margin-bottom: 4px;
}

.product-stock {
    font-size: 17px;
}
.product-stock.zero { color: #ff4d4f; }
.product-stock.has-stock { color: var(--success-color); }

.product-item-row {
    padding: 14px 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.item-name {
    font-size: 17px;
    color: var(--text-color);
}

.item-price {
    color: #ff6b6b;
    font-weight: 600;
}

/* 商品描述 */
.description-content {
    padding: 16px;
}

/* 描述段落样式 */
.description-content .desc-paragraph {
    font-size: 17px;
    color: var(--text-light);
    line-height: 1.8;
    margin-bottom: 12px;
}

/* 描述图片样式 */
.description-content .desc-images {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.description-content .desc-images img {
    max-width: 100%;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    max-height: 400px;
    object-fit: contain;
}

/* 序号列表样式 */
.description-content .desc-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.description-content .desc-list-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 12px;
    font-size: 17px;
    color: var(--text-light);
    line-height: 1.6;
}

.description-content .desc-list-item:last-child {
    margin-bottom: 0;
}

/* 蓝色序号圆圈 */
.description-content .desc-number {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    margin-top: 2px;
}

.description-content .desc-number-text {
    flex: 1;
}

/* 购买表单 */
.form-group {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
}

.form-group:last-child {
    border-bottom: none;
}

.form-label {
    display: block;
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text-color);
}

.required {
    color: #ff6b6b;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 17px;
    outline: none;
    transition: border-color 0.3s;
}

.form-input:focus {
    border-color: var(--primary-color);
}

.form-hint {
    display: block;
    font-size: 17px;
    color: var(--text-light);
    margin-top: 8px;
}

.checkbox-group {
    display: flex;
    gap: 20px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 17px;
}

.checkbox-input {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.payment-methods {
    display: flex;
    gap: 12px;
}

.payment-item {
    flex: 0 0 25%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.payment-item:hover {
    border-color: var(--primary-color);
}

.payment-item.active {
    border-color: var(--primary-color);
    background: #e8f4fd;
}

.payment-item input {
    display: none;
}

.payment-icon {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    font-weight: 700;
    color: white;
}

.payment-icon svg {
    width: 22px;
    height: 22px;
    fill: white;
}

.payment-icon.alipay {
    background: linear-gradient(135deg, #1677ff, #4096ff);
}

.payment-icon.wechat {
    background: linear-gradient(135deg, #07c160, #52d68a);
}

.payment-name {
    font-size: 17px;
    color: var(--text-color);
}

/* 底部支付栏 */
.bottom-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    padding: 6px 120px;
    padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px));
    z-index: 100;
}

.bottom-info {
    display: none;
}

.bottom-text {
    font-size: 17px;
    color: var(--text-light);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.bottom-actions {
    display: flex;
    align-items: center;
    gap: 100px;
}

.bottom-text {
    flex: 1;
    font-size: 17px;
    color: var(--text-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 350px;
}

.quantity-control {
    display: flex;
    align-items: center;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
}

.price-info {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
}

.price-label {
    font-size: 17px;
    color: var(--text-light);
}

.price-value {
    font-size: 22px;
    font-weight: 700;
    color: #ff6b6b;
}

.fee {
    font-size: 17px;
    color: var(--text-light);
}

.qty-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: var(--secondary-color);
    cursor: pointer;
    font-size: 17px;
    color: var(--text-color);
    transition: background 0.3s;
}

.qty-btn:hover {
    background: var(--border-color);
}

.qty-input {
    width: 36px;
    height: 28px;
    border: none;
    border-left: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    text-align: center;
    font-size: 17px;
    outline: none;
}

.price-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.price-label {
    font-size: 17px;
    color: var(--text-light);
}

.price-value {
    font-size: 18px;
    font-weight: 700;
    color: #ff6b6b;
}

.fee {
    font-size: 17px;
    color: var(--text-light);
}

.pay-btn {
    background: linear-gradient(135deg, #ff6b6b, #ee5a5a);
    color: white;
    border: none;
    padding: 8px 24px;
    border-radius: 20px;
    font-size: 17px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.4);
    transition: all 0.3s;
    flex-shrink: 0;
}

.pay-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(255, 107, 107, 0.5);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .header-tag {
        display: none;
    }
    
    .sidebar-float,
    .qr-float {
        display: none;
    }
    
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .bottom-info {
        display: none;
    }
    
    .payment-methods {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 10px 12px;
    }
    
    .site-name {
        font-size: 17px;
    }
    
    .order-btn {
        padding: 6px 12px;
        font-size: 17px;
    }
    
    .main-container {
        padding: 8px;
    }
    
    .card {
        margin-bottom: 8px;
        border-radius: 8px;
    }
    
    .card-header {
        padding: 10px 12px;
        font-size: 17px;
    }
    
    .merchant-details {
        padding: 12px;
        gap: 10px;
        font-size: 17px;
    }
    
    .search-box {
        padding: 12px;
    }
    
    .search-input {
        padding: 10px 12px;
        font-size: 17px;
    }
    
    .search-btn {
        padding: 10px 16px;
        font-size: 17px;
    }
    
    .product-grid {
        padding: 8px;
        gap: 10px;
    }
    
    .product-card {
        padding: 12px;
    }
    
    .product-name {
        font-size: 17px;
    }
    
    .product-price {
        font-size: 17px;
    }
    
    .form-group {
        padding: 12px;
    }
    
    .form-label {
        font-size: 17px;
    }
    
    .form-input {
        padding: 10px 12px;
        font-size: 17px;
    }
    
    .bottom-bar {
        padding: 6px 20px;
        padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px));
        box-sizing: border-box;
    }
    
    .bottom-actions {
        gap: 20px;
        flex-wrap: nowrap;
    }
    
    .qty-btn, .qty-input {
        flex-shrink: 0;
    }
    
    .pay-btn {
        flex-shrink: 0;
        padding: 8px 16px;
        font-size: 17px;
    }
    
    .bottom-text {
        max-width: 150px;
        font-size: 17px;
    }
    
    .price-label {
        font-size: 17px;
    }
    
    .fee {
        font-size: 17px;
    }
    
    .qty-btn {
        width: 24px;
        height: 24px;
        font-size: 17px;
    }
    
    .qty-input {
        width: 28px;
        height: 24px;
        font-size: 17px;
    }
    
    .price-value {
        font-size: 17px;
    }
}

/* 隐藏PC端悬浮按钮在移动端 */
@media (max-width: 768px) {
    .sidebar-float,
    .qr-float {
        display: none !important;
    }
}

/* 隐藏移动端元素在PC端 */
@media (min-width: 769px) {
    .mobile-only {
        display: none;
    }
}
