/**
 * Vannies SkinCare - Interactive Platform Tour Guidance CSS
 * High-performance spotlight, gliding animations, beacon, and tooltips.
 */

:root {
    --tour-primary: #0d9488;
    --tour-primary-glow: rgba(13, 148, 136, 0.45);
    --tour-card-bg: #ffffff;
    --tour-text: #0f172a;
    --tour-text-muted: #64748b;
    --tour-border: #e2e8f0;
    --tour-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(0, 0, 0, 0.06);
}

html[data-theme="dark"] {
    --tour-card-bg: #111e36;
    --tour-text: #f8fafc;
    --tour-text-muted: #94a3b8;
    --tour-border: #293b5c;
    --tour-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(255, 255, 255, 0.1);
}

/* SVG Dimmed Backdrop Overlay with Crystal-Clear Cutout Hole */
.vanies-tour-svg-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1045;
    pointer-events: auto;
    opacity: 0;
    display: none;
    transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.vanies-tour-svg-backdrop.active {
    opacity: 1;
    display: block;
}

#vaniesTourMaskHole {
    transition: x 0.45s cubic-bezier(0.16, 1, 0.3, 1),
                y 0.45s cubic-bezier(0.16, 1, 0.3, 1),
                width 0.45s cubic-bezier(0.16, 1, 0.3, 1),
                height 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Fallback legacy overlay div if SVG unsupported */
.vanies-tour-overlay {
    display: none !important;
}

/* Spotlight Highlight Box (Glides smoothly around the transparent cutout) */
.vanies-tour-spotlight {
    position: fixed;
    z-index: 1046;
    border-radius: 16px;
    border: 3.5px solid #0d9488;
    box-shadow: 0 0 0 3px rgba(88, 220, 207, 0.6),
                0 8px 32px rgba(13, 148, 136, 0.45);
    pointer-events: none;
    display: none;
    transition: top 0.45s cubic-bezier(0.16, 1, 0.3, 1),
                left 0.45s cubic-bezier(0.16, 1, 0.3, 1),
                width 0.45s cubic-bezier(0.16, 1, 0.3, 1),
                height 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

.vanies-tour-spotlight.active {
    display: block;
}

/* High-tech targeting reticle corner brackets */
.vanies-tour-spotlight::before {
    content: '';
    position: absolute;
    top: -8px;
    left: -8px;
    width: 20px;
    height: 20px;
    border-top: 4px solid #58dccf;
    border-left: 4px solid #58dccf;
    border-top-left-radius: 8px;
}

.vanies-tour-spotlight::after {
    content: '';
    position: absolute;
    bottom: -8px;
    right: -8px;
    width: 20px;
    height: 20px;
    border-bottom: 4px solid #58dccf;
    border-right: 4px solid #58dccf;
    border-bottom-right-radius: 8px;
}

/* Floating High-Visibility Target Callout Tag */
.vanies-tour-target-tag {
    position: fixed;
    z-index: 1048;
    background: linear-gradient(135deg, #0d9488, #0284c7);
    color: #ffffff !important;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.3px;
    padding: 6px 14px;
    border-radius: 30px;
    box-shadow: 0 6px 20px rgba(13, 148, 136, 0.6), 0 2px 6px rgba(0, 0, 0, 0.3);
    border: 1.5px solid rgba(255, 255, 255, 0.4);
    display: none;
    align-items: center;
    gap: 8px;
    pointer-events: none;
    white-space: nowrap;
    transition: top 0.45s cubic-bezier(0.16, 1, 0.3, 1),
                left 0.45s cubic-bezier(0.16, 1, 0.3, 1),
                opacity 0.2s ease;
}

.vanies-tour-target-tag.active {
    display: inline-flex;
}

.vanies-tour-target-tag .target-tag-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #58dccf;
    box-shadow: 0 0 6px #58dccf;
    flex-shrink: 0;
}

/* Target Element Glowing Active State */
.vanies-tour-active-target {
    position: relative !important;
    z-index: 1047 !important;
    transition: box-shadow 0.35s ease !important;
    box-shadow: 0 0 0 4px rgba(13, 148, 136, 0.5), 0 8px 30px rgba(0, 0, 0, 0.25) !important;
    border-radius: inherit;
}

/* Animated Target Beacon (Visual Pointer) */
.vanies-tour-beacon {
    position: fixed;
    z-index: 1047;
    width: 24px;
    height: 24px;
    pointer-events: none;
    display: none;
    transition: top 0.45s cubic-bezier(0.16, 1, 0.3, 1),
                left 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

.vanies-tour-beacon.active {
    display: block;
}

.vanies-tour-beacon::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(13, 148, 136, 0.25);
    border: 1.5px solid #0d9488;
}

.vanies-tour-beacon::after {
    content: '';
    position: absolute;
    top: 7px;
    left: 7px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #58dccf;
    box-shadow: 0 0 8px rgba(88, 220, 207, 0.95);
}

/* Floating Tour Tooltip Popover */
.vanies-tour-popover {
    position: fixed;
    z-index: 1049;
    width: 380px;
    max-width: calc(100vw - 32px);
    background: var(--tour-card-bg);
    color: var(--tour-text);
    border: 1px solid var(--tour-border);
    border-radius: 18px;
    padding: 22px 24px;
    box-shadow: var(--tour-shadow);
    opacity: 0;
    display: none;
    pointer-events: none;
    transform: translateY(8px) scale(0.97);
    transition: top 0.45s cubic-bezier(0.16, 1, 0.3, 1),
                left 0.45s cubic-bezier(0.16, 1, 0.3, 1),
                opacity 0.25s ease,
                transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    font-family: inherit;
}

.vanies-tour-popover.active {
    opacity: 1;
    display: block;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

/* Directional Arrow on Popover */
.vanies-tour-popover-arrow {
    position: absolute;
    width: 14px;
    height: 14px;
    background: var(--tour-card-bg);
    border: 1px solid var(--tour-border);
    transform: rotate(45deg);
    z-index: 2;
}

.vanies-tour-popover[data-arrow="top"] .vanies-tour-popover-arrow {
    top: -7px;
    left: 36px;
    border-bottom: none;
    border-right: none;
}

.vanies-tour-popover[data-arrow="bottom"] .vanies-tour-popover-arrow {
    bottom: -7px;
    left: 36px;
    border-top: none;
    border-left: none;
}

.vanies-tour-popover[data-arrow="left"] .vanies-tour-popover-arrow {
    left: -7px;
    top: 28px;
    border-top: none;
    border-right: none;
}

.vanies-tour-popover[data-arrow="right"] .vanies-tour-popover-arrow {
    right: -7px;
    top: 28px;
    border-bottom: none;
    border-left: none;
}

/* Popover Header */
.tour-popover-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    gap: 8px;
}

.tour-badge {
    background: rgba(13, 148, 136, 0.12);
    color: var(--tour-primary);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    padding: 3px 10px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.tour-close-btn {
    background: none;
    border: none;
    color: var(--tour-text-muted);
    font-size: 16px;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    border-radius: 6px;
    transition: all 0.2s;
}

.tour-close-btn:hover {
    color: var(--tour-text);
    background: rgba(0, 0, 0, 0.05);
}

html[data-theme="dark"] .tour-close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Location Banner */
.tour-location-pill {
    background: rgba(13, 148, 136, 0.08);
    border: 1px solid rgba(13, 148, 136, 0.18);
    border-radius: 8px;
    padding: 5px 10px;
    font-size: 11.5px;
    color: var(--tour-text);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.tour-location-pill i {
    color: var(--tour-primary);
    font-size: 12px;
}

/* Popover Content */
.tour-popover-title {
    font-size: 16px;
    font-weight: 700;
    margin: 0 0 8px 0;
    color: var(--tour-text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.tour-popover-desc {
    font-size: 13.5px;
    line-height: 1.55;
    color: var(--tour-text-muted);
    margin: 0 0 16px 0;
}

/* Step Progress & Dots */
.tour-progress-bar {
    width: 100%;
    height: 4px;
    background: rgba(0, 0, 0, 0.06);
    border-radius: 4px;
    margin-bottom: 8px;
    overflow: hidden;
}

html[data-theme="dark"] .tour-progress-bar {
    background: rgba(255, 255, 255, 0.08);
}

.tour-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #0d9488, #58dccf);
    transition: width 0.35s ease;
}

/* Auto-Tour Countdown Progress Timer */
.tour-auto-timer {
    width: 100%;
    height: 3px;
    background: rgba(0, 0, 0, 0.04);
    border-radius: 2px;
    margin-bottom: 14px;
    overflow: hidden;
}

html[data-theme="dark"] .tour-auto-timer {
    background: rgba(255, 255, 255, 0.06);
}

.tour-auto-timer-fill {
    height: 100%;
    background: #0284c7;
    width: 0%;
}

.tour-auto-timer-fill.animating {
    animation: tourAutoCountdown 5.5s linear forwards;
}

@keyframes tourAutoCountdown {
    from { width: 0%; }
    to { width: 100%; }
}

/* Auto-Tour Pill Toggle */
.tour-btn-autoplay {
    background: rgba(13, 148, 136, 0.1);
    color: var(--tour-primary);
    border: 1px solid rgba(13, 148, 136, 0.25);
    font-size: 11px;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tour-btn-autoplay:hover {
    background: var(--tour-primary);
    color: #ffffff;
}

.tour-btn-autoplay.is-paused {
    background: rgba(100, 116, 139, 0.1);
    color: var(--tour-text-muted);
    border-color: rgba(100, 116, 139, 0.2);
}

/* Popover Footer Controls */
.tour-popover-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.tour-step-counter {
    font-size: 12px;
    font-weight: 600;
    color: var(--tour-text-muted);
}

.tour-btn-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tour-btn {
    border: none;
    border-radius: 10px;
    padding: 7px 15px;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.tour-btn-prev {
    background: transparent;
    color: var(--tour-text-muted);
    border: 1px solid var(--tour-border);
}

.tour-btn-prev:hover:not(:disabled) {
    background: rgba(0, 0, 0, 0.04);
    color: var(--tour-text);
}

.tour-btn-prev:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.tour-btn-next {
    background: var(--tour-primary);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(13, 148, 136, 0.3);
}

.tour-btn-next:hover {
    background: #0f766e;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(13, 148, 136, 0.4);
}

/* Floating Tour Launcher Pill */
.vanies-tour-launcher-btn {
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 9980;
    background: var(--tour-card-bg);
    color: var(--tour-primary);
    border: 1px solid var(--tour-border);
    padding: 10px 18px;
    border-radius: 30px;
    font-size: 13px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.12);
    cursor: pointer;
    pointer-events: auto !important;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.vanies-tour-launcher-btn:hover {
    background: var(--tour-primary);
    color: #ffffff;
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 24px rgba(13, 148, 136, 0.35);
    border-color: var(--tour-primary);
}

/* Floating Feedback Button */
.vanies-feedback-launcher-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 104000 !important;
    background: linear-gradient(135deg, #0d9488, #0284c7);
    color: #ffffff;
    border: none;
    padding: 10px 18px;
    border-radius: 30px;
    font-size: 13px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 6px 20px rgba(13, 148, 136, 0.38);
    cursor: pointer;
    pointer-events: auto !important;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Strictly remove on Admin, Store Manager, and Developer dashboard */
body.backend-body #vaniesFeedbackLauncherBtn,
body.backend-body .vanies-feedback-launcher-btn,
body[data-user-role="admin"] #vaniesFeedbackLauncherBtn,
body[data-user-role="super_admin"] #vaniesFeedbackLauncherBtn,
body[data-user-role="store_manager"] #vaniesFeedbackLauncherBtn,
body[data-user-role="developer"] #vaniesFeedbackLauncherBtn,
.backend-layout #vaniesFeedbackLauncherBtn,
.backend-layout .vanies-feedback-launcher-btn {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
    opacity: 0 !important;
}

.vanies-feedback-launcher-btn:hover {
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 10px 28px rgba(13, 148, 136, 0.5);
    color: #ffffff;
}

@media (max-width: 767.98px) {
    .vanies-tour-launcher-btn {
        bottom: 16px;
        left: 16px;
        padding: 8px 14px;
        font-size: 12px;
    }

    .vanies-feedback-launcher-btn {
        bottom: 16px;
        right: 16px;
        padding: 8px 14px;
        font-size: 12px;
    }
}

/* ============================================================
   MODAL ISOLATION & GLOBAL STACKING PROTECTION
   Guarantees all Bootstrap modals are 100% clickable and
   never obscured by tour guides, masks, or rogue backdrops.
   ============================================================ */
body.modal-open .vanies-tour-svg-backdrop,
body.modal-open .vanies-tour-spotlight,
body.modal-open .vanies-tour-target-tag,
body.modal-open .vanies-tour-beacon,
body.modal-open .vanies-tour-popover {
    display: none !important;
    pointer-events: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
}

.modal-backdrop {
    z-index: 1050 !important;
}

.modal {
    z-index: 1055 !important;
}

.modal-dialog {
    pointer-events: none;
}

.modal-content {
    pointer-events: auto !important;
}
