/* WooCommerce Jersey Customizer - 短代码模式 v2.5.0 */

/* 隐藏可能冲突的WooCommerce原生变体选择 */
.wcjc-cart-form ~ .variations_form,
.wcjc-cart-form ~ form.cart,
.wcjc-cart-form + .variations_form,
.wcjc-cart-form + form.cart {
    display: none !important;
}

/* 确保我们的表单优先显示 */
.wcjc-cart-form {
    position: relative;
    z-index: 100;
}

/* ============================================
   两栏布局：70% 图片 + 30% 定制组件
   ============================================ */
.wcjc-main-container {
    display: flex;
    flex-direction: row;
    gap: 30px;
    align-items: flex-start;
    margin: 24px 0;
    max-width: 100%;
    box-sizing: border-box;
}

.wcjc-gallery-section {
    flex: 0 0 70%;
    width: 70%;
    max-width: 70%;
    box-sizing: border-box;
}

.wcjc-customizer-section {
    flex: 0 0 30%;
    width: 30%;
    max-width: 30%;
    box-sizing: border-box;
}

/* ============================================
   桌面端：图片网格布局（两列）
   ============================================ */
.wcjc-gallery-grid {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 4px !important;
    margin-bottom: 0 !important;
    width: 100% !important;
}

.wcjc-gallery-item {
    position: relative !important;
    width: 100% !important;
    padding-bottom: 100% !important; /* 1:1 宽高比 */
    overflow: hidden !important;
    border-radius: 8px !important;
    background: #f5f5f5 !important;
    display: block !important;
    cursor: pointer !important;
    isolation: isolate !important; /* 创建新的堆叠上下文 */
}

.wcjc-gallery-item img {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    transition: transform 0.3s ease !important;
    display: block !important;
    will-change: transform !important;
    backface-visibility: hidden !important;
    -webkit-backface-visibility: hidden !important;
}

/* 图片加载波纹动效 */
.wcjc-gallery-item img.loading {
    opacity: 0;
}

.wcjc-gallery-item::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 3px solid #e5e5e5;
    border-top-color: #333;
    border-radius: 50%;
    animation: wcjc-spin 0.8s linear infinite;
    opacity: 0;
    pointer-events: none;
    z-index: 1;
}

.wcjc-gallery-item.loading::before {
    opacity: 1;
}

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

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

/* 鼠标跟随放大效果 */
.wcjc-gallery-item:hover img {
    /* transform由JS动态控制 */
}

/* 隐藏的图片项 */
.wcjc-gallery-item.wcjc-hidden-item {
    /* 样式由内联style控制 */
    border-radius: 8px !important;
}

/* 显示全部图片时 */
.wcjc-gallery-grid.show-all .wcjc-gallery-item.wcjc-hidden-item {
    display: block !important;
    visibility: visible !important;
    position: relative !important;
    left: auto !important;
    width: 100% !important;
    height: auto !important;
    overflow: hidden !important;
    padding-bottom: 100% !important;
    border-radius: 8px !important;
    background: #f5f5f5 !important;
    cursor: pointer !important;
}

.wcjc-gallery-grid.show-all .wcjc-gallery-item.wcjc-hidden-item img {
    border-radius: 8px !important;
}

/* "展示更多"按钮 - 在图片下方居中 */
.wcjc-show-more-btn {
    width: 100% !important;
    max-width: 100% !important;
    height: 48px !important;
    margin-top: 12px !important;
    background: #fff !important;
    border: 2px solid #e5e5e5 !important;
    border-radius: 8px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    color: #333 !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    text-align: center !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-sizing: border-box !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    position: relative !important;
}

.wcjc-show-more-btn:hover {
    border-color: #666 !important;
    background: #f5f5f5 !important;
}

.wcjc-show-more-btn:active {
    border-color: #000 !important;
    background: #000 !important;
    color: #fff !important;
}

/* ============================================
   移动端：轮播图
   ============================================ */
.wcjc-gallery-slider {
    position: relative;
    width: 100%;
    overflow: hidden;
    border-radius: 8px;
    background: #f5f5f5;
}

.wcjc-slider-container {
    position: relative;
    width: 100%;
    padding-bottom: 100%; /* 1:1 宽高比 */
    touch-action: pan-y pinch-zoom;
}

.wcjc-slider-item {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.wcjc-slider-item.active {
    opacity: 1;
    pointer-events: auto;
}

.wcjc-slider-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 轮播指示器 */
.wcjc-slider-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 16px 0;
}

.wcjc-slider-dots .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ddd;
    cursor: pointer;
    transition: all 0.3s ease;
}

.wcjc-slider-dots .dot.active {
    background: #333;
    width: 24px;
    border-radius: 4px;
}

/* ============================================
   响应式显示控制
   ============================================ */
.mobile-only {
    display: none !important;
}

.desktop-only {
    display: block !important;
}

/* 确保移动端轮播在桌面端完全隐藏 */
@media (min-width: 769px) {
    .wcjc-gallery-slider.mobile-only {
        display: none !important;
        visibility: hidden !important;
        position: absolute !important;
        left: -9999px !important;
    }
}

/* 桌面端强制左右布局 */
@media (min-width: 769px) {
    body, html {
        overflow-x: hidden !important;
    }
    
    .wcjc-main-container {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        gap: 30px !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        align-items: flex-start !important;
    }
    
    .wcjc-gallery-section {
        flex: 0 0 70% !important;
        width: 70% !important;
        max-width: 70% !important;
        box-sizing: border-box !important;
    }
    
    .wcjc-customizer-section {
        flex: 0 0 30% !important;
        width: 30% !important;
        max-width: 30% !important;
        box-sizing: border-box !important;
    }
    
    .wcjc-customizer-section * {
        box-sizing: border-box !important;
    }
    
    .wcjc-customizer-section .wcjc-dd-toggle,
    .wcjc-customizer-section input[type="text"],
    .wcjc-customizer-section select,
    .wcjc-customizer-section .wcjc-add-to-cart-btn {
        width: 100% !important;
    }
}

/* 平板端适配 */
@media (max-width: 1024px) and (min-width: 769px) {
    .wcjc-main-container {
        gap: 20px;
    }
    
    .wcjc-gallery-section {
        flex: 0 0 65% !important;
        max-width: 65% !important;
    }
    
    .wcjc-customizer-section {
        flex: 0 0 35% !important;
        max-width: 35% !important;
    }
}

/* 平板和桌面端适配（769px以上）- 防止缩小时重叠 */
@media (min-width: 769px) {
    .wcjc-gallery-grid.desktop-only {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 4px !important;
    }
    
    .wcjc-gallery-slider.mobile-only {
        display: none !important;
    }
    
    /* 强制防止所有组件重叠 */
    body .wcjc-product-gallery,
    body .wcjc-customizer-container,
    .wcjc-product-gallery,
    .wcjc-customizer-container {
        position: relative !important;
        display: block !important;
        float: none !important;
        clear: both !important;
        z-index: auto !important;
    }
    
    body .wcjc-product-gallery {
        margin-bottom: 40px !important;
    }
    
    body .wcjc-customizer-container {
        margin-top: 40px !important;
    }
}

/* 极小窗口（如PC浏览器缩到最小）- 使用padding增加间距 */
@media (min-width: 769px) and (max-width: 900px) {
    body .wcjc-product-gallery {
        padding-bottom: 60px !important;
        margin: 0 !important;
    }
    
    body .wcjc-customizer-container {
        padding-top: 60px !important;
        margin: 0 !important;
    }
}

/* 全局移动端修复 - 使用padding而非margin防止重叠 */
@media (max-width: 768px) {
    body .wcjc-product-gallery,
    body .wcjc-customizer-container {
        position: relative !important;
        display: block !important;
        float: none !important;
        clear: both !important;
        transform: none !important;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        bottom: auto !important;
    }
    
    body .wcjc-product-gallery {
        z-index: 1 !important;
        isolation: isolate !important;
        padding: 0 0 4px 0 !important;
        margin: 0 !important;
        margin-top: 0 !important;
        margin-bottom: 0 !important;
        height: auto !important;
    }
    
    body .wcjc-customizer-container,
    body .wcjc-box {
        z-index: 2 !important;
        isolation: isolate !important;
        padding-top: 4px !important;
        margin: 0 !important;
        margin-top: 0 !important;
    }
    
    /* 强制禁用所有固定定位 */
    body .wcjc-customizer-container *,
    body .wcjc-box *,
    body .wcjc-customizer-section * {
        position: relative !important;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        bottom: auto !important;
    }
    
    /* 组合短代码容器样式 */
    body .wcjc-combined-wrapper .wcjc-product-gallery {
        margin-bottom: 0 !important;
        padding-bottom: 0 !important;
    }
    
    body .wcjc-combined-wrapper .wcjc-customizer-container {
        margin-top: 0 !important;
        padding-top: 0 !important;
    }
}

/* 移动端适配 */
@media (max-width: 768px) {
    /* 强制上下布局 */
    .wcjc-main-container {
        display: flex !important;
        flex-direction: column !important;
        gap: 20px !important;
        margin: 20px 0 !important;
        width: 100% !important;
        padding: 0 15px !important;
        box-sizing: border-box !important;
    }
    
    /* 图片区域占满宽度 */
    .wcjc-gallery-section {
        flex: 0 0 auto !important;
        max-width: 100% !important;
        width: 100% !important;
        min-width: 0 !important;
        order: 1 !important;
        box-sizing: border-box !important;
    }
    
    /* 定制组件区域占满宽度 - 防止溢出 */
    .wcjc-customizer-section {
        flex: 0 0 auto !important;
        max-width: 100% !important;
        width: 100% !important;
        min-width: 0 !important;
        order: 2 !important;
        display: block !important;
        visibility: visible !important;
        box-sizing: border-box !important;
        overflow-x: hidden !important;
    }
    
    .wcjc-customizer-section .wcjc-box {
        width: 100% !important;
        display: block !important;
        box-sizing: border-box !important;
        padding: 0 !important;
        margin: 0 !important;
        overflow-x: hidden !important;
    }
    
    /* 防止所有子元素溢出 */
    .wcjc-customizer-section * {
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
    
    /* 尺寸按钮移动端布局 */
    .wcjc-radio-group {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 8px !important;
        justify-content: space-between !important;
    }
    
    .wcjc-size-btn {
        flex: 1 1 auto !important;
        min-width: 60px !important;
        max-width: calc(20% - 6px) !important;
        padding: 12px 8px !important;
        font-size: 14px !important;
    }
    
    /* 移动端显示轮播，隐藏网格 */
    .wcjc-gallery-slider.mobile-only {
        display: block !important;
        visibility: visible !important;
        height: auto !important;
        position: static !important;
        left: auto !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }
    
    .wcjc-gallery-grid.desktop-only,
    .wcjc-show-more-btn.desktop-only {
        display: none !important;
        visibility: hidden !important;
        height: 0 !important;
        overflow: hidden !important;
        position: absolute !important;
        left: -9999px !important;
    }
}

/* Base Container - Clean design matching original image */
.wcjc-box, .wcjc-dynamic-customizer {
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
    box-shadow: none;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: visible;
}

.wcjc-customizer-section .wcjc-box {
    margin: 0;
    padding: 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: visible;
}

.wcjc-customizer-section * {
    box-sizing: border-box;
}

/* Header Section - "CUSTOMIZAR" with "Mais >" */
.wcjc-headline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding: 0;
    border-bottom: none;
}

.wcjc-title {
    font-weight: 700;
    font-size: 18px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: #333;
    margin: 0;
    padding: 0;
    border: none;
}

/* "Mais >" link */
.wcjc-headline::after {
    content: "Mais >";
    font-size: 14px;
    color: #333;
    text-decoration: underline;
    cursor: pointer;
    font-weight: normal;
}

/* Radio Button Section */
.wcjc-mode {
    display: flex;
    gap: 32px;
    margin-bottom: 24px;
    align-items: center;
}

.wcjc-radio {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    color: #333;
    cursor: pointer;
    margin: 0;
}

.wcjc-radio input[type="radio"] {
    width: 20px;
    height: 20px;
    margin: 0;
    accent-color: #000;
    cursor: pointer;
}

.wcjc-radio span {
    font-weight: 400;
    color: #333;
}

/* Section containers */
.wcjc-section {
    margin: 20px 0;
}

/* Player dropdown section */
.wcjc-preset {
    margin: 20px 0;
}

/* Custom inputs section - 名字输入框长，号码输入框短 */
.wcjc-custom {
    display: grid !important;
    grid-template-columns: 2fr 1fr !important;
    gap: 16px !important;
    margin: 20px 0 !important;
}

.wcjc-custom[data-section="custom"] {
    /* 由JS控制display: none/grid */
}

/* 确保模态窗口中的自定义输入框在同一行 */
.modal-custom-section {
    display: block !important;
}

/* 模态窗口中的单选按钮样式 */
.modal-mode-radio {
    width: 20px !important;
    height: 20px !important;
    margin: 0 !important;
    accent-color: #000 !important;
    cursor: pointer !important;
}

/* 强制显示自定义输入框行 */
.wcjc-custom .wcjc-custom-row {
    display: block !important;
    margin: 0 !important;
}

.wcjc-custom-row {
    margin: 0;
}

.wcjc-custom-row input[type="text"] {
    width: 100%;
    height: 48px;
    border: 2px solid #e5e5e5;
    border-radius: 8px;
    padding: 0 12px;
    font-size: 14px;
    font-weight: 600;
    background: #fff;
    color: #333;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.wcjc-custom-row input[type="text"]:hover {
    border-color: #666;
    background: #f5f5f5;
}

.wcjc-custom-row input[type="text"]:focus {
    outline: none;
    border-color: #333;
    background: #fff;
}

.wcjc-custom-row input[type="text"]::placeholder {
    color: #999;
    font-size: 14px;
    font-weight: 400;
}

/* Dropdown styling - for both player and patch */
.wcjc-dd {
    position: relative;
    margin: 20px 0;
}

/* Dropdown toggle button */
.wcjc-dd-toggle {
    width: 100% !important;
    height: 48px !important;
    border: 2px solid #e5e5e5 !important;
    border-radius: 8px !important;
    background: #fff !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 0 12px !important;
    cursor: pointer !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    position: relative !important;
    color: #333 !important;
    text-align: left !important;
    justify-content: space-between !important;
    transition: all 0.2s ease !important;
    box-sizing: border-box !important;
}

.wcjc-dd-toggle:hover {
    border-color: #666 !important;
    background: #f5f5f5 !important;
}

/* 下拉菜单打开时的样式通过JS直接控制，不再使用is-open类 */

.wcjc-dd-label {
    flex: 1;
    color: #333;
    font-size: 14px;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.wcjc-dd-label .timg {
    display: flex;
    align-items: center;
    gap: 3px;
    flex-shrink: 0;
}

.wcjc-dd-label img.wcjc-patch-img {
    width: 24px !important;
    height: 24px !important;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #e5e5e5;
}

/* Dropdown arrow */
.wcjc-dd-caret {
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid #666;
    transition: all 0.2s ease;
    margin-left: 8px;
}

/* Dropdown menu - 通过JS的.toggle()和.hide()控制显示 */
.wcjc-dd-menu {
    position: absolute;
    left: 0;
    width: 100%;
    top: calc(100% + 1px);
    background: #fff;
    max-height: 200px;
    overflow-y: auto;
    overflow-x: hidden;
    border: 2px solid #e5e5e5;
    border-radius: 8px;
    z-index: 9999;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    display: none;
    list-style: none;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.wcjc-dd-menu li {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 15px;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    transition: background-color 0.2s ease;
    border-bottom: 1px solid #f0f0f0;
}

.wcjc-dd-menu li:hover {
    background: #f8f9fa;
}

.wcjc-dd-menu li:last-child {
    border-bottom: none;
}

.wcjc-dd-menu .timg {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 3px;
    margin-right: 8px;
}

.wcjc-dd-menu .timg img.wcjc-patch-img {
    width: 28px !important;
    height: 28px !important;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #e5e5e5;
    transition: transform 0.2s ease;
    cursor: pointer;
}

.wcjc-dd-menu .timg img.wcjc-patch-img:hover {
    transform: scale(1.5);
    z-index: 1000;
    position: relative;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.wcjc-dd-menu .ttext {
    flex: 1;
}

.wcjc-dd-menu .tcheck {
    opacity: 0;
    color: #007cba;
    font-weight: bold;
}

.wcjc-dd-menu .is-checked {
    background-color: #f0f8ff !important;
}

.wcjc-dd-menu .is-checked .tcheck {
    opacity: 1;
}

.wcjc-dd-menu .is-checked .tcheck:after {
    content: '✓';
    color: #00a32a;
    font-weight: bold;
    font-size: 16px;
}

/* Extra price display */
.wcjc-extra {
    text-align: right;
    margin: 16px 0;
    font-size: 14px;
    color: #333;
}

.wcjc-extra-amount {
    font-weight: 700;
    color: #333;
}

/* Quantity Section */
.wcjc-quantity-section {
    margin: 20px 0;
}

.wcjc-quantity-section label {
    display: block;
    margin-bottom: 8px;
    font-weight: 700;
    font-size: 18px;
    color: #333;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Action buttons */
.wcjc-action-buttons {
    display: flex;
    gap: 12px;
    margin: 30px 0;
    align-items: center;
}

.wcjc-add-to-cart-btn {
    flex: 1;
    width: 100%;
    height: 48px;
    background: #000;
    color: #fff;
    border: 2px solid #000;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.wcjc-wishlist-btn {
    width: 48px;
    height: 48px;
    border: 2px solid #e5e5e5;
    border-radius: 8px;
    background: #fff;
    color: #e74c3c;
    cursor: pointer;
    font-size: 36px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wcjc-wishlist-btn:hover {
    border-color: #e74c3c;
    background: #fdf2f2;
    transform: scale(1.05);
}

.wcjc-wishlist-btn.added {
    background: #fdf2f2;
    border-color: #e74c3c;
}

/* 属性按钮样式 */
.wcjc-attr-btn, .wcjc-size-btn {
    transition: all 0.2s ease !important;
}

.wcjc-attr-btn:hover, .wcjc-size-btn:hover {
    border-color: #666 !important;
    background: #f5f5f5 !important;
}

.wcjc-attr-btn.is-active, .wcjc-size-btn.is-active,
.wcjc-attr-btn.active, .wcjc-size-btn.active {
    border-color: #000 !important;
    background: #000 !important;
    color: #fff !important;
}

/* Native Select Styling */
.wcjc-player-select,
.wcjc-patch-select {
    width: 100%;
    height: 48px;
    border: 2px solid #e5e5e5;
    border-radius: 8px;
    padding: 0 12px;
    font-size: 14px;
    font-weight: 600;
    background: #fff;
    color: #333;
    cursor: pointer;
    box-sizing: border-box;
}

.wcjc-patch-select.wcjc-patch-multi {
    height: auto;
    min-height: 120px;
    padding: 8px;
}

.wcjc-player-select:focus,
.wcjc-patch-select:focus {
    outline: none;
}

/* Responsive */
@media (max-width: 768px) {
    .wcjc-custom {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .wcjc-mode {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
    }
    
    .wcjc-action-buttons {
        flex-direction: column !important;
        gap: 12px !important;
    }
    
    .wcjc-wishlist-btn {
        width: 100% !important;
        height: 48px !important;
    }
}

