/**
 * Profi, kevésbé tolakodó naptár-tutorial
 */

:root {
    --tutorial-accent: #2f9d5c;
    --tutorial-accent-soft: rgba(47, 157, 92, 0.18);
    --tutorial-dim: rgba(15, 23, 20, 0.34);
    --tutorial-card-bg: rgba(255, 255, 255, 0.96);
    --tutorial-text: #1f2933;
    --tutorial-muted: #6b7280;
    --tutorial-border: rgba(15, 23, 20, 0.08);
    --tutorial-shadow: 0 12px 40px rgba(15, 23, 20, 0.16);
    /* Tab-sheet (10050), modalOverlay (20050–99999), enlarged/FX (~999999) fölött */
    --tutorial-z-stage: 1200000;
    --tutorial-z-tip: 1200010;
    --tutorial-z-help: 1000;
}

/* Aktív tutorial: tip / spotlight mindig a sheet-ek és modalok felett */
body.tutorial-active .tutorial-stage,
body.tutorial-active .tutorial-demo-layer {
    z-index: var(--tutorial-z-stage);
}
body.tutorial-active .tutorial-tooltip {
    z-index: var(--tutorial-z-tip);
}

/* Stage: nem blokkoló réteg */
.tutorial-stage {
    position: fixed;
    inset: 0;
    z-index: var(--tutorial-z-stage);
    pointer-events: none;
    animation: tutorialFadeIn 0.28s ease;
}

.tutorial-spotlight {
    position: fixed;
    border-radius: 14px;
    box-shadow: 0 0 0 9999px var(--tutorial-dim);
    outline: 2px solid rgba(47, 157, 92, 0.55);
    background: transparent;
    transition: top 0.28s ease, left 0.28s ease, width 0.28s ease, height 0.28s ease, border-radius 0.28s ease, opacity 0.2s ease;
    opacity: 0;
    pointer-events: none;
}

.tutorial-spotlight.is-visible {
    opacity: 1;
}

.tutorial-spotlight.is-soft {
    outline-color: rgba(47, 157, 92, 0.28);
    box-shadow: 0 0 0 9999px rgba(15, 23, 20, 0.22);
}

/* Kompakt tip kártya */
.tutorial-tooltip {
    position: fixed;
    z-index: var(--tutorial-z-tip);
    width: min(320px, calc(100vw - 32px));
    background: var(--tutorial-card-bg);
    color: var(--tutorial-text);
    border: 1px solid var(--tutorial-border);
    border-radius: 16px;
    box-shadow: var(--tutorial-shadow);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    pointer-events: auto;
    opacity: 0;
    transform: translateY(6px) scale(0.98);
    transition: opacity 0.22s ease, transform 0.22s ease;
    box-sizing: border-box;
    overflow: hidden;
}

.tutorial-tooltip-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.tutorial-tooltip.is-center {
    width: min(360px, calc(100vw - 32px));
}

.tutorial-tooltip.is-safe-top {
    width: min(340px, calc(100vw - 24px));
    box-shadow: 0 10px 28px rgba(15, 23, 20, 0.18);
}

.tutorial-tooltip.is-safe-bottom {
    width: min(340px, calc(100vw - 24px));
    box-shadow: 0 -8px 28px rgba(15, 23, 20, 0.18);
}

/* Mobilon esemény-sheet fölött kompakt tip – ne takarja az űrlapot */
@media (max-width: 768px) {
    body.tutorial-active.tab-sheet-open .tutorial-tooltip.is-safe-top {
        width: min(100vw - 20px, 360px);
        max-height: none;
    }
    body.tutorial-active.tab-sheet-open .tutorial-tooltip .tutorial-body p {
        font-size: 13px;
        line-height: 1.35;
        margin: 0;
    }
}

.tutorial-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 14px 0;
}

.tutorial-header h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 650;
    letter-spacing: -0.01em;
    line-height: 1.35;
    color: var(--tutorial-text);
    flex: 1;
}

.tutorial-close {
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: var(--tutorial-muted);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: background 0.15s ease, color 0.15s ease;
}

.tutorial-close:hover {
    background: rgba(15, 23, 20, 0.06);
    color: var(--tutorial-text);
}

.tutorial-body {
    padding: 8px 14px 0;
}

.tutorial-body p {
    margin: 0;
    font-size: 13.5px;
    line-height: 1.55;
    color: var(--tutorial-muted);
}

.tutorial-footer {
    padding: 12px 14px 14px;
}

.tutorial-progress {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-bottom: 12px;
}

.tutorial-dot {
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: rgba(15, 23, 20, 0.12);
    transition: width 0.2s ease, background 0.2s ease;
}

.tutorial-dot.is-active {
    width: 18px;
    background: var(--tutorial-accent);
}

.tutorial-dot.is-done {
    background: rgba(47, 157, 92, 0.45);
}

.tutorial-buttons {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.tutorial-btn {
    appearance: none;
    border: none;
    border-radius: 999px;
    padding: 9px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s ease, background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
    white-space: nowrap;
}

.tutorial-btn:active {
    transform: scale(0.98);
}

.tutorial-btn-primary {
    background: var(--tutorial-accent);
    color: #fff;
    box-shadow: 0 6px 16px rgba(47, 157, 92, 0.28);
}

.tutorial-btn-primary:hover {
    background: #278650;
}

.tutorial-btn-secondary {
    background: rgba(15, 23, 20, 0.05);
    color: #374151;
}

.tutorial-btn-secondary:hover {
    background: rgba(15, 23, 20, 0.09);
    color: var(--tutorial-text);
}

.tutorial-btn:focus-visible,
.tutorial-close:focus-visible,
.tutorial-help-button:focus-visible {
    outline: 2px solid var(--tutorial-accent);
    outline-offset: 2px;
}

/* Demo elemek */
.tutorial-demo-layer {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: calc(var(--tutorial-z-stage) + 2);
}

.tutorial-ghost {
    position: fixed;
    width: 72px;
    height: 72px;
    border-radius: 12px;
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.92), rgba(236, 242, 238, 0.92)),
        repeating-linear-gradient(
            45deg,
            rgba(47, 157, 92, 0.08),
            rgba(47, 157, 92, 0.08) 8px,
            rgba(47, 157, 92, 0.02) 8px,
            rgba(47, 157, 92, 0.02) 16px
        );
    border: 1px solid rgba(47, 157, 92, 0.35);
    box-shadow: 0 10px 28px rgba(15, 23, 20, 0.22);
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.92);
    overflow: hidden;
    z-index: 2;
}

.tutorial-ghost.has-image {
    background-size: cover;
    background-position: center;
}

.tutorial-ghost.is-visible {
    opacity: 0.92;
}

.tutorial-ghost.is-pressing {
    transform: translate(-50%, -50%) scale(0.86);
}

.tutorial-ghost.is-dragging {
    opacity: 0.88;
    transform: translate(-50%, -50%) scale(0.95) rotate(-2deg);
    box-shadow: 0 16px 36px rgba(15, 23, 20, 0.28);
}

.tutorial-cursor {
    position: fixed;
    width: 28px;
    height: 28px;
    margin: 0;
    transform: translate(-4px, -2px);
    opacity: 0;
    z-index: 3;
    filter: drop-shadow(0 4px 8px rgba(15, 23, 20, 0.35));
    transition: opacity 0.15s ease;
}

.tutorial-cursor.is-visible {
    opacity: 1;
}

.tutorial-cursor.is-pressing {
    transform: translate(-4px, -2px) scale(0.9);
}

.tutorial-cursor svg {
    display: block;
    width: 100%;
    height: 100%;
}

.tutorial-finger {
    position: fixed;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.95), rgba(220, 232, 224, 0.9));
    border: 2px solid rgba(47, 157, 92, 0.55);
    box-shadow:
        0 0 0 8px var(--tutorial-accent-soft),
        0 10px 22px rgba(15, 23, 20, 0.22);
    opacity: 0;
    transform: translate(-50%, -50%);
    z-index: 3;
    transition: opacity 0.15s ease, box-shadow 0.2s ease;
}

.tutorial-finger.is-visible {
    opacity: 1;
}

.tutorial-finger.is-pressing {
    box-shadow:
        0 0 0 14px rgba(47, 157, 92, 0.16),
        0 8px 18px rgba(15, 23, 20, 0.2);
    animation: tutorialFingerPress 0.9s ease-in-out 1;
}

.tutorial-finger::after {
    content: '';
    position: absolute;
    inset: 12px;
    border-radius: 50%;
    background: rgba(47, 157, 92, 0.35);
}

.tutorial-drop-ring {
    position: fixed;
    width: 88px;
    height: 88px;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    opacity: 0;
    z-index: 1;
}

.tutorial-drop-ring.is-visible {
    opacity: 1;
}

.tutorial-drop-ring::before,
.tutorial-drop-ring::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid rgba(47, 157, 92, 0.65);
}

.tutorial-drop-ring::before {
    animation: tutorialDropPulse 1.6s ease-out infinite;
}

.tutorial-drop-ring::after {
    inset: 18px;
    background: rgba(47, 157, 92, 0.14);
    border-color: rgba(47, 157, 92, 0.85);
}

.tutorial-drop-label {
    position: fixed;
    transform: translate(-50%, 0);
    margin-top: 52px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(20, 30, 24, 0.78);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.01em;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    z-index: 1;
}

.tutorial-drop-label.is-visible {
    opacity: 1;
}

.tutorial-source-pulse {
    outline: 2px solid rgba(47, 157, 92, 0.55) !important;
    outline-offset: 3px;
    box-shadow: 0 0 0 6px var(--tutorial-accent-soft) !important;
    border-radius: 10px;
}

.tutorial-demo-thumb {
    position: relative;
    outline: 2px dashed rgba(47, 157, 92, 0.55);
    outline-offset: 2px;
}

.tutorial-demo-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.tutorial-demo-thumb-badge {
    position: absolute;
    left: 4px;
    top: 4px;
    padding: 2px 6px;
    border-radius: 999px;
    background: rgba(47, 157, 92, 0.92);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.02em;
    pointer-events: none;
    z-index: 2;
}

.tutorial-click-ripple {
    position: fixed;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(47, 157, 92, 0.35);
    border: 2px solid rgba(47, 157, 92, 0.75);
    transform: translate(-50%, -50%) scale(0.4);
    opacity: 0;
    z-index: 4;
    pointer-events: none;
}

.tutorial-click-ripple.is-visible {
    animation: tutorialClickRipple 0.6s ease-out forwards;
}

@keyframes tutorialClickRipple {
    0% {
        opacity: 0.9;
        transform: translate(-50%, -50%) scale(0.35);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(2.4);
    }
}

/* Help gomb */
.tutorial-help-button {
    position: fixed;
    top: auto;
    right: 14px;
    bottom: 18px;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.35);
    background: rgba(47, 157, 92, 0.95);
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(15, 23, 20, 0.18);
    z-index: 35;
    display: none;
    align-items: center;
    justify-content: center;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.tutorial-help-button.is-visible {
    display: flex;
}

.tutorial-help-button.anchored-to-canvas {
    top: var(--tutorial-help-top, auto);
    right: auto;
    bottom: auto;
    left: var(--tutorial-help-left, auto);
}

@media (min-width: 769px) {
    body.naptar-desktop .tutorial-help-button {
        position: absolute;
        top: 8px;
        right: 8px;
        bottom: auto;
        left: auto;
        z-index: 260;
        width: 36px;
        height: 36px;
        font-size: 16px;
        box-shadow: 0 6px 16px rgba(15, 23, 20, 0.22);
    }
}

.tutorial-help-button:hover {
    transform: translateY(-1px) scale(1.04);
    box-shadow: 0 10px 24px rgba(47, 157, 92, 0.35);
}

.tutorial-help-button:active {
    transform: scale(0.96);
}

@keyframes tutorialFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes tutorialDropPulse {
    0% {
        transform: scale(0.72);
        opacity: 0.9;
    }
    70% {
        transform: scale(1.25);
        opacity: 0;
    }
    100% {
        transform: scale(1.25);
        opacity: 0;
    }
}

@keyframes tutorialFingerPress {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    40% { transform: translate(-50%, -50%) scale(0.86); }
    70% { transform: translate(-50%, -50%) scale(1.02); }
}

@media (max-width: 768px) {
    .tutorial-tooltip {
        width: min(100vw - 24px, 360px);
    }

    /* Feljebb: ne takarja a fotósávot / alsó menüt */
    .tutorial-help-button {
        top: calc(env(safe-area-inset-top, 0px) + 118px);
        right: 10px;
        left: auto;
        bottom: auto;
        width: 38px;
        height: 38px;
        font-size: 16px;
        z-index: 45;
    }
    body.naptar-open .tutorial-help-button {
        /* Felül, a sticky chrome alatt – soha ne a fotósáv / tabok fölé essen */
        top: calc(env(safe-area-inset-top, 0px) + var(--naptar-chrome-height, 120px) + 10px);
        right: 10px;
        bottom: auto;
    }
    body.naptar-open .tutorial-help-button.anchored-to-canvas {
        top: calc(env(safe-area-inset-top, 0px) + var(--naptar-chrome-height, 120px) + 10px) !important;
        left: auto !important;
        right: 10px !important;
        bottom: auto !important;
    }

    body.tab-sheet-open .tutorial-help-button.is-visible {
        display: none !important;
    }

    .tutorial-ghost {
        width: 64px;
        height: 64px;
    }

    .tutorial-drop-ring {
        width: 76px;
        height: 76px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .tutorial-stage,
    .tutorial-tooltip,
    .tutorial-spotlight,
    .tutorial-drop-ring::before,
    .tutorial-finger.is-pressing {
        animation: none !important;
        transition: none !important;
    }
}

@media print {
    .tutorial-stage,
    .tutorial-tooltip,
    .tutorial-demo-layer,
    .tutorial-help-button {
        display: none !important;
    }
}
