/* ==========================================================
   O BAG BUILDER – Version 1
   Två kolumner (Handtag | Innerväska) som mockupen,
   "Visa alla" expanderar, tunn sammanfattningsrad.
========================================================== */

.obag-builder {
    --obag-bg: #f7f4ef;
    --obag-card-bg: #f9f9f9;
    --obag-ink: #1f1f1f;
    --obag-muted: #857f75;
    --obag-hairline: #e5e0d6;
    --obag-accent: #1f1f1f;
    --obag-accent-contrast: #fff;
    --obag-radius-lg: 14px;
    --obag-radius-md: 10px;
    --obag-radius-sm: 8px;
    --obag-radius-pill: 999px;

    margin: 24px 0 16px;
    padding: 20px 16px 14px;
    background: var(--obag-bg);
    border-radius: var(--obag-radius-lg);
    box-sizing: border-box;
    color: var(--obag-ink);
    font-family: inherit;
}

.obag-builder *,
.obag-builder *::before,
.obag-builder *::after {
    box-sizing: border-box;
}

.obag-builder__intro {
    margin-bottom: 16px;
}

.obag-builder__title {
    font-size: 20px;
    line-height: 1.2;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    margin: 0 0 6px;
    color: var(--obag-ink);
}

.obag-builder__subtitle {
    margin: 0;
    max-width: 560px;
    font-size: 13px;
    line-height: 1.5;
    color: var(--obag-muted);
}

.obag-builder__empty {
    font-size: 13px;
    color: var(--obag-muted);
    margin: 0;
}

/* ---------------- Sections: Handtag | Innerväska ---------------- */

.obag-builder__sections {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.obag-section {
    min-width: 0;
}

.obag-section__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.obag-section__title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 0;
    color: var(--obag-ink);
}

.obag-section__viewall {
    font-size: 12px;
    font-weight: 500;
    color: var(--obag-muted);
    text-decoration: none;
    white-space: nowrap;
}

.obag-section__viewall::after {
    content: "\203A";
    margin-left: 3px;
    font-weight: 700;
}

.obag-section__viewall:hover {
    color: var(--obag-ink);
}

/* ---------------- Carousel / Visa alla expand ---------------- */

.obag-carousel {
    position: relative;
}

.obag-grid {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

.obag-grid::-webkit-scrollbar {
    display: none;
}

/* Visa alla → 4 kort per rad i sektionen */
.obag-carousel.is-expanded .obag-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    overflow: visible;
    scroll-snap-type: none;
}

.obag-carousel.is-expanded .obag-carousel__nav {
    display: none;
}

.obag-carousel.is-expanded .obag-card {
    flex: none;
    width: auto;
    min-width: 0;
}

.obag-carousel__nav {
    display: none;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 36%;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid var(--obag-hairline);
    background: #fff;
    color: var(--obag-ink);
    font-size: 17px;
    line-height: 1;
    cursor: pointer;
    z-index: 2;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.07);
}

.obag-carousel__nav:disabled,
.obag-carousel__nav.is-disabled {
    opacity: 0;
    pointer-events: none;
}

.obag-carousel__nav--prev {
    left: -12px;
}

.obag-carousel__nav--next {
    right: -12px;
}

/* ---------------- Cards ---------------- */

.obag-card {
    display: flex;
    flex-direction: column;
    /* Mobile: ~2.5 cards peeking; desktop overrides to 4 per column */
    flex: 0 0 calc(38% - 6px);
    max-width: 96px;
    scroll-snap-align: start;
    padding: 4px;
    border: 1px solid var(--obag-hairline);
    border-radius: 6px;
    background: var(--obag-card-bg);
    font: inherit;
    text-align: left;
    color: inherit;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

.obag-card:focus-visible {
    outline: 2px solid var(--obag-ink);
    outline-offset: 2px;
}

.obag-card__media {
    position: relative;
    display: block;
    aspect-ratio: 1 / 1;
    background: var(--obag-card-bg);
    border-radius: var(--obag-radius-sm);
    overflow: hidden;
}

.obag-card__media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.obag-card__media::after {
    content: "\2713";
    position: absolute;
    top: 3px;
    right: 3px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--obag-ink);
    color: #fff;
    font-size: 8px;
    font-weight: 700;
    line-height: 12px;
    text-align: center;
    opacity: 0;
    transform: scale(0.6);
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.obag-card.is-selected {
    border-color: var(--obag-ink);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.obag-card.is-selected .obag-card__media::after {
    opacity: 1;
    transform: scale(1);
}

.obag-card__body {
    display: block;
    padding-top: 4px;
}

.obag-card__name {
    display: -webkit-box;
    margin: 0 0 1px;
    font-size: 9px;
    font-weight: 500;
    line-height: 1.25;
    color: var(--obag-ink);
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.obag-card__price {
    display: block;
    margin: 0;
    font-size: 9px;
    font-weight: 700;
    color: var(--obag-ink);
}

/* ---------------- Thin summary strip ---------------- */

.obag-configuration {
    margin-top: 14px;
    padding-top: 10px;
    border-top: 1px solid var(--obag-hairline);
}

.obag-configuration__lines {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 14px;
    margin: 0 0 8px;
}

.obag-configuration__line {
    display: flex;
    gap: 5px;
    font-size: 11px;
    line-height: 1.25;
    color: var(--obag-muted);
}

.obag-configuration__line dt {
    font-weight: 600;
    color: var(--obag-ink);
}

.obag-configuration__line dd {
    margin: 0;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.obag-configuration__action {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.obag-configuration__total {
    font-size: 12px;
    line-height: 1.2;
    color: var(--obag-muted);
}

.obag-configuration__total strong {
    font-size: 14px;
    font-weight: 700;
    color: var(--obag-ink);
    margin-left: 4px;
}

.obag-configuration__cta {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 40px;
    border: none;
    border-radius: var(--obag-radius-pill);
    background: var(--obag-accent);
    color: var(--obag-accent-contrast);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.obag-configuration__cta:hover {
    opacity: 0.9;
}

.obag-configuration__cta:disabled,
.obag-configuration__cta.is-loading {
    opacity: 0.55;
    cursor: default;
}

.obag-configuration__info {
    margin: 6px 0 0;
    font-size: 11px;
    line-height: 1.35;
    color: var(--obag-muted);
}

.obag-configuration__error {
    margin: 6px 0 0;
    font-size: 11px;
    color: #b3261e;
}

.obag-configuration__error[hidden] {
    display: none;
}

@media (min-width: 640px) {
    .obag-builder {
        padding: 22px 22px 14px;
    }

    .obag-builder__title {
        font-size: 22px;
    }

    /* 4 kort synliga i karusellen */
    .obag-card {
        flex: 0 0 calc(25% - 4.5px);
        max-width: none;
    }

    .obag-carousel__nav {
        display: flex;
    }

    /* Tunn rad: total + CTA sida vid sida */
    .obag-configuration__action {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
    }

    .obag-configuration__cta {
        width: auto;
        min-width: 240px;
        height: 38px;
        padding: 0 20px;
    }
}

/* Desktop: två kolumner med vertikal delare (som mockupen) */
@media (min-width: 900px) {
    .obag-builder {
        padding: 24px 28px 14px;
    }

    .obag-builder__sections {
        flex-direction: row;
        align-items: flex-start;
        gap: 0;
    }

    .obag-section {
        flex: 1 1 0;
        min-width: 0;
        padding: 0 24px;
        border-right: 1px solid var(--obag-hairline);
    }

    .obag-section:first-child {
        padding-left: 0;
    }

    .obag-section:last-child {
        padding-right: 0;
        border-right: none;
    }

    /* 4 kort synliga per kolumn i karusellen */
    .obag-card {
        flex: 0 0 calc(25% - 4.5px);
        max-width: none;
    }

    /* Visa alla: 4 kort per rad i varje kolumn */
    .obag-carousel.is-expanded .obag-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    /* Sammanfattning: en enda tunn strip */
    .obag-configuration {
        display: grid;
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "lines action"
            "info  info";
        column-gap: 20px;
        row-gap: 4px;
        align-items: center;
        margin-top: 12px;
        padding-top: 10px;
    }

    .obag-configuration__lines {
        grid-area: lines;
        margin: 0;
    }

    .obag-configuration__action {
        grid-area: action;
        margin: 0;
    }

    .obag-configuration__info {
        grid-area: info;
        margin: 0;
    }

    .obag-configuration__error {
        grid-column: 1 / -1;
    }
}

/* ---------------- Bundle cart confirmation modal ----------------
   Visar Body + Handtag + Innerväska tillsammans (PS standardmodal
   visar bara den senaste tillagda produkten).
---------------------------------------------------------------- */

body.obag-bundle-modal-open {
    overflow: hidden;
}

.obag-bundle-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(0, 0, 0, 0.45);
}

.obag-bundle-modal__dialog {
    position: relative;
    width: 100%;
    max-width: 440px;
    max-height: calc(100vh - 32px);
    overflow: auto;
    padding: 22px 20px 18px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
    color: #1f1f1f;
}

.obag-bundle-modal__close {
    position: absolute;
    top: 8px;
    right: 10px;
    border: 0;
    background: transparent;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    color: #857f75;
}

.obag-bundle-modal__title {
    margin: 0 28px 14px 0;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.3;
}

.obag-bundle-modal__list {
    list-style: none;
    margin: 0 0 14px;
    padding: 0;
    border-top: 1px solid #e5e0d6;
}

.obag-bundle-modal__item {
    display: grid;
    grid-template-columns: 78px 1fr auto;
    gap: 8px;
    align-items: baseline;
    padding: 10px 0;
    border-bottom: 1px solid #e5e0d6;
    font-size: 13px;
}

.obag-bundle-modal__item-label {
    font-weight: 700;
    color: #1f1f1f;
}

.obag-bundle-modal__item-name {
    color: #857f75;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.obag-bundle-modal__item-price {
    font-weight: 700;
    white-space: nowrap;
}

.obag-bundle-modal__count {
    margin: 0 0 6px;
    font-size: 13px;
    color: #857f75;
}

.obag-bundle-modal__total {
    margin: 0 0 16px;
    font-size: 14px;
    color: #857f75;
}

.obag-bundle-modal__total strong {
    color: #1f1f1f;
    font-size: 16px;
    margin-left: 4px;
}

.obag-bundle-modal__actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.obag-bundle-modal__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 16px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-decoration: none;
    cursor: pointer;
    box-sizing: border-box;
}

.obag-bundle-modal__btn--secondary {
    border: 1px solid #1f1f1f;
    background: #fff;
    color: #1f1f1f;
}

.obag-bundle-modal__btn--primary {
    border: 1px solid #1f1f1f;
    background: #1f1f1f;
    color: #fff;
}

@media (min-width: 480px) {
    .obag-bundle-modal__actions {
        flex-direction: row;
    }

    .obag-bundle-modal__btn {
        flex: 1 1 0;
    }
}
