/* Stilovero Gallery - 增强样式 */
.stilovero-gallery {
    display: flex;
    width: 100%;
    overflow: hidden;
    justify-content: center;
}

.stilovero-thumbnails {
    width: 120px;
    padding: 15px 10px;
    overflow-y: auto;
    max-height: 600px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.stilovero-thumb {
    width: 100%;
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: 4px;
    transition: all 0.3s ease;
    opacity: 0.7;
    overflow: hidden;
}

.stilovero-thumb:hover {
    opacity: 1;
    transform: scale(1.05);
}

.stilovero-thumb.active {
    border-color: #bb5644;
    opacity: 1;
}

.stilovero-thumb img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 3px;
}

.stilovero-main {
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.stilovero-main-image-wrapper {
    position: relative;
    width: 100%;
    text-align: center;
}

.stilovero-main-image {
    max-width: 100%;
    max-height: 650px;
    height: auto;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.stilovero-image-info {
    margin-top: 15px;
    text-align: center;
    width: 100%;
}

.stilovero-image-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.stilovero-image-caption {
    font-size: 14px;
    color: #666;
    font-style: italic;
}

.stilovero-no-images {
    padding: 40px 20px;
    text-align: center;
    background: #f9f9f9;
    border-radius: 8px;
    color: #666;
    font-size: 16px;
}

/* 加入购物车按钮样式 */
.stilovero-add-to-cart {
}

.stilovero-size-selector {
    margin-bottom: 15px;
}

.stilovero-size-label {
    display: block;
    font-weight: normal;
    color: #333;
    margin-bottom: 10px;
}

.stilovero-size-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.stilovero-size-button {
    padding: 8px 16px;
    border: 2px solid #ddd;
    border-radius: 4px;
    background: white;
    color: #333;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    min-width: 50px;
    text-align: center;
}

.stilovero-size-button:hover {
    border-color: #bb5644;
    color: white;
}

.stilovero-size-button.active {
    border-color: #bb5644;
    background: #bb5644;
    color: white;
}

.stilovero-size-button:disabled {
    background: #f5f5f5;
    color: #999;
    cursor: not-allowed;
    border-color: #e0e0e0;
}

.stilovero-no-sizes {
    color: #999;
    font-style: italic;
    padding: 10px 0;
}

.stilovero-variation-info {
    margin-top: 10px;
    font-size: 14px;
}

.stilovero-variation-price {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 5px;
}

.stilovero-variation-stock {
    font-size: 13px;
    padding: 3px 8px;
    border-radius: 3px;
    display: inline-block;
    margin-bottom: 5px;
}

.stilovero-variation-stock.in-stock {
    background: #bb5644;
    color: #fff;
}

.stilovero-variation-stock.out-of-stock {
    background: #f8d7da;
    color: #721c24;
}

.stilovero-variation-error {
    color: #e74c3c;
    font-size: 13px;
}

.stilovero-loading-text {
    color: #7f8c8d;
    font-style: italic;
}

.stilovero-quantity-selector {
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.stilovero-quantity-selector label {
    font-weight: 600;
    color: #333;
}

.stilovero-quantity {
    width: 80px;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

/* 操作按钮容器 */
.stilovero-action-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.stilovero-add-to-cart-button {
    background: #bb5644;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-block;
    text-align: center;
    flex: 2;
}

.stilovero-add-to-cart-button:hover:not(:disabled) {
    background: #bb5644;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.stilovero-add-to-cart-button:disabled {
    background: #95a5a6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.stilovero-add-to-cart-button.loading {
    position: relative;
    color: transparent;
}

.stilovero-add-to-cart-button.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid transparent;
    border-top: 2px solid #ffffff;
    border-radius: 50%;
    animation: stilovero-spin 1s linear infinite;
}

/* 心愿单按钮样式 */
.stilovero-add-to-wishlist-button {
    border: none;
    padding: 12px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    flex: 0 0 auto;
    width: 50px;
    height: 50px;
}

.stilovero-add-to-wishlist-button:hover:not(:disabled) {
    background-color: transparent;
    border-color: #bb5644;
    transform: translateY(-2px);
}

.stilovero-add-to-wishlist-button:disabled {
    color: #999;
    cursor: not-allowed;
    border-color: #e0e0e0;
    transform: none;
}

.stilovero-add-to-wishlist-button.loading {
    position: relative;
    color: transparent;
}

.stilovero-add-to-wishlist-button.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid transparent;
    border-top: 2px solid #bb5644;
    border-radius: 50%;
    animation: stilovero-spin 1s linear infinite;
}

/* 心愿单图标样式 */
.stilovero-wishlist-icon {
    width: 30px;
    height: 30px;
    transition: all 0.3s ease;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
}

.stilovero-add-to-wishlist-button .stilovero-wishlist-icon {
    color: #666;
}

.stilovero-add-to-wishlist-button:hover .stilovero-wishlist-icon {
    color: #bb5644;
}

.stilovero-add-to-wishlist-button.active .stilovero-wishlist-icon {
    fill: #bb5644;
    stroke: #bb5644;
    color: #bb5644;
}

.stilovero-add-to-wishlist-button.active:hover .stilovero-wishlist-icon {
    fill: #bb5644;
    stroke: #bb5644;
    color: #bb5644;
}

.stilovero-cart-message {
    margin-top: 10px;
    padding: 10px;
    border-radius: 4px;
    font-size: 14px;
    display: none;
}

.stilovero-cart-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    display: block;
}

.stilovero-cart-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    display: block;
}

.stilovero-wishlist-message {
    margin-top: 10px;
    padding: 10px;
    border-radius: 4px;
    font-size: 14px;
    display: none;
}

.stilovero-wishlist-message.success {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
    display: block;
}

.stilovero-wishlist-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    display: block;
}

.stilovero-error {
    padding: 15px;
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    margin: 10px 0;
}

/* 缩略图列数设置 */
.stilovero-gallery[data-columns="2"] .stilovero-thumbnails {
    width: 80px;
}

.stilovero-gallery[data-columns="3"] .stilovero-thumbnails {
    width: 100px;
}

.stilovero-gallery[data-columns="4"] .stilovero-thumbnails {
    width: 120px;
}

.stilovero-gallery[data-columns="5"] .stilovero-thumbnails {
    width: 140px;
}

.stilovero-gallery[data-columns="6"] .stilovero-thumbnails {
    width: 160px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .stilovero-gallery {
        flex-direction: column-reverse;
    }
    
    .stilovero-thumbnails {
        width: 100%;
        flex-direction: row;
        overflow-x: auto;
        padding: 10px;
        border-right: none;
        border-top: 1px solid #eee;
        max-height: none;
    }
    
    .stilovero-thumb {
        width: 80px;
        min-width: 80px;
    }
    
    .stilovero-main {
        padding: 15px;
    }
    
    .stilovero-main-image {
        max-height: 400px;
    }
    
    /* 移动端加入购物车样式 */
    .stilovero-add-to-cart {

    }
    
    .stilovero-size-buttons {
        gap: 6px;
    }
    
    .stilovero-size-button {
        padding: 6px 12px;
        font-size: 13px;
        min-width: 45px;
    }
    
    .stilovero-quantity-selector {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .stilovero-action-buttons {
        flex-direction: row;
        gap: 8px;
        width: 80%;
    }
    
    .stilovero-add-to-cart-button {
        width: 100%;
        padding: 15px;
        flex: 2;
    }
    
    .stilovero-add-to-wishlist-button {
        width: 50px;
        height: 50px;
        flex: 0 0 auto;
    }
    
    /* 移动端缩略图列数 */
    .stilovero-gallery[data-columns="2"] .stilovero-thumbnails,
    .stilovero-gallery[data-columns="3"] .stilovero-thumbnails,
    .stilovero-gallery[data-columns="4"] .stilovero-thumbnails,
    .stilovero-gallery[data-columns="5"] .stilovero-thumbnails,
    .stilovero-gallery[data-columns="6"] .stilovero-thumbnails {
        width: 100%;
    }
}

/* 缩放效果 */
.stilovero-zoom-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    cursor: zoom-out;
}

.stilovero-zoom-image {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
}

/* 加载指示器 */
.stilovero-loading {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.9);
    padding: 12px 20px;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    z-index: 10;
    align-items: center;
}

.stilovero-loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3498db;
    border-radius: 50%;
    animation: stilovero-spin 1s linear infinite;
    display: inline-block;
    margin-right: 10px;
}

@keyframes stilovero-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 与WooCommerce主题兼容性 */
.woocommerce div.product .stilovero-gallery {
    
}

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
    .stilovero-thumb.active {
        border-color: #000;
    }
    
    .stilovero-gallery {
        border: 1px solid #000;
    }
    
    .stilovero-add-to-cart-button {
        border: 2px solid #000;
    }
    
    .stilovero-add-to-wishlist-button {
        border: 2px solid #000;
    }
    
    .stilovero-size-button.active {
        border-color: #000;
        background: #000;
        color: #fff;
    }
}

/* 减少动画模式支持 */
@media (prefers-reduced-motion: reduce) {
    .stilovero-thumb,
    .stilovero-main-image,
    .stilovero-loading-spinner,
    .stilovero-add-to-cart-button,
    .stilovero-add-to-wishlist-button,
    .stilovero-size-button {
        transition: none;
        animation: none;
    }
}