/**
 * Shop 頁面樣式 v2 - Gogoro 風格
 */

/* 變數定義 */
:root {
    --bpc-primary: #4CAF50;
    --bpc-primary-dark: #388E3C;
    --bpc-secondary: #2196F3;
    --bpc-dark: #1a1a1a;
    --bpc-gray: #757575;
    --bpc-light-gray: #f5f5f5;
    --bpc-white: #ffffff;
    --bpc-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    --bpc-transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 主容器 */
.bpc-shop-configurator {
    max-width: 100%;
    margin: 0;
    padding: 0;
    background: linear-gradient(135deg, #f5f5f5 0%, #e0e0e0 100%);
    min-height: 100vh;
}

/* 標題區塊 */
.bpc-shop-header {
    text-align: center;
    padding: 60px 20px 40px;
    background: var(--bpc-white);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.bpc-shop-title {
    font-size: 48px;
    font-weight: 300;
    letter-spacing: -1px;
    color: var(--bpc-dark);
    margin-bottom: 15px;
    animation: slideInDown 0.6s ease;
}

.bpc-shop-subtitle {
    font-size: 18px;
    color: var(--bpc-gray);
    margin: 0;
    animation: fadeIn 0.8s ease 0.2s both;
}

/* 篩選容器 */
.bpc-filter-container {
    background: var(--bpc-white);
    padding: 30px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.08);
}

/* 篩選按鈕 - Gogoro 風格 */
.bpc-filter-pills {
    display: flex;
    justify-content: center;
    gap: 20px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.bpc-filter-pill {
    position: relative;
    padding: 15px 35px;
    background: transparent;
    border: 2px solid #e0e0e0;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 500;
    color: var(--bpc-gray);
    cursor: pointer;
    transition: var(--bpc-transition);
    overflow: hidden;
}

.bpc-filter-pill::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: var(--bpc-primary);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.bpc-filter-pill:hover {
    border-color: var(--bpc-primary);
    color: var(--bpc-primary);
    transform: translateY(-2px);
}

.bpc-filter-pill.active {
    background: var(--bpc-primary);
    border-color: var(--bpc-primary);
    color: var(--bpc-white);
    box-shadow: 0 10px 30px rgba(76, 175, 80, 0.3);
}

/* 輪播容器 */
.bpc-slider-container {
    padding: 60px 0;
    background: linear-gradient(180deg, #ffffff 0%, #f5f5f5 100%);
}

/* 全局圖片大小規範 - 確保所有滑塊中的腳踏車圖片大小一致 */
.bpc-product-slider img.woocommerce-placeholder,
.bpc-product-slider img.attachment-large,
.bpc-product-slider .bpc-product-image-wrapper img {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
    object-position: center center !important;
}

/* 主輪播區 */
.bpc-slider-main {
    max-width: 1400px;
    margin: 0 auto;
    position: relative;
}

.bpc-product-slider {
    overflow: hidden !important; /* 隱藏滑動時的溢出內容 */
    position: relative;
    min-height: 600px; /* 確保切換時有固定高度 */
    perspective: 1200px; /* 添加 3D 透視效果 */
    isolation: isolate; /* 創建新的堆疊上下文 */
}

.bpc-product-slider .swiper {
    width: 100%;
    overflow: visible !important;
    position: relative;
    will-change: transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

/* 預載入容器 */
.bpc-product-slider .swiper-preload {
    position: absolute !important;
    width: 100% !important;
    height: 100% !important;
    top: 0;
    z-index: 1;
}

.bpc-product-slider .swiper-wrapper {
    align-items: center;
    position: relative; /* 為滾動動畫添加 */
    transform-style: preserve-3d; /* 保持 3D 效果 */
}

/* 連續滾動動畫效果 */
.bpc-product-slider .swiper.transitioning {
    pointer-events: none;
}

/* 雙層容器滑動效果 */
.bpc-product-slider .swiper {
    transition: none;
}

.bpc-product-slider .swiper.transitioning {
    transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* 預載入容器的初始狀態 */
.swiper-preload {
    transform: translateX(0);
}

/* 防止閃爍 */
.bpc-product-slider .swiper-slide {
    opacity: 1 !important;
    visibility: visible !important;
}

/* 切換時禁用互動 */
.bpc-product-slider.is-transitioning {
    pointer-events: none;
}

/* 平滑的滑動效果 */
.bpc-product-slider .swiper-wrapper {
    transition-duration: 800ms !important;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* 無縫切換動畫 */
@keyframes slideFromRight {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

@keyframes slideToLeft {
    from {
        transform: translateX(0);
    }
    to {
        transform: translateX(-100%);
    }
}

/* 確保滑塊在切換時保持可見 */
.bpc-product-slider .swiper-slide {
    opacity: 1 !important;
    visibility: visible !important;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transform: translate3d(0, 0, 0);
}

/* 產品幻燈片 - 平滑滑動樣式 */
.bpc-product-slider .swiper-slide {
    transition: opacity 0.3s ease, transform 0.3s ease;
    transform-style: preserve-3d;
    backface-visibility: hidden;
    will-change: transform;
}

/* 中央活動滑塊 */
.bpc-product-slider .swiper-slide-active {
    z-index: 10;
}

/* 側邊滑塊漸變效果 - 移除，改由 JS 控制 */
.bpc-product-slider .swiper-slide-prev,
.bpc-product-slider .swiper-slide-next {
    /* opacity 由 JS 控制 */
}

/* 更遠的滑塊 - 移除，改由 JS 控制 */
.bpc-product-slider .swiper-slide:not(.swiper-slide-active):not(.swiper-slide-prev):not(.swiper-slide-next) {
    /* opacity 由 JS 控制 */
}

/* 確保所有滑塊的圖片容器大小一致 */
.bpc-product-slider .bpc-product-image-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 防止圖片變形 */
.bpc-product-slider .bpc-product-image-wrapper img,
.bpc-product-slider .bpc-product-image {
    object-fit: contain !important;
    object-position: center !important;
}

/* 滑塊內容的過渡動畫 */
.bpc-product-slider .swiper-slide .bpc-product-image {
    transition: transform 0.6s ease-out;
    will-change: transform;
}

/* 篩選按鈕切換時的特殊處理 */
.bpc-filter-pill {
    transition: all 0.3s ease;
    will-change: transform, background-color, color;
}

.bpc-filter-pill.active {
    animation: none;
    transition: all 0.3s ease;
}

/* 預載入狀態指示器 */
.bpc-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.bpc-product-slider.is-loading .bpc-loading-overlay {
    display: flex;
}

/* 產品卡片 */
.bpc-product-slide {
    background: var(--bpc-white);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
    transition: var(--bpc-transition);
    position: relative;
}

/* 中央選中狀態 */
.bpc-product-slide.is-selected {
    border: 3px solid var(--bpc-primary);
    box-shadow: 0 30px 80px rgba(76, 175, 80, 0.25);
}

/* 選中標記 */
.bpc-product-slide.is-selected::before {
    content: '✓';
    position: absolute;
    top: 20px;
    left: 20px;
    width: 30px;
    height: 30px;
    background: var(--bpc-primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: bold;
    z-index: 10;
    animation: checkmarkPop 0.3s ease;
}

@keyframes checkmarkPop {
    0% {
        transform: scale(0);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}

.swiper-slide-active .bpc-product-slide {
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.15);
    transform: scale(1.02);
}

/* 中央卡片高亮效果 */
.swiper-slide-active .bpc-product-slide::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, var(--bpc-primary), var(--bpc-secondary));
    border-radius: 20px;
    opacity: 0;
    z-index: -1;
    transition: opacity 0.3s ease;
}

.swiper-slide-active .bpc-product-slide.is-selected::after {
    opacity: 0.3;
}

/* 產品視覺區 */
.bpc-product-visual {
    position: relative;
    background: linear-gradient(135deg, #f5f5f5 0%, #e0e0e0 100%);
    overflow: hidden;
}

.bpc-product-image-container {
    position: relative;
    padding-top: 75%;
}

.bpc-product-image {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 85%;
    height: 85%;
    object-fit: contain;
    transition: transform 0.6s ease;
    /* 確保所有圖片基準大小一致 */
    max-width: 100%;
    max-height: 100%;
}

/* 統一所有滑塊中的圖片大小 */
.swiper-slide .bpc-product-image {
    width: 85%;
    height: 85%;
    transform: translate(-50%, -50%) scale(1);
}

/* 移除中央滑塊的額外縮放，由 JS 控制 */
.swiper-slide-active .bpc-product-image {
    transform: translate(-50%, -50%) scale(1);
}

/* 熱點系統 - Gogoro 風格 */
.bpc-hotspots {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.bpc-hotspot {
    position: absolute;
    pointer-events: auto;
    cursor: pointer;
    z-index: 20;
}

.bpc-hotspot-marker {
    position: relative;
    width: 40px;
    height: 40px;
}

.bpc-hotspot-dot {
    position: absolute;
    width: 16px;
    height: 16px;
    background: var(--bpc-primary);
    border: 3px solid var(--bpc-white);
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
    transition: all 0.3s ease;
}

.bpc-hotspot-pulse {
    position: absolute;
    width: 40px;
    height: 40px;
    background: var(--bpc-primary);
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0.3;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.3;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.5);
        opacity: 0.1;
    }
    100% {
        transform: translate(-50%, -50%) scale(2);
        opacity: 0;
    }
}

.bpc-hotspot:hover .bpc-hotspot-dot {
    transform: translate(-50%, -50%) scale(1.2);
    background: var(--bpc-primary-dark);
}

/* 熱點提示框 */
.bpc-hotspot-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-10px);
    background: var(--bpc-dark);
    color: var(--bpc-white);
    border-radius: 12px;
    padding: 15px;
    min-width: 250px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    margin-bottom: 10px;
    z-index: 100;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.bpc-hotspot-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 8px solid transparent;
    border-top-color: var(--bpc-dark);
}

.bpc-hotspot:hover .bpc-hotspot-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* 產品標籤 */
.bpc-product-badge {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 10px;
}

.badge-sale,
.badge-featured {
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-sale {
    background: #ff5252;
    color: white;
}

.badge-featured {
    background: #ffa726;
    color: white;
}

/* 產品詳情 */
.bpc-product-details {
    padding: 25px;
}

.bpc-product-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--bpc-dark);
    margin: 0 0 10px 0;
}

.bpc-product-meta {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

.product-category {
    color: var(--bpc-primary);
    font-size: 14px;
    font-weight: 500;
}

.product-sku {
    color: var(--bpc-gray);
    font-size: 14px;
}

.bpc-product-price {
    font-size: 28px;
    font-weight: 700;
    color: var(--bpc-primary);
    margin-bottom: 15px;
}

.bpc-product-price del {
    color: #999;
    font-size: 20px;
    margin-right: 10px;
}

.bpc-product-desc {
    font-size: 14px;
    color: var(--bpc-gray);
    line-height: 1.6;
    margin-bottom: 20px;
}

/* 產品操作按鈕 */
.bpc-product-actions {
    display: flex;
    gap: 10px;
}

.btn-quick-view,
.btn-select-product {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--bpc-transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.btn-quick-view {
    background: var(--bpc-light-gray);
    color: var(--bpc-gray);
}

.btn-quick-view:hover {
    background: var(--bpc-gray);
    color: var(--bpc-white);
}

.btn-select-product {
    background: var(--bpc-primary);
    color: var(--bpc-white);
}

.btn-select-product:hover {
    background: var(--bpc-primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(76, 175, 80, 0.3);
}

/* 自定義導航按鈕 */
.bpc-slider-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0 20px;
    pointer-events: none;
    z-index: 30;
}

.bpc-nav-prev,
.bpc-nav-next {
    width: 60px;
    height: 60px;
    background: var(--bpc-white);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    pointer-events: auto;
    transition: var(--bpc-transition);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.bpc-nav-prev:hover,
.bpc-nav-next:hover {
    background: var(--bpc-primary);
    color: var(--bpc-white);
    transform: scale(1.1);
    box-shadow: 0 10px 30px rgba(76, 175, 80, 0.3);
}

/* 縮略圖導航 */
.bpc-slider-thumbs {
    max-width: 800px;
    margin: 40px auto 0;
}

.bpc-thumbs-slider .swiper-wrapper {
    justify-content: center;
}

.bpc-thumbs-slider .swiper-slide {
    width: 80px !important;
    height: 80px;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    border: 3px solid transparent;
    transition: var(--bpc-transition);
}

.bpc-thumbs-slider .swiper-slide-thumb-active {
    border-color: var(--bpc-primary);
}

.bpc-thumbs-slider img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 進度指示器 */
.bpc-slider-progress {
    max-width: 400px;
    margin: 30px auto 0;
    text-align: center;
}

.progress-bar {
    height: 4px;
    background: #e0e0e0;
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: var(--bpc-primary);
    width: 20%;
    transition: width 0.3s ease;
}

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

.current-slide {
    font-weight: 600;
    color: var(--bpc-primary);
}

/* 操作區域 */
.bpc-action-area {
    background: var(--bpc-white);
    padding: 40px;
    text-align: center;
    box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.05);
}

.bpc-selected-info {
    margin-bottom: 20px;
    font-size: 18px;
}

.selected-label {
    color: var(--bpc-gray);
}

.selected-product-name {
    font-weight: 600;
    color: var(--bpc-primary);
    margin-left: 10px;
}

/* 繼續搭配按鈕 - Gogoro 風格 */
.bpc-continue-btn,
.bep-continue-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 18px 50px;
    background: linear-gradient(135deg, var(--bpc-primary) 0%, var(--bpc-primary-dark) 100%);
    color: var(--bpc-white);
    border: none;
    border-radius: 50px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--bpc-transition);
    box-shadow: 0 10px 30px rgba(76, 175, 80, 0.3);
    position: relative;
    overflow: hidden;
}

/* BEP 按鈕特別樣式 */
.bep-continue-btn {
    background: transparent;
    padding: 0;
    box-shadow: none;
}

.bep-continue-btn img {
    width: 100px;
    height: auto;
    transition: transform 0.3s ease;
}

.bep-continue-btn:hover img {
    transform: scale(1.05);
}

.bpc-continue-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: -100%;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-50%) skewX(-20deg);
    transition: left 0.5s ease;
}

.bpc-continue-btn:hover::before {
    left: 100%;
}

/* 載入狀態 */
.bpc-continue-btn.loading,
.bep-continue-btn.loading {
    pointer-events: none;
    opacity: 0.7;
}

.bpc-continue-btn.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
}

@keyframes spin {
    to {
        transform: translateY(-50%) rotate(360deg);
    }
}

.bpc-continue-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(76, 175, 80, 0.4);
}

.bpc-continue-btn:disabled {
    background: linear-gradient(135deg, #ccc 0%, #999 100%);
    cursor: not-allowed;
    box-shadow: none;
}

.bpc-continue-btn:disabled:hover {
    transform: none;
}

.btn-arrow {
    font-size: 24px;
    transition: transform 0.3s ease;
}

.bpc-continue-btn:hover .btn-arrow {
    transform: translateX(5px);
}

.bpc-hint-text {
    margin-top: 15px;
    font-size: 14px;
    color: var(--bpc-gray);
    font-style: italic;
}

/* 動畫 */
@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* 載入動畫 */
.bpc-loader {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
}

.bpc-loader::after {
    content: '';
    display: block;
    width: 60px;
    height: 60px;
    border: 6px solid var(--bpc-light-gray);
    border-top-color: var(--bpc-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* 響應式設計 */
@media (max-width: 1024px) {
    .bpc-shop-title {
        font-size: 36px;
    }
    
    .bpc-filter-pills {
        flex-wrap: wrap;
        gap: 15px;
    }
    
    .bpc-filter-pill {
        padding: 12px 25px;
        font-size: 14px;
    }
}

@media (max-width: 768px) {
    .bpc-shop-title {
        font-size: 28px;
    }
    
    .bpc-shop-subtitle {
        font-size: 16px;
    }
    
    .bpc-product-slider .swiper-slide-active {
        transform: scale(1);
    }
    
    .bpc-nav-prev,
    .bpc-nav-next {
        width: 45px;
        height: 45px;
    }
    
    .bpc-continue-btn {
        padding: 15px 40px;
        font-size: 16px;
    }
    
    .bpc-product-actions {
        flex-direction: column;
    }
    
    .bpc-slider-thumbs {
        display: none;
    }
}