/* ============================================
   Mall CSS — 蝦皮模式商城樣式
   ============================================ */
.mall-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 16px 12px;
}

/* 搜尋欄 */
.mall-search {
    margin-bottom: 16px;
}
.mall-search form {
    display: flex;
    background: #fff;
    border: 2px solid #f97316;
    border-radius: 24px;
    overflow: hidden;
}
.mall-search input {
    flex: 1;
    padding: 10px 16px;
    border: none;
    outline: none;
    font-size: 14px;
}
.mall-search button {
    background: #f97316;
    color: #fff;
    border: none;
    padding: 10px 20px;
    font-size: 18px;
    cursor: pointer;
}

/* 分類圖示 */
.mall-categories {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 8px;
    background: #fff;
    padding: 16px 8px;
    border-radius: 12px;
    margin-bottom: 24px;
}
.mall-cat-item {
    text-align: center;
    text-decoration: none;
    color: #334155;
}
.mall-cat-icon {
    font-size: 28px;
    margin-bottom: 4px;
}
.mall-cat-name {
    font-size: 11px;
    color: #64748b;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 區塊 */
.mall-section {
    margin-bottom: 32px;
}
.mall-section-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.mall-section-head h2 {
    font-size: 20px;
    color: #0f172a;
}
.mall-section-head a {
    font-size: 13px;
    color: #f97316;
    text-decoration: none;
}

/* 精選商家 */
.mall-shop-scroll {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 4px 0 12px;
    scrollbar-width: thin;
}
.mall-shop-card {
    flex-shrink: 0;
    width: 100px;
    text-align: center;
    text-decoration: none;
    color: inherit;
}
.mall-shop-logo {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb, #1e40af);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: 700;
    margin: 0 auto 6px;
    overflow: hidden;
}
.mall-shop-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.mall-shop-name {
    font-size: 12px;
    font-weight: 600;
    color: #0f172a;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.mall-shop-count {
    font-size: 11px;
    color: #94a3b8;
}

/* 商品網格 */
.mall-product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
}
.mall-product-card {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: all .2s;
    display: block;
    box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.mall-product-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,.1);
}
.mall-product-img {
    aspect-ratio: 1;
    background: #f8fafc;
    overflow: hidden;
}
.mall-product-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.mall-product-body {
    padding: 8px 10px 12px;
}
.mall-product-title {
    font-size: 13px;
    color: #0f172a;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 36px;
    margin-bottom: 6px;
}
.mall-product-prices {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin-bottom: 4px;
}
.mall-price-original {
    font-size: 12px;
    color: #94a3b8;
    text-decoration: line-through;
}
.mall-price-final {
    font-size: 16px;
    font-weight: 700;
    color: #f97316;
}
.mall-product-meta {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #94a3b8;
}
.mall-seller {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 60%;
}

/* 子分類 */
.mall-subcats {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.mall-subcat {
    padding: 6px 14px;
    background: #fff;
    border-radius: 20px;
    text-decoration: none;
    color: #334155;
    font-size: 13px;
    border: 1px solid #e2e8f0;
    transition: all .15s;
}
.mall-subcat:hover {
    border-color: #f97316;
    color: #f97316;
}

/* 篩選 */
.mall-filter {
    background: #fff;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
}
.mall-select, .mall-input-sm {
    padding: 6px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 13px;
    outline: none;
}
.mall-input-sm {
    width: 80px;
}

/* 商家列表 */
.mall-shop-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}
.mall-shop-block {
    display: flex;
    gap: 14px;
    background: #fff;
    padding: 16px;
    border-radius: 12px;
    text-decoration: none;
    color: inherit;
    transition: all .2s;
}
.mall-shop-block:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,.08);
}
.mall-shop-block-logo {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    background: linear-gradient(135deg, #2563eb, #1e40af);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    font-weight: 700;
    flex-shrink: 0;
    overflow: hidden;
}
.mall-shop-block-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.mall-shop-block-name {
    font-size: 15px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 4px;
}
.mall-shop-block-desc {
    font-size: 12px;
    color: #64748b;
    margin-bottom: 6px;
}
.mall-shop-block-count {
    font-size: 12px;
    color: #f97316;
    font-weight: 600;
}

/* 商家專屬頁頭部 */
.mall-shop-header {
    display: flex;
    gap: 20px;
    background: #fff;
    padding: 20px;
    border-radius: 12px;
    align-items: center;
    flex-wrap: wrap;
}
.mall-shop-header-logo {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb, #1e40af);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    font-weight: 700;
    overflow: hidden;
    flex-shrink: 0;
}
.mall-shop-header-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.mall-shop-header-info {
    flex: 1;
    min-width: 200px;
}
.mall-shop-header-info h1 {
    font-size: 22px;
    color: #0f172a;
    margin-bottom: 6px;
}
.mall-shop-header-info p {
    font-size: 14px;
    color: #64748b;
    line-height: 1.6;
}

/* 商品詳情 */
.mall-product-detail {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    background: #fff;
    padding: 24px;
    border-radius: 12px;
}
.mall-product-images img#mainImg {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 8px;
    background: #f8fafc;
}
.mall-product-thumbs {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    margin-top: 12px;
}
.mall-product-thumbs img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 6px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all .15s;
}
.mall-product-thumbs img.active {
    border-color: #f97316;
}
.mall-product-detail-info h1 {
    font-size: 24px;
    color: #0f172a;
    margin-bottom: 16px;
    line-height: 1.4;
}
.mall-detail-prices {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 8px;
}
.mall-detail-original {
    font-size: 14px;
    color: #94a3b8;
    text-decoration: line-through;
}
.mall-detail-final {
    font-size: 32px;
    font-weight: 700;
    color: #f97316;
}
.mall-detail-discount {
    background: #fee2e2;
    color: #dc2626;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}
.mall-detail-stock {
    font-size: 13px;
    color: #64748b;
    margin: 16px 0;
}
.mall-detail-seller {
    background: #f8fafc;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
}
.mall-detail-qty {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}
.mall-detail-qty label {
    font-size: 14px;
    color: #64748b;
}
.qty-selector {
    display: inline-flex;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    overflow: hidden;
}
.qty-selector button {
    width: 36px;
    height: 36px;
    background: #f8fafc;
    border: none;
    cursor: pointer;
    font-size: 16px;
    color: #475569;
}
.qty-selector button:hover {
    background: #e2e8f0;
}
.qty-selector input {
    width: 60px;
    text-align: center;
    border: none;
    outline: none;
    font-size: 15px;
    font-weight: 600;
}
.mall-detail-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}
.mall-btn-cart, .mall-btn-buy {
    flex: 1;
    padding: 14px;
    font-size: 15px;
    font-weight: 700;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all .15s;
}
.mall-btn-cart {
    background: #eff6ff;
    color: #2563eb;
    border: 2px solid #2563eb;
}
.mall-btn-buy {
    background: #f97316;
    color: #fff;
    border: 2px solid #f97316;
}
.mall-btn-buy:hover {
    background: #ea580c;
}
.mall-detail-desc {
    border-top: 1px solid #e2e8f0;
    padding-top: 20px;
}
.mall-detail-desc h3 {
    font-size: 16px;
    margin-bottom: 12px;
    color: #0f172a;
}
.mall-detail-desc div img {
    max-width: 100%;
    border-radius: 6px;
    margin: 8px 0;
}

/* 購物車 */
.mall-cart-items {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 20px;
}
.mall-cart-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    border-bottom: 1px solid #f1f5f9;
}
.mall-cart-img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    background: #f8fafc;
}
.mall-cart-info {
    flex: 1;
    min-width: 0;
}
.mall-cart-title {
    font-size: 15px;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.mall-cart-seller {
    font-size: 12px;
    color: #64748b;
    margin-bottom: 6px;
}
.mall-cart-price {
    font-size: 15px;
    font-weight: 700;
    color: #f97316;
}
.mall-cart-qty {
    flex-shrink: 0;
}
.mall-cart-subtotal {
    font-size: 18px;
    font-weight: 700;
    color: #f97316;
    min-width: 90px;
    text-align: right;
}

/* 購物車摘要 */
.mall-cart-summary {
    background: #fff;
    padding: 20px;
    border-radius: 12px;
}
.mall-summary-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 14px;
    color: #475569;
}
.mall-summary-total {
    border-top: 1px solid #e2e8f0;
    padding-top: 12px;
    margin-top: 8px;
    font-size: 18px;
    font-weight: 700;
    color: #0f172a;
}

/* 結帳 */
.mall-checkout-block {
    background: #fff;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 16px;
}
.mall-checkout-block h3 {
    font-size: 16px;
    margin-bottom: 16px;
    color: #0f172a;
}

/* 手機版 */
@media (max-width: 768px) {
    .mall-categories {
        grid-template-columns: repeat(4, 1fr);
    }
    .mall-product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    .mall-product-detail {
        grid-template-columns: 1fr;
        padding: 16px;
        gap: 16px;
    }
    .mall-detail-final { font-size: 26px; }
    .mall-cart-item {
        flex-wrap: wrap;
        gap: 10px;
    }
    .mall-cart-img { width: 60px; height: 60px; }
    .mall-cart-subtotal { min-width: auto; font-size: 16px; }
    .mall-shop-header { flex-direction: column; text-align: center; }
    .mall-shop-header > div:last-child { margin-left: 0 !important; }
}
/* 產品說明富文本樣式 */
.product-description-content {
    font-size: 15px;
    line-height: 1.8;
    color: #334155;
}
.product-description-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 12px 0;
}
.product-description-content h1,
.product-description-content h2,
.product-description-content h3 {
    color: #0f172a;
    margin: 16px 0 8px;
}
.product-description-content ul,
.product-description-content ol {
    padding-left: 24px;
    margin: 8px 0;
}
.product-description-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
}
.product-description-content table th,
.product-description-content table td {
    border: 1px solid #e2e8f0;
    padding: 8px 12px;
}
.product-description-content table th {
    background: #f8fafc;
    font-weight: 600;
}
.product-description-content a {
    color: #2563eb;
    text-decoration: underline;
}
