/**
 * CartSetup Capture Mode Styles
 *
 * Styles for the capture overlay, highlight ring, and confirmation toolbar.
 * All z-index values via CSS variables — no literals.
 *
 * @package UpsellMax\CartSetup
 * @see     Section 12 — CSS asset owned by capture layer
 * @see     Section 8  — Capture Mode State Machine
 * @see     Section 9.5 — Z-Index Stack
 */

/* ── Capture Overlay (full-screen dim) ───────────────────────────────── */
/* 2026-10-03: renamed every .umscs-capture-* class below to .um-capture-*
   -- confirmed live that class-capture.php (the PHP source of this
   markup) has only ever output um-capture-* classes, so these selectors
   never matched anything: the overlay rendered with none of this
   styling, no fixed positioning, no z-index, no background, just an
   unstyled block wherever it fell in normal document flow. IDs were
   unaffected (capture.js's own lookups already fall back between both
   prefixes for IDs), only these class selectors. */
/* 2026-10-03: was pointer-events: all -- capture.js's own click detection
   is a window-level capture-phase listener (handleClick), not a click-
   blocking layer; this overlay is purely a visual dim + cursor hint. With
   pointer-events: all, this full-viewport div sat on top of the entire
   page and physically absorbed every click before it ever reached the
   real cart icon underneath -- confirmed live as the direct cause of
   resolveTarget() finding nothing (e.target was this div, which has no
   cart-icon ancestor to walk up to). pointer-events: none lets clicks
   pass straight through to the real page; handleClick still sees every
   one of them regardless, since it's bound on window, not on this div. */
.um-capture-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
    z-index: var(--umscs-z-capture-bg);
    cursor: crosshair;
    pointer-events: none;
}

/* Toolbar sits inside the overlay at the bottom -- deliberately NOT the
 * top: a merchant's real cart icon almost always lives in the theme's own
 * header (within the first ~100px of the viewport), so a top-fixed bar
 * physically covers and swallows clicks on it (confirmed live: elementFromPoint
 * on the real cart icon's center hit .um-capture-toolbar__label, not the
 * icon, with no click handler bound there -- the click was silently eaten).
 * Bottom placement has no equivalent header to collide with. */
.um-capture-toolbar {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    min-height: 56px;
    background: #1a1a2e;
    color: #fff;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 12px;
    padding: 10px 24px;
    z-index: var(--umscs-z-capture-confirm);
    font-family: var(--umscs-font);
    font-size: 14px;
    /* A child does not regain pointer-events just because its ancestor
       (.um-capture-overlay, now pointer-events: none) lost them -- the
       Cancel button and timer need to stay genuinely clickable. */
    pointer-events: auto;
}

.um-capture-toolbar__icon {
    font-size: 18px;
    color: #f4c430;
    flex-shrink: 0;
}

.um-capture-toolbar__label {
    flex: 1;
    margin: 0;
    font-weight: 500;
}

.um-capture-toolbar__cancel {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.3);
    color: #fff;
    padding: 6px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.15s;
}

.um-capture-toolbar__cancel:hover {
    background: rgba(255,255,255,0.25);
}

.um-capture-timer {
    font-family: monospace;
    font-size: 14px;
    color: rgba(255,255,255,0.7);
    min-width: 36px;
    text-align: right;
}

/* Timer warning: turns orange under 30 seconds */
.um-capture-timer--warning {
    color: #f4a430;
    font-weight: 700;
}

/* ── Capture Highlight Ring ───────────────────────────────────────────── */
/* Positioned absolutely around the hovered element by capture.js.        */
/* @see Section 8.2 — "Visible highlight ring around hovered element"     */
.um-capture-ring {
    position: fixed; /* JS sets top/left/width/height */
    pointer-events: none;
    border: 3px solid #f4c430;
    border-radius: 4px;
    z-index: var(--umscs-z-capture-ring);
    box-shadow: 0 0 0 9999px rgba(0,0,0,0.1); /* soft mask outside ring */
    transition: top 0.08s, left 0.08s, width 0.08s, height 0.08s;
    box-sizing: border-box;
}

/* No admin-bar offset needed -- the toolbar is bottom-fixed, and the WP
 * admin bar only ever occupies the top of the viewport. */

/* The floating cart button (.um-floating-cart, floating-ui.js) sits at
 * bottom:24px/16px -- squarely inside this toolbar's footprint now that
 * it's bottom-fixed too. It only ever shows when a CONFIRMED selector
 * exists and has scrolled out of view, which is exactly the state a
 * merchant re-running Capture against an already-confirmed selector is
 * in -- the same collision this whole fix is about, just moved to the
 * other edge. Suppressed for the duration of the capture session instead
 * of trying to offset two independently-positioned elements around each
 * other. body.um-capturing is toggled by capture.js's start()/the reset
 * path (see that file).
 */
body.um-capturing .um-floating-cart {
    display: none !important;
}

@media (max-width: 480px) {
    .um-capture-toolbar {
        padding: 10px 12px;
        font-size: 13px;
    }

    .um-capture-toolbar__label {
        flex-basis: 100%;
        order: 3;
    }
}
