/* ==========================================================================
   CriSTEAM — AI Robot Onboarding Tour Styles
   Pedagog.uzedu.uz & EduKids inspired interactive guided walkthrough
   ========================================================================== */

/* 1. Backdrop Overlay & Spotlight */
.tour-overlay-wrap {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    z-index: 99990;
    pointer-events: auto;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.tour-overlay-wrap.is-active {
    opacity: 1;
    visibility: visible;
}

.tour-spotlight-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: auto;
}

/* Glowing Pulsing Ring around Highlighted Element */
.tour-highlight-ring {
    position: absolute;
    border-radius: 16px;
    border: 3px solid #06b6d4;
    box-shadow: 0 0 0 4px rgba(6, 182, 212, 0.35), 0 0 35px rgba(6, 182, 212, 0.55);
    pointer-events: none;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    animation: tourPulseRing 2s ease-in-out infinite;
    z-index: 99992;
    opacity: 0;
}

.tour-highlight-ring.is-visible {
    opacity: 1;
}

@keyframes tourPulseRing {
    0%, 100% {
        box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.3), 0 0 25px rgba(6, 182, 212, 0.45);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 0 6px rgba(99, 102, 241, 0.4), 0 0 35px rgba(6, 182, 212, 0.7);
        transform: scale(1.006);
    }
}

/* Pointer Arrow / Beacon pointing to target */
.tour-pointer-arrow {
    position: absolute;
    z-index: 99993;
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: none;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    animation: tourArrowBounce 1.5s ease-in-out infinite;
}

.tour-pointer-arrow svg {
    filter: drop-shadow(0 4px 10px rgba(6, 182, 212, 0.6));
}

@keyframes tourArrowBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

/* 2. Popover Dialog Card */
.tour-card {
    position: absolute;
    z-index: 99995;
    width: 90%;
    max-width: 440px;
    background: #ffffff;
    border-radius: 24px;
    padding: 1.6rem 1.6rem 1.4rem;
    box-shadow: 0 20px 50px -10px rgba(15, 23, 42, 0.3), 0 0 0 1px rgba(99, 102, 241, 0.12);
    border: 2px solid rgba(6, 182, 212, 0.25);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

/* Mascot Robot Image on Card */
.tour-mascot-wrapper {
    position: absolute;
    top: -42px;
    left: 20px;
    width: 82px;
    height: 82px;
    border-radius: 50%;
    background: linear-gradient(135deg, #e0f2fe 0%, #ffffff 100%);
    border: 3px solid #06b6d4;
    box-shadow: 0 10px 25px rgba(6, 182, 212, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    animation: tourRobotFloat 3s ease-in-out infinite;
    z-index: 2;
}

.tour-mascot-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scale(1.05);
}

@keyframes tourRobotFloat {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-5px) rotate(2deg); }
}

/* Card Header: Badge & Progress */
.tour-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-left: 78px;
    margin-bottom: 0.9rem;
    min-height: 36px;
}

.tour-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: linear-gradient(135deg, #06b6d4 0%, #3b82f6 100%);
    color: #ffffff;
    font-size: 0.78rem;
    font-weight: 800;
    padding: 0.28rem 0.75rem;
    border-radius: 999px;
    letter-spacing: 0.02em;
    box-shadow: 0 3px 10px rgba(6, 182, 212, 0.3);
}

.tour-step-indicator {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.85rem;
    font-weight: 800;
    color: #6366f1;
    background: #eef2ff;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
}

.tour-step-star {
    color: #f59e0b;
    font-size: 0.95rem;
}

/* Progress bar inside card */
.tour-progress-bar-bg {
    width: 100%;
    height: 5px;
    background: #f1f5f9;
    border-radius: 999px;
    margin-bottom: 1.1rem;
    overflow: hidden;
}

.tour-progress-bar-fill {
    height: 100%;
    width: 20%;
    background: linear-gradient(90deg, #06b6d4, #6366f1);
    border-radius: 999px;
    transition: width 0.35s ease-in-out;
}

/* Card Body */
.tour-content {
    margin-bottom: 1.3rem;
}

.tour-title {
    font-size: 1.18rem;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.35;
    margin-bottom: 0.6rem;
}

.tour-desc {
    font-size: 0.92rem;
    line-height: 1.6;
    color: #475569;
}

.tour-desc b, .tour-desc strong {
    color: #0284c7;
    font-weight: 700;
}

/* Card Footer: Action Buttons */
.tour-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #f1f5f9;
    padding-top: 0.9rem;
    gap: 0.75rem;
}

.tour-btn-skip {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 0.86rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0.4rem 0.6rem;
    border-radius: 8px;
    transition: color 0.2s ease, background 0.2s ease;
}

.tour-btn-skip:hover {
    color: #475569;
    background: #f8fafc;
}

.tour-nav-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tour-btn-prev {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1.5px solid #e2e8f0;
    background: #ffffff;
    color: #64748b;
    cursor: pointer;
    font-size: 1.05rem;
    font-weight: 700;
    transition: all 0.2s ease;
}

.tour-btn-prev:hover:not(:disabled) {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #1e293b;
}

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

.tour-btn-next {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: linear-gradient(135deg, #06b6d4 0%, #3b82f6 100%);
    color: #ffffff;
    border: none;
    border-radius: 999px;
    padding: 0.55rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(6, 182, 212, 0.4);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.tour-btn-next:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(6, 182, 212, 0.55);
}

.tour-btn-next:active {
    transform: translateY(1px);
}

/* 3. Floating Launcher Button (Bottom Right) */
.tour-launcher-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9990;
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    background: #ffffff;
    border: 2px solid rgba(6, 182, 212, 0.4);
    padding: 0.4rem 1rem 0.4rem 0.5rem;
    border-radius: 999px;
    box-shadow: 0 10px 30px -5px rgba(6, 182, 212, 0.35), 0 4px 10px rgba(0, 0, 0, 0.05);
    cursor: pointer;
    font-family: inherit;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    animation: launcherFloat 4s ease-in-out infinite;
}

.tour-launcher-btn:hover {
    transform: translateY(-3px) scale(1.03);
    border-color: #06b6d4;
    box-shadow: 0 14px 35px -5px rgba(6, 182, 212, 0.5);
}

.tour-launcher-avatar {
    position: relative;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    background: #e0f2fe;
    border: 2px solid #06b6d4;
    flex-shrink: 0;
}

.tour-launcher-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tour-launcher-pulse {
    position: absolute;
    top: 1px;
    right: 1px;
    width: 9px;
    height: 9px;
    background: #10b981;
    border-radius: 50%;
    border: 2px solid #ffffff;
}

.tour-launcher-label {
    font-size: 0.88rem;
    font-weight: 800;
    background: linear-gradient(135deg, #0284c7 0%, #6366f1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 0.01em;
}

@keyframes launcherFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

/* 4. Responsive adjustments */
@media (max-width: 640px) {
    .tour-card {
        width: calc(100% - 32px);
        left: 16px !important;
        right: 16px !important;
        padding: 1.25rem 1.2rem 1.1rem;
        border-radius: 20px;
    }

    .tour-mascot-wrapper {
        width: 68px;
        height: 68px;
        top: -34px;
        left: 14px;
    }

    .tour-header {
        margin-left: 64px;
        margin-bottom: 0.75rem;
    }

    .tour-title {
        font-size: 1.05rem;
    }

    .tour-desc {
        font-size: 0.85rem;
    }

    .tour-launcher-btn {
        bottom: 16px;
        right: 16px;
        padding: 0.35rem 0.85rem 0.35rem 0.45rem;
    }

    .tour-launcher-label {
        font-size: 0.82rem;
    }
}
