.abp-bundle-form .abp-rows {
    display: flex;
    flex-direction: column;
    border-top: 1px solid #e2ddd3;
}

.abp-row {
    display: grid;
    grid-template-columns: 56px 1fr auto auto;
    align-items: center;
    gap: 16px;
    padding: 20px 0;
    border-bottom: 1px solid #e2ddd3;
    position: relative;
}

.abp-row--out-of-stock {
    opacity: 0.6;
}

.abp-swatch-circle {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

.abp-swatch-circle--empty {
    background: #ddd;
}

.abp-row__name {
    font-weight: 600;
    margin-bottom: 2px;
}

.abp-stock--in { color: #2e7d32; font-size: 0.85em; }
.abp-stock--out { color: #c0392b; font-size: 0.85em; }

.abp-bundle-form .abp-choose-color-toggle {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin: 6px 0 0;
    padding: 0;
    background: none;
    border: none;
    border-radius: 0;
    box-shadow: none;
    font-size: 0.95em;
    font-family: inherit;
    font-weight: 400;
    line-height: 1.4;
    letter-spacing: normal;
    text-transform: none;
    text-align: left;
    white-space: nowrap;
    color: inherit;
    cursor: pointer;
    width: auto;
    min-width: 0;
    height: auto;
}

.abp-bundle-form .abp-choose-color-toggle:hover .abp-choose-color-toggle__text {
    text-decoration: underline;
}

.abp-bundle-form .abp-choose-color-toggle:focus-visible {
    outline: 1px dotted currentColor;
    outline-offset: 2px;
}

.abp-bundle-form .abp-choose-color-toggle .abp-caret {
    font-size: 1.15em;
    line-height: 1;
    transition: transform 0.15s ease;
}

.abp-bundle-form .abp-choose-color-toggle.is-open .abp-caret {
    transform: rotate(180deg);
}

/* ---- Knapp paa kategorisider ---- */
/* Ingen egen padding her: knappen har naa temaets egne klasser, og skal
   faa noeyaktig samme maal som temaets ordinaere kjoepsknapp. En egen
   verdi her ville bare gjort den litt annerledes igjen. */
.abp-select-options {
    text-align: center;
}

/* Temaet legger paa et handlekurv-ikon. Her gaar knappen bare til
   produktsiden, saa ikonet ville vært misvisende. */
.abp-select-options::before,
.abp-select-options::after {
    content: none !important;
    display: none !important;
}

.abp-color-picker[hidden] { display: none !important; }

.abp-color-picker {
    position: absolute;
    z-index: 30;
    top: 100%;
    left: 0;
    width: min(440px, calc(100vw - 32px));
    background: #fff;
    border: 1px solid #ddd;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.1);
    padding: 12px;
}

.abp-color-grid {
    display: grid;
    /* Faerre kolonner gir stoerre ruter. Fire i en 440px boks blir ca 95px. */
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    align-items: start;
}

.abp-color-option {
    /* Fargen ligger som bakgrunn og ikke som <img>. Da finnes det ikke noe
       bildeelement temaet kan krympe med sine egne regler. */
    position: relative;
    display: block;
    width: 100%;
    padding: 0;
    margin: 0;
    border: none;
    border-radius: 3px;
    overflow: hidden;
    cursor: pointer;
    line-height: 0;
    background-color: #e6e6e6;
    background-repeat: no-repeat;
    background-position: center center;
    background-size: cover;
}

.abp-color-option__ratio {
    display: block;
    width: 100%;
    padding-top: 100%;
}

.abp-color-option:hover { outline: 2px solid #bbb; outline-offset: -2px; }
.abp-color-option.is-selected { outline: 2px solid #111; outline-offset: -2px; }

/* Utsolgt: roedt slor over fargen, roed ramme og en diagonal strek. */
.abp-color-option--disabled { cursor: not-allowed; }

.abp-color-option--disabled::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: rgba(253, 236, 234, 0.72);
}

.abp-color-option--disabled:hover { outline: 2px solid #e0a9a3; outline-offset: -2px; }

.abp-color-option--disabled::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: linear-gradient(
        to top right,
        transparent calc(50% - 1px),
        rgba(192, 57, 43, 0.65) 50%,
        transparent calc(50% + 1px)
    );
}

.abp-color-picker__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid #eee;
}

/* Navnet staar under rutenettet, slik at lange fargenavn ikke sprenger det. */
.abp-color-picker__name {
    font-size: 0.85em;
    line-height: 1.3;
    min-height: 2.6em;
    flex: 1;
}

.abp-color-picker__footer { justify-content: flex-start; }


/* Antallsvelger.
   Selektorene er bevisst spesifikke: temaet har egne regler for
   input[type=number] som ellers overstyrer bredden. */
.abp-bundle-form .abp-row__qty {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
}

.abp-bundle-form .abp-row__qty button,
.abp-bundle-form .abp-row__qty input.abp-qty-input {
    /* min-height maa ogsaa laases: temaet setter en egen min-height paa
       knapper, og da blir de hoeyere enn de er brede. */
    box-sizing: border-box !important;
    width: 34px !important;
    min-width: 34px !important;
    max-width: 34px !important;
    height: 34px !important;
    min-height: 34px !important;
    max-height: 34px !important;
    flex: 0 0 34px;
    padding: 0 !important;
    margin: 0 !important;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 2px;
    font-size: 0.95em;
    font-family: inherit;
    line-height: 1 !important;
    text-align: center;
    color: inherit;
}

.abp-bundle-form .abp-row__qty button {
    cursor: pointer;
    user-select: none;
}

.abp-bundle-form .abp-row__qty button:hover {
    border-color: #111;
}

/* Skjul nettleserens egne opp/ned-piler. + og - holder. */
.abp-bundle-form .abp-row__qty input.abp-qty-input::-webkit-outer-spin-button,
.abp-bundle-form .abp-row__qty input.abp-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
}

.abp-bundle-form .abp-row__qty input.abp-qty-input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

.abp-row__price {
    min-width: 90px;
    text-align: right;
    font-weight: 600;
}

.abp-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    font-size: 1.15em;
    font-weight: 700;
}

/* Storrelsesvelger */
.abp-size-picker { margin-bottom: 20px; }
.abp-size-picker__label { font-size: 1em; margin: 0 0 8px; }
/* Rutenett og ikke flex: da er alle cellene garantert like brede,
   uansett hvor lang etiketten er. */
.abp-sizes {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
    gap: 8px;
}
.abp-size {
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    /* Fast hoeyde og ingen linjebrytning. Med min-height ble en boks
       hoeyere enn de andre saa snart etiketten brakk over to linjer. */
    height: 38px;
    white-space: nowrap;
    overflow: hidden;
    padding: 6px 10px;
    border: 1px solid #ccc;
    border-radius: 2px;
    text-align: center;
    line-height: 1.3;
    cursor: pointer;
    user-select: none;
}
.abp-size:hover { border-color: #888; }
.abp-size.is-selected { border-color: #111; background: #111; color: #fff; }

@media (max-width: 600px) {
    /* Samme oppsett som paa skjerm: alt paa en linje, med antall og pris
       til hoeyre. Bare strammere maal, saa det faar plass. */
    .abp-row {
        grid-template-columns: 44px minmax(0, 1fr) auto auto;
        grid-template-areas: none;
        column-gap: 10px;
        row-gap: 0;
        align-items: center;
        padding: 16px 0;
    }

    .abp-row__swatch,
    .abp-row__info,
    .abp-row__qty,
    .abp-row__price {
        grid-area: auto;
    }

    .abp-swatch-circle { width: 40px; height: 40px; }

    .abp-row__name { font-size: 0.95em; }

    .abp-bundle-form .abp-row__qty { gap: 4px; }

    .abp-row__price {
        min-width: 0;
        font-size: 0.9em;
        white-space: nowrap;
        text-align: right;
    }

    /* left: 0 og ikke negativ verdi, ellers skyves boksen ut av skjermen
       paa venstre side. Bredden foelger skjermen med en tak-verdi. */
    .abp-color-picker {
        left: 0;
        right: auto;
        width: min(300px, calc(100vw - 40px));
        max-width: calc(100vw - 40px);
        padding: 10px;
    }

    .abp-color-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 6px;
    }

    .abp-color-picker__name { font-size: 0.8em; min-height: 2.4em; }

    .abp-bundle-form .abp-row__qty button,
    .abp-bundle-form .abp-row__qty input.abp-qty-input {
        width: 30px !important;
        min-width: 30px !important;
        max-width: 30px !important;
        height: 30px !important;
        min-height: 30px !important;
        max-height: 30px !important;
        flex: 0 0 30px;
    }
}

/* Produkter som bare selges i en pakke */
.abp-bundle-only { margin: 16px 0; }
.abp-bundle-only__text { margin: 0 0 10px; }
.abp-bundle-only__link { display: inline-block; margin-right: 8px; }

/* Forklaring naar pakken ikke kan bestilles slik den staar */
.abp-form-notice {
    margin: 0 0 12px;
    padding: 10px 14px;
    background: #fdf3f2;
    border-left: 3px solid #c0392b;
    font-size: 0.9em;
    line-height: 1.4;
}

.abp-form-notice[hidden] { display: none !important; }

.abp-bundle-form .single_add_to_cart_button[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}
