/* Inkeria Navnelapp-builder V2 — Konsept 2 skin
 *
 * Restyles the original [navnelapp_builder] DOM by scoping every override
 * under `.lnb-v2`. The v1 stylesheet still loads first; this file just
 * paints over it. v1 sets a few inline grid styles via JS, so a small
 * number of !important overrides are unavoidable.
 *
 * Tokens (Konsept 2):
 *   pink   #E94CA0   green  #5B9279   ink    #1F2421   inkSoft #5C6661
 *   paper  #FAF7F1   border #EAE4D7   greenSoft #E6F0EA
 */

.lnb-v2 {
    --lnbv2-pink: #E94CA0;
    --lnbv2-green: #5B9279;
    --lnbv2-green-soft: #E6F0EA;
    --lnbv2-ink: #1F2421;
    --lnbv2-ink-soft: #5C6661;
    --lnbv2-paper: #FAF7F1;
    --lnbv2-border: #EAE4D7;
    --lnbv2-border-strong: #D6CDB8;
    --lnbv2-theme-bg: #D0DDD0; /* updated by JS when a color is selected */
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--lnbv2-ink);
}

.lnb-v2 .lappeliten-navnelapp-builder {
    background: #fff;
    border-radius: 16px;
    border: 1px solid var(--lnbv2-border);
    box-shadow: 0 12px 32px -24px rgba(0, 0, 0, 0.18);
    overflow: hidden;
    max-width: 100%;
}

.lnb-v2 .lnb-container {
    padding: 0;
    margin: 0;
    max-width: none;
}

/* ---------- Two-column layout ---------- */
.lnb-v2 .lnb-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
}

@media (min-width: 900px) {
    .lnb-v2 .lnb-grid {
        grid-template-columns: minmax(380px, 460px) 1fr;
    }
}

.lnb-v2 .lnb-main-column {
    padding: 28px 28px 32px;
    border-right: 1px solid var(--lnbv2-border);
}

@media (max-width: 899px) {
    .lnb-v2 .lnb-main-column {
        border-right: none;
        border-bottom: 1px solid var(--lnbv2-border);
        padding: 20px 18px 24px;
    }
}

.lnb-v2 .lnb-section {
    margin-bottom: 24px;
}

.lnb-v2 .lnb-section-title {
    font-size: 13px;
    font-weight: 800;
    color: var(--lnbv2-ink);
    letter-spacing: -0.01em;
    margin: 0 0 10px 0;
}

/* ---------- Text inputs ---------- */
.lnb-v2 .lnb-text-inputs {
    gap: 10px;
}

.lnb-v2 .lnb-text-input {
    background: #fff;
    border: 1.5px solid var(--lnbv2-border);
    border-radius: 14px;
    padding: 13px 16px;
    padding-right: 4rem;
    font-size: 15px;
    font-weight: 600;
    color: var(--lnbv2-ink);
    font-family: inherit;
    transition: border-color 0.15s;
}

.lnb-v2 .lnb-text-input:focus {
    border-color: var(--lnbv2-green);
}

.lnb-v2 .lnb-text-input:not(:placeholder-shown) {
    border-color: var(--lnbv2-border-strong);
}

.lnb-v2 .lnb-char-counter {
    font-size: 11px;
    color: var(--lnbv2-ink-soft);
    font-weight: 700;
}

.lnb-v2 .lnb-add-line-btn {
    background: transparent;
    border: 1.5px dashed var(--lnbv2-border-strong);
    border-radius: 14px;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 700;
    color: var(--lnbv2-ink-soft);
    text-align: left;
    width: 100%;
    cursor: pointer;
    font-family: inherit;
}

.lnb-v2 .lnb-add-line-btn:hover {
    border-color: var(--lnbv2-green);
    color: var(--lnbv2-green);
    background: transparent;
}

/* ---------- Category pills (replaces dropdown via JS) ---------- */
.lnb-v2 .lnb-category-header {
    display: block;
}

.lnb-v2 .lnb-category-dropdown-wrapper {
    display: none !important;
}

.lnb-v2 .lnbv2-category-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}

@media (max-width: 899px) {
    /* On narrow screens 12 categories stack to many rows. Switch to a
     * single horizontally scrolling row, like the v1 builder did. */
    .lnb-v2 .lnbv2-category-pills {
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 4px;
        scrollbar-width: thin;
    }
    .lnb-v2 .lnbv2-category-pills::-webkit-scrollbar { height: 4px; }
    .lnb-v2 .lnbv2-category-pills::-webkit-scrollbar-thumb {
        background: var(--lnbv2-border-strong);
        border-radius: 4px;
    }
    .lnb-v2 .lnbv2-category-pill { white-space: nowrap; flex-shrink: 0; }
}

.lnb-v2 .lnbv2-category-pill {
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    background: var(--lnbv2-paper);
    color: var(--lnbv2-ink-soft);
    border: 1px solid var(--lnbv2-border);
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.lnb-v2 .lnbv2-category-pill:hover {
    border-color: var(--lnbv2-border-strong);
}

.lnb-v2 .lnbv2-category-pill.is-active {
    background: var(--lnbv2-ink);
    color: #fff;
    border-color: var(--lnbv2-ink);
}

/* ---------- Design grid (motif tiles) ----------
 * 2 rows on desktop, 4 rows on mobile, scrolling horizontally — same UX
 * as v1. v2 JS recomputes columns whenever the visible set changes so the
 * grid stays packed regardless of category filter.
 */
.lnb-v2 .lnb-design-section {
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    /* Lateral padding so the box-shadow ring on tiles at the row edges
     * isn't clipped by the section's overflow-x auto edge. */
    padding: 6px 4px 12px;
}

.lnb-v2 .lnb-design-section::-webkit-scrollbar {
    height: 6px;
}
.lnb-v2 .lnb-design-section::-webkit-scrollbar-track {
    background: var(--lnbv2-paper);
    border-radius: 4px;
}
.lnb-v2 .lnb-design-section::-webkit-scrollbar-thumb {
    background: var(--lnbv2-border-strong);
    border-radius: 4px;
}
.lnb-v2 .lnb-design-section::-webkit-scrollbar-thumb:hover {
    background: var(--lnbv2-ink-soft);
}

.lnb-v2 .lnb-design-grid {
    grid-auto-flow: column !important;
    gap: 10px;
    width: fit-content;
}

.lnb-v2 .lnb-design-item {
    width: 64px;
    height: 64px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06);
    display: grid;
    place-items: center;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    padding: 3px;
}

.lnb-v2 .lnb-design-item:hover {
    transform: scale(1.04);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12);
}

.lnb-v2 .lnb-design-item.selected {
    box-shadow: 0 0 0 2px var(--lnbv2-green);
    transform: scale(1.04);
}

.lnb-v2 .lnb-design-icon {
    width: 100%;
    height: 100%;
    border: none !important;
    border-radius: 50%;
    box-shadow: none;
    object-fit: cover;
}

.lnb-v2 .lnb-design-item.selected .lnb-design-icon {
    border: none !important;
}

/* ---------- Color theme picker ----------
 * Same scroll pattern as the design grid: a single row of fixed-size
 * swatches that scrolls horizontally when there are more than fit. v1
 * already paints .lnb-color-grid as a column-flow grid with 70px rows;
 * v2 keeps that flow, just resizes the cells and adds a scrollbar.
 */
.lnb-v2 .lnb-color-section {
    overflow: visible;
}

.lnb-v2 .lnb-color-scroll {
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    padding: 6px 4px 12px;
}

.lnb-v2 .lnb-color-scroll::-webkit-scrollbar { height: 6px; }
.lnb-v2 .lnb-color-scroll::-webkit-scrollbar-track {
    background: var(--lnbv2-paper);
    border-radius: 4px;
}
.lnb-v2 .lnb-color-scroll::-webkit-scrollbar-thumb {
    background: var(--lnbv2-border-strong);
    border-radius: 4px;
}
.lnb-v2 .lnb-color-scroll::-webkit-scrollbar-thumb:hover {
    background: var(--lnbv2-ink-soft);
}

.lnb-v2 .lnb-color-grid {
    display: grid !important;
    grid-auto-flow: column !important;
    grid-template-columns: unset !important;
    grid-template-rows: 56px !important;
    grid-auto-columns: 56px !important;
    gap: 12px;
    width: fit-content !important;
}

.lnb-v2 .lnb-color-item {
    width: 56px !important;
    height: 56px !important;
    flex-shrink: 0;
    align-self: start;
    margin: 0 !important;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.15s;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06);
    overflow: hidden;
}

.lnb-v2 .lnb-color-item:hover {
    transform: scale(1.06);
}

.lnb-v2 .lnb-color-item.selected {
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--lnbv2-green);
}

.lnb-v2 .lnb-color-preview {
    width: 100% !important;
    height: 100% !important;
    border: none !important;
    border-radius: 50%;
    margin: 0;
    padding: 0;
}

.lnb-v2 .lnb-color-item.selected .lnb-color-preview {
    border: none !important;
    padding: 0 !important;
}

/* ---------- Right column: preview + products + CTA ---------- */
.lnb-v2 .lnb-sidebar-column {
    background: linear-gradient(180deg,
        color-mix(in srgb, var(--lnbv2-theme-bg) 40%, transparent) 0%,
        var(--lnbv2-paper) 70%);
    padding: 28px 32px 32px;
    transition: background 0.4s ease;
    display: flex;
    flex-direction: column;
}

@media (max-width: 899px) {
    .lnb-v2 .lnb-sidebar-column {
        padding: 24px 18px 28px;
    }
}

.lnb-v2 .lnb-sticky-container {
    display: flex;
    flex-direction: column;
    gap: 18px;
    flex: 1;
}

.lnb-v2 .lnb-preview-scroll-zone {
    display: grid;
    place-items: center;
    padding: 16px 0;
    min-height: 280px;
    flex: 1;
}

@media (max-width: 899px) {
    .lnb-v2 .lnb-preview-scroll-zone {
        min-height: 0;
        padding: 4px 0 8px;
    }
}

.lnb-v2 .lnb-preview-wrapper {
    display: grid;
    place-items: center;
    width: auto;
    max-width: 360px;
}

.lnb-v2 .lnb-preview-container {
    background: transparent;
    box-shadow: none;
    padding: 0;
    width: auto;
}

.lnb-v2 .lnb-preview-image {
    max-width: 320px;
    width: 100%;
    height: auto;
    /* Match v1's rounded-rectangle preview shape. */
    border-radius: 18px;
    filter: drop-shadow(0 12px 24px rgba(0, 0, 0, 0.12));
}

@media (max-width: 899px) {
    .lnb-v2 .lnb-preview-image {
        max-width: 240px;
    }
}

/* ---------- Product section ---------- */
.lnb-v2 .lnb-product-section {
    background: #fff;
    border: 1px solid var(--lnbv2-border);
    border-radius: 18px;
    padding: 18px;
    box-shadow: 0 12px 32px -24px rgba(0, 0, 0, 0.2);
}

.lnb-v2 .lnb-product-section .lnb-section-title {
    font-size: 13px;
    margin: 0 0 12px 0;
}

.lnb-v2 .lnb-product-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

@media (max-width: 480px) {
    .lnb-v2 .lnb-product-options {
        grid-template-columns: 1fr;
    }
}

.lnb-v2 .lnb-product-option {
    border: 1.5px solid var(--lnbv2-border);
    border-radius: 14px;
    padding: 12px 14px;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    position: relative;
}

.lnb-v2 .lnb-product-option:hover {
    border-color: var(--lnbv2-border-strong);
}

.lnb-v2 .lnb-product-option.selected {
    border-color: var(--lnbv2-green);
    background: var(--lnbv2-green-soft);
}

.lnb-v2 .lnb-product-option .lnb-product-title,
.lnb-v2 .lnb-product-section--single .lnb-product-title {
    font-size: 14px;
    font-weight: 800;
    color: var(--lnbv2-ink);
    margin: 0 0 2px 0;
}

.lnb-v2 .lnb-product-option .lnb-product-desc,
.lnb-v2 .lnb-product-section--single .lnb-product-desc {
    font-size: 12px;
    color: var(--lnbv2-ink-soft);
    line-height: 1.4;
    margin: 0;
}

.lnb-v2 .lnb-product-price {
    margin: 6px 0 0 0;
    font-size: 14px;
    font-weight: 800;
    color: var(--lnbv2-ink);
}

.lnb-v2 .lnb-product-section--single {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.lnb-v2 .lnb-product-section--single .lnb-product-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* ---------- Add to cart ---------- */
.lnb-v2 .lnb-add-to-cart {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    background: var(--lnbv2-green);
    color: #fff;
    border: none;
    border-radius: 999px;
    padding: 14px 22px;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: -0.01em;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 8px 16px -10px rgba(91, 146, 121, 0.7);
    transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.15s;
    font-family: inherit;
}

.lnb-v2 .lnb-add-to-cart:hover {
    background: #4d7e69;
    transform: translateY(-1px);
    color: #fff;
}

.lnb-v2 .lnb-add-to-cart:active {
    transform: translateY(0);
}

.lnb-v2 .lnb-add-to-cart[disabled],
.lnb-v2 .lnb-add-to-cart.adding,
.lnb-v2 .lnb-add-to-cart.added {
    opacity: 0.85;
    cursor: default;
}

/* ---------- Color label fallback ---------- */
.lnb-v2 .lnb-color-status-label {
    display: none; /* keep stock UI from v1 hidden in this iteration */
}

/* ============================================================
 * Mobile tab flow (≤899px)
 *
 * Konsept 2 mobile: preview at top → tab bar (Navn / Design / Farge /
 * Produkt) with step indicators → only the active tab's content visible
 * → sticky bottom bar with prev arrow + Next/CTA. v2 JS injects the tab
 * bar and the bottom bar; this CSS hides everything that isn't on the
 * active tab and pins the bottom bar.
 * ============================================================ */

@media (max-width: 899px) {
    /* Undo v1's display:contents on the column wrappers so we can scope
     * tab visibility through the normal section hierarchy. */
    .lnb-v2 .lnb-main-column,
    .lnb-v2 .lnb-sidebar-column,
    .lnb-v2 .lnb-sticky-container {
        display: block !important;
    }

    /* Single column, preview on top. */
    .lnb-v2 .lnb-grid {
        display: flex;
        flex-direction: column;
        gap: 0;
    }
    .lnb-v2 .lnb-sidebar-column { order: 1; }
    .lnb-v2 .lnb-main-column { order: 2; }

    /* v1 makes preview sticky on mobile — keep it but at top of our card. */
    .lnb-v2 .lnb-preview-wrapper {
        position: static !important;
        background: transparent !important;
        padding: 0 !important;
    }

    /* The product section lives in sidebar-column on desktop. On mobile
     * it should only appear on the produkt tab — see rules below. */
    .lnb-v2 .lnb-sidebar-column .lnb-product-section {
        margin-top: 18px;
    }

    /* Hide v1's inline add-to-cart on mobile — the sticky bottom bar
     * routes through it programmatically. */
    .lnb-v2--mobile .lnb-product-section .lnb-add-to-cart {
        display: none !important;
    }

    /* Reserve room for the fixed bottom bar. */
    .lnb-v2--mobile .lappeliten-navnelapp-builder {
        padding-bottom: 96px;
        border-radius: 16px;
    }

    /* Tab visibility: hide every .lnb-section except the active tab's.
     *
     * v1's JS sets inline `display: block` on .lnb-color-section when a
     * design is picked, so the show rules need !important.
     * Also: the hide rule chains three classes (`.lnb-v2--mobile`,
     * `.lnb-main-column`, `.lnb-section`) which is more specific than a
     * naive show rule with two. The show rules below mirror the hide
     * chain so they win on source order, not specificity. */
    .lnb-v2--mobile[data-lnbv2-tab] .lnb-main-column .lnb-section { display: none !important; }
    .lnb-v2--mobile[data-lnbv2-tab] .lnb-sidebar-column .lnb-product-section { display: none !important; }

    .lnb-v2--mobile[data-lnbv2-tab="navn"] .lnb-main-column .lnb-text-section { display: block !important; }
    .lnb-v2--mobile[data-lnbv2-tab="design"] .lnb-main-column .lnb-category-section,
    .lnb-v2--mobile[data-lnbv2-tab="design"] .lnb-main-column .lnb-design-section { display: block !important; }
    .lnb-v2--mobile[data-lnbv2-tab="farge"] .lnb-main-column .lnb-color-section { display: block !important; }
    .lnb-v2--mobile[data-lnbv2-tab="produkt"] .lnb-sidebar-column .lnb-product-section { display: block !important; }
}

/* Tab bar (always rendered, hidden on desktop) */
.lnbv2-mobile-tabs {
    display: none;
}

@media (max-width: 899px) {
    .lnb-v2--mobile .lnbv2-mobile-tabs {
        display: flex;
        gap: 6px;
        padding: 0 18px;
        border-bottom: 1px solid var(--lnbv2-border);
        background: #fff;
    }

    .lnbv2-mobile-tab {
        flex: 1;
        padding: 12px 0 10px;
        font-size: 13px;
        font-weight: 800;
        color: var(--lnbv2-ink-soft);
        background: transparent;
        border: none;
        border-bottom: 2px solid transparent;
        cursor: pointer;
        font-family: inherit;
        margin-bottom: -1px;
        text-align: center;
    }

    .lnbv2-mobile-tab .lnbv2-mobile-tab-marker {
        display: block;
        font-size: 10px;
        line-height: 1;
        margin-bottom: 3px;
        color: var(--lnbv2-ink-soft);
        min-height: 12px;
    }

    .lnbv2-mobile-tab.is-active {
        color: var(--lnbv2-ink);
        border-bottom-color: var(--lnbv2-pink);
    }

    .lnbv2-mobile-tab.is-done .lnbv2-mobile-tab-marker {
        color: var(--lnbv2-green);
    }

    .lnbv2-mobile-tab.is-active .lnbv2-mobile-tab-marker {
        color: var(--lnbv2-ink);
    }
}

/* Sticky bottom bar — only pinned to the viewport while the builder
 * itself is in view (toggled via the .lnb-v2--in-view class set by an
 * IntersectionObserver). Outside that window the bar is hidden so it
 * doesn't follow the user up or down the rest of the page. */
.lnbv2-mobile-bottombar {
    display: none;
}

@media (max-width: 899px) {
    .lnb-v2--mobile.lnb-v2--in-view .lnbv2-mobile-bottombar {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        padding: 12px 18px 18px;
        background: #fff;
        border-top: 1px solid var(--lnbv2-border);
        gap: 10px;
        align-items: center;
        z-index: 50;
    }

    .lnbv2-mobile-prev {
        width: 48px;
        height: 48px;
        border-radius: 999px;
        border: 1px solid var(--lnbv2-border);
        background: #fff;
        color: var(--lnbv2-ink);
        cursor: pointer;
        font-size: 18px;
        font-family: inherit;
        flex-shrink: 0;
    }

    .lnbv2-mobile-prev:disabled,
    .lnbv2-mobile-prev[hidden] {
        display: none;
    }

    .lnbv2-mobile-next {
        flex: 1;
        background: var(--lnbv2-green);
        color: #fff;
        border: none;
        border-radius: 999px;
        padding: 14px;
        font-size: 15px;
        font-weight: 800;
        cursor: pointer;
        box-shadow: 0 8px 16px -10px rgba(91, 146, 121, 0.7);
        font-family: inherit;
    }

    .lnbv2-mobile-next:hover {
        background: #4d7e69;
    }
}
