/*
 * heunec Bundle-Konfigurator – Storefront-Styles
 * Branding: siehe brand_guidelines.md (Primärfarben nur als Akzent, Flächen Weiß / Sanftes Blau,
 * Calibri für UI, Schmuckschrift nur für die Headline, runde Formen).
 */
.hb,
.hb-modal {
    --hb-blue: #1C74BB;
    --hb-blue-dark: #155C95;
    --hb-red: #E51F1F;
    --hb-yellow: #FFE708;
    --hb-soft-blue: #86C2EB;
    --hb-soft-blue-bg: #E9F4FB;
    --hb-soft-blue-line: #CFE5F5;
    --hb-green: #A0C96D;
    --hb-soft-yellow: #FFCE44;
    --hb-soft-yellow-bg: #FFF5D6;
    --hb-text: #1D1D1B;
    --hb-muted: #5C5C58;
    --hb-radius: 16px;

    font-family: Calibri, Arial, Helvetica, Mulish, sans-serif;
    font-size: 16px;
    line-height: 1.4;
    color: var(--hb-text);
}

.hb {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin: 0 0 24px;
}

.hb *,
.hb *::before,
.hb *::after,
.hb-modal *,
.hb-modal *::before,
.hb-modal *::after {
    box-sizing: border-box;
}

.hb button,
.hb-modal button {
    font: inherit;
    color: inherit;
}

.hb-sr {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.hb__headline {
    margin: 0;
    font-family: "DB Coffee", "DBJ Coffee Shoppe", "Trebuchet MS", sans-serif;
    font-size: 30px;
    font-weight: 400;
    line-height: 1.15;
    color: var(--hb-blue);
}

/* ---------- Box / Picker ---------- */

.hb-box {
    background: #fff;
    border: 1px solid var(--hb-soft-blue-line);
    border-radius: var(--hb-radius);
    padding: 16px 16px 12px;
}

.hb-picker__label {
    margin: 0 0 14px;
    font-size: 15px;
}

.hb-picker__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
    gap: 14px 6px;
    justify-items: center;
}

.hb-animal {
    appearance: none;
    background: none;
    border: 0;
    padding: 0;
    width: 100%;
    max-width: 100px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.hb-animal__img {
    width: 82px;
    height: 82px;
    border-radius: 50%;
    border: 3px solid #fff;
    box-shadow: 0 0 0 1px var(--hb-soft-blue-line);
    background: var(--hb-soft-blue-bg);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: box-shadow .15s ease, transform .15s ease;
}

.hb-animal__img img,
.hb-slot__img img,
.hb-tier__gift-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.hb-animal:hover .hb-animal__img {
    box-shadow: 0 0 0 2px var(--hb-soft-blue);
    transform: translateY(-2px);
}

.hb-animal.is-selected .hb-animal__img {
    box-shadow: 0 0 0 3px var(--hb-blue);
}

.hb-animal:focus-visible {
    outline: none;
}

.hb-animal:focus-visible .hb-animal__img {
    box-shadow: 0 0 0 3px var(--hb-blue), 0 0 0 6px var(--hb-soft-blue);
}

.hb-animal__name {
    font-size: 13px;
    line-height: 1.2;
    text-align: center;
    color: var(--hb-muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.hb-animal.is-selected .hb-animal__name {
    font-weight: 700;
    color: var(--hb-text);
}

.hb-animal.is-disabled {
    cursor: not-allowed;
    opacity: .45;
}

.hb-animal.is-disabled:hover .hb-animal__img {
    transform: none;
    box-shadow: 0 0 0 1px var(--hb-soft-blue-line);
}

.hb-img-fallback {
    font-weight: 700;
    font-size: 1.4em;
    color: var(--hb-blue);
}

/* ---------- Staffeln ---------- */

.hb-tiers {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.hb-tier {
    position: relative;
    background: var(--hb-soft-blue-bg);
    border: 2px solid var(--hb-soft-blue-line);
    border-radius: var(--hb-radius);
    cursor: pointer;
    transition: border-color .15s ease, background-color .15s ease, box-shadow .15s ease;
}

.hb-tier:hover {
    border-color: var(--hb-soft-blue);
}

.hb-tier.is-selected {
    background: #fff;
    border-color: var(--hb-blue);
    box-shadow: 0 6px 20px rgba(28, 116, 187, .14);
    cursor: default;
}

.hb-tier__head {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px 12px;
    margin: 0;
    padding: 18px;
    cursor: pointer;
}

.hb-tier__radio {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    margin: 0;
    pointer-events: none;
}

.hb-tier__dot {
    flex: none;
    position: relative;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid #8FB4D1;
    background: #fff;
}

.hb-tier.is-selected .hb-tier__dot {
    border-color: var(--hb-blue);
}

.hb-tier.is-selected .hb-tier__dot::after {
    content: "";
    position: absolute;
    inset: 4px;
    border-radius: 50%;
    background: var(--hb-blue);
}

.hb-tier__radio:focus-visible + .hb-tier__dot {
    outline: 3px solid var(--hb-soft-blue);
    outline-offset: 3px;
}

.hb-tier__title {
    font-size: 20px;
    font-weight: 700;
    white-space: nowrap;
}

.hb-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--hb-green);
    color: var(--hb-text);
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}

.hb-tier__prices {
    margin-left: auto;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    text-align: right;
    line-height: 1.25;
}

.hb-tier__unit {
    font-size: 22px;
    font-weight: 700;
    white-space: nowrap;
}

.hb-tier__unit.is-discounted {
    color: var(--hb-red);
}

.hb-tier__total {
    font-size: 15px;
    font-weight: 700;
    white-space: nowrap;
}

.hb s,
.hb-modal s {
    margin-left: 4px;
    font-size: .72em;
    font-weight: 400;
    color: var(--hb-muted);
}

.hb-tier__total s,
.hb-tier__gift s {
    font-size: 13px;
}

.hb-tier__popular {
    position: absolute;
    top: -12px;
    right: 18px;
    z-index: 1;
    padding: 3px 12px;
    border-radius: 999px;
    background: var(--hb-red);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}

/* ---------- Slots im gewählten Bundle ---------- */

.hb-slots {
    list-style: none;
    margin: 0;
    padding: 0 18px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.hb-slot {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 0 4px 4px;
}

.hb-slot__img {
    flex: none;
    width: 46px;
    height: 46px;
    border-radius: 12px;
    background: var(--hb-soft-blue-bg);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hb-slot__name {
    flex: 1;
    font-size: 15px;
}

.hb-slot__num {
    flex: none;
    min-width: 1.4em;
    margin: 0;
    font-weight: 700;
    color: var(--hb-blue);
}

/* Ab 2 Plüschies: Zeile öffnet das Pop-up */
.hb-slot--button {
    appearance: none;
    width: 100%;
    padding: 4px 12px 4px 4px;
    background: none;
    border: 1px solid transparent;
    border-radius: 12px;
    text-align: left;
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease;
}

.hb-slot--button:hover {
    background: var(--hb-soft-blue-bg);
    border-color: var(--hb-soft-blue-line);
}

.hb-slot--button:focus-visible {
    outline: 3px solid var(--hb-soft-blue);
    outline-offset: 1px;
}

/* Stift-Symbol */
.hb-slot__edit {
    flex: none;
    width: 16px;
    height: 16px;
    background: var(--hb-blue);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zm17.71-10.21a1 1 0 0 0 0-1.41l-2.34-2.34a1 1 0 0 0-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zm17.71-10.21a1 1 0 0 0 0-1.41l-2.34-2.34a1 1 0 0 0-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.hb-tier__edit {
    padding: 0 18px 16px;
}

/* Name des Bundles, zu dem die Auswahl gehört */
.hb-tier__bundle {
    margin: -6px 18px 10px;
    font-size: 14px;
    font-weight: 700;
    color: var(--hb-blue);
}

.hb-btn-outline {
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 46px;
    padding: 10px 20px;
    background: #fff;
    border: 2px solid var(--hb-blue);
    border-radius: 999px;
    color: var(--hb-blue) !important;
    font-weight: 700;
    cursor: pointer;
    transition: background-color .15s ease;
}

.hb-btn-outline:hover {
    background: var(--hb-soft-blue-bg);
}

.hb-btn-outline:focus-visible {
    outline: 3px solid var(--hb-soft-blue);
    outline-offset: 2px;
}

/* ---------- Geschenk ---------- */

.hb-tier__gift {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 18px;
    background: var(--hb-soft-yellow-bg);
    border-top: 1px solid var(--hb-soft-yellow);
    border-radius: 0 0 14px 14px;
    font-size: 14px;
    font-weight: 700;
}

.hb-tier__gift-img {
    flex: none;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hb-tier__gift-name {
    flex: 1;
}

/* ---------- CTA & Meldungen ---------- */

.hb-cta {
    appearance: none;
    width: 100%;
    padding: 15px 24px;
    border: 0;
    border-radius: 999px;
    background: var(--hb-blue);
    color: #fff !important;
    font-size: 18px !important;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(28, 116, 187, .3);
    transition: background-color .15s ease, transform .1s ease;
}

.hb-cta:hover {
    background: var(--hb-blue-dark);
}

.hb-cta:active {
    transform: translateY(1px);
}

.hb-cta:focus-visible {
    outline: 3px solid var(--hb-soft-blue);
    outline-offset: 3px;
}

.hb-cta[disabled] {
    cursor: progress;
    opacity: .75;
}

.hb-message {
    margin: -8px 0 0;
    min-height: 1.4em;
    font-size: 15px;
    text-align: center;
}

.hb-message--success,
.hb-message--error {
    margin-top: 0;
    padding: 10px 14px;
    border-radius: 12px;
}

.hb-message--success {
    background: #EEF6E4;
    border-left: 4px solid var(--hb-green);
}

.hb-message--error {
    background: #FDECEC;
    border-left: 4px solid var(--hb-red);
    color: #A11414;
}

/* ---------- Pop-up: Bundle zusammenstellen ---------- */

html.hb-modal-open,
html.hb-modal-open body {
    overflow: hidden;
}

.hb-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    animation: hb-fade-in .18s ease-out;
}

@keyframes hb-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.hb-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 19, 29, .6); /* Nachtblau */
}

.hb-modal__dialog {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 1100px;
    height: min(900px, 100%);
    background: #fff;
    border-radius: 24px;
    box-shadow: 0 24px 60px rgba(0, 19, 29, .35);
    overflow: hidden;
}

/* Kopf */
.hb-modal__header {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 24px 28px 8px;
}

.hb-modal__heading {
    flex: 1;
    min-width: 0;
}

.hb-modal__title {
    margin: 0;
    font-family: "DB Coffee", "DBJ Coffee Shoppe", "Trebuchet MS", sans-serif;
    font-size: 32px;
    font-weight: 400;
    line-height: 1.15;
    color: var(--hb-blue);
}

.hb-modal__subtitle {
    margin: 4px 0 0;
    font-size: 16px;
    color: var(--hb-muted);
}

.hb-modal__close {
    appearance: none;
    flex: none;
    position: relative;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 50%;
    background: var(--hb-soft-blue-bg);
    cursor: pointer;
    transition: background-color .15s ease;
}

.hb-modal__close::before,
.hb-modal__close::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 2px;
    margin: -1px 0 0 -9px;
    border-radius: 2px;
    background: var(--hb-text);
    transform: rotate(45deg);
}

.hb-modal__close::after {
    transform: rotate(-45deg);
}

.hb-modal__close:hover {
    background: var(--hb-soft-blue-line);
}

.hb-modal__close:focus-visible {
    outline: 3px solid var(--hb-soft-blue);
    outline-offset: 2px;
}

/* Plätze 1 / 2 / 3 */
.hb-modal__slots {
    list-style: none;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    gap: 12px;
    margin: 0;
    padding: 12px 28px 16px;
    border-bottom: 1px solid var(--hb-soft-blue-line);
}

.hb-mslot {
    appearance: none;
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 8px 12px 8px 8px;
    background: var(--hb-soft-blue-bg);
    border: 2px solid var(--hb-soft-blue-line);
    border-radius: 16px;
    text-align: left;
    cursor: pointer;
    transition: border-color .15s ease, background-color .15s ease, box-shadow .15s ease;
}

.hb-mslot:hover {
    border-color: var(--hb-soft-blue);
}

.hb-mslot.is-active {
    background: #fff;
    border-color: var(--hb-blue);
    box-shadow: 0 4px 14px rgba(28, 116, 187, .18);
}

.hb-mslot:focus-visible {
    outline: 3px solid var(--hb-soft-blue);
    outline-offset: 2px;
}

.hb-mslot__num {
    position: absolute;
    top: -9px;
    left: -6px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--hb-blue);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    line-height: 24px;
    text-align: center;
}

.hb-mslot__img {
    flex: none;
    width: 56px;
    height: 56px;
    border-radius: 12px;
    background: #fff;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hb-mslot__img img,
.hb-mcard__img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.hb-mslot__text {
    min-width: 0;
    display: flex;
    flex-direction: column;
    line-height: 1.25;
}

.hb-mslot__name {
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hb-mslot__variant {
    font-size: 14px;
    color: var(--hb-muted);
}

/* Auswahl (scrollt) */
.hb-modal__body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 16px 28px 24px;
}

.hb-modal__hint {
    margin: 0 0 14px;
    font-size: 16px;
    font-weight: 700;
}

.hb-modal__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 18px;
}

.hb-mcard {
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 2px solid var(--hb-soft-blue-line);
    border-radius: 20px;
    overflow: hidden;
    transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}

.hb-mcard:hover {
    border-color: var(--hb-soft-blue);
    box-shadow: 0 6px 18px rgba(28, 116, 187, .12);
    transform: translateY(-2px);
}

.hb-mcard.is-selected {
    border-color: var(--hb-blue);
    box-shadow: 0 0 0 2px var(--hb-blue);
}

.hb-mcard.is-disabled {
    opacity: .5;
}

.hb-mcard.is-disabled:hover {
    transform: none;
    box-shadow: none;
    border-color: var(--hb-soft-blue-line);
}

.hb-mcard__main {
    appearance: none;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 0 0 10px;
    background: none;
    border: 0;
    text-align: center;
    cursor: pointer;
}

.hb-mcard__main[disabled] {
    cursor: not-allowed;
}

.hb-mcard__main:focus-visible {
    outline: 3px solid var(--hb-soft-blue);
    outline-offset: -3px;
    border-radius: 18px;
}

.hb-mcard__img {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1;
    background: var(--hb-soft-blue-bg);
    overflow: hidden;
}

.hb-mcard__img .hb-img-fallback {
    font-size: 2.4em;
}

.hb-mcard__count {
    position: absolute;
    top: 10px;
    right: 10px;
    min-width: 34px;
    padding: 3px 8px;
    border-radius: 999px;
    background: var(--hb-blue);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
}

.hb-mcard__name {
    margin: 10px 10px 0;
    font-size: 17px;
    font-weight: 700;
    line-height: 1.2;
}

.hb-mcard__price {
    margin: 2px 10px 0;
    font-size: 15px;
    color: var(--hb-muted);
}

/* Fuß */
.hb-modal__footer {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px 24px;
    padding: 16px 28px;
    background: #fff;
    border-top: 1px solid var(--hb-soft-blue-line);
    box-shadow: 0 -6px 18px rgba(0, 19, 29, .06);
}

.hb-modal__sum {
    flex: 1;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 12px;
}

.hb-modal__sum-label {
    font-size: 16px;
    color: var(--hb-muted);
}

.hb-modal__sum-price strong {
    font-size: 26px;
}

.hb-modal__sum-price strong.is-discounted {
    color: var(--hb-red);
}

.hb-modal__actions {
    display: flex;
    gap: 12px;
}

.hb-modal__actions .hb-btn-outline {
    width: auto;
}

.hb-modal__cta {
    width: auto;
    min-width: 230px;
}

@media (prefers-reduced-motion: reduce) {
    .hb-modal,
    .hb-mcard {
        animation: none;
        transition: none;
    }
}

@media (max-width: 720px) {
    .hb-modal {
        padding: 0;
    }

    .hb-modal__dialog {
        height: 100%;
        max-width: none;
        border-radius: 0;
    }

    .hb-modal__header {
        padding: 16px 16px 4px;
    }

    .hb-modal__title {
        font-size: 26px;
    }

    .hb-modal__slots {
        grid-auto-columns: minmax(150px, 1fr);
        overflow-x: auto;
        padding: 14px 16px 14px;
    }

    .hb-mslot__img {
        width: 44px;
        height: 44px;
    }

    .hb-modal__body {
        padding: 14px 16px 20px;
    }

    .hb-modal__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }

    .hb-mcard__name {
        font-size: 15px;
    }

    .hb-modal__footer {
        padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    }

    .hb-modal__sum-price strong {
        font-size: 22px;
    }

    .hb-modal__actions {
        width: 100%;
    }

    .hb-modal__actions .hb-btn-outline {
        flex: 0 0 auto;
    }

    .hb-modal__cta {
        flex: 1;
        min-width: 0;
    }
}

/* ---------- Mobil ---------- */

@media (max-width: 480px) {
    .hb__headline {
        font-size: 26px;
    }

    .hb-picker__grid {
        grid-template-columns: repeat(auto-fill, minmax(74px, 1fr));
    }

    .hb-animal__img {
        width: 68px;
        height: 68px;
    }

    .hb-tier__head {
        padding: 16px 14px;
    }

    .hb-tier__title {
        font-size: 18px;
    }

    .hb-tier__unit {
        font-size: 19px;
    }

    .hb-slots {
        padding: 0 14px 14px;
    }
}
