/* ==========================================================================
   WC Free Gift – 前台樣式 v2.0 優化版
   ========================================================================== */

/* ---- 產品頁：贈品提示 ---- */
.wcfg-gift-notice {
    margin: 20px 0;
    border: 1px solid #e8e8e8;
    border-radius: 12px;
    background: #fff;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.wcfg-gift-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 18px;
    background: linear-gradient(135deg, #fff9f9 0%, #fff 100%);
    border-bottom: 1px solid #f0f0f0;
}

.wcfg-gift-header-icon {
    font-size: 20px;
}

.wcfg-gift-header-text {
    font-size: 15px;
    font-weight: 600;
    color: #333;
}

.wcfg-gift-cond {
    padding: 10px 18px;
    font-size: 13px;
    color: #666;
    background: #fafafa;
    border-bottom: 1px solid #f0f0f0;
}

.wcfg-gift-list {
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* 贈品卡片 */
.wcfg-gift-card {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 14px;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 10px;
    transition: all 0.2s ease;
}

.wcfg-gift-card:hover {
    border-color: #ddd;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

/* 圖片容器 - 包含FREE標籤 */
.wcfg-gc-img-wrap {
    position: relative;
    flex-shrink: 0;
    width: 80px;
    height: 80px;
}

.wcfg-gc-img-link {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 8px;
    overflow: hidden;
    background: #f8f8f8;
    border: 1px solid #eee;
}

.wcfg-gc-img-link img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.wcfg-gc-img-link:hover img {
    transform: scale(1.05);
}

/* FREE 標籤 - 左上角傾斜紅色小標籤 */
.wcfg-free-tag {
    position: absolute;
    top: -2px;
    left: -2px;
    background: linear-gradient(135deg, #e53935 0%, #c62828 100%);
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 4px 0 8px 0;
    transform: rotate(-8deg);
    transform-origin: top left;
    z-index: 10;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(229, 57, 53, 0.3);
    text-transform: uppercase;
}

/* 舊的圖片容器樣式（向後相容） */
.wcfg-gc-img {
    flex-shrink: 0;
    width: 72px;
    height: 72px;
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
    border: 1px solid #eee;
}

.wcfg-gc-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* 內容區域 */
.wcfg-gc-body {
    flex: 1;
    min-width: 0;
    text-align: left;
}

/* 商品名稱連結 */
.wcfg-gc-name-link {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    line-height: 1.4;
    text-decoration: none;
    transition: color 0.2s ease;
    text-align: left;
}

.wcfg-gc-name-link:hover {
    color: #c62828;
}

.wcfg-gc-name {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    line-height: 1.4;
    text-align: left;
}

.wcfg-gc-qty {
    font-size: 12px;
    color: #999;
    margin-left: 6px;
    font-weight: 400;
}

/* 規格選擇器 */
.wcfg-gc-variation {
    margin-top: 10px;
    text-align: left;
}

.wcfg-var-select {
    width: 100%;
    max-width: 220px;
    padding: 8px 12px;
    font-size: 13px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background: #fff;
    color: #333;
    cursor: pointer;
    appearance: auto;
    -webkit-appearance: auto;
    transition: border-color 0.2s ease;
}

.wcfg-var-select:hover {
    border-color: #ccc;
}

.wcfg-var-select:focus {
    outline: none;
    border-color: #c62828;
    box-shadow: 0 0 0 2px rgba(198, 40, 40, 0.1);
}

/* 舊的FREE標籤（隱藏） */
.wcfg-gc-free {
    display: none;
}


/* ---- 購物車 / 結帳：標籤 ---- */
.wcfg-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    color: #c62828;
    background: #ffebee;
    padding: 3px 8px;
    border-radius: 4px;
    vertical-align: middle;
    white-space: nowrap;
    margin-left: 6px;
}

.wcfg-free {
    font-weight: 600;
    color: #c62828;
    font-size: 13px;
}

/* 迷你購物車小標籤 */
.wcfg-badge-sm {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    color: #c62828;
    background: #ffebee;
    padding: 2px 6px;
    border-radius: 3px;
    margin-left: 4px;
}

/* 迷你購物車贈品項目 - 圖片左上角標籤 */
.wcfg-mini-gift-item {
    position: relative;
}

.wcfg-mini-gift-item .cart-item-image,
.wcfg-mini-gift-item .product-thumbnail,
.wcfg-mini-gift-item > a:first-of-type img {
    position: relative;
    display: block;
}

/* Woodmart主題 */
.wcfg-mini-gift-item .cart-item-image::before {
    content: '贈品';
    position: absolute;
    top: -2px;
    left: -2px;
    background: linear-gradient(135deg, #e53935 0%, #c62828 100%);
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    padding: 3px 6px;
    border-radius: 4px 0 6px 0;
    transform: rotate(-8deg);
    transform-origin: top left;
    z-index: 10;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(229, 57, 53, 0.3);
    line-height: 1;
}

/* 通用主題備用 */
.wcfg-mini-gift-item .product-thumbnail::before,
.wcfg-mini-gift-item .mini_cart_item_thumbnail::before {
    content: '贈品';
    position: absolute;
    top: -2px;
    left: -2px;
    background: linear-gradient(135deg, #e53935 0%, #c62828 100%);
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    padding: 3px 6px;
    border-radius: 4px 0 6px 0;
    transform: rotate(-8deg);
    transform-origin: top left;
    z-index: 10;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(229, 57, 53, 0.3);
    line-height: 1;
}

/* 確保圖片容器有相對定位 */
.wcfg-mini-gift-item a[class*="image"],
.wcfg-mini-gift-item a[class*="thumbnail"] {
    position: relative !important;
    display: block;
    overflow: visible !important;
}

/* 移除贈品列背景 */
tr.wcfg-gift-row,
tr.cart_item.wcfg-gift-row {
    background: transparent !important;
}

/* 鎖定數量 */
.wcfg-gift-qty-lock {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 36px;
    padding: 0 12px;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    color: #666;
    font-weight: 500;
}


/* ---- 響應式 ---- */
@media (max-width: 600px) {
    .wcfg-gift-notice {
        margin: 16px 0;
        border-radius: 10px;
    }
    
    .wcfg-gift-header {
        padding: 12px 14px;
    }
    
    .wcfg-gift-cond {
        padding: 8px 14px;
        font-size: 12px;
    }
    
    .wcfg-gift-list {
        padding: 12px 14px;
    }
    
    .wcfg-gift-card {
        gap: 12px;
        padding: 12px;
    }
    
    .wcfg-gc-img-wrap {
        width: 64px;
        height: 64px;
    }
    
    .wcfg-gc-img {
        width: 56px;
        height: 56px;
    }
    
    .wcfg-gc-name-link,
    .wcfg-gc-name {
        font-size: 13px;
    }
    
    .wcfg-free-tag {
        font-size: 8px;
        padding: 2px 6px;
    }
    
    .wcfg-var-select {
        max-width: 100%;
        padding: 10px 12px;
    }
}
