/**
 * AIEO Navigator — Ctrl+K command palette styles.
 *
 * Architecture mirrors Vultr Panel's command-palette.js (single overlay,
 * two-pane layout, glass backdrop) but with theme-token-driven colours
 * so it inherits the host theme's brand. Falls back to neutral defaults
 * when the host theme doesn't define the relevant `--wp--preset-*` vars.
 */

#aieo-navigator-root {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 10vh;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(4px) saturate(1.1);
    -webkit-backdrop-filter: blur(4px) saturate(1.1);
    font-family: var(--wp--preset--font-family--aeonik, system-ui, sans-serif);
}
#aieo-navigator-root[hidden] { display: none; }

.aieo-navigator-backdrop {
    position: absolute;
    inset: 0;
}

.aieo-navigator-panel {
    position: relative;
    width: min(1030px, 94vw);
    max-height: 78vh;
    /* Background / text / accent are admin-tunable via inline CSS vars
       on `#aieo-navigator-root` — when the admin leaves them empty the
       theme tokens win. Border + padding likewise admin-tunable. */
    background: var(--aieo-nav-bg, var(--wp--preset--color--bg, #ffffff));
    color:      var(--aieo-nav-fg, var(--wp--preset--color--fg, #1f2937));
    border-width: var(--aieo-nav-border-width, 1px);
    border-style: solid;
    border-color: var(--aieo-nav-border-color, var(--wp--preset--color--border, #e5e7eb));
    border-radius: var(--aieo-nav-border-radius, 12px);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.28);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
/* Pull the admin-tuned padding into the body's interior so a wider
 * value gives more breathing room without pushing the header out. */
.aieo-navigator-left,
.aieo-navigator-right,
.aieo-navigator-rail {
    padding: var(--aieo-nav-padding, 8px);
}
/* Accent override — when the admin sets one, it wins over the theme
 * token for ALL link-colored elements inside the navigator. */
.aieo-navigator-panel a,
.aieo-navigator-panel .aieo-nav-row.is-active,
.aieo-navigator-panel .aieo-nav-rail-item:hover {
    color: var(--aieo-nav-accent, var(--wp--preset--color--accent, #2563eb));
}

/* ── Header ───────────────────────────────────────────────────────────── */

.aieo-navigator-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--aieo-nav-border-color, var(--wp--preset--color--border, #e5e7eb));
}
.aieo-navigator-header::before {
    /* Magnifier glyph rendered via mask so it inherits currentColor */
    content: '';
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    background-color: var(--wp--preset--color--muted, #6b7280);
    -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='7'/><line x1='21' y1='21' x2='16.65' y2='16.65'/></svg>") no-repeat center / 20px 20px;
            mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='7'/><line x1='21' y1='21' x2='16.65' y2='16.65'/></svg>") no-repeat center / 20px 20px;
}
.aieo-navigator-input {
    /* `min-width: 0` is the flex-shrink magic ingredient: without it the
     * input refuses to shrink below its placeholder/content width and
     * pushes the count + size + close buttons off the right edge on
     * narrow mobile headers. With it, the input shrinks first when the
     * header runs out of room — count/buttons stay visible. */
    flex: 1 1 0;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    font-family: inherit;
    font-size: 16px;
    color: var(--wp--preset--color--fg, #111827);
    padding: 0;
    /* Truncate placeholder gracefully if the input is very narrow. */
    text-overflow: ellipsis;
}
.aieo-navigator-input::placeholder {
    color: var(--wp--preset--color--muted, #9ca3af);
}
.aieo-navigator-count {
    font-size: 11px;
    color: var(--wp--preset--color--muted, #9ca3af);
    white-space: nowrap;
}
.aieo-navigator-close {
    background: var(--wp--preset--color--accent, #F46767);
    border: 1px solid var(--wp--preset--color--accent, #F46767);
    color: #fff;
    border-radius: 6px;
    /* 32×32 — Material Design's icon-button minimum. */
    width: 32px;
    height: 32px;
    padding: 0;
    /* SVG × is drawn within a 14×14 viewBox centered inside the
     * 32×32 button via flex. No text glyph means no font-baseline
     * drift to fight. */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 120ms ease, transform 120ms ease;
}
.aieo-navigator-close > svg {
    display: block;
}
.aieo-navigator-close:hover,
.aieo-navigator-close:focus-visible {
    background: #d94c4c;
    border-color: #d94c4c;
    transform: scale(1.05);
    color: #fff;
}
.aieo-navigator-close:focus-visible {
    outline: 2px solid var(--wp--preset--color--accent, #F46767);
    outline-offset: 2px;
}

/* ── Body (two-column grid) ─────────────────────────────────────────── */

/* Layout vars — JS overrides these on the panel element to honour
 * user preferences (saved in localStorage):
 *   --aieo-nav-left-pct   percent width of the LEFT (categories) pane
 *                         on desktop, drag-handle controlled. Range 25–65.
 *   --aieo-nav-scale      multiplier for row padding/font/icon sizes,
 *                         A−/A=/A+ button controlled (1, 1.15, 1.30).
 *                         Bumped to fix tappability on touch devices.
 */
.aieo-navigator-panel {
    --aieo-nav-left-pct: 44;
    --aieo-nav-scale:    1;
}
.aieo-navigator-body {
    display: grid;
    grid-template-columns: minmax(320px, calc(var(--aieo-nav-left-pct, 44) * 1%)) 1fr;
    flex: 1 1 auto;
    overflow: hidden;
    min-height: 0;
}
/* When at least one group has placement=rail, JS adds .has-rail to the
 * body — switch to a 3-column layout where the rail occupies a fixed
 * 200px on the right. Rail-less builds stay on the original 2-column. */
.aieo-navigator-body.has-rail {
    grid-template-columns: minmax(280px, calc(var(--aieo-nav-left-pct, 38) * 1%)) 1fr 200px;
}

/* Drag handle straddling the left/middle column boundary. Anchored to
 * the panel via position:absolute so it doesn't reflow the grid. JS
 * positions its `left` to match the column edge. */
.aieo-nav-resize-handle {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 8px;
    margin-left: -4px;
    cursor: col-resize;
    z-index: 5;
    background: transparent;
    transition: background-color 0.12s;
    user-select: none;
}
.aieo-nav-resize-handle:hover,
.aieo-nav-resize-handle.is-dragging {
    background: var(--aieo-nav-selection-bg, var(--wp--preset--color--accent, #F46767));
    opacity: 0.35;
}

/* Size-cycle button in the header — a single 32×32 button that cycles
 * Compact → Cozy → Comfortable on click. Single-button design instead
 * of a 3-button group keeps the mobile header (search + count + close
 * + this) from overflowing on narrow phones. The character inside
 * grows / shrinks to indicate the current step. */
.aieo-nav-size-cycle {
    width: 32px;
    height: 32px;
    margin-right: 6px;
    flex-shrink: 0;
    border: 1px solid var(--aieo-nav-border-color, var(--wp--preset--color--border, #e5e7eb));
    background: var(--aieo-nav-bg, #ffffff);
    color: var(--wp--preset--color--fg, #111827);
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.1s, border-color 0.1s;
}
.aieo-nav-size-cycle:hover {
    background: var(--aieo-nav-hover-bg, var(--wp--preset--color--subtle, #f3f4f6));
}
.aieo-nav-size-cycle:active { transform: scale(0.96); }
.aieo-nav-size-cycle[data-step="1"]   { font-size: 11px; }
.aieo-nav-size-cycle[data-step="2"]   { font-size: 14px; }
.aieo-nav-size-cycle[data-step="3"]   { font-size: 17px; }
/* Visual feedback that a non-default size is active. */
.aieo-nav-size-cycle:not([data-step="1"]) {
    background: var(--aieo-nav-selection-bg, var(--wp--preset--color--accent, #F46767));
    color: #ffffff;
    border-color: transparent;
}
.aieo-navigator-body:not(.has-rail) .aieo-navigator-rail {
    display: none;
}
.aieo-navigator-rail {
    overflow-y: auto;
    border-left: 1px solid var(--aieo-nav-border-color, var(--wp--preset--color--border, #e5e7eb));
    background: color-mix(in srgb, var(--aieo-nav-bg, #ffffff) 92%, #000 8%);
}
.aieo-nav-rail-group + .aieo-nav-rail-group {
    margin-top: 14px;
    padding-top: 10px;
    border-top: 1px dashed var(--aieo-nav-border-color, var(--wp--preset--color--border, #e5e7eb));
}
.aieo-nav-rail-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--wp--preset--color--muted, #6b7280);
    margin: 0 0 6px;
    padding: 0 6px;
}
.aieo-nav-rail-item {
    display: block;
    padding: 7px 8px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 13.5px;
    line-height: 1.3;
    color: inherit;
    transition: background 120ms ease, color 120ms ease;
}
.aieo-nav-rail-item:hover,
.aieo-nav-rail-item:focus-visible {
    background: var(--wp--preset--color--subtle, #f3f4f6);
    outline: none;
}
.aieo-navigator-left,
.aieo-navigator-right {
    overflow-y: auto;
    padding: 8px;
    min-height: 0;
}
.aieo-navigator-left {
    border-right: 1px solid var(--aieo-nav-border-color, var(--wp--preset--color--border, #e5e7eb));
}

/* Section headers (group labels — Categories, Brands, Needs, …) */
.aieo-nav-section {
    font-family: inherit;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--wp--preset--color--muted, #9ca3af);
    padding: 10px 12px 4px;
    margin-top: 4px;
}
.aieo-nav-section:first-child { margin-top: 0; }

/* Item rows — used in both left (filterable list) and right (details).
 * Padding scales with --aieo-nav-scale so the size-toggle buttons
 * (A−/A=/A+) bump tappability on touch devices uniformly. */
.aieo-nav-row {
    display: flex;
    align-items: center;
    gap: calc(10px * var(--aieo-nav-scale, 1));
    padding: calc(8px * var(--aieo-nav-scale, 1)) calc(10px * var(--aieo-nav-scale, 1));
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.1s;
    color: var(--wp--preset--color--fg, #111827);
    min-height: calc(32px * var(--aieo-nav-scale, 1));
}
.aieo-nav-row:hover {
    background: var(--aieo-nav-hover-bg, var(--wp--preset--color--subtle, #f3f4f6));
}
.aieo-nav-row.is-active {
    background: var(--aieo-nav-selection-bg, var(--wp--preset--color--accent, #F46767));
}
.aieo-nav-row.is-active .aieo-nav-row-label,
.aieo-nav-row.is-active .aieo-nav-icon {
    color: #ffffff;
}
/* Active row: a clean white numeral on the selection background (no pill),
   matching the active label + icon. */
.aieo-nav-row.is-active .aieo-nav-row-meta {
    color: #ffffff;
    background: transparent;
}

.aieo-nav-icon {
    width: calc(18px * var(--aieo-nav-scale, 1));
    height: calc(18px * var(--aieo-nav-scale, 1));
    flex-shrink: 0;
    color: var(--wp--preset--color--muted, #6b7280);
}
.aieo-nav-chevron {
    flex-shrink: 0;
    color: var(--wp--preset--color--muted, #9ca3af);
    transition: transform 120ms ease;
}
.aieo-nav-chevron.is-open { transform: rotate(90deg); }
.aieo-nav-row.is-active .aieo-nav-chevron { color: #fff; }
.aieo-nav-chevron-spacer {
    display: inline-block;
    width: 12px;
    height: 12px;
    flex-shrink: 0;
}
.aieo-nav-row-label {
    flex: 1 1 auto;
    font-size: calc(14px * var(--aieo-nav-scale, 1));
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
/* Indent for level-1 / level-2 entries — 14px per level */
.aieo-nav-row[data-level="1"] .aieo-nav-row-label { padding-left: 14px; }
.aieo-nav-row[data-level="2"] .aieo-nav-row-label { padding-left: 28px; }

.aieo-nav-row-meta {
    /* DEFAULT: clean numerals — no grey pill. Tabular figures so they align.
       Operator can switch to the pill style via the navigator Appearance
       setting (adds `.is-count-pill` on the root). */
    font-size: 12px;
    color: var(--wp--preset--color--muted, #9ca3af);
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
}

/* OPT-IN pill style (navigator Appearance → Category counts = "Pill"). Colours
   are admin-tunable (`--aieo-nav-count-bg/fg`, rgba-capable) and fall back to
   the theme tokens. */
.aieo-navigator-root.is-count-pill .aieo-nav-row-meta {
    font-size: 11px;
    font-weight: 500;
    padding: 2px 7px;
    border-radius: 999px;
    background: var(--aieo-nav-count-bg, var(--wp--preset--color--subtle, #f3f4f6));
    color: var(--aieo-nav-count-fg, var(--wp--preset--color--muted, #6b7280));
}
.aieo-navigator-root.is-count-pill .aieo-nav-row.is-active .aieo-nav-row-meta {
    background: #ffffff;
    color: var(--wp--preset--color--fg, #111827);
}

.aieo-nav-empty {
    padding: 24px;
    text-align: center;
    color: var(--wp--preset--color--muted, #9ca3af);
    font-size: 14px;
}
.aieo-nav-hint {
    padding: 10px 12px;
    font-size: 12px;
    color: var(--wp--preset--color--muted, #9ca3af);
}
/* `+N more — type to search` strip rendered at the bottom of every
 * truncated group (per-group cap kicks in to keep all groups
 * visible). Italic + muted so it reads as a hint, not a row. */
.aieo-nav-truncated {
    padding: 6px 12px 10px 36px;
    font-size: 11px;
    font-style: italic;
    color: var(--wp--preset--color--muted, #9ca3af);
    letter-spacing: 0.02em;
}

/* ── Right pane — selected-item detail (clickable, image + desc + kids) ── */

.aieo-nav-right-head {
    padding: 12px;
    margin-bottom: 4px;
}
a.aieo-nav-right-title {
    display: block;
    font-size: 16px;
    font-weight: 600;
    /* Brand-accent + underline by default so the customer immediately
     * recognises this as a clickable destination — without the
     * accent treatment it reads as a plain heading and the
     * "where do I click to go to the category page" answer is
     * non-obvious (test-confirmed UX issue). */
    color: var(--wp--preset--color--accent, #F46767);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
    transition: color 120ms ease, text-decoration-color 120ms ease;
}
a.aieo-nav-right-title:hover,
a.aieo-nav-right-title:focus {
    color: #d94c4c;
    text-decoration-thickness: 2px;
}
.aieo-nav-right-sub {
    font-size: 11px;
    color: var(--wp--preset--color--muted, #6b7280);
    margin-top: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.aieo-nav-right-imagewrap {
    padding: 0 12px 12px;
}
.aieo-nav-right-image {
    display: block;
    max-width: 100%;
    max-height: 160px;
    object-fit: contain;
    border-radius: 6px;
    background: var(--wp--preset--color--subtle, #f9fafb);
}
.aieo-nav-right-desc {
    padding: 0 12px 12px;
    font-size: 12px;
    color: var(--wp--preset--color--fg, #374151);
    line-height: 1.55;
    white-space: pre-wrap;
}
.aieo-nav-right-section {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--wp--preset--color--muted, #9ca3af);
    padding: 8px 12px 4px;
    border-top: 1px solid var(--aieo-nav-border-color, var(--wp--preset--color--border, #e5e7eb));
    margin-top: 4px;
}
a.aieo-nav-right-kid {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    font-size: 13px;
    color: var(--wp--preset--color--fg, #111827);
    text-decoration: none;
    border-radius: 6px;
    margin: 0 6px;
    transition: background-color 100ms ease, color 100ms ease;
}
a.aieo-nav-right-kid:hover,
a.aieo-nav-right-kid:focus {
    background: var(--aieo-nav-hover-bg, var(--wp--preset--color--subtle, #f3f4f6));
    color: var(--aieo-nav-accent, var(--wp--preset--color--accent, #F46767));
}

/* Highlights block — top brands + top needs, always visible at the
   bottom of the right pane so processed-popularity data is one glance
   away regardless of selection. */
.aieo-nav-right-highlights {
    margin-top: 0;
    padding-top: 0;
}

/* ── Footer (keyboard hints) ─────────────────────────────────────────── */

.aieo-navigator-footer {
    display: flex;
    gap: 16px;
    padding: 10px 16px;
    border-top: 1px solid var(--aieo-nav-border-color, var(--wp--preset--color--border, #e5e7eb));
    font-size: 11px;
    color: var(--wp--preset--color--muted, #6b7280);
    flex-wrap: wrap;
}
.aieo-navigator-footer kbd {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 10px;
    padding: 1px 5px;
    border: 1px solid var(--aieo-nav-border-color, var(--wp--preset--color--border, #e5e7eb));
    border-radius: 4px;
    background: var(--wp--preset--color--subtle, #f3f4f6);
    margin-right: 3px;
    line-height: 1.4;
}

/* ── Archive filters injected into the navigator's left pane ──────────── */

/* When opened on a product_cat / product_tag archive, the navigator
 * clones the page's FiboFilters vertical container into the top of
 * its left list as a "Φίλτρα" section. The merchant must keep
 * FiboFilters' "Enable the mobile-optimized layout" setting OFF
 * (Settings → FiboFilters) — that's what tells the plugin to render
 * the full vertical filter UI on every viewport rather than swapping
 * to compact horizontal buttons on phones. */
.aieo-nav-archive-filters {
    margin: 0 0 8px;
    padding: 0;
}
.aieo-nav-archive-filters .fibofilters-vertical-filters-container {
    margin: 0;
    padding: 8px 0 0;
}

/* Compact the FibFilters block layout when it's nested inside the
 * navigator. The default filter UI is sized for a roomy sidebar; in
 * the navigator's narrower left pane that produces the "huge gaps"
 * the merchant flagged. We reduce headline padding, tighten the gap
 * between filter rows, and pipe the size-cycle scale through to
 * filter labels + checkboxes so A− / A= / A+ affects them too. */
/* Drop the parent theme's `padding: 15px 0` on each filter block —
 * inside the narrow navigator it doubles up with the headline padding
 * below and produces the "huge gaps" the merchant flagged. Theme rule
 * has (0,1,0); we win at (0,3,0) AND scope to navigator only. */
.aieo-navigator-panel .aieo-nav-archive-filters .fibofilters-block {
    padding: 0 !important;
}

/* Headline rows ("ΦΙΛΤΡΑ", "ΑΝΑΓΚΗ", "BRANDS"). The parent theme's
 * fibosearch.css ships `padding: 12px 0 6px !important` at (0,2,0)
 * specificity. We need (0,3,0) to win. Keep ~8px TOP padding so
 * adjacent blocks have visible separation between the previous
 * block's last item and this block's heading; bottom stays 0. */
.aieo-navigator-panel .aieo-nav-archive-filters .fibofilters-block__headline,
.aieo-navigator-panel .aieo-nav-archive-filters .fibofilters-block__headline-box,
.aieo-navigator-panel .aieo-nav-archive-filters .fibofilters-block__headline-box-inner,
.aieo-navigator-panel .aieo-nav-archive-filters [class*="fibofilters-block__headline"] {
    padding: 8px 0 0 !important;
    margin: 0 !important;
    min-height: 0 !important;
    font-size: calc(11px * var(--aieo-nav-scale, 1)) !important;
    letter-spacing: 0.05em !important;
    text-transform: uppercase !important;
    line-height: 1.4 !important;
}
.aieo-nav-archive-filters .fibofilters-block__content,
.aieo-nav-archive-filters [class*="fibofilters-block__content"] {
    padding: 4px 0 12px !important;
    margin: 0 !important;
}
/* Each filter line — checkbox + label. Universal rule that catches
 * the common shapes FibFilters emits (label, list item, anchor row). */
.aieo-nav-archive-filters .fibofilters-block__content label,
.aieo-nav-archive-filters .fibofilters-block__content li,
.aieo-nav-archive-filters .fibofilters-block__content a {
    padding: calc(4px * var(--aieo-nav-scale, 1)) 0 !important;
    margin: 0 !important;
    font-size: calc(13px * var(--aieo-nav-scale, 1)) !important;
    line-height: 1.3 !important;
    min-height: calc(28px * var(--aieo-nav-scale, 1)) !important;
}
/* Checkbox / radio sized via scale — bigger touch target on mobile. */
.aieo-nav-archive-filters .fibofilters-block__content input[type="checkbox"],
.aieo-nav-archive-filters .fibofilters-block__content input[type="radio"] {
    width: calc(16px * var(--aieo-nav-scale, 1)) !important;
    height: calc(16px * var(--aieo-nav-scale, 1)) !important;
    margin-right: calc(8px * var(--aieo-nav-scale, 1)) !important;
}
/* Trim the gap between filter blocks (need / brand / price etc.). */
.aieo-nav-archive-filters .fibofilters-block,
.aieo-nav-archive-filters [class*="fibofilters-block"]:not([class*="block__"]) {
    margin: 0 0 8px !important;
}

/* ── Mobile sticky bottom bar — Browse + Cart, ≤720px only ───────────── */

.aieo-mobile-bottom-bar {
    /* Hidden by default; the @media block below activates it on phones. */
    display: none;
}
@media (max-width: 720px) {
    .aieo-mobile-bottom-bar {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 9990;             /* under the navigator modal (10000+) */
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 8px 28px calc(env(safe-area-inset-bottom, 0px) + 8px);
        background: var(--wp--preset--color--subtle, #fce4e6);
        border-top: 1px solid var(--aieo-nav-border-color, var(--wp--preset--color--border, #e5e7eb));
        /* Slight shadow so the bar reads as floating, not glued. */
        box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.06);
    }
    .aieo-mobile-bottom-bar__btn {
        position: relative;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        background: transparent;
        border: 0;
        padding: 8px;
        min-width: 44px;            /* WCAG touch target */
        min-height: 44px;
        color: var(--wp--preset--color--fg, #1f2937);
        cursor: pointer;
        text-decoration: none;
    }
    .aieo-mobile-bottom-bar__btn:active { transform: scale(0.96); }
    .aieo-mobile-bottom-bar__count {
        position: absolute;
        top: 4px;
        right: 0;
        min-width: 18px;
        height: 18px;
        padding: 0 5px;
        border-radius: 999px;
        background: var(--wp--preset--color--fg, #1f2937);
        color: var(--wp--preset--color--bg, #fff);
        font-size: 11px;
        font-weight: 600;
        line-height: 18px;
        text-align: center;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    .aieo-mobile-bottom-bar__count[hidden] { display: none; }
}

/* ── Mobile bottom-sheet skin for the navigator (≤720px) ─────────────── */

@media (max-width: 720px) {
    /* The whole modal pivots from "centered card" to "bottom sheet": the
     * backdrop covers the page, the panel hugs the bottom and slides up
     * from there. Search header stays at the top of the sheet, footer
     * is hidden (kbd hints are useless on touch), and the body scrolls
     * vertically inside the sheet. */
    #aieo-navigator-root {
        /* The mobile bottom bar is ~64px tall + iOS safe-area inset.
         * Pad the navigator root by that amount so the sheet (which
         * sits at align-items: flex-end) stops above the bar — the
         * bar stays tappable while the navigator is open, and the
         * Browse button remains reachable as a close toggle. */
        padding-top: 0;
        padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px));
        align-items: flex-end;
        box-sizing: border-box;
    }
    .aieo-navigator-panel {
        width: 100vw;
        max-width: 100vw;
        /* Max height now leaves room for the bar at the bottom (the
         * root's padding-bottom does the actual positioning). */
        height: calc(82dvh - env(safe-area-inset-bottom, 0px));
        max-height: calc(82dvh - env(safe-area-inset-bottom, 0px));
        border-radius: 18px 18px 0 0;
        border-width: 0;
        box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.18);
    }
    /* Visual drag handle at the top of the sheet — hint that this is
     * dismissable via swipe (and reads as native to mobile users). */
    .aieo-navigator-panel::before {
        content: '';
        position: absolute;
        top: 6px;
        left: 50%;
        transform: translateX(-50%);
        width: 42px;
        height: 4px;
        border-radius: 999px;
        background: var(--wp--preset--color--border, #d1d5db);
        z-index: 2;
    }
    /* Push the search header down a touch so it doesn't collide with
     * the drag handle. Trim the L/R padding on mobile so the count +
     * size cycle + close button never get pushed off-screen by the
     * search input on narrow phone widths. */
    .aieo-navigator-header {
        padding: 18px 10px 14px;
        gap: 8px;
    }
    /* The size cycle button sits between count and close — give it a
     * smaller right margin on mobile so the close button reads cleanly. */
    .aieo-nav-size-cycle { margin-right: 4px; }

    .aieo-navigator-body,
    .aieo-navigator-body.has-rail {
        grid-template-columns: 1fr;
    }
    .aieo-navigator-left {
        border-right: 0;
        border-bottom: 1px solid var(--aieo-nav-border-color, var(--wp--preset--color--border, #e5e7eb));
    }
    .aieo-navigator-right {
        max-height: 30vh;
    }
    /* Hide the desktop right-rail and footer on phones — the dedicated
     * mobile UX takes over below this breakpoint. */
    .aieo-navigator-rail,
    .aieo-navigator-footer {
        display: none !important;
    }
}
