/**
 * WooCommerce Variation Switch - 樣式文件
 */

/* 使用 Flexbox 让父容器可以调整子元素顺序 */
.woocommerce-variation-add-to-cart,
form.variations_form {
    display: flex;
    flex-direction: column;
}

/* 自定义字段容器显示在最上方 */
.customField {
    order: -1; /* 负数让它显示在最前面 */
    margin-bottom: 20px;
}

.wapf-wrapper,
.wapf-field-container {
    margin-bottom: 10px;
}

/* 变体卡片容器 */
.wvs-variation-cards-container {
    order: 0; /* 默认顺序 */
    margin: 20px 0;
    padding-bottom: 0;
    transition: padding-bottom 0.3s ease;
}

/* 当底部工具栏显示时，添加底部空间 */
.wvs-variation-cards-container.has-footer-bar {
    padding-bottom: 100px;
}

/* 手机端需要更多空间 */
@media (max-width: 768px) {
    .wvs-variation-cards-container.has-footer-bar {
        padding-bottom: 160px;
    }
}

.wvs-loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

.wvs-variation-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.wvs-card {
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 0;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: relative;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    overflow: hidden;
}

.wvs-card:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.wvs-card-selected {
    border-color: #FF6B35;
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.2);
}

.wvs-card-image {
    width: 100%;
    height: 200px;
    flex-shrink: 0;
    overflow: hidden;
    background: #ffffff;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 核心光晕 - 外层 */
.wvs-card-image::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 250px;
    height: 250px;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, rgba(255, 183, 3, 0.5) 0%, rgba(255, 183, 3, 0) 70%);
    filter: blur(50px);
    animation: wvs-core-glow-outer 2000ms ease-in-out infinite alternate;
    pointer-events: none;
    z-index: 2;
}

/* 核心光晕 - 内层（更强烈）*/
.wvs-card-image::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100px;
    height: 100px;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, rgba(255, 183, 3, 0.9) 0%, rgba(255, 183, 3, 0.1) 80%);
    filter: blur(25px);
    animation: wvs-core-glow-inner 4000ms ease-in-out infinite alternate;
    pointer-events: none;
    z-index: 3;
}

/* 光束容器 */
.wvs-card-image-rays {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

/* 四个角落的柔和光束 */
.wvs-card-image-ray {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 80px;
    height: 200%;
    background: #FFB703;
    filter: blur(35px);
    opacity: 0.1;
    transform-origin: center center;
}

.wvs-card-image-ray:nth-child(1) {
    transform: translate(-50%, -50%) rotate(45deg);
    animation: wvs-ray-breathe-1 4000ms ease-in-out infinite alternate;
}

.wvs-card-image-ray:nth-child(2) {
    transform: translate(-50%, -50%) rotate(135deg);
    animation: wvs-ray-breathe-2 4000ms ease-in-out infinite alternate;
}

.wvs-card-image-ray:nth-child(3) {
    transform: translate(-50%, -50%) rotate(225deg);
    animation: wvs-ray-breathe-3 4000ms ease-in-out infinite alternate;
}

.wvs-card-image-ray:nth-child(4) {
    transform: translate(-50%, -50%) rotate(315deg);
    animation: wvs-ray-breathe-4 4000ms ease-in-out infinite alternate;
}

/* 核心外层呼吸动画 */
@keyframes wvs-core-glow-outer {
    0% {
        opacity: 0.6;
        transform: translate(-50%, -50%) scale(1);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.1);
    }
}

/* 核心内层呼吸动画 */
@keyframes wvs-core-glow-inner {
    0% {
        opacity: 0.6;
        transform: translate(-50%, -50%) scale(1);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.1);
    }
}

/* 光束柔和呼吸动画 */
@keyframes wvs-ray-breathe-1 {
    0% {
        opacity: 0.1;
        transform: translate(-50%, -50%) rotate(45deg) scale(1);
    }
    100% {
        opacity: 0.4;
        transform: translate(-50%, -50%) rotate(45deg) scale(1.05);
    }
}

@keyframes wvs-ray-breathe-2 {
    0% {
        opacity: 0.1;
        transform: translate(-50%, -50%) rotate(135deg) scale(1);
    }
    100% {
        opacity: 0.4;
        transform: translate(-50%, -50%) rotate(135deg) scale(1.05);
    }
}

@keyframes wvs-ray-breathe-3 {
    0% {
        opacity: 0.1;
        transform: translate(-50%, -50%) rotate(225deg) scale(1);
    }
    100% {
        opacity: 0.4;
        transform: translate(-50%, -50%) rotate(225deg) scale(1.05);
    }
}

@keyframes wvs-ray-breathe-4 {
    0% {
        opacity: 0.1;
        transform: translate(-50%, -50%) rotate(315deg) scale(1);
    }
    100% {
        opacity: 0.4;
        transform: translate(-50%, -50%) rotate(315deg) scale(1.05);
    }
}

.wvs-card-image-empty {
    background: transparent;
}

.wvs-card-image-empty::before,
.wvs-card-image-empty::after {
    display: none;
}

.wvs-card-image-empty .wvs-card-image-rays {
    display: none;
}

.wvs-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: relative;
    scale: 0.5;
    z-index: 10;
}

.wvs-card-content {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 15px;
    flex: 1;
}

.wvs-card-title {
    font-size: 14px;
    font-weight: 600;
    margin: 0;
    color: #333;
    line-height: 1.4;
    min-height: 40px;
}

.wvs-card-attributes {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.wvs-attribute {
    display: inline-block;
    padding: 4px 8px;
    background: #f0f0f0;
    border-radius: 4px;
    font-size: 12px;
    color: #666;
    text-transform: capitalize;
}

.wvs-card-sku {
    font-size: 11px;
    color: #999;
}

.wvs-card-description {
    font-size: 12px;
    color: #666;
    line-height: 1.5;
    margin-top: 5px;
}

.wvs-card-price {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: auto;
}

.wvs-price-regular {
    font-size: 12px;
    color: #999;
    text-decoration: line-through;
}

.wvs-price-current {
    font-size: 18px;
    font-weight: 700;
    color: #FF6B35;
}

.wvs-price-discount {
    font-size: 12px;
    color: #FF6B35;
    font-weight: 600;
    margin-left: auto;
}

.wvs-card-stock {
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 4px;
    display: inline-block;
    margin-bottom: 10px;
}

.wvs-stock-in {
    background: #e8f5e9;
    color: #2e7d32;
}

.wvs-stock-out {
    background: #ffebee;
    color: #c62828;
}

.wvs-card-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: #FF6B35;
    color: #fff;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    z-index: 1;
}

.wvs-card-quantity {
    display: flex;
    align-items: center;
    gap: 10px;
}

.wvs-qty-btn {
    width: 36px;
    height: 36px;
    min-width: 36px;
    max-width: 36px;
    min-height: 36px;
    max-height: 36px;
    border: 2px solid #e0e0e0;
    background: #fff;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    font-weight: 600;
    color: #333;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 0;
    line-height: 1;
    flex-shrink: 0;
    box-sizing: border-box;
}

.wvs-qty-btn:hover {
    border-color: #FF6B35;
    color: #FF6B35;
    background: #fff5f2;
}

.wvs-qty-btn:active {
    transform: scale(0.95);
}

.wvs-qty-input {
    width: 60px;
    height: 36px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    color: var(--theme-palette-color-6) !important;
    padding: 0 10px;
}

.wvs-qty-input:focus {
    outline: none;
    border-color: #FF6B35;
}

.wvs-qty-input::-webkit-inner-spin-button,
.wvs-qty-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.wvs-qty-input[type=number] {
    -moz-appearance: textfield;
    appearance: textfield;
}

.wvs-footer-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    border-top: 2px solid #e0e0e0;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    padding: 15px 20px;
}

.wvs-footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.wvs-total-section {
    display: flex;
    align-items: center;
    gap: 20px;
}

.wvs-total-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.wvs-total-label {
    font-size: 12px;
    color: #666;
    text-transform: uppercase;
}

.wvs-total-price {
    font-size: 24px;
    font-weight: 700;
    color: #FF6B35;
}

.wvs-actions {
    display: flex;
    gap: 10px;
}

.wvs-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 120px;
}

.wvs-btn-primary {
    background: #FF6B35;
    color: #fff;
}

.wvs-btn-primary:hover:not(:disabled) {
    background: #e55a2b;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(255, 107, 53, 0.3);
}

.wvs-btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
    opacity: 0.6;
}

.wvs-btn-secondary {
    background: #f5f5f5;
    color: #333;
    border: 2px solid #e0e0e0;
}

.wvs-btn-secondary:hover {
    background: #e0e0e0;
}

.wvs-notice {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    font-weight: 600;
    animation: slideIn 0.3s ease;
}

.wvs-notice-success {
    background: #4caf50;
    color: #fff;
}

.wvs-notice-error {
    background: #f44336;
    color: #fff;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@media (max-width: 768px) {
    .wvs-variation-cards-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 15px;
    }
    
    .wvs-card-image {
        height: 150px;
    }
    
    .wvs-card-title {
        font-size: 13px;
        min-height: 36px;
    }
    
    .wvs-footer-content {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }
    
    .wvs-total-section {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .wvs-total-info {
        align-items: center;
    }
    
    .wvs-actions {
        width: 100%;
    }
    
    .wvs-btn {
        flex: 1;
    }
}

/* Custom Fields Error Styling */
.wvs-field-error,
input.wvs-field-error,
select.wvs-field-error,
textarea.wvs-field-error {
    border-color: #dc3545 !important;
}

.wvs-field-error:focus {
    outline-color: #dc3545 !important;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1) !important;
}

.ct-cart-actions{
    display: none !important;
}

/* 缺貨卡片樣式 */
.wvs-card-disabled {
    opacity: 0.6;
    cursor: not-allowed;
    filter: grayscale(50%);
}

.wvs-card-disabled:hover {
    transform: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.wvs-card-disabled .wvs-card-image::before,
.wvs-card-disabled .wvs-card-image::after {
    display: none;
}

.wvs-card-disabled .wvs-card-image-rays {
    display: none;
}

/* 缺貨標籤樣式 */
.wvs-card-badge-out-of-stock {
    background: #9e9e9e;
}

/* 缺貨價格文字樣式 */
.wvs-price-out-of-stock {
    font-size: 14px;
    font-weight: 600;
    color: #9e9e9e;
}
