/**
 * EC-CUBE 4.2 / 4.3 Product Image Sticker & Ribbon Badge Plugin
 * (c) Studio Hermitage - All Rights Reserved
 */

/* ==========================================================================
   1. コンテナラッパーおよび基本配置レイアウト (Positioning & Stacking)
   ========================================================================== */
.ec-product-sticker-wrapper,
.ec-shelfGrid .ec-shelfGrid__item-image.ec-product-sticker-wrapper,
.item_visual .slide-item.ec-product-sticker-wrapper {
    position: relative !important;
    display: block !important;
    overflow: hidden !important;
}

.ec-product-sticker-badge {
    position: absolute !important;
    z-index: 999 !important;
    pointer-events: none;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
    box-sizing: border-box;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 4px;
    letter-spacing: 0.02em;
    user-select: none;
    -webkit-font-smoothing: antialiased;
}

/* 表示位置：四隅の配置 (Pill / Badge用) */
.ec-product-sticker-badge.position-top-left {
    top: 10px !important;
    left: 10px !important;
    right: auto !important;
    bottom: auto !important;
}

.ec-product-sticker-badge.position-top-right {
    top: 10px !important;
    right: 10px !important;
    left: auto !important;
    bottom: auto !important;
}

.ec-product-sticker-badge.position-bottom-left {
    bottom: 10px !important;
    left: 10px !important;
    top: auto !important;
    right: auto !important;
}

.ec-product-sticker-badge.position-bottom-right {
    bottom: 10px !important;
    right: 10px !important;
    top: auto !important;
    left: auto !important;
}

/* ==========================================================================
   2. バッジデザイン形状 (Styles: Pill, Badge, Ribbon)
   ========================================================================== */

/* A. ピル型 (Pill: 丸型・モダン・リボンと同等の13px拡大) */
.ec-product-sticker-badge.style-pill {
    width: auto !important;
    transform: none;
    padding: 7px 16px !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    letter-spacing: 0.03em !important;
    border-radius: 9999px !important;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.28) !important;
    backdrop-filter: blur(2px);
}

/* B. フラット四角型 (Badge: スタイリッシュ・リボンと同等の13px拡大) */
.ec-product-sticker-badge.style-badge {
    width: auto !important;
    transform: none;
    padding: 7px 14px !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    letter-spacing: 0.03em !important;
    border-radius: 6px !important;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.28) !important;
}

/* C. コーナーリボン型 (Ribbon: 伝統的な斜め掛けリボン - 視認性を約30%拡大) */
.ec-product-sticker-badge.style-ribbon {
    position: absolute !important;
    width: 156px !important;
    padding: 7px 0 !important;
    font-size: 13px !important;
    letter-spacing: 0.02em !important;
    text-transform: uppercase;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3) !important;
}

.ec-product-sticker-badge.style-ribbon.position-top-left {
    top: 22px !important;
    left: -36px !important;
    right: auto !important;
    bottom: auto !important;
    transform: rotate(-45deg) !important;
}

.ec-product-sticker-badge.style-ribbon.position-top-right {
    top: 22px !important;
    right: -36px !important;
    left: auto !important;
    bottom: auto !important;
    transform: rotate(45deg) !important;
}

.ec-product-sticker-badge.style-ribbon.position-bottom-left {
    bottom: 22px !important;
    left: -36px !important;
    top: auto !important;
    right: auto !important;
    transform: rotate(45deg) !important;
}

.ec-product-sticker-badge.style-ribbon.position-bottom-right {
    bottom: 22px !important;
    right: -36px !important;
    top: auto !important;
    left: auto !important;
    transform: rotate(-45deg) !important;
}

/* D. 商品詳細画面専用：大型リボン (Product Detail - Large Ribbon) */
.item_visual .ec-product-sticker-badge.style-ribbon,
.ec-sliderItemRole .ec-product-sticker-badge.style-ribbon {
    width: 210px !important;
    padding: 9px 0 !important;
    font-size: 15px !important;
    letter-spacing: 0.04em !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35) !important;
}

.item_visual .ec-product-sticker-badge.style-ribbon .badge-icon,
.ec-sliderItemRole .ec-product-sticker-badge.style-ribbon .badge-icon {
    width: 18px !important;
    height: 18px !important;
}

.item_visual .ec-product-sticker-badge.style-ribbon.position-top-left,
.ec-sliderItemRole .ec-product-sticker-badge.style-ribbon.position-top-left {
    top: 32px !important;
    left: -48px !important;
    transform: rotate(-45deg) !important;
}

.item_visual .ec-product-sticker-badge.style-ribbon.position-top-right,
.ec-sliderItemRole .ec-product-sticker-badge.style-ribbon.position-top-right {
    top: 32px !important;
    right: -48px !important;
    transform: rotate(45deg) !important;
}

.item_visual .ec-product-sticker-badge.style-ribbon.position-bottom-left,
.ec-sliderItemRole .ec-product-sticker-badge.style-ribbon.position-bottom-left {
    bottom: 32px !important;
    left: -48px !important;
    transform: rotate(45deg) !important;
}

.item_visual .ec-product-sticker-badge.style-ribbon.position-bottom-right,
.ec-sliderItemRole .ec-product-sticker-badge.style-ribbon.position-bottom-right {
    bottom: 32px !important;
    right: -48px !important;
    transform: rotate(-45deg) !important;
}

.item_visual .ec-product-sticker-badge.style-pill,
.ec-sliderItemRole .ec-product-sticker-badge.style-pill {
    padding: 10px 22px !important;
    font-size: 15px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35) !important;
}

.item_visual .ec-product-sticker-badge.style-badge,
.ec-sliderItemRole .ec-product-sticker-badge.style-badge {
    padding: 10px 20px !important;
    font-size: 15px !important;
    border-radius: 8px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35) !important;
}

/* ==========================================================================
   3. プリセット配色およびテーマカラー (Color Themes & Presets)
   ========================================================================== */

/* 1. NEW (新商品) - 洗練されたスカイブルー */
.ec-product-sticker-badge.type-new {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    color: #ffffff;
}

/* 2. SALE (セール・割引) - 鮮烈なビビッドレッド */
.ec-product-sticker-badge.type-sale {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: #ffffff;
}

/* 3. 限定 (限定品) - プレミアムパープル */
.ec-product-sticker-badge.type-limited {
    background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
    color: #ffffff;
}

/* 4. おすすめ (おすすめ) - フレッシュなオレンジ */
.ec-product-sticker-badge.type-recommend {
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    color: #ffffff;
}

/* 5. 人気No.1〜No.3 (ランキング順位) */
/* 5-1. 人気No.1 (ロイヤルゴールド) */
.ec-product-sticker-badge.type-popular,
.ec-product-sticker-badge.type-popular_1 {
    background: linear-gradient(135deg, #eab308 0%, #ca8a04 100%);
    color: #ffffff;
}

/* 5-2. 人気No.2 (プレミアムシルバー) */
.ec-product-sticker-badge.type-popular_2 {
    background: linear-gradient(135deg, #94a3b8 0%, #475569 100%);
    color: #ffffff;
}

/* 5-3. 人気No.3 (クラシックブロンズ) */
.ec-product-sticker-badge.type-popular_3 {
    background: linear-gradient(135deg, #d97706 0%, #92400e 100%);
    color: #ffffff;
}

/* 6. 送料無料 (送料無料) - 信頼感のあるエメラルドグリーン */
.ec-product-sticker-badge.type-free_shipping {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #ffffff;
}

/* 7. 予約 (予約商品) - ディープインディゴ */
.ec-product-sticker-badge.type-pre_order {
    background: linear-gradient(135deg, #6366f1 0%, #4338ca 100%);
    color: #ffffff;
}

/* 8. クール便 (冷蔵/冷凍) - 清涼感のあるアイスシアン（食品・乳製品必須） */
.ec-product-sticker-badge.type-cool_delivery {
    background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
    color: #ffffff;
}

/* 9. OUTLET (アウトレット) - ホットピンク */
.ec-product-sticker-badge.type-outlet {
    background: linear-gradient(135deg, #ec4899 0%, #db2777 100%);
    color: #ffffff;
}

/* 10. オーガニック (有機・自然派) - オリーブ・フォレストグリーン */
.ec-product-sticker-badge.type-organic {
    background: linear-gradient(135deg, #22c55e 0%, #15803d 100%);
    color: #ffffff;
}

/* 11. 殿堂入り (ロングセラー) - ディープアンバー */
.ec-product-sticker-badge.type-ranking {
    background: linear-gradient(135deg, #f59e0b 0%, #b45309 100%);
    color: #ffffff;
}

/* 12. カスタムテキスト */
.ec-product-sticker-badge.type-custom {
    background-color: #334155;
    color: #ffffff;
}

/* ==========================================================================
   4. インラインアイコン (Icon Sizing)
   ========================================================================== */
.ec-product-sticker-badge .badge-icon {
    display: inline-block;
    width: 14px;
    height: 14px;
    fill: currentColor;
    flex-shrink: 0;
}

/* ==========================================================================
   5. ホバーアニメーション効果 (Hover Animations: Pulse Effect)
   ========================================================================== */

/* A. 丸型(Pill)・角丸四角(Badge)用パルスアニメーション */
.ec-product-sticker-wrapper:hover .ec-product-sticker-badge.style-pill.animate-pulse,
.ec-product-sticker-wrapper:hover .ec-product-sticker-badge.style-badge.animate-pulse,
.ec-shelfGrid__item:hover .ec-product-sticker-badge.style-pill.animate-pulse,
.ec-shelfGrid__item:hover .ec-product-sticker-badge.style-badge.animate-pulse,
.item_visual:hover .ec-product-sticker-badge.style-pill.animate-pulse,
.item_visual:hover .ec-product-sticker-badge.style-badge.animate-pulse,
.ec-product-sticker-badge.style-pill.animate-pulse:hover,
.ec-product-sticker-badge.style-badge.animate-pulse:hover {
    animation: stickerPulse 1.2s infinite ease-in-out !important;
}

@keyframes stickerPulse {
    0% {
        transform: scale(1);
        filter: brightness(1);
        box-shadow: 0 3px 8px rgba(0, 0, 0, 0.28);
    }
    50% {
        transform: scale(1.09);
        filter: brightness(1.15);
        box-shadow: 0 5px 14px rgba(0, 0, 0, 0.38);
    }
    100% {
        transform: scale(1);
        filter: brightness(1);
        box-shadow: 0 3px 8px rgba(0, 0, 0, 0.28);
    }
}

/* B. コーナーリボン用パルスアニメーション（斜め角度 -45deg / 45deg を完全維持） */
.ec-product-sticker-wrapper:hover .ec-product-sticker-badge.style-ribbon.position-top-left.animate-pulse,
.ec-product-sticker-wrapper:hover .ec-product-sticker-badge.style-ribbon.position-bottom-right.animate-pulse,
.ec-shelfGrid__item:hover .ec-product-sticker-badge.style-ribbon.position-top-left.animate-pulse,
.ec-shelfGrid__item:hover .ec-product-sticker-badge.style-ribbon.position-bottom-right.animate-pulse,
.item_visual:hover .ec-product-sticker-badge.style-ribbon.position-top-left.animate-pulse,
.item_visual:hover .ec-product-sticker-badge.style-ribbon.position-bottom-right.animate-pulse,
.ec-product-sticker-badge.style-ribbon.position-top-left.animate-pulse:hover,
.ec-product-sticker-badge.style-ribbon.position-bottom-right.animate-pulse:hover {
    animation: stickerPulseRibbonNeg 1.2s infinite ease-in-out !important;
}

@keyframes stickerPulseRibbonNeg {
    0% {
        transform: rotate(-45deg) scale(1);
        filter: brightness(1);
    }
    50% {
        transform: rotate(-45deg) scale(1.08);
        filter: brightness(1.15);
    }
    100% {
        transform: rotate(-45deg) scale(1);
        filter: brightness(1);
    }
}

.ec-product-sticker-wrapper:hover .ec-product-sticker-badge.style-ribbon.position-top-right.animate-pulse,
.ec-product-sticker-wrapper:hover .ec-product-sticker-badge.style-ribbon.position-bottom-left.animate-pulse,
.ec-shelfGrid__item:hover .ec-product-sticker-badge.style-ribbon.position-top-right.animate-pulse,
.ec-shelfGrid__item:hover .ec-product-sticker-badge.style-ribbon.position-bottom-left.animate-pulse,
.item_visual:hover .ec-product-sticker-badge.style-ribbon.position-top-right.animate-pulse,
.item_visual:hover .ec-product-sticker-badge.style-ribbon.position-bottom-left.animate-pulse,
.ec-product-sticker-badge.style-ribbon.position-top-right.animate-pulse:hover,
.ec-product-sticker-badge.style-ribbon.position-bottom-left.animate-pulse:hover {
    animation: stickerPulseRibbonPos 1.2s infinite ease-in-out !important;
}

@keyframes stickerPulseRibbonPos {
    0% {
        transform: rotate(45deg) scale(1);
        filter: brightness(1);
    }
    50% {
        transform: rotate(45deg) scale(1.08);
        filter: brightness(1.15);
    }
    100% {
        transform: rotate(45deg) scale(1);
        filter: brightness(1);
    }
}

/* ==========================================================================
   6. モバイルレスポンシブ最適化 (Mobile Optimization)
   ========================================================================== */
@media (max-width: 767.98px) {
    .ec-product-sticker-badge.position-top-left {
        top: 5px;
        left: 5px;
    }
    .ec-product-sticker-badge.position-top-right {
        top: 5px;
        right: 5px;
    }
    .ec-product-sticker-badge.position-bottom-left {
        bottom: 5px;
        left: 5px;
    }
    .ec-product-sticker-badge.position-bottom-right {
        bottom: 5px;
        right: 5px;
    }
    .ec-product-sticker-badge.style-pill {
        padding: 5px 12px !important;
        font-size: 11px !important;
    }
    .ec-product-sticker-badge.style-badge {
        padding: 5px 10px !important;
        font-size: 11px !important;
    }
    .ec-product-sticker-badge.style-ribbon {
        width: 110px;
        font-size: 11px;
        padding: 4px 0;
    }
    .ec-product-sticker-badge.style-ribbon.position-top-left {
        top: 14px;
        left: -28px;
    }
    .ec-product-sticker-badge.style-ribbon.position-top-right {
        top: 14px;
        right: -28px;
    }
    .ec-product-sticker-badge .badge-icon {
        width: 12px;
        height: 12px;
    }
}
