/* ════════════════════════════════════════════════════════════════════
   Inspira Woo Add-ons — Brand Nav (frontend)
   Two position modes: 'sides' (floating left/right circles) and 'top'
   (inline strip above product). Hover expands to show product preview.
   ════════════════════════════════════════════════════════════════════ */

.iwa-brand-nav {
    --iwa-bn-paper: #FFFFFF;
    --iwa-bn-ink: #14130F;
    --iwa-bn-muted: #6B6862;
    --iwa-bn-rule: #E5E0D6;
    --iwa-bn-accent: #C8472B;
    --iwa-bn-accent-hover: #B33D24;
    --iwa-bn-shadow: 0 6px 24px rgba(20, 19, 15, .12), 0 2px 6px rgba(20, 19, 15, .08);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ─── Sides layout — base ───────────────────────────────────────── */
.iwa-brand-nav--sides {
    position: static;
    pointer-events: none;
}
.iwa-brand-nav--sides .iwa-brand-nav-link {
    /* z-index applies HERE — the position:fixed visible element. Putting
     * it on the position:static wrapper was a bug: z-index is ignored on
     * static elements, and the link's effective stacking was z-index:auto
     * (≈0), which is why badges at z-index:10 were always winning. Now
     * the link sits at the configured z-index (default max-int32). */
    position: fixed;
    z-index: var(--iwa-brand-nav-z, 2147483647);
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    overflow: hidden;
    pointer-events: auto;
    background: var(--iwa-bn-paper);
    border: 1px solid var(--iwa-bn-rule);
    box-shadow: var(--iwa-bn-shadow);
    color: var(--iwa-bn-ink);
    text-decoration: none;
    transition: width .25s cubic-bezier(.16, 1, .3, 1), background-color .15s ease;
    height: 56px;
}
.iwa-brand-nav--sides .iwa-brand-nav-link--prev {
    left: 0; border-radius: 0 28px 28px 0; border-left: 0; padding-right: 12px;
}
.iwa-brand-nav--sides .iwa-brand-nav-link--next {
    right: 0; border-radius: 28px 0 0 28px; border-right: 0; padding-left: 12px;
}
.iwa-brand-nav--sides .iwa-brand-nav-arrow {
    flex-shrink: 0;
    width: 56px; height: 56px;
    display: flex; align-items: center; justify-content: center;
    color: var(--iwa-bn-accent);
}
.iwa-brand-nav--sides .iwa-brand-nav-preview {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 10px;
    min-width: 0;
}

/* Styles that show multi-line content (badge + title wrap + SKU) grow vertically.
 * These styles have NO hover-state height change, so the transform: translateY(-50%)
 * stays consistent → no jump. */
.iwa-brand-nav--sides.iwa-brand-nav--style-arrow_name .iwa-brand-nav-link,
.iwa-brand-nav--sides.iwa-brand-nav--style-arrow_thumb_name .iwa-brand-nav-link {
    height: auto;
    min-height: 56px;
}

/* ─── Sides display-style presets ───────────────────────────────── */

/* arrow_only — just the arrow with a "Prev." / "Next" label below */
.iwa-brand-nav--sides.iwa-brand-nav--style-arrow_only .iwa-brand-nav-link {
    width: 80px;
    flex-direction: column;
    height: auto;
    min-height: 56px;
    padding: 8px 4px;
    gap: 2px;
}
.iwa-brand-nav--sides.iwa-brand-nav--style-arrow_only .iwa-brand-nav-preview { display: none; }
.iwa-brand-nav--sides.iwa-brand-nav--style-arrow_only .iwa-brand-nav-arrow-stack {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}
.iwa-brand-nav--sides.iwa-brand-nav--style-arrow_only .iwa-brand-nav-arrow {
    height: 28px;
}
.iwa-brand-nav--sides.iwa-brand-nav--style-arrow_only .iwa-brand-nav-direction {
    display: block;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--iwa-bn-muted);
    line-height: 1;
}
/* Hide direction label everywhere else (it's an arrow_only thing). */
.iwa-brand-nav-direction { display: none; }

/* arrow_thumb — arrow + thumbnail always. Thumb radius 20px, preview no padding. */
.iwa-brand-nav--sides.iwa-brand-nav--style-arrow_thumb .iwa-brand-nav-link { width: 116px; }
.iwa-brand-nav--sides.iwa-brand-nav--style-arrow_thumb .iwa-brand-nav-preview {
    opacity: 1;
    padding: 0;
}
.iwa-brand-nav--sides.iwa-brand-nav--style-arrow_thumb .iwa-brand-nav-preview-body { display: none; }

/* arrow_name — arrow + product name always */
.iwa-brand-nav--sides.iwa-brand-nav--style-arrow_name .iwa-brand-nav-preview { opacity: 1; }
.iwa-brand-nav--sides.iwa-brand-nav--style-arrow_name .iwa-brand-nav-preview-thumb { display: none; }

/* arrow_thumb_name — all visible always. Preview padding 8px 5px; thumb radius
 * comes from the user-configurable --iwa-bn-thumb-radius CSS var (no hardcode). */
.iwa-brand-nav--sides.iwa-brand-nav--style-arrow_thumb_name .iwa-brand-nav-link { width: 280px; }
.iwa-brand-nav--sides.iwa-brand-nav--style-arrow_thumb_name .iwa-brand-nav-preview {
    opacity: 1;
    padding: 8px 5px;
}

/* hover_expand — clean default: arrow collapsed, expand to thumb+name+SKU on hover.
 * Link height grows on hover to fit content; transform: translateY(-50%) keeps it centered. */
.iwa-brand-nav--sides.iwa-brand-nav--style-hover_expand .iwa-brand-nav-link {
    width: 56px;
    height: 56px;
    transition: width .25s ease, height .25s ease;
}
.iwa-brand-nav--sides.iwa-brand-nav--style-hover_expand .iwa-brand-nav-preview {
    opacity: 0;
    transition: opacity .15s ease .1s;
}
.iwa-brand-nav--sides.iwa-brand-nav--style-hover_expand .iwa-brand-nav-link:hover,
.iwa-brand-nav--sides.iwa-brand-nav--style-hover_expand .iwa-brand-nav-link:focus-visible {
    width: 280px;
    height: auto;
    min-height: 80px;
}
.iwa-brand-nav--sides.iwa-brand-nav--style-hover_expand .iwa-brand-nav-link:hover .iwa-brand-nav-preview,
.iwa-brand-nav--sides.iwa-brand-nav--style-hover_expand .iwa-brand-nav-link:focus-visible .iwa-brand-nav-preview {
    opacity: 1;
}

/* ─── Preview content (shared) ──────────────────────────────────── */
.iwa-brand-nav-preview-thumb {
    flex-shrink: 0;
    width: 50px; height: 50px;
    overflow: hidden;
    border-radius: var(--iwa-bn-thumb-radius, 4px);
    border: var(--iwa-bn-thumb-border-width, 2px) solid var(--iwa-bn-thumb-border-color, #cfcbcb);
    background: var(--iwa-bn-rule);
}
.iwa-brand-nav-preview-thumb img {
    width: 100%; height: 100%;
    object-fit: cover; display: block;
}
.iwa-brand-nav-preview-body {
    display: flex; flex-direction: column;
    min-width: 0; max-width: 200px;
    gap: 4px;
    padding: 4px 0;
}
.iwa-brand-nav-term-badge {
    display: inline-block;
    width: fit-content;
    font-size: var(--iwa-bn-fs-badge, 10px);
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--iwa-bn-accent);
    background: rgba(200, 71, 43, .12);
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    line-height: 1.4;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.iwa-brand-nav-preview-title {
    font-size: var(--iwa-bn-fs-title, 11px);
    font-weight: 600;
    color: var(--iwa-bn-ink);
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.iwa-brand-nav-sku {
    display: block;
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
    font-size: var(--iwa-bn-fs-sku, 11px);
    font-weight: 500;
    letter-spacing: .02em;
    color: var(--iwa-bn-muted);
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}
.iwa-brand-nav-sku-label {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--iwa-bn-muted);
    opacity: .8;
}

/* arrow_name style: name should be FULLY visible — allow wrap, give the link more room. */
.iwa-brand-nav--sides.iwa-brand-nav--style-arrow_name .iwa-brand-nav-link { width: 260px; }
.iwa-brand-nav--sides.iwa-brand-nav--style-arrow_name .iwa-brand-nav-preview-body { max-width: 100%; }
.iwa-brand-nav--sides.iwa-brand-nav--style-arrow_name .iwa-brand-nav-preview-title {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    word-break: break-word;
}

/* arrow-stack: column container for the arrow icon + (arrow_only) direction label.
 * flex-shrink: 0 so the arrow can't get squashed when the preview body grows. */
.iwa-brand-nav-arrow-stack {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.iwa-brand-nav-arrow {
    flex-shrink: 0;
}

/* ─── Top layout (inline strip) ─────────────────────────────────── */
.iwa-brand-nav--top {
    display: flex; justify-content: space-between; align-items: center;
    gap: 12px;
    margin: 0 auto 18px;
    max-width: 1200px;
    padding: 0 18px;
}
.iwa-brand-nav--top .iwa-brand-nav-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    background: var(--iwa-bn-paper);
    border: 1px solid var(--iwa-bn-rule);
    border-radius: 8px;
    text-decoration: none;
    color: var(--iwa-bn-ink);
    transition: border-color .15s ease, background-color .15s ease;
    box-shadow: 0 1px 3px rgba(20, 19, 15, .04);
    max-width: 45%;
    min-width: 0;
}
.iwa-brand-nav--top .iwa-brand-nav-link--next {
    margin-left: auto;
}
.iwa-brand-nav--top .iwa-brand-nav-link:hover {
    border-color: var(--iwa-bn-accent);
}
.iwa-brand-nav--top .iwa-brand-nav-arrow {
    flex-shrink: 0;
    color: var(--iwa-bn-accent);
    display: inline-flex; align-items: center;
}
.iwa-brand-nav--top .iwa-brand-nav-preview {
    display: flex; align-items: center; gap: 10px;
    min-width: 0;
}

/* ─── Hide on mobile if configured ──────────────────────────────── */
@media (max-width: 768px) {
    .iwa-brand-nav--hide-mobile { display: none; }
    .iwa-brand-nav--sides .iwa-brand-nav-link {
        width: 44px !important;
        min-height: 44px;
    }
    .iwa-brand-nav--sides .iwa-brand-nav-arrow {
        width: 44px; height: 44px;
    }
    .iwa-brand-nav--sides .iwa-brand-nav-preview {
        display: none !important;
    }
}
