/* =============================================================================
   amCore.tour.css — Guided tour component
   Prefix: amct- (amCore Tour)
   Tokens: var(--am-*) from amCore.tokens.css
   ============================================================================= */

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

@keyframes amct-overlay-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ---------------------------------------------------------------------------
   Overlay — full-screen backdrop with spotlight cutout
   --------------------------------------------------------------------------- */
.amct-overlay {
    position: fixed;
    inset: 0;
    z-index: calc(var(--am-z-modal) - 2);
    pointer-events: none;
    animation: amct-overlay-in var(--am-duration-base) var(--am-easing-standard) both;
}

.amct-overlay--full {
    background: rgba(0, 0, 0, 0.55);
}

/* Fixed highlight ring — dims page except the focused section */
.amct-highlight-ring {
    position: fixed;
    z-index: calc(var(--am-z-modal) - 1);
    pointer-events: none;
    border-radius: var(--am-radius-sm);
    outline: 2px solid var(--am-primary);
    outline-offset: 2px;
    box-shadow:
        0 0 0 9999px rgba(0, 0, 0, 0.55),
        var(--am-shadow-lg);
    transition:
        top var(--am-duration-fast) var(--am-easing-standard),
        left var(--am-duration-fast) var(--am-easing-standard),
        width var(--am-duration-fast) var(--am-easing-standard),
        height var(--am-duration-fast) var(--am-easing-standard);
}

/* Legacy in-flow spotlight (unused; kept for backward compatibility) */
.amct-spotlight {
    position: relative;
    z-index: var(--am-z-modal);
    border-radius: var(--am-radius-sm);
    outline: 2px solid var(--am-primary);
    outline-offset: 4px;
    box-shadow:
        0 0 0 9999px rgba(0, 0, 0, 0.55),
        var(--am-shadow-lg);
    transition:
        outline var(--am-duration-fast) var(--am-easing-standard),
        box-shadow var(--am-duration-fast) var(--am-easing-standard);
}

/* ---------------------------------------------------------------------------
   Popover card
   --------------------------------------------------------------------------- */
.amct-popover {
    position: fixed;
    z-index: calc(var(--am-z-modal) + 1);
    width: 360px;
    max-width: calc(100vw - 24px);
    background: var(--am-bg-base);
    border: 1px solid var(--am-border-default);
    border-radius: var(--am-radius-lg);
    box-shadow: var(--am-shadow-lg);
    padding: var(--am-space-5);
    font-family: var(--am-font-sans);
    animation: amct-fade-in var(--am-duration-slow) var(--am-easing-decelerated) both;
    outline: none; /* focusable via tabindex=-1 without focus ring */
}

/* Pointer arrow — shared diamond; placement classes position it toward the target */
.amct-popover::before {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    background: var(--am-bg-base);
    border: 1px solid var(--am-border-default);
    transform: rotate(45deg);
    pointer-events: none;
}

.amct-popover--placement-bottom::before {
    top: -7px;
    left: var(--amct-arrow-x, 24px);
    margin-left: -6px;
    border-right: none;
    border-bottom: none;
}

.amct-popover--placement-top::before {
    bottom: -7px;
    left: var(--amct-arrow-x, 24px);
    margin-left: -6px;
    border-left: none;
    border-top: none;
}

.amct-popover--placement-right::before {
    left: -7px;
    top: var(--amct-arrow-y, 24px);
    margin-top: -6px;
    border-top: none;
    border-right: none;
}

.amct-popover--placement-left::before {
    right: -7px;
    top: var(--amct-arrow-y, 24px);
    margin-top: -6px;
    border-bottom: none;
    border-left: none;
}

.amct-popover--no-arrow::before,
.amct-popover--bottom-sheet::before {
    display: none;
}

/* ---------------------------------------------------------------------------
   Popover header — step counter + close button
   --------------------------------------------------------------------------- */
.amct-popover__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--am-space-3);
}

.amct-popover__counter {
    font-size: var(--am-font-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--am-text-tertiary);
}

/* ---------------------------------------------------------------------------
   Popover title
   --------------------------------------------------------------------------- */
.amct-popover__title {
    margin: 0 0 var(--am-space-2) 0;
    font-size: var(--am-font-lg);
    font-weight: 600;
    line-height: 1.3;
    color: var(--am-text-primary);
    font-family: var(--am-font-sans);
}

/* ---------------------------------------------------------------------------
   Popover body
   --------------------------------------------------------------------------- */
.amct-popover__body {
    margin: 0 0 var(--am-space-5) 0;
    font-size: var(--am-font-base);
    line-height: 1.6;
    color: var(--am-text-secondary);
}

/* ---------------------------------------------------------------------------
   Popover footer
   --------------------------------------------------------------------------- */
.amct-popover__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--am-space-2);
}

/* ---------------------------------------------------------------------------
   Buttons
   --------------------------------------------------------------------------- */
.amct-btn--primary,
.amct-btn--ghost,
.amct-btn--skip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    font-family: var(--am-font-sans);
    font-size: var(--am-font-sm);
    font-weight: 500;
    border-radius: var(--am-radius-sm);
    transition: background var(--am-trans-fast), color var(--am-trans-fast),
                box-shadow var(--am-trans-fast);
    white-space: nowrap;
}

.amct-btn--primary {
    background: var(--am-primary);
    color: var(--am-text-inverse);
    padding: var(--am-space-2) var(--am-space-4);
    min-width: 80px;
}

.amct-btn--primary:hover {
    background: var(--am-primary-hover);
}

.amct-btn--primary:active {
    background: var(--am-primary-active);
}

.amct-btn--ghost {
    background: transparent;
    color: var(--am-text-secondary);
    border: 1px solid var(--am-border-default);
    padding: var(--am-space-2) var(--am-space-4);
    min-width: 64px;
}

.amct-btn--ghost:hover {
    background: var(--am-bg-elevated);
    color: var(--am-text-primary);
}

.amct-btn--skip {
    background: transparent;
    color: var(--am-text-tertiary);
    padding: var(--am-space-1);
    width: 44px;
    height: 44px;
    font-size: 14px;
    border-radius: var(--am-radius-full);
    flex-shrink: 0;
}

.amct-btn--skip:hover {
    background: var(--am-bg-elevated);
    color: var(--am-text-primary);
}

.amct-btn--skip:focus-visible {
    outline: 2px solid var(--am-border-focus);
    outline-offset: 2px;
}

.amct-popover__disable-wrap {
    margin-top: var(--am-space-3);
    padding-top: var(--am-space-3);
    border-top: 1px solid var(--am-border-subtle);
    text-align: center;
}

.amct-btn--disable {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--am-text-tertiary);
    font-family: var(--am-font-sans);
    font-size: var(--am-font-sm);
    font-weight: 500;
    cursor: pointer;
    padding: var(--am-space-1) var(--am-space-2);
    border-radius: var(--am-radius-sm);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.amct-btn--disable:hover {
    color: var(--am-text-primary);
    background: var(--am-bg-elevated);
}

.amct-btn--disable:focus-visible {
    outline: 2px solid var(--am-border-focus);
    outline-offset: 2px;
}

.amct-disabled-notice {
    position: fixed;
    left: 50%;
    bottom: calc(var(--am-space-5) + var(--am-safe-area-bottom, 0px));
    transform: translateX(-50%);
    z-index: calc(var(--am-z-modal) + 1);
    display: flex;
    align-items: flex-start;
    gap: var(--am-space-3);
    max-width: min(520px, calc(100vw - var(--am-space-6)));
    padding: var(--am-space-3) var(--am-space-4);
    border-radius: var(--am-radius-md);
    background: var(--am-bg-elevated);
    border: 1px solid var(--am-border-default);
    box-shadow: var(--am-shadow-lg);
    animation: amct-fade-in var(--am-duration-slow) var(--am-easing-decelerated) both;
}

.amct-disabled-notice__text {
    margin: 0;
    font-size: var(--am-font-sm);
    line-height: 1.5;
    color: var(--am-text-primary);
}

.amct-disabled-notice__close {
    flex-shrink: 0;
    border: none;
    background: transparent;
    color: var(--am-text-tertiary);
    width: var(--am-touch-min, 44px);
    height: var(--am-touch-min, 44px);
    cursor: pointer;
    border-radius: var(--am-radius-full);
}

.amct-disabled-notice__close:hover {
    background: var(--am-bg-sunken);
    color: var(--am-text-primary);
}

/* Focus rings */
.amct-btn--primary:focus-visible,
.amct-btn--ghost:focus-visible,
.amct-btn--skip:focus-visible {
    outline: 2px solid var(--am-border-focus);
    outline-offset: 2px;
}

/* ---------------------------------------------------------------------------
   Mobile — bottom sheet
   --------------------------------------------------------------------------- */
@media (max-width: 639px) {
    .amct-popover--bottom-sheet {
        position: fixed;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        top: auto !important;
        width: 100% !important;
        max-width: 100% !important;
        transform: none !important;
        border-radius: var(--am-radius-lg) var(--am-radius-lg) 0 0;
        padding: var(--am-space-5) var(--am-space-5) calc(var(--am-space-5) + var(--am-safe-area-bottom));
        animation: amct-bottom-sheet-in var(--am-duration-slow) var(--am-easing-decelerated) both;
    }

    @keyframes amct-bottom-sheet-in {
        from {
            opacity: 0;
            transform: translateY(100%);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
}

/* ---------------------------------------------------------------------------
   Dark mode
   --------------------------------------------------------------------------- */
@media (prefers-color-scheme: dark) {
    .amct-popover {
        background: var(--am-bg-elevated);
        border: 1px solid var(--am-border-subtle);
    }

    .amct-popover::before {
        background: var(--am-bg-elevated);
        border-color: var(--am-border-subtle);
    }
}

/* ---------------------------------------------------------------------------
   Reduced motion
   --------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    .amct-overlay,
    .amct-popover {
        animation: none;
    }

    .amct-spotlight {
        transition: none;
    }

    .amct-highlight-ring {
        transition: none;
    }
}
