/**
 * BW Onboarding Guide — Front-end Tour Styles
 *
 * Spotlight overlay, tooltip, progress dots, buttons, animations.
 * Uses CSS custom properties set by PHP:
 *   --bw-primary, --bw-accent, --bw-overlay-opacity, --bw-animation-speed
 */

/* ========================================
   Overlay
   ======================================== */
.bw-tour-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999990;
    pointer-events: auto;
    transition: opacity var(--bw-animation-speed, 400ms) ease;
}

.bw-tour-overlay.bw-fade-in {
    opacity: 1;
}

.bw-tour-overlay.bw-fade-out {
    opacity: 0;
}

/* The overlay uses a box-shadow trick on the spotlight element to create the cutout */
.bw-tour-spotlight {
    position: absolute;
    border-radius: 6px;
    z-index: 999991;
    pointer-events: none;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, var(--bw-overlay-opacity, 0.7));
    transition: top var(--bw-animation-speed, 400ms) ease,
                left var(--bw-animation-speed, 400ms) ease,
                width var(--bw-animation-speed, 400ms) ease,
                height var(--bw-animation-speed, 400ms) ease;
}

/* Pulse ring around spotlight */
.bw-tour-spotlight::after {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    border: 2px solid var(--bw-accent, #1fa88e);
    border-radius: 8px;
    animation: bw-pulse 2s ease-in-out infinite;
}

@keyframes bw-pulse {
    0%, 100% { opacity: 0.4; transform: scale(1); }
    50%      { opacity: 0.8; transform: scale(1.02); }
}

/* ========================================
   Tooltip
   ======================================== */
.bw-tour-tooltip {
    position: absolute;
    z-index: 999992;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18), 0 2px 8px rgba(0, 0, 0, 0.08);
    max-width: 380px;
    min-width: 280px;
    padding: 0;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity var(--bw-animation-speed, 400ms) ease,
                transform var(--bw-animation-speed, 400ms) ease,
                top var(--bw-animation-speed, 400ms) ease,
                left var(--bw-animation-speed, 400ms) ease;
    pointer-events: auto;
}

.bw-tour-tooltip.bw-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Centered modal mode (no target selector) */
.bw-tour-tooltip.bw-modal-center {
    position: fixed;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%);
    max-width: 460px;
}

.bw-tour-tooltip.bw-modal-center.bw-visible {
    transform: translate(-50%, -50%);
}

/* Tooltip arrow */
.bw-tour-arrow {
    position: absolute;
    width: 16px;
    height: 16px;
    background: #fff;
    transform: rotate(45deg);
    box-shadow: -2px -2px 4px rgba(0, 0, 0, 0.04);
}

.bw-tour-tooltip[data-position="bottom"] .bw-tour-arrow {
    top: -8px;
    left: 50%;
    margin-left: -8px;
}

.bw-tour-tooltip[data-position="top"] .bw-tour-arrow {
    bottom: -8px;
    left: 50%;
    margin-left: -8px;
    box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.04);
}

.bw-tour-tooltip[data-position="left"] .bw-tour-arrow {
    right: -8px;
    top: 50%;
    margin-top: -8px;
    box-shadow: 2px -2px 4px rgba(0, 0, 0, 0.04);
}

.bw-tour-tooltip[data-position="right"] .bw-tour-arrow {
    left: -8px;
    top: 50%;
    margin-top: -8px;
}

/* ========================================
   Tooltip Content
   ======================================== */
.bw-tour-header {
    padding: 20px 20px 0;
}

.bw-tour-step-label {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--bw-accent, #1fa88e);
    margin-bottom: 6px;
}

.bw-tour-title {
    font-size: 17px;
    font-weight: 700;
    color: #1d2327;
    line-height: 1.3;
    margin: 0 0 8px;
}

.bw-tour-content {
    padding: 0 20px;
    font-size: 14px;
    line-height: 1.6;
    color: #50575e;
}

.bw-tour-content p {
    margin: 0 0 8px;
}

.bw-tour-tip {
    padding: 8px 20px;
    margin: 8px 20px 0;
    background: #f0f6fc;
    border-radius: 6px;
    font-size: 12px;
    color: #2271b1;
    border-left: 3px solid var(--bw-accent, #1fa88e);
}

/* ========================================
   Progress Dots
   ======================================== */
.bw-tour-progress {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 20px 0;
}

.bw-tour-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #dcdcde;
    transition: background var(--bw-animation-speed, 400ms) ease,
                transform 0.2s ease;
}

.bw-tour-dot.bw-dot-active {
    background: var(--bw-primary, #2B2663);
    transform: scale(1.3);
}

.bw-tour-dot.bw-dot-completed {
    background: var(--bw-accent, #1fa88e);
}

/* ========================================
   Footer / Buttons
   ======================================== */
.bw-tour-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 20px;
    gap: 10px;
}

.bw-tour-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 20px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    line-height: 1;
    text-decoration: none;
}

.bw-tour-btn:active {
    transform: scale(0.97);
}

/* Primary (Next / Finish) */
.bw-tour-btn-primary {
    background: var(--bw-primary, #2B2663);
    color: #fff;
}

.bw-tour-btn-primary:hover {
    filter: brightness(1.15);
}

/* Secondary (Back) */
.bw-tour-btn-secondary {
    background: #f0f0f1;
    color: #50575e;
}

.bw-tour-btn-secondary:hover {
    background: #e2e4e7;
}

/* Skip / Close */
.bw-tour-btn-skip {
    background: transparent;
    color: #8c8f94;
    padding: 9px 12px;
}

.bw-tour-btn-skip:hover {
    color: #50575e;
}

.bw-tour-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 50%;
    font-size: 18px;
    color: #b4b9be;
    cursor: pointer;
    transition: color 0.2s, background 0.2s;
    line-height: 1;
    z-index: 1;
}

.bw-tour-close:hover {
    color: #d63638;
    background: #fcf0f1;
}

/* ========================================
   Shortcode Start Button
   ======================================== */
.bw-start-tour-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 24px;
    background: var(--bw-primary, #2B2663);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.bw-start-tour-btn:hover {
    filter: brightness(1.15);
}

.bw-start-tour-btn:active {
    transform: scale(0.97);
}

/* ========================================
   Keyboard Focus
   ======================================== */
.bw-tour-btn:focus-visible,
.bw-tour-close:focus-visible,
.bw-start-tour-btn:focus-visible {
    outline: 2px solid var(--bw-accent, #1fa88e);
    outline-offset: 2px;
}

/* ========================================
   Animations
   ======================================== */
@keyframes bw-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes bw-slide-up {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ========================================
   Responsive
   ======================================== */
@media screen and (max-width: 480px) {
    .bw-tour-tooltip {
        max-width: calc(100vw - 32px);
        min-width: 0;
        left: 16px !important;
        right: 16px;
    }

    .bw-tour-tooltip.bw-modal-center {
        max-width: calc(100vw - 32px);
    }

    .bw-tour-arrow {
        display: none;
    }

    .bw-tour-footer {
        flex-wrap: wrap;
    }
}
