/**
 * Modern Mode Styles - Exact Demo Copy
 * Copied exactly from demo-package-selector.html
 */

.wab-demo-container {
    max-width: 800px;
    margin: 0 auto;
    border: 2px solid #17ef97;
    padding: 20px;
    background: rgba(0,0,0,0.8);
    border-radius: 10px;
    color: white;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.wab-demo-title {
    color: #17ef97;
    text-align: center;
    margin-bottom: 30px;
    font-size: 24px;
}

/* 产品属性选择区域 */
.wab-attributes-section {
    margin-bottom: 30px;
}

.wab-attributes-section h3 {
    color: #17ef97;
    margin-bottom: 20px;
}

.wab-attribute-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 6px;
    border: 1px solid #ddd;
}

.wab-attribute-name {
    color: white;
    font-weight: 500;
    flex: 1;
}

.wab-quantity-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.wab-qty-btn {
    width: 32px;
    height: 32px;
    background: #ffffff;
    color: #333;
    border: 1px solid #ddd;
    border-radius: 50%;
    font-weight: bold;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.wab-qty-btn:hover {
    background: #17ef97;
    color: white;
    border-color: #17ef97;
}

.wab-qty-input {
    width: 60px;
    text-align: center;
    font-size: 14px;
    padding: 4px 2px;
    border: 2px solid #17ef97;
    border-radius: 4px;
    background: white;
    color: black;
}

/* 套餐选择区域 */
.wab-package-section {
    margin: 30px 0;
}

.wab-package-section h3 {
    color: white;
    margin-bottom: 15px;
    font-size: 18px;
}

.wab-package-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.wab-package-option {
    position: relative;
    flex: 1;
    min-width: 120px;
}

.wab-fire-icon {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #ff4444;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    z-index: 2;
    animation: fireFlicker 1s ease-in-out infinite alternate;
}

@keyframes fireFlicker {
    0% { transform: scale(1) rotate(-2deg); }
    100% { transform: scale(1.1) rotate(2deg); }
}

.wab-package-btn {
    width: 100%;
    padding: 15px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    font-weight: 600;
    position: relative;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.wab-package-btn.first {
    background: white;
    color: #333;
    border: 2px solid #ddd;
}

.wab-package-btn:hover {
    background: #17ef97 !important;
    color: white !important;
    border: 2px solid #17ef97 !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(23, 239, 151, 0.3);
}

/* 用户主动选择的套餐 - 完全绿色高亮 */
.wab-package-btn.selected {
    background: #17ef97 !important;
    color: white !important;
    border: 2px solid #17ef97 !important;
    /* 移除transform，防止创建层叠上下文 */
    box-shadow: 0 4px 12px rgba(23, 239, 151, 0.3);
}

/* 根据数量自动高亮的套餐 - 完全禁用，强制用户主动选择 */
.wab-package-btn.active:not(.selected) {
    /* 暂时禁用自动高亮，强制完全绿色 */
    background: #17ef97 !important;
    color: white !important;
    border: 2px solid #17ef97 !important;
    box-shadow: 0 4px 12px rgba(23, 239, 151, 0.3);
    /* 移除transform，防止创建层叠上下文 */
}

.wab-package-btn.active:not(.selected) .wab-package-label {
    color: white !important;  /* 修复：白色文字在绿色背景上 */
    font-weight: 600;
}

/* 确保选中状态优先级最高 */
.wab-package-btn.selected .wab-package-label,
.wab-package-btn.selected .wab-package-discount,
.wab-package-btn.selected .wab-package-price {
    color: white !important;
}

.wab-package-details {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.wab-package-label {
    font-size: 14px;
}

.wab-package-discount {
    font-size: 12px;
    opacity: 0.8;
}

.wab-package-price {
    font-size: 16px;
    font-weight: bold;
}

/* 选中套餐信息 */
.wab-selected-package-info {
    background: rgba(23, 239, 151, 0.1);
    border: 1px solid #17ef97;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    display: none;
}

.wab-selected-package-info .wab-info-title {
    color: #17ef97;
    font-weight: 600;
    margin-bottom: 5px;
}

.wab-selected-package-info .wab-info-details {
    color: white;
}

/* 进度条样式 */
.wab-discount-progress {
    margin: 20px 0;
}

.wab-progress-bar-container {
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    overflow: hidden;
}

.wab-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #28a745, #17ef97);
    border-radius: 2px;
    transition: width 0.3s ease;
    width: 0%;
}

.wab-current-discount-info {
    text-align: center;
    margin-top: 10px;
    color: #17ef97;
    font-size: 14px;
    font-weight: 500;
}

/* 总计区域 */
.wab-total-section {
    margin-top: 20px;
    padding: 15px;
    background: rgba(255,255,255,0.1);
    border-radius: 8px;
}

.wab-total-item {
    color: white;
    margin-bottom: 10px;
}

.wab-total-value {
    color: #17ef97;
    font-weight: bold;
}

.wab-add-to-cart-btn {
    width: 100%;
    padding: 15px;
    background: #17ef97;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.wab-add-to-cart-btn:hover {
    background: #15d085;
    transform: translateY(-1px);
}

.wab-add-to-cart-btn:disabled {
    background: #666;
    cursor: not-allowed;
    transform: none;
}

/* 智能提示样式 */
.wab-smart-tip {
    background: rgba(255, 193, 7, 0.1);
    border: 1px solid #ffc107;
    border-radius: 8px;
    padding: 15px;
    margin: 15px 0;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: tipFadeIn 0.3s ease-in-out;
}

@keyframes tipFadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.wab-tip-icon {
    font-size: 18px;
}

.wab-tip-text {
    color: white;
    font-weight: 500;
    font-size: 16px;  /* 设置字号为16px */
}

.wab-smart-tip.success {
    background: rgba(23, 239, 151, 0.1);
    border-color: #17ef97;
}

.wab-smart-tip.success .wab-tip-text {
    color: white;
}

.wab-smart-tip.warning {
    background: rgba(255, 193, 7, 0.1);
    border-color: #ffc107;
}

.wab-smart-tip.warning .wab-tip-text {
    color: white;
}

/* ---------- Woo Advanced Bundles - stacking 修复 ---------- */
/* 外层容器：确保有相对定位作为层叠上下文根 */
.wab-wrap, .woo-advanced-bundles, [data-wab-root], .wab-bundle-container {
    position: relative;
}

/* 让卡片（N Packs）永远压在最上层 - 使用正确的类名 */
.wab-package-option {
    position: relative !important;
    z-index: 10 !important;
}

.wab-package-btn, .wab-package-btn * {
    position: relative !important;
    z-index: 11 !important;
} /* 卡片内部文字/徽章再抬一层，避免被条形进度/光晕遮住 */

/* 数量选择器放在最低层 - 使用正确的类名 */
.wab-quantity-controls, .wab-qty-input, .wab-qty-btn {
    position: relative !important;
    z-index: 1 !important;
}

/* 数量选择器的伪元素强制最低层级 */
.wab-quantity-controls::before, .wab-quantity-controls::after,
.wab-qty-input::before, .wab-qty-input::after,
.wab-qty-btn::before, .wab-qty-btn::after {
    z-index: 0 !important;
    pointer-events: none !important;
}

/* 限制数量选择器容器，避免溢出 */
.wab-quantity-controls, .wab-attribute-item {
    overflow: hidden !important;
}

/* 输入框获得焦点时，强制低层级和内阴影 - 覆盖所有可能的输入框 */
.wab-qty-input:focus,
.wab-modern-qty-input:focus,
input[type="number"]:focus {
    outline: none !important;
    box-shadow: inset 0 0 0 2px #17ef97 !important; /* 强制内阴影，绝不外溢 */
    z-index: 1 !important; /* 确保不超过卡片层级 */
    transform: none !important; /* 防止创建新层叠上下文 */
    filter: none !important; /* 防止创建新层叠上下文 */
}

/* 防止数量选择器创建新的层叠上下文 */
.wab-quantity-controls, .wab-quantity-controls *,
.wab-qty-input, .wab-qty-btn {
    transform: none !important;
    filter: none !important;
}

/* 火焰图标确保在最高层级 */
.wab-fire-icon {
    z-index: 12 !important; /* 比卡片内容更高 */
}

/* Safari/Chromium 的 number spinner 收敛 */
.wab-qty-input {
    -moz-appearance: textfield;
}
.wab-qty-input::-webkit-outer-spin-button,
.wab-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* 调试按钮样式 */
.wab-debug-panel {
    position: fixed;
    top: 10px;
    right: 10px;
    background: #333;
    color: white;
    padding: 15px;
    border-radius: 8px;
    z-index: 9999;
    font-family: monospace;
    font-size: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    max-width: 300px;
}

.wab-debug-panel h4 {
    margin: 0 0 10px 0;
    color: #17ef97;
}

.wab-debug-btn {
    display: block;
    width: 100%;
    margin: 5px 0;
    padding: 8px 12px;
    background: #17ef97;
    color: #333;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    font-weight: bold;
}

.wab-debug-btn:hover {
    background: #00ff88;
}

.wab-debug-info {
    margin-top: 10px;
    padding: 8px;
    background: #444;
    border-radius: 4px;
    font-size: 10px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .wab-package-options {
        flex-direction: column;
    }

    .wab-package-option {
        min-width: auto;
    }

    .wab-debug-panel {
        position: relative;
        top: auto;
        right: auto;
        margin: 10px;
    }
}
