/* Onboarding Overlay Styles */
#onboarding-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none; /* Let clicks pass through EXCEPT where we block them */
    z-index: 10005;
    transition: opacity 0.4s var(--ease-ios);
    opacity: 0;
    display: none;
}

#onboarding-layer.active {
    display: block;
    opacity: 1;
}

/* The dark background with a cutout */
.onboarding-mask {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* We use a box-shadow trick on a floating div to create the spotlight */
    pointer-events: none;
}

.onboarding-spotlight {
    position: absolute;
    border-radius: var(--radius-sq-sm, 16px);
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.45); /* The dark overlay */
    transition: all 0.5s var(--ease-ios);
    pointer-events: none; /* Spotlight hole lets clicks through! */
    z-index: 10006;
}

/* The glowing border around the spotlight */
.onboarding-spotlight::after {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    border: 2px solid var(--accent-color, #FF6B00);
    border-radius: calc(var(--radius-sq-sm, 16px) + 4px);
    box-shadow: 0 0 15px rgba(255, 107, 0, 0.5);
    animation: pulseSpotlight 2s infinite;
}

@keyframes pulseSpotlight {
    0% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.02); opacity: 1; }
    100% { transform: scale(1); opacity: 0.8; }
}

/* Tooltip container */
.onboarding-tooltip {
    position: absolute;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 18px 22px;
    border-radius: var(--radius-sq-sm, 16px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2), inset 0 1px 1px rgba(255,255,255,0.8);
    border: 1px solid rgba(255,255,255,0.4);
    z-index: 10007;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
    transition: all 0.5s var(--ease-ios);
    color: var(--text-main);
    font-weight: 600;
    font-size: 1.1rem;
    line-height: 1.35;
    max-width: min(420px, calc(100vw - 32px));
    min-width: min(280px, calc(100vw - 32px));
    pointer-events: auto;
}

.onboarding-tooltip span {
    min-width: 0;
}

.onboarding-target-focus {
    position: relative;
    z-index: 10008;
    border-radius: 12px;
    background: rgba(255, 107, 0, 0.12);
    box-shadow: 0 0 0 2px rgba(255, 107, 0, 0.75), 0 12px 28px rgba(255, 107, 0, 0.18);
}

.onboarding-tooltip.is-passive {
    pointer-events: none;
}

.onboarding-tooltip.is-drag-step {
    padding: 16px 18px;
    max-width: min(320px, calc(100vw - 32px));
    min-width: min(280px, calc(100vw - 32px));
}

.onboarding-drag-step-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
}

.onboarding-drag-step-number {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(255, 107, 0, 0.1);
    color: var(--accent-color, #FF6B00);
    font-size: 0.74rem;
    font-weight: 800;
    line-height: 1;
}

.onboarding-drag-step-title {
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.2;
}

.onboarding-drag-step-copy {
    color: var(--text-muted);
    font-size: 0.88rem;
    font-weight: 500;
    line-height: 1.35;
}

.onboarding-start-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
}

.onboarding-wheel-icon {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    margin-top: 10px;
    color: var(--accent-color, #FF6B00);
}

.onboarding-wheel-demo {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
}

.onboarding-wheel-core {
    position: absolute;
    top: 9px;
    left: 50%;
    width: 6px;
    height: 11px;
    border-radius: 999px;
    background: currentColor;
    box-shadow: 0 0 0 4px rgba(255, 107, 0, 0.12);
    transform: translateX(-50%);
    transform-origin: center center;
    animation: wheelRoll 1.15s ease-in-out infinite;
}

.onboarding-wheel-demo.is-down .onboarding-wheel-core {
    animation-name: wheelRollDown;
}

.onboarding-wheel-copy {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

.onboarding-wheel-pill {
    display: inline-flex;
    align-items: center;
    padding: 4px 9px;
    border-radius: 999px;
    background: rgba(255, 107, 0, 0.12);
    font-size: 0.76rem;
    font-weight: 700;
    line-height: 1;
}

.onboarding-wheel-caption {
    font-size: 0.84rem;
    line-height: 1.15;
    color: var(--text-muted);
    font-weight: 600;
}

.onboarding-next-btn {
    margin-top: 8px;
    padding: 10px 18px;
    border-radius: var(--radius-pill);
    background: var(--accent-color);
    color: white;
    font-weight: 700;
    border: 0;
    min-height: 40px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    box-shadow: 0 8px 24px rgba(255, 107, 0, 0.25);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.onboarding-next-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 28px rgba(255, 107, 0, 0.3);
}

.onboarding-secondary-btn {
    margin-top: 0;
    margin-left: 0;
    padding: 8px 14px;
    background: rgba(255, 107, 0, 0.12);
    color: var(--accent-color);
    border: 1px solid rgba(255, 107, 0, 0.22);
    box-shadow: none;
}

.onboarding-icon {
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    color: var(--accent-color, #FF6B00);
}

@keyframes wheelRoll {
    0%, 100% {
        transform: translate(-50%, 3px);
        opacity: 0.45;
    }
    35% {
        transform: translate(-50%, -2px);
        opacity: 1;
    }
    55% {
        transform: translate(-50%, -4px) scaleY(0.86);
        opacity: 1;
    }
}

@keyframes wheelRollDown {
    0%, 100% {
        transform: translate(-50%, -3px);
        opacity: 0.45;
    }
    35% {
        transform: translate(-50%, 2px);
        opacity: 1;
    }
    55% {
        transform: translate(-50%, 4px) scaleY(0.86);
        opacity: 1;
    }
}

.editor-block.onboarding-force-controls .block-controls {
    opacity: 1;
}

.editor-block.onboarding-force-controls {
    background: rgba(255, 107, 0, 0.035);
}

.onboarding-drag-source {
    background: rgba(255, 107, 0, 0.08);
    box-shadow: 0 0 0 2px rgba(255, 107, 0, 0.6);
}

.onboarding-force-handle .todo-handle {
    opacity: 1;
    color: var(--accent-color, #FF6B00);
}

.onboarding-drag-target {
    background: linear-gradient(180deg, rgba(255, 107, 0, 0.08), rgba(255, 107, 0, 0.03));
    box-shadow: inset 0 0 0 2px rgba(255, 107, 0, 0.42), 0 0 0 8px rgba(255, 107, 0, 0.08);
}

.onboarding-drag-guide {
    position: absolute;
    display: none;
    pointer-events: none;
    z-index: 10007;
}

.onboarding-drag-guide.active {
    display: block;
}

.onboarding-drag-path {
    position: absolute;
    inset: 0;
    overflow: visible;
}

.onboarding-drag-path path {
    fill: none;
    stroke: rgba(255, 107, 0, 0.92);
    stroke-width: 3.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 8 8;
    marker-end: url(#onboarding-drag-arrowhead);
    filter: drop-shadow(0 6px 16px rgba(255, 107, 0, 0.22));
}

.onboarding-path-start {
    position: absolute;
    width: 12px;
    height: 12px;
    border-radius: 999px;
    background: rgba(255, 107, 0, 0.95);
    box-shadow: 0 0 0 5px rgba(255, 107, 0, 0.15);
    transform: translate(-50%, -50%);
}

.onboarding-drop-preview {
    position: absolute;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.97);
    border: 1px solid rgba(255, 107, 0, 0.2);
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.12);
}

.onboarding-drop-preview--todo {
    border-style: dashed;
}

.onboarding-drop-preview--calendar {
    border-left: 4px solid var(--accent-color, #FF6B00);
    border-radius: 12px;
}

.onboarding-drop-preview-accent {
    width: 9px;
    height: 9px;
    flex-shrink: 0;
    border-radius: 999px;
    background: var(--accent-color, #FF6B00);
    box-shadow: 0 0 0 4px rgba(255, 107, 0, 0.12);
}

.onboarding-drop-preview-label {
    color: var(--accent-color, #FF6B00);
    font-size: 0.84rem;
    font-weight: 800;
    line-height: 1.2;
    white-space: nowrap;
}

.onboarding-drop-pulse {
    position: absolute;
    width: 14px;
    height: 14px;
    border-radius: 999px;
    background: rgba(255, 107, 0, 0.88);
    box-shadow: 0 0 0 2px rgba(255, 107, 0, 0.16);
    transform: translate(-50%, -50%);
}

.onboarding-drop-pulse::after {
    content: '';
    position: absolute;
    inset: -10px;
    border-radius: inherit;
    border: 2px solid rgba(255, 107, 0, 0.36);
    animation: pulseDropTarget 1.6s ease-out infinite;
}

@keyframes pulseDropTarget {
    0% {
        transform: scale(0.72);
        opacity: 0.95;
    }
    100% {
        transform: scale(1.55);
        opacity: 0;
    }
}

/* Blocking layer for elements we don't want the user to click */
.onboarding-blocker {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
    pointer-events: auto; /* Catch all clicks outside the spotlight */
}

/* Specific tooltip positioners handled in JS */

@media (max-width: 720px) {
    .onboarding-tooltip {
        padding: 14px 16px;
        font-size: 1rem;
        max-width: calc(100vw - 24px);
        min-width: min(260px, calc(100vw - 24px));
    }

    .onboarding-next-btn {
        min-height: 38px;
    }
}
