/* ========== 全局重置 ========== */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: #f5f6fa;
    color: #333;
    font-size: 14px;
    line-height: 1.6;
    padding-bottom: 60px;
}
a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }
ul { list-style: none; }

/* ========== 顶部 Header ========== */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    box-shadow: 0 2px 12px rgba(102, 126, 234, 0.3);
}
.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.logo {
    font-size: 18px;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 8px;
}
.logo i { font-size: 22px; }
.search-btn {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 13px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}
.search-btn:active { background: rgba(255,255,255,0.3); transform: scale(0.96); }

/* ========== 长条形下拉分类 ========== */
.category-dropdown {
    background: #fff;
    border-bottom: 1px solid #eee;
    position: sticky;
    top: 49px;
    z-index: 99;
}
.cat-dropdown-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    cursor: pointer;
    transition: background 0.15s;
    background: #fff;
}
.cat-dropdown-header:active { background: #f5f5fa; }
.cat-current {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    font-weight: 500;
    color: #333;
}
.cat-main-icon {
    font-size: 18px;
    color: #667eea;
    width: 22px;
    text-align: center;
}
.cat-arrow {
    font-size: 16px;
    color: #bbb;
    transition: transform 0.25s;
}
.category-dropdown.open .cat-arrow {
    transform: rotate(180deg);
    color: #667eea;
}
.cat-dropdown-menu {
    display: none;
    background: #fff;
    border-top: 1px solid #f0f0f0;
    max-height: 320px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.category-dropdown.open .cat-dropdown-menu { display: block; }
.cat-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 18px;
    font-size: 14px;
    color: #555;
    border-bottom: 1px solid #f7f7fa;
    transition: background 0.12s;
    text-decoration: none;
}
.cat-menu-item:last-child { border-bottom: none; }
.cat-menu-item .cat-icon {
    font-size: 17px;
    color: #999;
    width: 22px;
    text-align: center;
    flex-shrink: 0;
}
.cat-menu-item span:nth-of-type(1) { flex: 1; }
.cat-menu-item .cat-check {
    font-size: 14px;
    color: #667eea;
    width: 18px;
    text-align: right;
    flex-shrink: 0;
}
.cat-menu-item.active {
    color: #667eea;
    font-weight: 500;
    background: #f5f7ff;
}
.cat-menu-item.active .cat-icon { color: #667eea; }
.cat-menu-item:active { background: #eef0f5; }

/* ========== 主体内容 ========== */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px 10px;
}

/* ========== 商品列表 - 响应式 ========== */
.goods-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);  /* 手机2列优先 */
    gap: 10px;
}
/* 平板 */
@media (min-width: 768px) {
    .goods-list {
        grid-template-columns: repeat(3, 1fr);
        gap: 14px;
    }
}
/* PC */
@media (min-width: 1024px) {
    .goods-list {
        grid-template-columns: repeat(4, 1fr);
        gap: 16px;
    }
    .main-content { padding: 18px; }
}
/* 大屏 */
@media (min-width: 1280px) {
    .goods-list {
        grid-template-columns: repeat(5, 1fr);
    }
}

.goods-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    transition: all 0.25s;
    cursor: pointer;
    display: flex;
    flex-direction: column;
}
.goods-card:active { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(102,126,234,0.18); }
@media (hover: hover) and (pointer: fine) {
    .goods-card:hover { transform: translateY(-3px); box-shadow: 0 8px 20px rgba(102,126,234,0.15); }
}
.goods-img {
    position: relative;
    width: 100%;
    padding-top: 100%;  /* 1:1 比例 */
    background: linear-gradient(135deg, #eef2ff, #fdf2ff);
    overflow: hidden;
}
.goods-img img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.goods-img-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #bbb;
    font-size: 42px;
}
.goods-info { padding: 10px 12px 12px; flex: 1; display: flex; flex-direction: column; }
.goods-name {
    font-size: 14px;
    color: #333;
    font-weight: 500;
    line-height: 1.4;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 38px;
}
.goods-price {
    color: #ff4757;
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 4px;
}
.goods-price::before { content: '¥'; font-size: 13px; font-weight: normal; margin-right: 2px; }
.goods-stock {
    font-size: 11px;
    color: #999;
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: auto;
}

/* ========== 空状态 ========== */
.empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: #999;
}
.empty i { font-size: 64px; margin-bottom: 16px; color: #ccc; }
.empty p { font-size: 15px; }

/* ========== 底部 ========== */
.footer {
    text-align: center;
    color: #bbb;
    font-size: 12px;
    padding: 20px 16px 4px;
}

/* ========== 商品详情页 ========== */
.detail-container { max-width: 1200px; margin: 0 auto; padding: 12px 14px; }
.detail-card {
    background: #fff;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
    margin-bottom: 12px;
}
.detail-banner {
    width: 100%;
    aspect-ratio: 4 / 3;
    background: linear-gradient(135deg, #eef2ff, #fdf2ff);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.detail-banner img { width: 100%; height: 100%; object-fit: cover; }
.detail-banner i { font-size: 80px; color: #ccc; }
.detail-info { padding: 16px; }
.detail-name {
    font-size: 18px;
    color: #333;
    font-weight: bold;
    margin-bottom: 10px;
    line-height: 1.4;
}
.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-top: 1px dashed #f0f0f0;
}
.detail-row:first-child { border-top: none; }
.detail-row .label { color: #888; font-size: 13px; }
.detail-row .value { color: #333; font-weight: 500; }
.detail-price {
    color: #ff4757;
    font-size: 26px;
    font-weight: bold;
}
.detail-price::before { content: '¥'; font-size: 16px; }
.detail-price sup { font-size: 13px; color: #999; margin-left: 8px; font-weight: normal; text-decoration: line-through; }

.section {
    background: #fff;
    border-radius: 14px;
    margin-bottom: 12px;
    overflow: hidden;
}
.section-title {
    padding: 14px 16px;
    font-size: 15px;
    font-weight: bold;
    border-bottom: 1px solid #f5f5f5;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
}
.section-title i { color: #667eea; }
.section-body { padding: 14px 16px; color: #555; line-height: 1.8; font-size: 14px; }
.section-body img { max-width: 100%; border-radius: 8px; }

/* 数量选择 */
.qty-box {
    display: flex;
    align-items: center;
    gap: 0;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
}
.qty-box button {
    width: 38px;
    height: 34px;
    border: none;
    background: #f5f6fa;
    color: #555;
    font-size: 18px;
    cursor: pointer;
}
.qty-box button:active { background: #e5e6ea; }
.qty-box input {
    width: 56px;
    height: 34px;
    text-align: center;
    border: none;
    border-left: 1px solid #eee;
    border-right: 1px solid #eee;
    font-size: 15px;
    outline: none;
    background: #fff;
}
.qty-box input::-webkit-outer-spin-button,
.qty-box input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* 底部操作栏 */
.action-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    padding: 10px 14px;
    display: flex;
    gap: 10px;
    border-top: 1px solid #eee;
    box-shadow: 0 -2px 12px rgba(0,0,0,0.06);
    z-index: 100;
}
.btn-back {
    flex-shrink: 0;
    width: 46px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f6fa;
    color: #666;
    border-radius: 23px;
    font-size: 18px;
}
.btn-buy {
    flex: 1;
    height: 46px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    border-radius: 23px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-buy:active { transform: scale(0.97); opacity: 0.9; }
.btn-buy:disabled { background: #ccc; }

/* ========== 确认下单页 ========== */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    font-size: 13px;
    color: #666;
    margin-bottom: 8px;
    font-weight: 500;
}
.form-group label .req { color: #ff4757; }
.form-group input, .form-group textarea, .form-group select {
    width: 100%;
    padding: 12px 14px;
    background: #f8f9fa;
    border: 1px solid #eef0f4;
    border-radius: 10px;
    font-size: 14px;
    outline: none;
    transition: all 0.2s;
    color: #333;
}
.form-group input:focus, .form-group textarea:focus {
    background: #fff;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102,126,234,0.1);
}
.pay-types {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.pay-item {
    flex: 1;
    min-width: calc(50% - 5px);
    padding: 14px;
    border: 2px solid #eef0f4;
    border-radius: 12px;
    background: #fafbfc;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}
.pay-item.active {
    border-color: #667eea;
    background: #f0f4ff;
    color: #667eea;
}
.pay-small-icon {
    font-size: 22px;
    display: block;
    margin-bottom: 8px;
}
.pay-small-icon.alipay-small { color: #1677ff; }
.pay-small-icon.wechat-small { color: #07c160; }
.pay-item.active .pay-small-icon.alipay-small { color: #667eea; }
.pay-item.active .pay-small-icon.wechat-small { color: #667eea; }
.pay-item .pay-icon {
    display: inline-block;
    font-size: 15px;
    font-weight: 700;
    padding: 6px 14px;
    border-radius: 8px;
    margin-bottom: 8px;
    color: #fff;
    letter-spacing: 1px;
}
.pay-item .alipay-icon {
    background: linear-gradient(135deg, #1677ff 0%, #4096ff 100%);
}
.pay-item .wechat-icon {
    background: linear-gradient(135deg, #07c160 0%, #09de6c 100%);
}
.pay-item.active .alipay-icon, .pay-item.active .wechat-icon {
    opacity: 0.9;
    transform: scale(1.05);
}
.pay-item span { font-size: 13px; font-weight: 500; }

.order-summary {
    background: #fafbfc;
    border-radius: 12px;
    padding: 14px 16px;
}
.order-summary .row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 14px;
    color: #666;
}
.order-summary .row.total {
    border-top: 1px dashed #eee;
    margin-top: 6px;
    padding-top: 12px;
    color: #333;
    font-size: 16px;
    font-weight: bold;
}
.order-summary .row.total .price {
    color: #ff4757;
    font-size: 22px;
}

/* ========== 订单查询页 ========== */
.search-box {
    background: #fff;
    border-radius: 14px;
    padding: 16px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}
.tabs {
    display: flex;
    background: #f5f6fa;
    border-radius: 10px;
    padding: 4px;
    margin-bottom: 16px;
}
.tabs .tab {
    flex: 1;
    padding: 8px;
    text-align: center;
    font-size: 14px;
    border-radius: 8px;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
}
.tabs .tab.active {
    background: #fff;
    color: #667eea;
    font-weight: 500;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.order-list { margin-top: 16px; }
.order-card {
    background: #fff;
    border-radius: 12px;
    margin-bottom: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.order-card .order-head {
    padding: 12px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #f5f5f5;
    background: #fafbfc;
}
.order-card .order-sn {
    font-size: 12px;
    color: #999;
    font-family: monospace;
}
.order-status {
    padding: 3px 10px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 500;
}
.status-0 { background: #fff7e6; color: #fa8c16; } /* 待支付 */
.status-1, .status-2 { background: #f6ffed; color: #52c41a; } /* 已支付/发货 */
.status-3 { background: #fff1f0; color: #f5222d; }
.order-card .order-body { padding: 12px 14px; }
.order-card .order-title {
    font-size: 15px;
    color: #333;
    margin-bottom: 8px;
    font-weight: 500;
}
.order-card .order-meta {
    display: flex;
    justify-content: space-between;
    color: #888;
    font-size: 13px;
}
.order-card .cards-box {
    margin-top: 10px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    font-size: 13px;
}
.order-card .cards-box table { width: 100%; border-collapse: collapse; }
.order-card .cards-box th, .order-card .cards-box td {
    padding: 6px 4px;
    text-align: left;
    border-bottom: 1px dashed #eee;
    font-size: 12px;
    word-break: break-all;
}
.order-card .cards-box td { font-family: monospace; color: #667eea; }
.copy-btn {
    background: #fff;
    border: 1px solid #667eea;
    color: #667eea;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    margin-top: 8px;
}

/* ========== Toast ========== */
.toast {
    position: fixed;
    top: 30%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.8);
    color: #fff;
    padding: 12px 20px;
    border-radius: 8px;
    z-index: 9999;
    max-width: 80%;
    text-align: center;
    animation: toastIn 0.25s ease-out;
}
@keyframes toastIn {
    from { opacity: 0; transform: translate(-50%, -60%); }
    to { opacity: 1; transform: translate(-50%, -50%); }
}

/* ========== 订单成功页 ========== */
.success-page {
    text-align: center;
    padding: 40px 20px;
    background: #fff;
    border-radius: 14px;
    margin-bottom: 14px;
}
.success-page .s-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 16px;
    background: #52c41a;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 38px;
    box-shadow: 0 6px 16px rgba(82, 196, 26, 0.35);
}
.success-page h2 { font-size: 20px; color: #333; margin-bottom: 6px; }
.success-page p { color: #888; margin-bottom: 14px; font-size: 14px; }
.waiting .s-icon { background: #fa8c16; box-shadow: 0 6px 16px rgba(250,140,22,0.35); }

/* ========== 公告横幅 ========== */
.site-notice {
    background: linear-gradient(90deg, #fff9e6, #fff4d6);
    color: #8a6d00;
    padding: 10px 16px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid #ffe58f;
}
.site-notice i { color: #fa8c16; flex-shrink: 0; }
.site-notice p { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
