/* ===== TUTORIAL OVERLAY STYLES ===== */

/* Tutorial backdrop overlay */
.tutorial-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 9998;
    animation: fadeIn 0.3s ease-in-out;
}

/* Disable animations if user prefers reduced motion */
@media (prefers-reduced-motion: reduce) {
    .tutorial-backdrop,
    .tutorial-instruction-container,
    .tutorial-highlight {
        animation: none !important;
        transition: none !important;
    }
}

/* Fade in animation */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Highlighted element container */
.tutorial-highlight {
    position: absolute;
    z-index: 9999;
    pointer-events: none;
    box-shadow: 0 0 0 4px rgba(255, 193, 7, 0.8), 0 0 0 8px rgba(255, 193, 7, 0.4);
    border-radius: 4px;
    animation: pulse 2s infinite;
}

/* Pulse animation for highlight */
@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 4px rgba(255, 193, 7, 0.8), 0 0 0 8px rgba(255, 193, 7, 0.4);
    }
    50% {
        box-shadow: 0 0 0 6px rgba(255, 193, 7, 0.9), 0 0 0 12px rgba(255, 193, 7, 0.5);
    }
}

/* Instruction container */
.tutorial-instruction-container {
    position: fixed;
    z-index: 10000;
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    min-width: 280px;
    animation: slideIn 0.3s ease-out;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .tutorial-instruction-container {
        background: #1E1E1E;
        color: rgba(255, 255, 255, 0.87);
    }
}

/* Slide in animation */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Arrow pointers for instruction containers */
.tutorial-instruction-container::before {
    content: '';
    position: absolute;
    width: 0;
    height: 0;
    border: 12px solid transparent;
}

/* Top position - arrow points down */
.tutorial-instruction-container.position-top::before {
    bottom: -24px;
    left: 50%;
    transform: translateX(-50%);
    border-top-color: white;
    border-bottom: none;
}

@media (prefers-color-scheme: dark) {
    .tutorial-instruction-container.position-top::before {
        border-top-color: #1E1E1E;
    }
}

/* Bottom position - arrow points up */
.tutorial-instruction-container.position-bottom::before {
    top: -24px;
    left: 50%;
    transform: translateX(-50%);
    border-bottom-color: white;
    border-top: none;
}

@media (prefers-color-scheme: dark) {
    .tutorial-instruction-container.position-bottom::before {
        border-bottom-color: #1E1E1E;
    }
}

/* Left position - arrow points right */
.tutorial-instruction-container.position-left::before {
    right: -24px;
    top: 50%;
    transform: translateY(-50%);
    border-left-color: white;
    border-right: none;
}

@media (prefers-color-scheme: dark) {
    .tutorial-instruction-container.position-left::before {
        border-left-color: #1E1E1E;
    }
}

/* Right position - arrow points left */
.tutorial-instruction-container.position-right::before {
    left: -24px;
    top: 50%;
    transform: translateY(-50%);
    border-right-color: white;
    border-left: none;
}

@media (prefers-color-scheme: dark) {
    .tutorial-instruction-container.position-right::before {
        border-right-color: #1E1E1E;
    }
}

/* Center position - no arrow */
.tutorial-instruction-container.position-center::before {
    display: none;
}

/* Tutorial instruction title */
.tutorial-instruction-title {
    font-size: 1.25rem;
    font-weight: 500;
    margin-bottom: 12px;
    color: var(--mud-palette-primary, #00897B);
}

@media (prefers-color-scheme: dark) {
    .tutorial-instruction-title {
        color: var(--mud-palette-dark-primary, #4DB6AC);
    }
}

/* Tutorial instruction content */
.tutorial-instruction-content {
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 20px;
    color: rgba(0, 0, 0, 0.87);
}

@media (prefers-color-scheme: dark) {
    .tutorial-instruction-content {
        color: rgba(255, 255, 255, 0.87);
    }
}

/* Tutorial navigation buttons */
.tutorial-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
    gap: 12px;
}

/* Step indicator */
.tutorial-step-indicator {
    font-size: 0.875rem;
    color: rgba(0, 0, 0, 0.6);
    flex-grow: 1;
    text-align: center;
}

@media (prefers-color-scheme: dark) {
    .tutorial-step-indicator {
        color: rgba(255, 255, 255, 0.6);
    }
}

/* Tutorial button group */
.tutorial-button-group {
    display: flex;
    gap: 8px;
}

/* Mobile responsive adjustments */
@media (max-width: 599.98px) {
    .tutorial-instruction-container {
        max-width: calc(100vw - 32px);
        min-width: calc(100vw - 32px);
        padding: 20px;
    }

    .tutorial-instruction-title {
        font-size: 1.1rem;
    }

    .tutorial-instruction-content {
        font-size: 0.9rem;
    }

    .tutorial-navigation {
        flex-wrap: wrap;
    }

    .tutorial-step-indicator {
        width: 100%;
        margin-bottom: 8px;
    }

    .tutorial-button-group {
        width: 100%;
        justify-content: space-between;
    }
}

/* Disable page interactions when tutorial is active */
body.tutorial-active {
    overflow: hidden;
}

body.tutorial-active * {
    pointer-events: none !important;
}

/* Re-enable pointer events for tutorial elements */
body.tutorial-active .tutorial-backdrop,
body.tutorial-active .tutorial-instruction-container,
body.tutorial-active .tutorial-instruction-container *,
body.tutorial-active .tutorial-navigation,
body.tutorial-active .tutorial-navigation * {
    pointer-events: auto !important;
}

/* Tutorial help button (invocation control) */
.tutorial-help-button {
    position: fixed !important;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
    border-radius: 50% !important;
    width: 56px !important;
    height: 56px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease !important;
}

.tutorial-help-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2) !important;
}

/* Mobile adjustments for help button */
@media (max-width: 599.98px) {
    .tutorial-help-button {
        bottom: 16px;
        right: 16px;
        width: 48px !important;
        height: 48px !important;
    }
}

/* Ensure tutorial help button is always clickable */
body:not(.tutorial-active) .tutorial-help-button {
    pointer-events: auto !important;
}

/* Close button styling */
.tutorial-close-button {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    min-width: 32px !important;
    padding: 0 !important;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}
