/* ============================================================
   Spin Maker — First-Time User Onboarding / Product Tour
   ============================================================ */

.tour-overlay {
    position: fixed;
    inset: 0;
    background: rgba(47, 45, 44, 0.55);
    z-index: 9000;
    opacity: 0;
    transition: opacity 0.18s ease;
    pointer-events: auto;
}

.tour-overlay.tour-visible {
    opacity: 1;
}

/* Spotlight ring around the highlighted element */
.tour-spotlight {
    position: fixed;
    z-index: 9001;
    border: 2px solid #c78ca0;
    border-radius: 6px;
    box-shadow:
        0 0 0 9999px rgba(47, 45, 44, 0.55),
        0 4px 24px rgba(0, 0, 0, 0.25);
    pointer-events: none;
    transition:
        top 0.2s ease,
        left 0.2s ease,
        width 0.2s ease,
        height 0.2s ease,
        opacity 0.18s ease;
    opacity: 0;
}

.tour-spotlight.tour-visible {
    opacity: 1;
}

/* Element being highlighted stays above overlay content */
.tour-target-active {
    position: relative;
    z-index: 9002 !important;
}

/* ---------- Tooltip card ---------- */
.tour-tooltip {
    position: fixed;
    z-index: 9003;
    width: min(320px, calc(100vw - 32px));
    background: #ffffff;
    color: #2f2d2c;
    border: 1px solid #2f2d2c;
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(47, 45, 44, 0.28);
    padding: 16px 16px 14px;
    opacity: 0;
    transform: translateY(6px) scale(0.98);
    transition:
        opacity 0.18s ease,
        transform 0.18s ease;
    font-family: 'Outfit', system-ui, sans-serif;
}

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

.tour-tooltip-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
}

.tour-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.1rem;
    font-weight: 600;
    line-height: 1.3;
    margin: 0;
    color: #2f2d2c;
}

.tour-close {
    flex: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid #eae6df;
    background: #f7f5f0;
    color: #2f2d2c;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease;
}

.tour-close:hover {
    background: #eae6df;
}
.tour-close:focus-visible,
.tour-btn:focus-visible {
    outline: 2px solid #c78ca0;
    outline-offset: 2px;
}

.tour-desc {
    font-size: 0.85rem;
    line-height: 1.55;
    color: #5c5855;
    margin: 0 0 12px;
}

.tour-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 12px;
}

.tour-step {
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #5c5855;
    font-variant-numeric: tabular-nums;
}

.tour-dots {
    display: flex;
    gap: 5px;
    align-items: center;
}

.tour-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #eae6df;
    transition:
        background 0.15s ease,
        transform 0.15s ease;
}

.tour-dot.tour-dot-active {
    background: #c78ca0;
    transform: scale(1.25);
}

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

.tour-btn {
    font-family: 'Outfit', system-ui, sans-serif;
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    border-radius: 50px;
    padding: 9px 16px;
    min-height: 38px;
    cursor: pointer;
    border: 1px solid #2f2d2c;
    transition:
        background 0.15s ease,
        color 0.15s ease;
}

.tour-btn-back {
    background: transparent;
    color: #2f2d2c;
}

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

.tour-btn-back:not(:disabled):hover {
    background: #f7f5f0;
}

.tour-btn-next {
    background: #c78ca0;
    border-color: #c78ca0;
    color: #fff;
    margin-left: auto;
}

.tour-btn-next:hover {
    background: #b67990;
    border-color: #b67990;
}

.tour-btn-skip {
    background: none;
    border: none;
    padding: 9px 4px;
    color: #5c5855;
    text-decoration: underline;
    text-underline-offset: 3px;
    text-transform: none;
    letter-spacing: 0;
    font-size: 0.78rem;
    min-height: 38px;
}

.tour-btn-skip:hover {
    color: #2f2d2c;
}

/* Replay / help entry point */
.tour-help-btn {
    position: fixed;
    left: 16px;
    bottom: 16px;
    z-index: 8000;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 1px solid #2f2d2c;
    background: #ffffff;
    color: #2f2d2c;
    font-size: 18px;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(47, 45, 44, 0.18);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition:
        transform 0.15s ease,
        background 0.15s ease;
}

.tour-help-btn:hover {
    background: #f7f5f0;
    transform: translateY(-1px);
}
.tour-help-btn:focus-visible {
    outline: 2px solid #c78ca0;
    outline-offset: 2px;
}

/* Help menu (tour replay + shortcuts) above the floating button */
.tour-help-menu {
    position: fixed;
    left: 16px;
    bottom: 70px;
    z-index: 8001;
    width: max-content;
    max-width: calc(100vw - 32px);
    background: #ffffff;
    color: #2f2d2c;
    border: 1px solid #2f2d2c;
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(47, 45, 44, 0.28);
    padding: 6px;
}

.tour-help-menu[hidden] {
    display: none;
}

.tour-help-menu button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    width: 100%;
    background: none;
    border: none;
    border-radius: 8px;
    padding: 10px 12px;
    min-height: 44px;
    font-family: 'Outfit', system-ui, sans-serif;
    font-size: 0.85rem;
    color: #2f2d2c;
    cursor: pointer;
    text-align: left;
}

.tour-help-menu button:hover {
    background: #f7f5f0;
}
.tour-help-menu button:focus-visible {
    outline: 2px solid #c78ca0;
    outline-offset: -2px;
}

/* ---------- Mobile: compact bottom sheet ---------- */
@media (max-width: 640px) {
    .tour-tooltip.tour-mobile-sheet {
        left: 16px !important;
        right: 16px !important;
        top: auto !important;
        bottom: 16px !important;
        width: auto;
        max-width: none;
        transform: translateY(12px);
    }

    .tour-tooltip.tour-mobile-sheet.tour-visible {
        transform: translateY(0);
    }

    .tour-btn {
        min-height: 44px;
        padding: 12px 18px;
    }
    .tour-btn-skip {
        min-height: 44px;
    }
    .tour-help-btn {
        bottom: 86px;
    } /* avoid sticky SPIN bar */
    .tour-help-menu {
        bottom: 142px;
    }
}

/* ---------- Tablet & mobile: sembunyikan tombol bantuan mengambang ---------- */
@media (max-width: 991px) {
    .tour-help-btn,
    .tour-help-menu {
        display: none !important;
    }
}

/* ---------- Accessibility: reduced motion & contrast ---------- */
@media (prefers-reduced-motion: reduce) {
    .tour-overlay,
    .tour-spotlight,
    .tour-tooltip,
    .tour-dot,
    .tour-help-btn {
        transition: none !important;
        animation: none !important;
    }

    .tour-tooltip {
        transform: none !important;
    }
}

/* High-contrast safeguard for tooltip text */
.tour-tooltip,
.tour-title {
    color: #2f2d2c;
}
