/* 商品规格选择组件样式 */
.goods-spec-section {
    margin: 20px 0;
    padding: 20px;
    background: #fff;
    border-radius: 8px;
    border: 1px solid #e1e5e9;
}

.spec-item {
    margin-bottom: 20px;
}

.spec-item:last-child {
    margin-bottom: 0;
}

.spec-label {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    margin-bottom: 10px;
}

.spec-value {
    font-size: 14px;
    color: #666;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 4px;
    border: 1px solid #e1e5e9;
}

.spec-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.spec-option {
    padding: 8px 16px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    color: #333;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 60px;
    text-align: center;
}

.spec-option:hover {
    border-color: #007bff;
    color: #007bff;
}

.spec-option.selected {
    border-color: #007bff;
    background: #007bff;
    color: #fff;
}

.spec-option.disabled {
    border-color: #e1e5e9;
    background: #f8f9fa;
    color: #999;
    cursor: not-allowed;
    text-decoration: line-through;
}

/* 购买区域样式 */
.goods-purchase-section {
    margin: 20px 0;
    padding: 20px;
    background: #fff;
    border-radius: 8px;
    border: 1px solid #e1e5e9;
}

.price-section {
    margin-bottom: 15px;
}

.current-price {
    font-size: 24px;
    font-weight: 600;
    color: #ff4757;
    margin-bottom: 5px;
}

.price-range {
    font-size: 18px;
    font-weight: 500;
    color: #ff4757;
    margin-bottom: 5px;
}

.original-price {
    font-size: 14px;
    color: #999;
    text-decoration: line-through;
}

.stock-section {
    margin-bottom: 15px;
}

.stock-info {
    font-size: 14px;
    color: #666;
}

.stock-info.low-stock {
    color: #ff4757;
    font-weight: 500;
}

.stock-info.out-of-stock {
    color: #999;
    text-decoration: line-through;
}

.quantity-section {
    margin-bottom: 20px;
}

.quantity-control {
    display: flex;
    align-items: center;
    width: 120px;
}

.quantity-btn {
    width: 32px;
    height: 32px;
    border: 1px solid #ddd;
    background: #fff;
    color: #333;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.quantity-btn:hover {
    border-color: #007bff;
    color: #007bff;
}

.quantity-btn:disabled {
    background: #f8f9fa;
    color: #999;
    cursor: not-allowed;
}

.quantity-input {
    flex: 1;
    height: 32px;
    text-align: center;
    border: 1px solid #ddd;
    border-left: none;
    border-right: none;
    font-size: 14px;
    font-weight: 500;
}

.quantity-input:focus {
    outline: none;
    border-color: #007bff;
}

.action-section {
    display: flex;
    gap: 15px;
}

.btn-add-cart,
.btn-buy-now {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-add-cart {
    background: #007bff;
    color: #fff;
}

.btn-add-cart:hover {
    background: #0056b3;
}

.btn-buy-now {
    background: #28a745;
    color: #fff;
}

.btn-buy-now:hover {
    background: #1e7e34;
}

.btn-add-cart:disabled,
.btn-buy-now:disabled {
    background: #e1e5e9;
    color: #999;
    cursor: not-allowed;
}

/* 提示信息样式 */
.spec-error-toast,
.spec-success-toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 12px 20px;
    border-radius: 6px;
    font-size: 14px;
    z-index: 1000;
    animation: fadeInOut 3s ease;
}

.spec-error-toast {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.spec-success-toast {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

@keyframes fadeInOut {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
    20% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    80% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .goods-spec-section,
    .goods-purchase-section {
        margin: 15px 0;
        padding: 15px;
    }
    
    .spec-options {
        gap: 8px;
    }
    
    .spec-option {
        padding: 6px 12px;
        font-size: 13px;
        min-width: 50px;
    }
    
    .current-price {
        font-size: 20px;
    }
    
    .price-range {
        font-size: 16px;
    }
    
    .quantity-control {
        width: 100px;
    }
    
    .quantity-btn {
        width: 28px;
        height: 28px;
        font-size: 14px;
    }
    
    .quantity-input {
        height: 28px;
        font-size: 13px;
    }
    
    .action-section {
        flex-direction: column;
        gap: 10px;
    }
    
    .btn-add-cart,
    .btn-buy-now {
        padding: 10px 16px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .goods-spec-section,
    .goods-purchase-section {
        margin: 10px 0;
        padding: 12px;
    }
    
    .spec-options {
        gap: 6px;
    }
    
    .spec-option {
        padding: 5px 10px;
        font-size: 12px;
        min-width: 45px;
    }
    
    .current-price {
        font-size: 18px;
    }
    
    .price-range {
        font-size: 14px;
    }
    
    .quantity-control {
        width: 90px;
    }
    
    .quantity-btn {
        width: 25px;
        height: 25px;
        font-size: 12px;
    }
    
    .quantity-input {
        height: 25px;
        font-size: 12px;
    }
}

/* 加载状态 */
.spec-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
    color: #666;
    font-size: 14px;
}

.spec-loading::before {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 规格图片预览 */
.spec-option-with-image {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 8px;
}

.spec-option-image {
    width: 20px;
    height: 20px;
    object-fit: cover;
    border-radius: 2px;
}

/* 库存不足提示 */
.low-stock-warning {
    color: #ff4757;
    font-size: 12px;
    margin-top: 5px;
}

/* 规格选择动画 */
.spec-option {
    position: relative;
    overflow: hidden;
}

.spec-option::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(0, 123, 255, 0.1);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.3s ease, height 0.3s ease;
}

.spec-option.selected::before {
    width: 100%;
    height: 100%;
}

/* 禁用状态的鼠标指针 */
.spec-option.disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

/* 价格变化动画 */
.price-section .current-price,
.price-section .price-range {
    transition: all 0.3s ease;
}

/* 按钮点击效果 */
.btn-add-cart:active,
.btn-buy-now:active {
    transform: scale(0.98);
}

/* 购物车图标动画 */
.btn-add-cart i {
    transition: transform 0.3s ease;
}

.btn-add-cart:hover i {
    transform: scale(1.1);
}

.btn-add-cart:active i {
    transform: scale(0.9);
}
