/**
 * FriendlyForce Product Tour - Premium Edition
 * Investor-grade UI with glass-morphism and smooth animations
 */

/* ============================================
   OVERLAY - Dark backdrop
   ============================================ */
.ff-tour-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    z-index: 99990;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
    pointer-events: none;
}

.ff-tour-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* ============================================
   SPOTLIGHT - Premium gradient glow
   ============================================ */
.ff-tour-highlight {
    position: absolute;
    border-radius: 12px;
    z-index: 99991;
    pointer-events: none;
    box-shadow:
        0 0 0 3px rgba(99, 102, 241, 0.9),
        0 0 20px rgba(99, 102, 241, 0.6),
        0 0 50px rgba(99, 102, 241, 0.3),
        0 0 0 9999px rgba(0, 0, 0, 0.82);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    animation: ff-breathe 3s ease-in-out infinite;
}

/* Subtle breathing glow - elegant, not cheap */
@keyframes ff-breathe {
    0%, 100% {
        box-shadow:
            0 0 0 3px rgba(99, 102, 241, 0.9),
            0 0 20px rgba(99, 102, 241, 0.6),
            0 0 50px rgba(99, 102, 241, 0.3),
            0 0 0 9999px rgba(0, 0, 0, 0.82);
    }
    50% {
        box-shadow:
            0 0 0 4px rgba(139, 92, 246, 0.95),
            0 0 30px rgba(139, 92, 246, 0.5),
            0 0 60px rgba(139, 92, 246, 0.25),
            0 0 0 9999px rgba(0, 0, 0, 0.82);
    }
}

/* ============================================
   TOOLTIP CARD - Matches Text Me / Report forms
   ============================================ */
.ff-tour-tooltip {
    position: absolute;
    width: 500px;
    max-width: 90vw;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    z-index: 99992;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: opacity 0.4s ease, visibility 0.4s ease, transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

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

/* Card entrance animation */
@keyframes ff-card-enter {
    from {
        opacity: 0;
        transform: translateY(24px) scale(0.94);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.ff-tour-tooltip.active {
    animation: ff-card-enter 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* ============================================
   TOOLTIP ARROWS - Clean pointers
   ============================================ */
.ff-tour-tooltip::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    background: white;
    transform: rotate(45deg);
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.ff-tour-tooltip[data-ff-position="bottom"]::before {
    top: -9px;
    left: 50%;
    margin-left: -8px;
    border-right: none;
    border-bottom: none;
}

.ff-tour-tooltip[data-ff-position="top"]::before {
    bottom: -9px;
    left: 50%;
    margin-left: -8px;
    border-left: none;
    border-top: none;
}

.ff-tour-tooltip[data-ff-position="left"]::before {
    right: -9px;
    top: 50%;
    margin-top: -8px;
    border-left: none;
    border-bottom: none;
}

.ff-tour-tooltip[data-ff-position="right"]::before {
    left: -9px;
    top: 50%;
    margin-top: -8px;
    border-right: none;
    border-top: none;
}

.ff-tour-tooltip[data-ff-position="center"]::before {
    display: none;
}

/* ============================================
   HEADER - Title and close button
   ============================================ */
.ff-tour-tooltip-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border-color, #e5e7eb);
}

.ff-tour-step-counter {
    font-size: 12px;
    font-weight: 600;
    color: #6366f1;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ff-tour-close {
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    border-radius: 4px;
    font-size: 24px;
    color: var(--text-muted, #6b7280);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.ff-tour-close:hover {
    background: var(--bg-secondary, #f3f4f6);
    color: var(--text-primary, #1f2937);
}

/* ============================================
   BODY - Content area
   ============================================ */
.ff-tour-tooltip-body {
    padding: 20px;
}

/* Hero Section - matches Text Me and Report forms */
.ff-tour-hero {
    background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
    color: white;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    text-align: center;
}

.ff-tour-hero-icon {
    font-size: 24px;
    margin-bottom: 8px;
}

.ff-tour-hero-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.ff-tour-hero-subtitle {
    font-size: 13px;
    opacity: 0.9;
}

.ff-tour-title {
    margin: 0 0 10px 0;
    font-size: 20px;
    font-weight: 700;
    color: #111827;
    line-height: 1.3;
}

/* Gradient title for special steps */
.ff-tour-title.ff-gradient-text {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.ff-tour-content {
    margin: 0;
    font-size: 15px;
    line-height: 1.6;
    color: #6b7280;
}

/* ============================================
   FOOTER - Progress and buttons
   ============================================ */
.ff-tour-tooltip-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-top: 1px solid var(--border-color, #e5e7eb);
}

/* Progress dots */
.ff-tour-progress {
    display: flex;
    gap: 8px;
}

.ff-tour-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #e5e7eb;
    transition: all 0.3s ease;
}

.ff-tour-dot.active {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    transform: scale(1.3);
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.5);
}

.ff-tour-dot.completed {
    background: #10b981;
}

/* Buttons */
.ff-tour-buttons {
    display: flex;
    gap: 10px;
}

.ff-tour-btn {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
}

.ff-tour-btn-prev {
    background: var(--bg-secondary, #f3f4f6);
    border: 1px solid var(--border-color, #e5e7eb);
    color: var(--text-primary, #1f2937);
}

.ff-tour-btn-prev:hover {
    background: var(--bg-tertiary, #e5e7eb);
}

.ff-tour-btn-next {
    background: var(--accent-blue, #007bff);
    color: #fff;
}

.ff-tour-btn-next:hover {
    background: #0056b3;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.ff-tour-btn-cta {
    background: var(--accent-blue, #007bff);
    color: #fff;
    padding: 12px 24px;
}

.ff-tour-btn-cta:hover {
    background: #0056b3;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

/* ============================================
   CREDIT COUNTER - Final step WOW effect
   ============================================ */
.ff-credit-counter-container {
    text-align: center;
    padding: 16px 0 8px;
}

.ff-credit-counter {
    font-size: 52px;
    font-weight: 800;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 40%, #a855f7 70%, #d946ef 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: ff-counter-glow 2s ease-in-out infinite;
    display: inline-block;
}

.ff-credit-label {
    font-size: 14px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 4px;
}

@keyframes ff-counter-glow {
    0%, 100% {
        filter: drop-shadow(0 0 8px rgba(99, 102, 241, 0.4));
    }
    50% {
        filter: drop-shadow(0 0 20px rgba(139, 92, 246, 0.6));
    }
}

/* ============================================
   CONFETTI - Celebration effect
   ============================================ */
.ff-confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 99999;
    overflow: hidden;
}

.ff-confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    opacity: 0;
    animation: ff-confetti-fall 3s ease-out forwards;
}

.ff-confetti.circle {
    border-radius: 50%;
}

.ff-confetti.square {
    border-radius: 2px;
}

.ff-confetti.ribbon {
    width: 4px;
    height: 16px;
    border-radius: 2px;
}

@keyframes ff-confetti-fall {
    0% {
        opacity: 1;
        transform: translateY(-20px) rotate(0deg) scale(1);
    }
    10% {
        opacity: 1;
    }
    100% {
        opacity: 0;
        transform: translateY(100vh) rotate(720deg) scale(0.5);
    }
}

/* ============================================
   TAKE TOUR BUTTON - For ALL users
   ============================================ */
.ff-tour-trigger {
    position: fixed;
    bottom: 52px;
    right: 24px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    padding: 14px 24px;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    z-index: 9990;
    box-shadow:
        0 10px 40px rgba(99, 102, 241, 0.4),
        0 2px 8px rgba(0, 0, 0, 0.1);
    animation: ff-trigger-float 3s ease-in-out infinite, ff-trigger-enter 0.6s ease-out;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ff-tour-trigger:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow:
        0 14px 50px rgba(99, 102, 241, 0.5),
        0 4px 12px rgba(0, 0, 0, 0.15);
}

.ff-tour-trigger-icon {
    font-size: 16px;
}

@keyframes ff-trigger-float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-6px);
    }
}

@keyframes ff-trigger-enter {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Dismiss X on hover */
.ff-tour-trigger-close {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 22px;
    height: 22px;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.2s ease;
    cursor: pointer;
    border: 2px solid white;
}

.ff-tour-trigger:hover .ff-tour-trigger-close {
    opacity: 1;
    transform: scale(1);
}

/* ============================================
   TABLET RESPONSIVE (768px)
   ============================================ */
@media (max-width: 768px) {
    .ff-tour-tooltip {
        width: 340px;
    }

    .ff-tour-title {
        font-size: 18px;
    }

    .ff-tour-content {
        font-size: 14px;
    }

    .ff-credit-counter {
        font-size: 44px;
    }

    .ff-tour-trigger {
        bottom: 50px;
        right: 20px;
        padding: 12px 20px;
    }
}

/* ============================================
   MOBILE RESPONSIVE (480px and below)
   ============================================ */
@media (max-width: 480px) {
    /* Fixed position tooltip at bottom of screen */
    .ff-tour-tooltip {
        position: fixed !important;
        bottom: 16px !important;
        left: 16px !important;
        right: 16px !important;
        top: auto !important;
        width: auto !important;
        max-width: none !important;
        transform: none !important;
        border-radius: 16px;
    }

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

    .ff-tour-tooltip[data-ff-position="center"] {
        bottom: 16px !important;
        left: 16px !important;
        right: 16px !important;
        top: auto !important;
        transform: none !important;
    }

    /* Hide arrows on mobile */
    .ff-tour-tooltip::before {
        display: none !important;
    }

    .ff-tour-tooltip-header {
        padding: 14px 16px 10px;
    }

    .ff-tour-tooltip-body {
        padding: 14px 16px;
    }

    .ff-tour-title {
        font-size: 17px;
    }

    .ff-tour-content {
        font-size: 13px;
        line-height: 1.5;
    }

    .ff-tour-tooltip-footer {
        flex-direction: column;
        gap: 12px;
        padding: 12px 16px;
    }

    .ff-tour-progress {
        order: 2;
    }

    .ff-tour-buttons {
        width: 100%;
        order: 1;
    }

    .ff-tour-btn {
        flex: 1;
        padding: 12px 16px;
        text-align: center;
    }

    .ff-tour-btn-cta {
        padding: 12px 16px;
    }

    .ff-credit-counter {
        font-size: 36px;
    }

    .ff-credit-counter-container {
        padding: 12px 0 4px;
    }

    .ff-credit-label {
        font-size: 12px;
    }

    /* Smaller highlight glow on mobile */
    .ff-tour-highlight {
        border-radius: 8px;
        box-shadow:
            0 0 0 2px rgba(99, 102, 241, 0.9),
            0 0 15px rgba(99, 102, 241, 0.5),
            0 0 0 9999px rgba(0, 0, 0, 0.75);
    }

    .ff-tour-trigger {
        bottom: 48px;
        right: 16px;
        padding: 10px 16px;
        font-size: 13px;
    }
}

/* Mobile breathing animation override */
@media (max-width: 480px) {
    @keyframes ff-breathe {
        0%, 100% {
            box-shadow:
                0 0 0 2px rgba(99, 102, 241, 0.9),
                0 0 15px rgba(99, 102, 241, 0.5),
                0 0 0 9999px rgba(0, 0, 0, 0.75);
        }
        50% {
            box-shadow:
                0 0 0 3px rgba(139, 92, 246, 0.95),
                0 0 20px rgba(139, 92, 246, 0.4),
                0 0 0 9999px rgba(0, 0, 0, 0.75);
        }
    }
}

/* ============================================
   SMALL MOBILE (360px and below)
   ============================================ */
@media (max-width: 360px) {
    .ff-tour-tooltip {
        left: 8px !important;
        right: 8px !important;
        bottom: 8px !important;
    }

    .ff-tour-title {
        font-size: 16px;
    }

    .ff-tour-content {
        font-size: 12px;
    }

    .ff-tour-btn {
        padding: 10px 12px;
        font-size: 13px;
    }

    .ff-credit-counter {
        font-size: 32px;
    }
}


/* ============================================
   SMOOTH SCROLLING DURING TOUR
   ============================================ */
html.ff-tour-active {
    scroll-behavior: smooth;
}

/* Prevent body scroll during tour */
body.ff-tour-active {
    overflow: hidden;
}
