/* ============================================================
   Tour System Styles
   Spotlight overlay, tooltip card, transitions, responsive
   ============================================================ */

/* ---- Overlay ---- */
.tour-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    pointer-events: auto;
}

/* ---- Direkte Element-Hervorhebung (funktioniert unabhaengig vom z-index) ---- */
/* Wird direkt auf das Ziel-Element gesetzt via data-tour-target Attribut.
   Loest das Problem, dass Elemente in Containern mit hohem z-index (z.B. MudAppBar)
   UEBER dem Spotlight liegen und die Spotlight-Border verdecken.
   outline wird IMMER auf dem Element selbst gerendert, unabhaengig vom Stacking. */
[data-tour-target] {
    outline: 3px solid var(--mud-palette-primary) !important;
    outline-offset: 4px !important;
    border-radius: 4px;
}

/* ---- Elevated Popover (fuer Tour-Ziele innerhalb von MudMenu/MudPopover) ---- */
/* !important ueberschreibt MudBlazor's Inline-Style z-index (z.B. 1201),
   damit der Popover ueber Overlay (10000) und Spotlight (10001) sichtbar ist */
.mud-popover[data-tour-elevated] {
    z-index: 10002 !important;
    overflow: visible !important;
}

/* Pulsierende grüne Umrandung fuer angehobene Popovers.
   Wird benoetigt, weil die Spotlight-::after-Border (z-index 10001)
   hinter dem Popover (z-index 10002) verdeckt wird. */
.mud-popover[data-tour-elevated]::before {
    content: '';
    position: absolute;
    top: -6px;
    left: -6px;
    right: -6px;
    bottom: -6px;
    border-radius: 6px;
    border: 2px solid var(--mud-palette-primary);
    animation: tour-pulse 2s ease-in-out infinite;
    pointer-events: none;
    z-index: -1;
}

/* ---- Spotlight ---- */
.tour-spotlight {
    position: fixed;
    z-index: 10001;
    border-radius: 4px;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.55);
    transition: top 0.35s ease, left 0.35s ease, width 0.35s ease, height 0.35s ease;
    pointer-events: none;
}

/* Pulsing ring around the spotlighted element */
.tour-spotlight::after {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    border-radius: 6px;
    border: 2px solid var(--mud-palette-primary);
    animation: tour-pulse 2s ease-in-out infinite;
}

@keyframes tour-pulse {
    0%, 100% {
        opacity: 0.6;
    }
    50% {
        opacity: 1;
    }
}

/* ---- Tooltip Card ---- */
.tour-card {
    position: fixed;
    z-index: 10002;
    width: 360px;
    max-width: calc(100vw - 32px);
    transition: top 0.35s ease, left 0.35s ease, opacity 0.25s ease;
    pointer-events: auto;
}

.tour-card .mud-card {
    border-radius: 12px;
    overflow: visible;
}

.tour-card .mud-card-header {
    padding-bottom: 4px;
}

.tour-card .mud-card-content {
    padding-top: 4px;
    padding-bottom: 8px;
}

.tour-card .mud-card-actions {
    padding-top: 4px;
    justify-content: space-between;
}

/* ---- Arrow Indicators ---- */
.tour-card-arrow {
    position: absolute;
    width: 12px;
    height: 12px;
    background-color: var(--mud-palette-surface);
    transform: rotate(45deg);
    z-index: -1;
}

/* Arrow pointing up (card is below the target) – left set dynamically via inline style */
.tour-card-arrow--top {
    top: -6px;
}

/* Arrow pointing down (card is above the target) – left set dynamically via inline style */
.tour-card-arrow--bottom {
    bottom: -6px;
}

/* Arrow pointing left (card is to the right of the target) – top set dynamically via inline style */
.tour-card-arrow--left {
    left: -6px;
}

/* Arrow pointing right (card is to the left of the target) – top set dynamically via inline style */
.tour-card-arrow--right {
    right: -6px;
}

/* ---- Progress Dots ---- */
.tour-progress {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 4px;
}

.tour-progress-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--mud-palette-lines-default);
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.tour-progress-dot--active {
    background-color: var(--mud-palette-primary);
    transform: scale(1.3);
}

.tour-progress-dot--completed {
    background-color: var(--mud-palette-primary);
}

/* ---- Step Transition ---- */
.tour-step-enter {
    opacity: 0;
    transform: translateY(8px);
}

.tour-step-enter-active {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* ---- Fade In/Out ---- */
.tour-fade-in {
    animation: tour-fade-in 0.3s ease forwards;
}

.tour-fade-out {
    animation: tour-fade-out 0.25s ease forwards;
}

@keyframes tour-fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes tour-fade-out {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

/* ---- Status Badges (used in User Settings) ---- */
.tour-status-badge--completed {
    color: var(--mud-palette-success);
}

.tour-status-badge--skipped {
    color: var(--mud-palette-text-disabled);
}

.tour-status-badge--inprogress {
    color: var(--mud-palette-info);
}

.tour-status-badge--notstarted {
    color: var(--mud-palette-text-secondary);
}

/* ---- Responsive ---- */
@media (max-width: 600px) {
    .tour-card {
        width: calc(100vw - 24px);
        left: 12px !important;
    }

    .tour-card-arrow {
        display: none;
    }

    .tour-spotlight::after {
        border-width: 1px;
    }

    .tour-progress-dot {
        width: 6px;
        height: 6px;
    }
}

@media (max-width: 960px) {
    .tour-card {
        max-width: calc(100vw - 24px);
    }
}
