/* ============================================
   抓药药药材商城 - 统一样式表
   配色：主色#2d8659，价格红#e53935，背景#f5f5f0，卡片白#fff
   ============================================ */

/* 基础变量 */
:root {
    --primary: #2d8659;
    --primary-dark: #236b47;
    --primary-light: #e8f5ee;
    --price-red: #e53935;
    --bg-color: #f5f5f0;
    --card-bg: #ffffff;
    --text-dark: #333333;
    --text-gray: #666666;
    --text-light: #999999;
    --border-color: #e8e8e8;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 2px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 20px rgba(0,0,0,0.12);
    --max-width: 1200px;
}

/* 全局重置 */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-dark);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* 页面容器 */
.page-wrapper {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 16px;
}

/* 页面内边距（移动端） */
@media (max-width: 768px) {
    .page-wrapper {
        padding: 0 12px;
    }
}

/* ============================================
   通用卡片样式
   ============================================ */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 16px;
    overflow: hidden;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    font-size: 15px;
    color: var(--primary);
}

.card-body {
    padding: 16px 20px;
}

/* ============================================
   搜索栏 + 购物车
   ============================================ */
.shop-header {
    background: var(--card-bg);
    padding: 12px 16px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.shop-header-inner {
    padding: 0 16px;
    max-width: var(--max-width);
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 12px;
}

.search-box {
    flex: 1;
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 10px 36px 10px 14px;
    border: 1.5px solid var(--primary);
    border-radius: 20px;
    font-size: 14px;
    outline: none;
    background: #f9fdf9;
    transition: border-color 0.2s;
}

.search-box input:focus {
    border-color: var(--primary-dark);
    background: #fff;
}

.search-box .search-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--primary);
    font-size: 16px;
    cursor: pointer;
}

.cart-link {
    position: relative;
    color: var(--primary);
    text-decoration: none;
    font-size: 24px;
    padding: 4px;
}

.cart-badge {
    position: absolute;
    top: -4px;
    right: -8px;
    background: var(--price-red);
    color: #fff;
    border-radius: 10px;
    padding: 1px 6px;
    font-size: 11px;
    font-weight: 600;
    min-width: 18px;
    text-align: center;
}

/* ============================================
   Banner 轮播
   ============================================ */
.banner-wrapper {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 16px;
}

.banner-carousel {
    position: relative;
    width: 100%;
    aspect-ratio: 750 / 320;
    max-height: 320px;
    overflow: hidden;
    border-radius: var(--radius);
    background: linear-gradient(135deg, #2d8659 0%, #4CAF50 50%, #81C784 100%);
    box-shadow: var(--shadow-lg);
}

.banner-slides {
    display: flex;
    height: 100%;
    transition: transform 0.4s ease;
}

.banner-slide {
    min-width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.banner-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.banner-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,0.9);
    font-size: 18px;
    text-align: center;
    padding: 20px;
}

.banner-placeholder .banner-title {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 8px;
}

.banner-placeholder .banner-subtitle {
    font-size: 14px;
    opacity: 0.8;
}

.banner-dots {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
}

.banner-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255,255,255,0.5);
    cursor: pointer;
    transition: all 0.3s;
}

.banner-dot.active {
    background: #fff;
    width: 24px;
    border-radius: 4px;
}

.banner-arrows {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0 10px;
    pointer-events: none;
}

.banner-arrow {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.8);
    border: none;
    cursor: pointer;
    font-size: 18px;
    color: var(--primary);
    pointer-events: auto;
    opacity: 0;
    transition: opacity 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.banner-carousel:hover .banner-arrow {
    opacity: 1;
}

.banner-arrow:hover {
    background: #fff;
}

/* ============================================
   分类导航
   ============================================ */
.category-nav {
    max-width: var(--max-width);
    margin: 16px auto;
    padding: 0 16px;
}

.category-scroll {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 0;
}

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

.cat-item {
    flex-shrink: 0;
    padding: 7px 16px;
    background: var(--card-bg);
    border-radius: 20px;
    font-size: 13px;
    color: var(--text-gray);
    cursor: pointer;
    transition: all 0.25s;
    border: 1.5px solid transparent;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

.cat-item:hover {
    color: var(--primary);
    border-color: var(--primary-light);
}

.cat-item.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(45,134,89,0.3);
}

/* ============================================
   优惠券横幅
   ============================================ */
.coupon-banner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 16px;
}

.coupon-scroll {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 12px 0;
    scrollbar-width: none;
}

.coupon-scroll::-webkit-scrollbar { display: none; }

.coupon-item {
    flex-shrink: 0;
    display: flex;
    background: linear-gradient(135deg, #ff6b6b, #ee5a5a);
    border-radius: var(--radius-sm);
    overflow: hidden;
    min-width: 200px;
    box-shadow: 0 3px 10px rgba(255,107,107,0.3);
}

.coupon-item .coupon-left {
    padding: 12px 16px;
    background: rgba(255,255,255,0.15);
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 80px;
}

.coupon-item .coupon-value {
    font-size: 22px;
    font-weight: bold;
    color: #fff;
}

.coupon-item .coupon-cond {
    font-size: 11px;
    color: rgba(255,255,255,0.8);
}

.coupon-item .coupon-right {
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex: 1;
}

.coupon-item .coupon-name {
    font-size: 13px;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.coupon-item .coupon-btn {
    margin-top: 6px;
    padding: 4px 12px;
    background: #fff;
    border: none;
    border-radius: 12px;
    font-size: 12px;
    color: #ee5a5a;
    cursor: pointer;
    align-self: flex-start;
}

.coupon-item .coupon-btn:disabled {
    background: rgba(255,255,255,0.5);
    color: #fff;
    cursor: not-allowed;
}

/* ============================================
   商品网格
   ============================================ */
.medicine-grid-wrapper {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 16px;
}

.section-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-title::before {
    content: '';
    width: 4px;
    height: 20px;
    background: var(--primary);
    border-radius: 2px;
}

.more-link {
    color: var(--primary);
    text-decoration: none;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.more-link:hover {
    text-decoration: underline;
}

.medicine-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}

.medicine-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
}

.medicine-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.medicine-card .card-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.medicine-card .card-img {
    width: 100%;
    aspect-ratio: 1;
    overflow: hidden;
    background: #f9f9f9;
}

.medicine-card .card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.medicine-card:hover .card-img img {
    transform: scale(1.05);
}

.medicine-card .card-info {
    padding: 14px;
}

.medicine-card .card-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.medicine-card .card-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.medicine-card .card-tag {
    font-size: 11px;
    padding: 2px 8px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 4px;
}

.medicine-card .card-tag.grade {
    background: #fff3e0;
    color: #e65100;
}

.medicine-card .card-meta {
    font-size: 12px;
    color: var(--text-light);
    margin-bottom: 10px;
}

.medicine-card .card-meta span {
    margin-right: 10px;
}

.medicine-card .card-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.medicine-card .card-price {
    font-size: 18px;
    font-weight: bold;
    color: var(--price-red);
}

.medicine-card .card-price small {
    font-size: 12px;
    font-weight: normal;
    color: var(--text-light);
}

.medicine-card .add-cart-btn {
    padding: 8px 16px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 16px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s;
}

.medicine-card .add-cart-btn:hover {
    background: var(--primary-dark);
}

/* 查看更多按钮 */
.load-more-wrapper {
    text-align: center;
    padding: 24px 0;
}

.load-more-btn {
    display: inline-block;
    padding: 12px 40px;
    background: var(--card-bg);
    color: var(--primary);
    border: 1.5px solid var(--primary);
    border-radius: 24px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.25s;
    text-decoration: none;
}

.load-more-btn:hover {
    background: var(--primary);
    color: #fff;
}

/* ============================================
   商品详情页样式
   ============================================ */
.detail-container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 16px 80px;
}

/* 商品轮播 */
.detail-swiper {
    width: 100%;
    aspect-ratio: 1;
    max-height: 400px;
    position: relative;
    overflow: hidden;
    background: #f5f5f5;
    border-radius: var(--radius);
    margin-bottom: 16px;
}

.detail-swiper .swiper-slide {
    display: none;
    width: 100%;
    height: 100%;
}

.detail-swiper .swiper-slide.active {
    display: block;
}

.detail-swiper .swiper-slide img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.detail-swiper .swiper-dots {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
}

.detail-swiper .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(0,0,0,0.3);
    cursor: pointer;
}

.detail-swiper .dot.active {
    background: var(--primary);
    width: 20px;
    border-radius: 4px;
}

/* 价格区块 */
.price-section {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}

.price-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.price-big {
    font-size: 28px;
    font-weight: bold;
    color: var(--price-red);
}

.price-unit {
    font-size: 14px;
    color: var(--text-light);
}

.price-origin {
    font-size: 14px;
    color: var(--text-light);
    text-decoration: line-through;
    margin-left: 8px;
}

.coupon-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed var(--border-color);
}

.coupon-label {
    font-size: 13px;
    color: var(--text-gray);
}

.coupon-tag {
    padding: 4px 10px;
    background: linear-gradient(135deg, #ff6b6b, #ee5a5a);
    color: #fff;
    font-size: 12px;
    border-radius: 4px;
    cursor: pointer;
}

/* 商品信息 */
.info-section {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}

.goods-name {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 8px;
}

.goods-alias {
    font-size: 13px;
    color: var(--text-light);
    margin-bottom: 16px;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.info-item {
    display: flex;
    font-size: 13px;
}

.info-label {
    color: var(--text-light);
    width: 60px;
    flex-shrink: 0;
}

.info-val {
    color: var(--text-dark);
}

.info-val.grade {
    color: #e65100;
}

/* 服务保障 */
.service-bar {
    display: flex;
    justify-content: space-around;
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 14px 10px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
    font-size: 12px;
    color: var(--primary);
}

/* 详情图片 */
.detail-images-section {
    margin-bottom: 16px;
}

.detail-images-section .section-title {
    font-size: 16px;
    font-weight: 600;
    padding: 16px 20px;
    background: var(--card-bg);
    border-radius: var(--radius) var(--radius) 0 0;
    box-shadow: var(--shadow);
}

.detail-img-wrap {
    background: var(--card-bg);
    padding: 10px;
    margin-bottom: 2px;
}

.detail-img-wrap img {
    width: 100%;
    display: block;
}

/* 底部操作栏 */
.bottom-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--card-bg);
    display: flex;
    align-items: center;
    padding: 10px 16px;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
    box-shadow: 0 -2px 12px rgba(0,0,0,0.1);
    z-index: 1000;
}

.bottom-bar-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
}

.bottom-bar .bar-btn {
    text-decoration: none;
    color: var(--text-gray);
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 20px;
    padding: 4px 12px;
    position: relative;
}

.bottom-bar .bar-btn small {
    font-size: 10px;
    margin-top: 2px;
}

.bottom-bar .cart-dot {
    position: absolute;
    top: 0;
    right: 8px;
    width: 8px;
    height: 8px;
    background: var(--price-red);
    border-radius: 50%;
}

.bottom-bar .addcart {
    flex: 1;
    background: linear-gradient(135deg, #ff9800, #f57c00);
    color: #fff;
    border: none;
    border-radius: 20px;
    padding: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

.bottom-bar .buynow {
    flex: 1;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    border: none;
    border-radius: 20px;
    padding: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

/* SKU弹窗 */
.sku-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: none;
}

.sku-modal.open {
    display: block;
}

.sku-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.5);
}

.sku-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--card-bg);
    border-radius: var(--radius) var(--radius) 0 0;
    padding: 20px;
    padding-bottom: max(20px, env(safe-area-inset-bottom));
    max-height: 80vh;
    overflow-y: auto;
}

.sku-header {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.sku-thumb {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-sm);
    object-fit: cover;
}

.sku-price {
    flex: 1;
    font-size: 20px;
    color: var(--price-red);
    font-weight: bold;
}

.sku-price small {
    font-size: 14px;
    color: var(--text-light);
    font-weight: normal;
}

.sku-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 28px;
    height: 28px;
    border: none;
    background: var(--bg-color);
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    color: var(--text-gray);
}

.sku-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 8px;
    display: block;
}

.weight-options {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.weight-opt {
    padding: 8px 20px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    cursor: pointer;
    background: #f9f9f9;
    transition: all 0.2s;
}

.weight-opt:hover {
    border-color: var(--primary);
}

.weight-opt.active {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}

.qty-control {
    display: flex;
    align-items: center;
    gap: 0;
    margin-bottom: 16px;
}

.qty-control button {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border-color);
    background: #f5f5f5;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qty-control button:first-child {
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

.qty-control button:last-child {
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.qty-control input {
    width: 50px;
    height: 36px;
    text-align: center;
    border: 1px solid var(--border-color);
    border-left: none;
    border-right: none;
    font-size: 14px;
    outline: none;
}

.sku-total {
    font-size: 14px;
    color: var(--text-gray);
    margin-bottom: 16px;
}

.sku-total .total-price {
    color: var(--price-red);
    font-size: 18px;
    font-weight: 700;
}

.sku-confirm {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    border: none;
    border-radius: 24px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
}

/* ============================================
   购物车页面
   ============================================ */
.cart-page {
    padding-bottom: 100px;
}

.cart-empty {
    text-align: center;
    padding: 80px 20px;
}

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

.cart-empty p {
    color: var(--text-light);
    font-size: 16px;
    margin-bottom: 24px;
}

.cart-empty .btn-go {
    display: inline-block;
    padding: 12px 32px;
    background: var(--primary);
    color: #fff;
    text-decoration: none;
    border-radius: 24px;
    font-size: 15px;
}

.cart-list {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 16px;
}

.cart-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: var(--shadow);
    position: relative;
}

.cart-check {
    padding-top: 20px;
}

.cart-check input {
    width: 20px;
    height: 20px;
    accent-color: var(--primary);
}

.cart-thumb {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    background: #f5f5f5;
}

.cart-info {
    flex: 1;
    min-width: 0;
}

.cart-info h4 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cart-tags {
    display: flex;
    gap: 4px;
    margin-bottom: 6px;
}

.cart-tags .card-tag {
    font-size: 10px;
    padding: 2px 6px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 3px;
}

.cart-tags .card-tag.grade {
    background: #fff3e0;
    color: #e65100;
}

.cart-weight {
    font-size: 12px;
    color: var(--text-light);
    margin-bottom: 6px;
}

.cart-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cart-price {
    font-size: 15px;
    font-weight: 600;
    color: var(--price-red);
}

.cart-subtotal {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 4px;
}

.cart-del {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 24px;
    height: 24px;
    border: none;
    background: #f5f5f5;
    border-radius: 50%;
    color: var(--text-light);
    cursor: pointer;
    font-size: 14px;
}

.qty-control.mini button {
    width: 28px;
    height: 28px;
    font-size: 14px;
}

.qty-control.mini input,
.qty-control.mini span {
    width: 36px;
    height: 28px;
    line-height: 28px;
    font-size: 13px;
}

/* 底部结算 */
.cart-bottom {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--card-bg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
    box-shadow: 0 -2px 12px rgba(0,0,0,0.1);
    z-index: 100;
}

.cart-summary {
    font-size: 14px;
    color: var(--text-gray);
}

.cart-summary b {
    color: var(--text-dark);
}

.cart-summary .total-price {
    font-size: 18px;
    color: var(--price-red);
    font-weight: bold;
}

.checkout-btn {
    padding: 12px 32px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    border: none;
    border-radius: 24px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

/* ============================================
   确认订单/支付页等小卡片页面
   ============================================ */
.narrow-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 16px;
    padding-bottom: 100px;
}

.confirm-page, .pay-page, .result-page {
    padding-bottom: 100px;
}

.narrow-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}

.narrow-card .section-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--primary);
}

/* 订单商品项 */
.order-item {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px dashed var(--border-color);
}

.order-item:last-child {
    border-bottom: none;
}

.order-item-img {
    width: 70px;
    height: 70px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    background: #f5f5f5;
    flex-shrink: 0;
}

.order-item-info {
    flex: 1;
    min-width: 0;
}

.order-item-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 4px;
}

.order-item-spec {
    font-size: 12px;
    color: var(--text-light);
    margin-bottom: 8px;
}

.order-item-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.order-item-price {
    color: var(--price-red);
    font-weight: 600;
}

/* 价格行 */
.price-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 14px;
    color: var(--text-gray);
}

.price-row.total {
    border-top: 1px solid var(--border-color);
    margin-top: 8px;
    padding-top: 14px;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-dark);
}

.price-row .price-value {
    color: var(--price-red);
    font-size: 20px;
}

/* 收货地址 */
.address-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: #f8f9fa;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.2s;
}

.address-card:hover {
    background: #f0f0f0;
}

.address-info {
    flex: 1;
}

.address-name {
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 4px;
}

.address-name span {
    font-weight: normal;
    color: var(--text-gray);
    margin-left: 12px;
}

.address-detail {
    font-size: 13px;
    color: var(--text-light);
}

.address-arrow {
    font-size: 24px;
    color: var(--text-light);
}

.no-address {
    padding: 24px;
    text-align: center;
    color: var(--text-light);
    background: #f8f9fa;
    border-radius: var(--radius-sm);
}

.no-address a {
    color: var(--primary);
}

/* 备注输入 */
.remark-input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    resize: vertical;
    min-height: 80px;
    outline: none;
}

.remark-input:focus {
    border-color: var(--primary);
}

/* 底部提交栏 */
.bottom-bar-submit {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--card-bg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
    box-shadow: 0 -2px 12px rgba(0,0,0,0.1);
    z-index: 100;
}

.bottom-total {
    font-size: 14px;
    color: var(--text-gray);
}

.bottom-total .amount {
    font-size: 20px;
    color: var(--price-red);
    font-weight: bold;
}

.submit-btn {
    padding: 12px 36px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    border: none;
    border-radius: 24px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

/* 弹窗样式 */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    display: none;
    align-items: flex-end;
    justify-content: center;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: var(--card-bg);
    width: 100%;
    max-width: 800px;
    max-height: 80vh;
    border-radius: var(--radius) var(--radius) 0 0;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.modal-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-dark);
}

.modal-close {
    width: 28px;
    height: 28px;
    border: none;
    background: var(--bg-color);
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    color: var(--text-gray);
}

.address-list-item {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.2s;
}

.address-list-item:hover {
    background: #f8f9fa;
}

.address-list-item.selected {
    background: var(--primary-light);
}

.addr-name {
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 4px;
}

.addr-name span {
    font-weight: normal;
    color: var(--text-gray);
    margin-left: 12px;
}

.addr-default {
    font-size: 10px;
    background: var(--primary);
    color: #fff;
    padding: 2px 6px;
    border-radius: 3px;
    margin-left: 8px;
}

.addr-detail {
    font-size: 13px;
    color: var(--text-light);
}

.add-address-btn {
    display: block;
    padding: 16px;
    text-align: center;
    color: var(--primary);
    text-decoration: none;
    font-size: 14px;
}

/* 优惠券列表 */
.coupon-list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.2s;
}

.coupon-list-item:hover {
    background: #f8f9fa;
}

.coupon-list-item.selected {
    background: var(--primary-light);
}

.coupon-list-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.coupon-amount {
    font-size: 20px;
    font-weight: bold;
    color: var(--price-red);
    min-width: 70px;
}

.coupon-desc {
    flex: 1;
}

.coupon-name {
    font-size: 14px;
    color: var(--text-dark);
}

.coupon-condition {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 2px;
}

/* ============================================
   支付页面
   ============================================ */
.pay-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 24px 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}

.pay-amount {
    text-align: center;
    padding: 20px 0;
}

.pay-amount-label {
    font-size: 14px;
    color: var(--text-light);
}

.pay-amount-value {
    font-size: 36px;
    color: var(--price-red);
    font-weight: 700;
    margin-top: 8px;
}

.pay-amount-value .symbol {
    font-size: 18px;
}

.pay-order-no {
    font-size: 12px;
    color: var(--text-light);
    text-align: center;
    margin-top: 6px;
}

.pay-method {
    display: flex;
    align-items: center;
    padding: 16px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.pay-method:hover {
    border-color: var(--primary);
}

.pay-method.selected {
    border-color: var(--primary);
    background: var(--primary-light);
}

.pay-method-icon {
    width: 32px;
    height: 32px;
    margin-right: 14px;
}

.pay-method-name {
    flex: 1;
    font-size: 15px;
    font-weight: 500;
}

.pay-method-check {
    width: 22px;
    height: 22px;
    border: 2px solid var(--border-color);
    border-radius: 50%;
}

.pay-method.selected .pay-method-check {
    border-color: var(--primary);
    background: var(--primary);
    position: relative;
}

.pay-method.selected .pay-method-check::after {
    content: '✓';
    color: #fff;
    font-size: 12px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.wechat-tip {
    background: var(--primary-light);
    color: var(--primary);
    padding: 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-top: 10px;
}

/* ============================================
   支付结果页面
   ============================================ */
.result-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 40px 30px;
    text-align: center;
    box-shadow: var(--shadow-lg);
    max-width: 400px;
    margin: 0 auto;
}

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

.result-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 8px;
}

.result-desc {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 24px;
}

.result-btns {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    padding: 12px 28px;
    border-radius: 24px;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
}

.btn-secondary {
    background: var(--card-bg);
    color: var(--primary);
    border: 1.5px solid var(--primary);
    padding: 12px 28px;
    border-radius: 24px;
    font-size: 15px;
    text-decoration: none;
}

.spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

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

/* ============================================
   Toast 提示
   ============================================ */
.shop-toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.8);
    color: #fff;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 9999;
    animation: fadeIn 0.3s;
}

.shop-toast.error {
    background: rgba(229, 57, 53, 0.9);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translate(-50%, -50%) scale(0.9); }
    to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* ============================================
   相关推荐
   ============================================ */
.related-section {
    margin-top: 16px;
}

.related-scroll {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 12px 0;
    scrollbar-width: none;
}

.related-scroll::-webkit-scrollbar { display: none; }

.related-card {
    flex-shrink: 0;
    width: 120px;
    text-decoration: none;
    color: inherit;
}

.related-card img {
    width: 120px;
    height: 120px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    background: #f5f5f5;
}

.related-name {
    display: block;
    font-size: 13px;
    color: var(--text-dark);
    margin-top: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.related-price {
    display: block;
    font-size: 14px;
    color: var(--price-red);
    font-weight: 600;
    margin-top: 4px;
}

/* ============================================
   响应式适配
   ============================================ */
@media (max-width: 768px) {
    :root {
        --radius: 10px;
    }
    
    .medicine-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .medicine-card .card-info {
        padding: 10px;
    }
    
    .medicine-card .card-name {
        font-size: 14px;
    }
    
    .medicine-card .card-price {
        font-size: 16px;
    }
    
    .medicine-card .add-cart-btn {
        padding: 6px 10px;
        font-size: 12px;
    }
    
    .info-grid {
        grid-template-columns: 1fr;
    }
    
    .service-bar {
        flex-wrap: wrap;
        gap: 8px;
        justify-content: flex-start;
    }
    
    .service-bar span {
        padding: 4px 10px;
        background: var(--primary-light);
        border-radius: 12px;
    }
    
    .bottom-bar .bar-btn {
        padding: 4px 8px;
        font-size: 18px;
    }
    
    .cart-item {
        flex-wrap: wrap;
    }
    
    .cart-thumb {
        width: 70px;
        height: 70px;
    }
    
    .pay-amount-value {
        font-size: 28px;
    }
    
    .narrow-container {
        padding: 12px;
    }
    
    .narrow-card {
        padding: 16px;
    }
}

@media (max-width: 480px) {
    .medicine-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .medicine-card .card-img {
        aspect-ratio: 1;
    }
    
    .banner-carousel {
        border-radius: 0;
        margin: 0 -12px;
        max-height: 200px;
    }
}

.sale-section{margin:0 16px 16px;background:white;border-radius:12px;padding:12px 0;box-shadow:0 2px 8px rgba(0,0,0,0.05)}
.sale-header{padding:8px 16px 12px;display:flex;align-items:center}
.sale-title{font-size:16px;font-weight:700;color:#333}
.sale-scroll{white-space:nowrap}
.sale-list{display:inline-flex;gap:10px;padding:0 12px}
.sale-card{display:inline-flex;flex-direction:column;width:120px;background:#f9f9f6;border-radius:10px;overflow:hidden;flex-shrink:0}
.sale-img{width:120px;height:120px}
.sale-info{padding:8px}
.sale-name{font-size:12px;color:#333;font-weight:500;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.sale-prices{display:flex;align-items:baseline;gap:4px;margin-top:4px}
.sale-p{font-size:16px;font-weight:700;color:#e4393c}
.sale-orig{font-size:11px;color:#999;text-decoration:line-through}
.sale-w{font-size:10px;color:#999;margin-top:2px}
