/* Homepage Tutorial Overlay */

.homepage-tutorial-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    pointer-events: none;
}

.homepage-tutorial-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.homepage-tutorial-overlay.active .homepage-tutorial-backdrop {
    opacity: 1;
    pointer-events: auto;
}

/* Tutorial Popup */
.homepage-tutorial-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background: #ffffff;
    border-radius: 24px;
    box-shadow: 
        0 25px 80px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
    max-width: 480px;
    width: 90%;
    max-height: 90vh;
    z-index: 100001;
    pointer-events: auto !important;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 2px solid rgba(220, 38, 38, 0.2);
    overflow: hidden;
}

.homepage-tutorial-overlay.active .homepage-tutorial-popup {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.tutorial-popup-header {
    padding: 20px 24px 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: #ffffff;
    pointer-events: auto;
    position: relative;
    z-index: 10;
}

.tutorial-progress {
    flex: 1;
    height: 6px;
    background: rgba(220, 38, 38, 0.1);
    border-radius: 10px;
    overflow: hidden;
}

.tutorial-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #dc2626 0%, #ef4444 100%);
    border-radius: 10px;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    width: 0%;
}

.tutorial-step-indicator {
    font-size: 14px;
    font-weight: 600;
    color: #dc2626;
    white-space: nowrap;
}

.tutorial-close-btn {
    background: transparent;
    border: none;
    padding: 8px;
    cursor: pointer !important;
    color: #6b7280;
    border-radius: 8px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    pointer-events: auto !important;
    position: relative;
    z-index: 10;
}

.tutorial-close-btn:hover {
    background: rgba(220, 38, 38, 0.1);
    color: #dc2626;
}

.tutorial-popup-body {
    padding: 32px 24px;
    text-align: center;
    pointer-events: auto;
    position: relative;
    z-index: 10;
}

.tutorial-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    background: linear-gradient(135deg, #fca5a5 0%, #fecaca 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #dc2626;
    box-shadow: 0 8px 24px rgba(220, 38, 38, 0.2);
}

.tutorial-title {
    font-size: 24px;
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 12px 0;
    line-height: 1.3;
}

.tutorial-description {
    font-size: 16px;
    color: #6b7280;
    line-height: 1.6;
    margin: 0 0 20px 0;
}

.tutorial-highlight-info {
    margin-top: 16px;
}

.highlight-badge {
    display: inline-block;
    padding: 6px 14px;
    background: rgba(220, 38, 38, 0.1);
    color: #dc2626;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

.tutorial-popup-footer {
    padding: 20px 24px;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: #fafafa;
    pointer-events: auto;
    position: relative;
    z-index: 10;
}

.tutorial-btn {
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    border: none;
    cursor: pointer !important;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    white-space: nowrap;
    pointer-events: auto !important;
    position: relative;
    z-index: 10;
}

.tutorial-btn-primary {
    background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

.tutorial-btn-primary:hover {
    background: linear-gradient(135deg, #b91c1c 0%, #dc2626 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(220, 38, 38, 0.4);
}

.tutorial-btn:focus-visible,
.tutorial-close-btn:focus-visible,
.tutorial-dot:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 3px;
}

.tutorial-btn:disabled,
.tutorial-dot:disabled {
    cursor: wait !important;
    opacity: 0.58;
}

.tutorial-btn-secondary {
    background: #ffffff;
    color: #6b7280;
    border: 1px solid #e5e7eb;
}

.tutorial-btn-secondary:hover {
    background: #f9fafb;
    color: #dc2626;
    border-color: rgba(220, 38, 38, 0.3);
}

.tutorial-dots {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
    flex: 1;
}

.tutorial-dot {
    width: 8px;
    height: 8px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #e5e7eb;
    transition: all 0.3s ease;
    cursor: pointer !important;
    pointer-events: auto !important;
    position: relative;
    z-index: 10;
}

.tutorial-dot.active {
    background: #dc2626;
    width: 24px;
    border-radius: 4px;
}

/* Highlight Wrapper */
.tutorial-highlight-wrapper {
    position: fixed;
    border: 3px solid #dc2626;
    border-radius: 12px;
    box-shadow: 
        0 0 0 9999px rgba(0, 0, 0, 0.3),
        0 0 0 4px #dc2626,
        0 0 20px rgba(220, 38, 38, 0.5);
    pointer-events: none;
    z-index: 99998;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    transform: translateZ(0); /* Force hardware acceleration */
}

.homepage-tutorial-overlay.active .tutorial-highlight-wrapper {
    opacity: 1;
}

/* Pulse Animation */
@keyframes tutorialPulse {
    0%, 100% {
        box-shadow: 
            0 0 0 9999px rgba(0, 0, 0, 0.3),
            0 0 0 4px #dc2626,
            0 0 20px rgba(220, 38, 38, 0.5);
    }
    50% {
        box-shadow: 
            0 0 0 9999px rgba(0, 0, 0, 0.35),
            0 0 0 6px #dc2626,
            0 0 30px rgba(220, 38, 38, 0.7);
    }
}

.tutorial-highlight-wrapper.pulse {
    animation: tutorialPulse 2s ease-in-out infinite;
}

/* Responsive Design */
@media (max-width: 767px) {
    .homepage-tutorial-popup {
        max-width: 95%;
        width: 95%;
        border-radius: 20px;
    }
    
    .tutorial-popup-header {
        padding: 16px 20px 12px;
    }
    
    .tutorial-popup-body {
        padding: 24px 20px;
    }
    
    .tutorial-icon {
        width: 64px;
        height: 64px;
        margin-bottom: 16px;
    }
    
    .tutorial-title {
        font-size: 20px;
    }
    
    .tutorial-description {
        font-size: 15px;
    }
    
    .tutorial-popup-footer {
        padding: 16px 20px;
        flex-wrap: wrap;
    }
    
    .tutorial-btn {
        padding: 10px 20px;
        font-size: 14px;
    }
    
    .tutorial-dots {
        order: -1;
        width: 100%;
        margin-bottom: 12px;
    }
}

/* Skip Confirmation */
.tutorial-skip-confirm {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #ffffff;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    z-index: 100001;
    max-width: 360px;
    width: 90%;
    text-align: center;
    display: none;
}

.tutorial-skip-confirm.show {
    display: block;
}

.tutorial-skip-confirm h4 {
    margin: 0 0 12px 0;
    font-size: 18px;
    color: #1f2937;
}

.tutorial-skip-confirm p {
    margin: 0 0 20px 0;
    color: #6b7280;
    font-size: 14px;
}

.tutorial-skip-confirm-btns {
    display: flex;
    gap: 12px;
}

.tutorial-skip-confirm-btns .tutorial-btn {
    flex: 1;
    justify-content: center;
}

/* Nexlancer network theme */
.homepage-tutorial-overlay {
    --tutorial-red: #ff3038;
    --tutorial-red-deep: #c90818;
    --tutorial-surface: rgba(10, 10, 14, 0.96);
    --tutorial-line: rgba(255, 255, 255, 0.11);
    font-family: "Inter", "Manrope", sans-serif;
}

.homepage-tutorial-backdrop {
    background:
        radial-gradient(circle at 50% 40%, rgba(255, 48, 56, 0.1), transparent 42%),
        rgba(2, 2, 5, 0.74);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.homepage-tutorial-overlay.tutorial-guided-active .homepage-tutorial-backdrop {
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

body.homepage-tutorial-running #aiChatBotTrigger,
body.homepage-tutorial-running .ai-guidance-floating-btn,
body.homepage-tutorial-running .scroll-to-top {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

.homepage-tutorial-popup {
    width: min(92vw, 480px);
    max-width: 480px;
    color: #ffffff;
    background:
        radial-gradient(circle at 100% 0, rgba(255, 48, 56, 0.13), transparent 34%),
        linear-gradient(145deg, rgba(18, 18, 23, 0.98), var(--tutorial-surface));
    border: 1px solid rgba(255, 48, 56, 0.42);
    border-radius: 20px;
    box-shadow:
        0 34px 90px rgba(0, 0, 0, 0.58),
        0 0 0 1px rgba(255, 255, 255, 0.035) inset,
        0 0 44px rgba(255, 48, 56, 0.1);
}

.homepage-tutorial-popup.tutorial-popup-guided {
    top: auto;
    left: auto;
    right: 28px;
    bottom: 96px;
    width: min(420px, calc(100vw - 56px));
    transform: translateY(18px) scale(0.98);
}

.homepage-tutorial-overlay.active .homepage-tutorial-popup.tutorial-popup-guided {
    transform: translateY(0) scale(1);
}

.tutorial-network-label {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 18px 24px 2px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 10px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.tutorial-network-pulse {
    position: relative;
    width: 7px;
    height: 7px;
    flex: 0 0 7px;
    border-radius: 50%;
    background: var(--tutorial-red);
    box-shadow: 0 0 14px rgba(255, 48, 56, 0.8);
}

.tutorial-network-pulse::after {
    content: "";
    position: absolute;
    inset: -4px;
    border: 1px solid rgba(255, 48, 56, 0.45);
    border-radius: inherit;
    animation: tutorialNetworkPulse 1.8s ease-out infinite;
}

@keyframes tutorialNetworkPulse {
    0% { opacity: 0.9; transform: scale(0.65); }
    100% { opacity: 0; transform: scale(1.6); }
}

.tutorial-popup-header {
    padding: 13px 24px 17px;
    border-bottom-color: var(--tutorial-line);
    background: transparent;
}

.tutorial-progress {
    height: 3px;
    background: rgba(255, 255, 255, 0.09);
}

.tutorial-progress-bar {
    background: linear-gradient(90deg, var(--tutorial-red-deep), #ff5960);
    box-shadow: 0 0 12px rgba(255, 48, 56, 0.45);
}

.tutorial-step-indicator {
    color: #ffffff;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
}

.tutorial-close-btn {
    width: 34px;
    height: 34px;
    padding: 7px;
    color: rgba(255, 255, 255, 0.52);
    border: 1px solid transparent;
}

.tutorial-close-btn:hover {
    color: #ffffff;
    background: rgba(255, 48, 56, 0.12);
    border-color: rgba(255, 48, 56, 0.25);
}

.tutorial-popup-body {
    padding: 30px 34px 32px;
}

.tutorial-icon {
    width: 72px;
    height: 72px;
    margin-bottom: 22px;
    color: #ffffff;
    background:
        radial-gradient(circle at 36% 28%, rgba(255, 255, 255, 0.2), transparent 32%),
        linear-gradient(145deg, #ff3038, #9f0714);
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow:
        0 16px 38px rgba(201, 8, 24, 0.34),
        0 0 0 8px rgba(255, 48, 56, 0.07);
}

.tutorial-title {
    max-width: 390px;
    margin: 0 auto 12px;
    color: #ffffff;
    font-size: clamp(23px, 4vw, 30px);
    font-weight: 800;
    line-height: 1.12;
    letter-spacing: -0.035em;
}

.tutorial-description {
    max-width: 390px;
    margin: 0 auto;
    color: rgba(255, 255, 255, 0.64);
    font-size: 15px;
    line-height: 1.7;
}

.tutorial-highlight-info {
    margin-top: 19px;
}

.highlight-badge {
    padding: 8px 13px;
    color: #ff858a;
    background: rgba(255, 48, 56, 0.1);
    border: 1px solid rgba(255, 48, 56, 0.2);
    border-radius: 7px;
    font-size: 11px;
    font-weight: 750;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.tutorial-popup-footer {
    min-height: 76px;
    padding: 15px 24px;
    border-top-color: var(--tutorial-line);
    background: rgba(255, 255, 255, 0.025);
}

.tutorial-btn {
    min-height: 44px;
    padding: 11px 18px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.035em;
    text-transform: uppercase;
}

.tutorial-btn-primary {
    background: linear-gradient(135deg, var(--tutorial-red), #d50b1b);
    box-shadow: 0 9px 24px rgba(213, 11, 27, 0.28);
}

.tutorial-btn-primary:hover {
    background: linear-gradient(135deg, #ff4c53, #e61120);
    box-shadow: 0 12px 30px rgba(213, 11, 27, 0.38);
}

.tutorial-btn-secondary {
    color: rgba(255, 255, 255, 0.64);
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.12);
}

.tutorial-btn-secondary:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 48, 56, 0.35);
}

.tutorial-dot {
    width: 6px;
    height: 6px;
    background: rgba(255, 255, 255, 0.16);
}

.tutorial-dot.active {
    width: 26px;
    background: var(--tutorial-red);
    box-shadow: 0 0 10px rgba(255, 48, 56, 0.45);
}

.tutorial-highlight-wrapper {
    border: 1px solid rgba(255, 67, 74, 0.92);
    border-radius: 18px;
    z-index: 100000;
    box-shadow:
        0 0 0 9999px rgba(1, 1, 4, 0.68),
        0 0 0 5px rgba(255, 48, 56, 0.12),
        0 0 34px rgba(255, 48, 56, 0.35);
}

@keyframes tutorialPulse {
    0%, 100% {
        box-shadow:
            0 0 0 9999px rgba(1, 1, 4, 0.68),
            0 0 0 5px rgba(255, 48, 56, 0.12),
            0 0 34px rgba(255, 48, 56, 0.35);
    }
    50% {
        box-shadow:
            0 0 0 9999px rgba(1, 1, 4, 0.72),
            0 0 0 8px rgba(255, 48, 56, 0.18),
            0 0 46px rgba(255, 48, 56, 0.5);
    }
}

@media (max-width: 767px) {
    .homepage-tutorial-popup,
    .homepage-tutorial-popup.tutorial-popup-guided {
        top: auto;
        right: 12px;
        bottom: 84px;
        left: 12px;
        width: auto;
        max-width: none;
        border-radius: 16px;
        transform: translateY(18px) scale(0.98);
    }

    .homepage-tutorial-overlay.active .homepage-tutorial-popup,
    .homepage-tutorial-overlay.active .homepage-tutorial-popup.tutorial-popup-guided {
        transform: translateY(0) scale(1);
    }

    .tutorial-network-label {
        padding: 15px 18px 1px;
    }

    .tutorial-popup-header {
        padding: 11px 18px 13px;
    }

    .tutorial-popup-body {
        padding: 22px 22px 24px;
    }

    .tutorial-icon {
        width: 58px;
        height: 58px;
        margin-bottom: 17px;
    }

    .tutorial-icon svg {
        width: 34px;
        height: 34px;
    }

    .tutorial-title {
        font-size: 22px;
    }

    .tutorial-description {
        font-size: 14px;
        line-height: 1.55;
    }

    .tutorial-popup-footer {
        min-height: 64px;
        padding: 11px 18px;
        flex-wrap: nowrap;
    }

    .tutorial-dots {
        order: initial;
        width: auto;
        margin: 0;
        gap: 6px;
    }

    .tutorial-btn {
        min-height: 40px;
        padding: 9px 13px;
        font-size: 10px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .tutorial-network-pulse::after,
    .tutorial-highlight-wrapper.pulse {
        animation: none;
    }
}

