/* ===================================
   DIY ONBOARDING WALKTHROUGH STYLES
   =================================== */

/* Blur Overlay - uses massive box-shadow to create darkened area around highlighted element */
.d2-onboarding-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.65);
    z-index: 99990;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s ease;
}

.d2-onboarding-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* Highlighted element (visible above the overlay) */
.d2-onboarding-highlight {
    position: relative !important;
    z-index: 99992 !important;
    border-radius: 12px;
    transition: box-shadow 0.3s ease, transform 0.3s ease;
    background: #fff !important;
    /* Spotlight effect - element pops out from darkness */
    box-shadow: 
        0 0 0 4px rgba(102, 126, 234, 0.7),
        0 0 0 9999px rgba(0, 0, 0, 0.6),
        0 0 30px rgba(102, 126, 234, 0.5),
        0 8px 32px rgba(0, 0, 0, 0.3) !important;
    transform: scale(1.01);
}

/* Hide the regular overlay when highlight is active - the box-shadow creates the effect */
.d2-onboarding-active .d2-onboarding-overlay.active {
    background: transparent;
}

/* Tooltip Bubble */
.d2-onboarding-bubble {
    position: absolute;
    z-index: 99995;
    width: 320px;
    max-width: calc(100vw - 40px);
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25),
                0 8px 24px rgba(102, 126, 234, 0.15);
    padding: 0;
    opacity: 0;
    transform: translateY(10px) scale(0.95);
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
    overflow: hidden;
}

.d2-onboarding-bubble.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Bubble Arrow */
.d2-onboarding-bubble::before {
    content: '';
    position: absolute;
    width: 0;
    height: 0;
    border: 12px solid transparent;
}

.d2-onboarding-bubble.arrow-top::before {
    bottom: 100%;
    left: 24px;
    border-bottom-color: #667eea;
}

.d2-onboarding-bubble.arrow-bottom::before {
    top: 100%;
    left: 24px;
    border-top-color: #fff;
}

.d2-onboarding-bubble.arrow-left::before {
    right: 100%;
    top: 24px;
    border-right-color: #667eea;
}

.d2-onboarding-bubble.arrow-right::before {
    left: 100%;
    top: 24px;
    border-left-color: #fff;
}

/* Bubble Header (Step indicator + Close) */
.d2-onboarding-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

.d2-onboarding-step-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.d2-onboarding-step-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    font-weight: 800;
    font-size: 14px;
}

.d2-onboarding-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.d2-onboarding-close:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: rotate(90deg);
}

/* Bubble Content */
.d2-onboarding-content {
    padding: 20px;
}

.d2-onboarding-title {
    margin: 0 0 10px 0;
    font-size: 18px;
    font-weight: 700;
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 10px;
}

.d2-onboarding-title-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
    color: #fff;
    font-size: 16px;
}

.d2-onboarding-description {
    margin: 0;
    font-size: 14px;
    line-height: 1.6;
    color: #5a6a7a;
}

/* Progress Dots */
.d2-onboarding-progress {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
}

.d2-onboarding-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #dee2e6;
    transition: all 0.3s ease;
}

.d2-onboarding-dot.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    transform: scale(1.2);
}

.d2-onboarding-dot.completed {
    background: #4CAF50;
}

/* Bubble Actions (Navigation) */
.d2-onboarding-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: #f8f9fa;
    gap: 12px;
}

.d2-onboarding-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    border: none;
}

.d2-onboarding-btn-back {
    background: #fff;
    color: #667eea;
    border: 2px solid #e1e4e8;
}

.d2-onboarding-btn-back:hover {
    background: #f8f9ff;
    border-color: #667eea;
}

.d2-onboarding-btn-back:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.d2-onboarding-btn-next {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    flex: 1;
    max-width: 160px;
}

.d2-onboarding-btn-next:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.35);
}

/* Completion Popup */
.d2-onboarding-completion-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.d2-onboarding-completion-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.d2-onboarding-completion-popup {
    background: #ffffff;
    border-radius: 24px;
    padding: 48px 40px;
    text-align: center;
    max-width: 420px;
    width: 90%;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.3);
    transform: translateY(30px) scale(0.9);
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.d2-onboarding-completion-overlay.visible .d2-onboarding-completion-popup {
    transform: translateY(0) scale(1);
}

.d2-onboarding-completion-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
    background: linear-gradient(135deg, #4CAF50 0%, #45B855 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    color: #fff;
    animation: completionBounce 0.6s ease-out 0.3s both;
}

@keyframes completionBounce {
    0% { transform: scale(0); }
    50% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

.d2-onboarding-completion-title {
    margin: 0 0 12px 0;
    font-size: 26px;
    font-weight: 800;
    color: #2c3e50;
    animation: fadeInUp 0.5s ease-out 0.4s both;
}

.d2-onboarding-completion-message {
    margin: 0 0 28px 0;
    font-size: 16px;
    line-height: 1.6;
    color: #5a6a7a;
    animation: fadeInUp 0.5s ease-out 0.5s both;
}

.d2-onboarding-completion-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 32px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    animation: fadeInUp 0.5s ease-out 0.6s both;
}

.d2-onboarding-completion-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.4);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* "How it works" Button */
.d2-how-it-works-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 30px;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
    margin-top: 16px;
}

.d2-how-it-works-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.6);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.d2-how-it-works-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    font-size: 14px;
    font-weight: 800;
}

/* Desktop-only: make the onboarding bubble a bit wider and keep it usable on short screens.
   (Mobile/smaller screens keep their current fixed-bottom layout via the existing max-width media queries.) */
@media (min-width: 769px) {
    .d2-onboarding-bubble {
        width: 420px;
        max-height: calc(100vh - 40px);
        display: flex;
        flex-direction: column;
    }

    .d2-onboarding-content {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .d2-onboarding-bubble {
        width: 290px;
        position: fixed;
        left: 50% !important;
        transform: translateX(-50%) translateY(10px) scale(0.95);
        /* Mobile-only: sit a bit LOWER so it doesn't visually collide with the highlighted step box */
        bottom: 60px !important; /* fallback */
        bottom: clamp(40px, calc(env(safe-area-inset-bottom, 0px) + 16px), 80px) !important;
        top: auto !important;
    }
    
    .d2-onboarding-bubble.visible {
        transform: translateX(-50%) translateY(0) scale(1);
    }
    
    .d2-onboarding-bubble::before {
        display: none;
    }
    
    .d2-onboarding-content {
        padding: 16px;
    }
    
    .d2-onboarding-title {
        font-size: 16px;
    }
    
    .d2-onboarding-description {
        font-size: 13px;
    }
    
    .d2-onboarding-actions {
        padding: 12px 16px;
    }
    
    .d2-onboarding-btn {
        padding: 10px 16px;
        font-size: 13px;
    }
    
    .d2-onboarding-completion-popup {
        padding: 36px 24px;
    }
    
    .d2-onboarding-completion-title {
        font-size: 22px;
    }
    
    .d2-onboarding-completion-message {
        font-size: 14px;
    }
    
    .d2-how-it-works-btn {
        padding: 8px 16px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .d2-onboarding-bubble {
        width: calc(100vw - 32px);
        max-width: 100%;
    }
    
    .d2-onboarding-header {
        padding: 12px 16px;
    }
    
    .d2-onboarding-step-indicator {
        font-size: 12px;
    }
    
    .d2-onboarding-step-badge {
        width: 24px;
        height: 24px;
        font-size: 12px;
    }
}

/* Ensure highlighted element doesn't get cut off */
.d2-onboarding-active .d2-enhanced-container {
    overflow: visible !important;
}

.d2-onboarding-active .d2-prompt-section,
.d2-onboarding-active .d2-text-section,
.d2-onboarding-active .d2-style-presets,
.d2-onboarding-active .d2-action-section {
    position: relative;
}

/* Ensure parent containers don't clip the spotlight effect */
.d2-onboarding-active,
.d2-onboarding-active body,
.d2-onboarding-active .qodef-page-wrapper,
.d2-onboarding-active .qodef-content-wrapper,
.d2-onboarding-active .woocommerce,
.d2-onboarding-active .product,
.d2-onboarding-active .summary,
.d2-onboarding-active #openai-image-generator {
    overflow: visible !important;
}

/* Background for highlighted sections to ensure clean appearance */
.d2-onboarding-highlight.d2-prompt-section,
.d2-onboarding-highlight.d2-text-section,
.d2-onboarding-highlight.d2-style-presets,
.d2-onboarding-highlight.d2-action-section {
    background: #f8f9fa !important;
    padding: 16px !important;
    margin: -8px !important;
}

/* Ensure bubble stays above everything */
.d2-onboarding-bubble {
    z-index: 99998 !important;
}

/* Keep FPD canvas dimmed during onboarding - NOT highlighted */
.d2-onboarding-active .fpd-container,
.d2-onboarding-active #fpdInstance,
.d2-onboarding-active .fpd,
.d2-onboarding-active .fancy-product-designer,
.d2-onboarding-active .fpd-product-view,
.d2-onboarding-active .qodef-woo-single-inner .qodef-woo-single-image,
.d2-onboarding-active .woocommerce-product-gallery {
    position: relative;
    z-index: 1 !important;
    pointer-events: none;
}

