/* ============================================================================
 * Snaplot — shared App Tabs bar
 * ----------------------------------------------------------------------------
 * Rendered at the top of /catalogue/, /bulk-upload/, /mailroom/ to make all
 * three flows feel like one app with three tabs. Each tab is a real <a>
 * link — clicking navigates between pages. The current page's tab gets
 * .is-active.
 *
 * Catalogue selection is preserved across tabs by reading
 * localStorage.snaplot_catalogue and appending ?catalogue=<name> to each
 * tab's href.
 * ========================================================================= */

.snap-apptabs {
    --apt-navy:    #0E2A47;
    --apt-amber:   #F59E0B;
    --apt-cream:   #FAF6EC;
    --apt-ivory:   #FFFFFF;
    --apt-line:    #E5E7EB;
    --apt-line-2:  #F1F5F9;
    --apt-slate-2: #64748B;

    background: var(--apt-ivory);
    border: 1px solid var(--apt-line);
    border-radius: 12px;
    /* Sit naturally beneath the WordPress site header with breathing room.
     * The previous `-16px` top margin pulled the bar UP into the header,
     * and `position: sticky` anchored it to the viewport so on scroll it
     * climbed above the site nav. We now flow normally inside the page
     * content area like any other component. Side margins are unset so
     * the bar respects the page's content max-width. */
    margin: 12px 0 18px;
    padding: 8px 12px;
    z-index: 1;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: saturate(180%) blur(8px);
    -webkit-backdrop-filter: saturate(180%) blur(8px);
    box-shadow: 0 1px 2px rgba(14, 42, 71, 0.04);
}

.snap-apptabs__inner {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: space-between;
}

.snap-apptabs__group {
    display: flex;
    gap: 4px;
    flex: 1 1 auto;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
}
.snap-apptabs__group::-webkit-scrollbar { display: none; }

.snap-apptabs__tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 999px;
    text-decoration: none;
    color: var(--apt-slate-2);
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
    border: 1px solid transparent;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.snap-apptabs__tab:hover {
    color: var(--apt-navy);
    background: var(--apt-line-2);
}
.snap-apptabs__tab.is-active {
    color: var(--apt-navy);
    background: #FEF3C7;
    border-color: #FCD34D;
}
.snap-apptabs__tab.is-active .snap-apptabs__icon { transform: scale(1.05); }

.snap-apptabs__icon {
    font-size: 16px;
    line-height: 1;
    transition: transform 0.15s ease;
}
.snap-apptabs__label {
    /* On narrow viewports, hide labels and show icons only */
}
@media (max-width: 480px) {
    .snap-apptabs__label { display: none; }
    .snap-apptabs__tab { padding: 8px 12px; }
    .snap-apptabs__icon { font-size: 18px; }
}

.snap-apptabs__cog {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    text-decoration: none;
    color: var(--apt-slate-2);
    font-size: 18px;
    background: var(--apt-line-2);
    border: 1px solid var(--apt-line);
    flex: 0 0 auto;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.2s ease;
}
.snap-apptabs__cog:hover {
    color: var(--apt-navy);
    background: var(--apt-ivory);
    border-color: var(--apt-amber);
    transform: rotate(35deg);
}

/* New labelled pill — replaces the icon-only cog. Same visual language as
 * the tabs (same border, same height) so the row feels balanced. The cog
 * styles above are kept for compatibility with any host page that still
 * renders the old anchor. */
.snap-apptabs__settings {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 999px;
    background: #fff;
    color: var(--apt-navy, #0E2A47);
    border: 1px solid var(--apt-line, #e2e8f0);
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    flex: 0 0 auto;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.snap-apptabs__settings:hover {
    background: var(--apt-ivory, #fffbf3);
    border-color: var(--apt-amber, #f4a623);
    box-shadow: 0 1px 3px rgba(14,42,71,0.08);
}
.snap-apptabs__settings:focus-visible {
    outline: 2px solid var(--apt-amber, #f4a623);
    outline-offset: 2px;
}
.snap-apptabs__settings-icon {
    font-size: 16px;
    line-height: 1;
    /* Sizing for both the legacy text glyph and the inline SVG. SVG sets
     * width/height attributes too, but this guarantees a sane fallback
     * if the attributes get stripped. */
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    color: currentColor;
}
svg.snap-apptabs__settings-icon { display: block; }

@media (max-width: 480px) {
    /* Narrow viewports: drop the label, keep the icon. Bump padding so
     * the touch target hits Apple's 44px minimum (was ~32px before, which
     * felt grey/inert under a thumb). Also widen the icon so it reads
     * cleanly against the white pill background. */
    .snap-apptabs__settings {
        padding: 10px 14px;
        min-width: 44px;
        min-height: 44px;
        justify-content: center;
        background: #FFFFFF;          /* solid — backdrop blur can wash it out */
        border-color: #CBD5E1;        /* slightly darker so the pill stands out */
    }
    .snap-apptabs__settings-label { display: none; }
    .snap-apptabs__settings-icon  { width: 20px; height: 20px; }
}
