/**
 * WhoKnew Views - Guided Mode Overlay Styles
 * Version: 1.0.0
 * Used for highlighting specific elements during onboarding
 */

/* Guided mode overlay - NO GRAY BACKGROUND */
.wkviews-guided-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: transparent; /* No gray overlay */
    z-index: 99999;
    display: none;
    pointer-events: none;
}

.wkviews-guided-overlay.active {
    display: block;
}

/* Highlighted element - RED GRADIENT BORDER (for ALL steps) */
.wkviews-guided-highlight {
    position: relative !important;
    z-index: 100000 !important;
    border: 8px solid #f5576c !important; /* Fallback solid color */
    border-image: linear-gradient(135deg, #f093fb 0%, #f5576c 100%) 1 !important;
    box-shadow: 0 0 60px 10px rgba(245, 87, 108, 0.6),
                0 0 40px 5px rgba(240, 147, 251, 0.5),
                0 0 20px 2px rgba(245, 87, 108, 0.8),
                inset 0 0 0 2px rgba(255, 255, 255, 0.5) !important;
    animation: pulse-red 2s infinite !important;
    pointer-events: auto !important;
    opacity: 1 !important;
}

/* Keep red borders for all highlighted elements regardless of theme (themes only affect instruction box) */
.wkviews-guided-highlight.wkviews-theme-blue {
    border: 8px solid #f5576c !important;
    border-image: linear-gradient(135deg, #f093fb 0%, #f5576c 100%) 1 !important;
    box-shadow: 0 0 60px 10px rgba(245, 87, 108, 0.6),
                0 0 40px 5px rgba(240, 147, 251, 0.5),
                0 0 20px 2px rgba(245, 87, 108, 0.8),
                inset 0 0 0 2px rgba(255, 255, 255, 0.5) !important;
    animation: pulse-red 2s infinite !important;
}

/* Ensure all child elements are fully visible */
.wkviews-guided-highlight * {
    opacity: 1 !important;
}

/* Special styling for checkboxes - make them more prominent */
input[type="checkbox"].wkviews-guided-highlight {
    width: 30px !important;
    height: 30px !important;
    min-width: 30px !important;
    min-height: 30px !important;
    cursor: pointer !important;
    transform: scale(1.5) !important;
    margin: 10px !important;
}

/* Red pulse animation - DRAMATIC GLOW */
@keyframes pulse-red {
    0%, 100% {
        box-shadow: 0 0 60px 10px rgba(245, 87, 108, 0.6),
                    0 0 40px 5px rgba(240, 147, 251, 0.5),
                    0 0 20px 2px rgba(245, 87, 108, 0.8),
                    inset 0 0 0 2px rgba(255, 255, 255, 0.5);
    }
    50% {
        box-shadow: 0 0 80px 15px rgba(245, 87, 108, 0.8),
                    0 0 60px 10px rgba(240, 147, 251, 0.7),
                    0 0 30px 5px rgba(245, 87, 108, 1),
                    inset 0 0 0 2px rgba(255, 255, 255, 0.8);
    }
}

/* Guided tooltip */
.wkviews-guided-tooltip {
    position: absolute;
    background: white;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    max-width: 300px;
    z-index: 100001;
}

.wkviews-guided-tooltip::before {
    content: '';
    position: absolute;
    width: 0;
    height: 0;
    border: 8px solid transparent;
}

.wkviews-guided-tooltip.top::before {
    bottom: -16px;
    left: 50%;
    transform: translateX(-50%);
    border-top-color: white;
}

.wkviews-guided-tooltip.bottom::before {
    top: -16px;
    left: 50%;
    transform: translateX(-50%);
    border-bottom-color: white;
}

.wkviews-guided-tooltip h4 {
    margin: 0 0 10px 0;
    color: #1e3a8a;
}

.wkviews-guided-tooltip p {
    margin: 0;
    color: #4b5563;
    font-size: 14px;
}

/* Guided tour instruction box - fixed top right */
.wkviews-guided-instruction {
    position: fixed;
    top: 20px;
    right: 20px;
    max-width: 400px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
    padding: 1.5rem;
    z-index: 100003;
    display: none;
    border: 8px solid;
    border-image: linear-gradient(135deg, #11998e 0%, #38ef7d 100%) 1; /* GREEN - default for styling steps */
}

/* BLUE THEME for instruction box (steps 29-57, pro features) */
.wkviews-guided-instruction.wkviews-theme-blue {
    border-image: linear-gradient(135deg, #667eea 0%, #764ba2 100%) 1;
}

/* Make header look draggable */
.wkviews-guided-instruction-header {
    cursor: move;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    position: relative;
}

.wkviews-guided-instruction-header:active {
    cursor: grabbing;
}

/* Add subtle hint that it's draggable */
.wkviews-guided-instruction-header::before {
    content: '⋮⋮';
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    color: rgba(0, 0, 0, 0.2);
    letter-spacing: -2px;
}

/* Adjust header left padding to make room for drag indicator */
.wkviews-guided-instruction-header .wkviews-guided-header-left {
    padding-left: 20px;
}

/* TRANSITION STEP THEME - Special styling for quick tab transition steps (42, 48) */
.wkviews-guided-instruction.wkviews-transition-step {
    max-width: 320px !important;
    padding: 1.25rem !important;
    border-width: 4px !important;
    border-image: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%) 1 !important;
    background: linear-gradient(135deg, #fefce8 0%, #fffbeb 100%) !important;
    box-shadow: 0 8px 30px rgba(251, 191, 36, 0.3) !important;
}

.wkviews-guided-instruction.wkviews-transition-step .wkviews-guided-instruction-content {
    font-size: 0.95rem !important;
    line-height: 1.6 !important;
    text-align: center !important;
}

.wkviews-guided-instruction.wkviews-transition-step .wkviews-guided-instruction-title {
    font-size: 1.1rem !important;
    text-align: center !important;
    color: #92400e !important;
}

.wkviews-guided-instruction.wkviews-transition-step .wkviews-guided-instruction-content p {
    color: #78350f !important;
    margin: 0.5rem 0 !important;
}

.wkviews-guided-instruction.active {
    display: block;
    animation: slideInFromRight 0.3s ease-out;
}

@keyframes slideInFromRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.wkviews-guided-instruction-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    gap: 1rem;
}

.wkviews-guided-header-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
}

.wkviews-guided-instruction-icon {
    display: none; /* Hide icons */
}

.wkviews-guided-instruction-title {
    font-size: 1rem;
    font-weight: 600;
    color: #1e3a8a;
    margin: 0;
    line-height: 1.4;
}

.wkviews-guided-instruction .wkviews-audio-toggle {
    padding: 0.5rem 0.75rem !important;
    font-size: 0.875rem !important;
    min-height: 32px;
    flex-shrink: 0;
}

.wkviews-guided-instruction .wkviews-audio-toggle .dashicons {
    width: 18px;
    height: 18px;
    font-size: 18px;
}

.wkviews-guided-instruction-text {
    font-size: 0.9375rem;
    color: #4b5563;
    line-height: 1.6;
    margin-bottom: 1rem;
}

.wkviews-audio-progress-bar {
    width: 100%;
    height: 8px;
    background: linear-gradient(135deg, #e5e7eb 0%, #d1d5db 100%);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 1.25rem;
}

.wkviews-audio-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(135deg, #38ef7d 0%, #11998e 100%);
    transition: width 0.1s linear;
    border-radius: 4px;
}

.wkviews-audio-progress-fill.wkviews-theme-blue {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.wkviews-guided-instruction-nav {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid #e5e7eb;
}

.wkviews-guided-progress {
    font-size: 0.8125rem;
    color: #6b7280;
    font-weight: 600;
}

.wkviews-guided-instruction .button {
    font-size: 0.875rem !important;
    padding: 0.5rem 1rem !important;
    height: auto !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.375rem !important;
    line-height: 1.5 !important;
}

/* Center align the arrow icons with text */
.wkviews-guided-instruction .button .dashicons {
    width: 18px !important;
    height: 18px !important;
    font-size: 18px !important;
    line-height: 18px !important;
    vertical-align: middle !important;
    margin: 0 !important;
    padding: 0 !important;
    display: inline-block !important;
}

/* GREEN THEME buttons (styling section, steps 1-28, free users) */
.wkviews-guided-instruction .button-primary {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%) !important;
    border-color: #11998e !important;
}

.wkviews-guided-instruction .button-primary:hover {
    background: linear-gradient(135deg, #0f8077 0%, #2fd66a 100%) !important;
}

/* BLUE THEME buttons (logic/preset section, steps 29-57, pro users) */
.wkviews-guided-instruction.wkviews-theme-blue .button-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    border-color: #667eea !important;
}

.wkviews-guided-instruction.wkviews-theme-blue .button-primary:hover {
    background: linear-gradient(135deg, #5568d3 0%, #653a8b 100%) !important;
}

/* Return to wizard button - GREEN THEME (default for styling steps) */
.wkviews-return-to-wizard {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 100002;
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%) !important;
    color: #ffffff !important;
    border: none !important;
    padding: 1rem 2rem !important;
    font-size: 1rem !important;
    font-weight: 600 !important;
    border-radius: 50px !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: all 0.3s;
    display: none;
}

/* BLUE THEME for return button (pro steps) */
.wkviews-return-to-wizard.wkviews-theme-blue {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
}

.wkviews-return-to-wizard.active {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Center align the dashicon in return to wizard button */
.wkviews-return-to-wizard .dashicons {
    width: 20px !important;
    height: 20px !important;
    font-size: 20px !important;
    line-height: 20px !important;
    vertical-align: middle !important;
    margin: 0 !important;
    padding: 0 !important;
    display: inline-block !important;
}

.wkviews-return-to-wizard:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(59, 130, 246, 0.4);
}

/* Field highlighting */
.wkviews-field-highlight {
    position: relative;
}

.wkviews-field-highlight::after {
    content: '';
    position: absolute;
    top: -5px;
    left: -5px;
    right: -5px;
    bottom: -5px;
    border: 2px solid #3b82f6;
    border-radius: 4px;
    pointer-events: none;
    animation: highlightPulse 1.5s infinite;
}

@keyframes highlightPulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.02);
    }
}

/* Counter highlight in preview (Step 4) */
.wkviews-counter-highlight {
    border: 4px solid #f5576c !important;
    border-image: linear-gradient(135deg, #f093fb 0%, #f5576c 100%) 1 !important;
    box-shadow: 0 0 30px rgba(245, 87, 108, 0.8),
                0 0 15px rgba(240, 147, 251, 0.6) !important;
    animation: pulse-counter 2s infinite !important;
    position: relative !important;
    z-index: 999999 !important;
}

@keyframes pulse-counter {
    0%, 100% {
        box-shadow: 0 0 30px rgba(245, 87, 108, 0.8),
                    0 0 15px rgba(240, 147, 251, 0.6);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 40px rgba(245, 87, 108, 1),
                    0 0 25px rgba(240, 147, 251, 0.9);
        transform: scale(1.02);
    }
}

/* ============================================
   Search Dropdown Z-Index Fix
   Ensures search dropdowns appear above preview during guided mode
   ============================================ */

/* When guided overlay is active, boost all search dropdown z-indexes */
.wkviews-guided-overlay.active ~ * .select2-container--open,
.wkviews-guided-overlay.active ~ * .select2-dropdown,
.wkviews-guided-overlay.active ~ * .ui-autocomplete,
body.wkviews-guided-active .select2-container--open,
body.wkviews-guided-active .select2-dropdown,
body.wkviews-guided-active .ui-autocomplete,
.select2-container--open.wkviews-guided-dropdown,
.select2-dropdown.wkviews-guided-dropdown {
    z-index: 100001 !important; /* Above highlighted elements (100000) */
    position: relative !important;
}

/* Ensure Select2 results appear above everything */
.select2-results,
.select2-results__options {
    z-index: 100002 !important;
}

/* WooCommerce product search specific */
.woocommerce-product-search .select2-container--open,
.woocommerce-product-search .select2-dropdown {
    z-index: 100001 !important;
}

/* ============================================
   Steps 46 & 47 Special Z-Index Boost
   Ensures instruction box appears above the activate modal
   ============================================ */

/* When on steps 46 or 47, boost z-indexes above jQuery UI dialog (which uses 1000-1002) */
body[data-wkviews-step="46"] .wkviews-guided-overlay,
body[data-wkviews-step="47"] .wkviews-guided-overlay,
.wkviews-guided-overlay[data-step="46"],
.wkviews-guided-overlay[data-step="47"] {
    z-index: 100999 !important;
}

body[data-wkviews-step="46"] .wkviews-guided-highlight,
body[data-wkviews-step="47"] .wkviews-guided-highlight,
.wkviews-guided-highlight[data-step="46"],
.wkviews-guided-highlight[data-step="47"] {
    z-index: 101000 !important;
}

body[data-wkviews-step="46"] .wkviews-guided-instruction,
body[data-wkviews-step="47"] .wkviews-guided-instruction,
.wkviews-guided-instruction[data-step="46"],
.wkviews-guided-instruction[data-step="47"] {
    z-index: 101003 !important;
}

body[data-wkviews-step="46"] .wkviews-return-to-wizard,
body[data-wkviews-step="47"] .wkviews-return-to-wizard,
.wkviews-return-to-wizard[data-step="46"],
.wkviews-return-to-wizard[data-step="47"] {
    z-index: 101002 !important;
}

/* Modal should appear ABOVE highlighted element but BELOW instruction box on steps 46 & 47 */
body[data-wkviews-step="46"] .ui-widget-overlay,
body[data-wkviews-step="47"] .ui-widget-overlay {
    z-index: 100998 !important; /* Below everything in guided mode but above normal content */
}

body[data-wkviews-step="46"] .ui-dialog,
body[data-wkviews-step="47"] .ui-dialog {
    z-index: 101001 !important; /* Above highlighted element (101000) but below instruction box (101003) */
}

/* ========================================
   COLOR PICKER (COLORIS) Z-INDEX FIX
   ======================================== */
/* Ensure color picker popup appears ABOVE all onboarding overlays (steps 20 & 23) */
.clr-picker {
    z-index: 101010 !important; /* Above instruction box (101003) */
    opacity: 1 !important;
    pointer-events: auto !important;
}

/* Ensure color picker wrapper and all child elements are fully visible */
.clr-picker * {
    opacity: 1 !important;
    pointer-events: auto !important;
}

/* Ensure the color field itself can open the picker */
.clr-field.wkviews-guided-highlight,
.clr-field.wkviews-guided-highlight button {
    pointer-events: auto !important;
    cursor: pointer !important;
}

/* CRITICAL: Keep the color swatch button visible when highlighted */
.clr-field.wkviews-guided-highlight button,
.whoknew-views-color-field.wkviews-guided-highlight .clr-field button,
.whoknew-views-color-field .clr-field.wkviews-guided-highlight button {
    opacity: 1 !important;
    visibility: visible !important;
    display: block !important;
    position: absolute !important;
    z-index: 100002 !important; /* Above the highlight border */
    pointer-events: auto !important;
    background: inherit !important; /* Keep the actual color showing */
}

/* Ensure input field is also visible */
.clr-field.wkviews-guided-highlight input,
.whoknew-views-color-field.wkviews-guided-highlight .clr-field input,
.whoknew-views-color-field .clr-field.wkviews-guided-highlight input {
    opacity: 1 !important;
    visibility: visible !important;
    z-index: 100001 !important;
}

/* Override the parent container's box-shadow to not cover the color swatch */
.whoknew-views-color-field.wkviews-guided-highlight,
.clr-field.wkviews-guided-highlight {
    overflow: visible !important;
    /* Remove inset shadow that might cover the button */
    box-shadow: 0 0 60px 10px rgba(245, 87, 108, 0.6),
                0 0 40px 5px rgba(240, 147, 251, 0.5),
                0 0 20px 2px rgba(245, 87, 108, 0.8) !important;
}

