/**
 * KI-Hinweis für umgefärbte Optionsbilder (Badshop_OptionImageSwitcher).
 * Badge nur bei /option_images/ — nicht bei Upscales.
 */

[data-gallery-role="gallery-placeholder"],
[data-gallery-role="gallery-placeholder"] .fotorama__stage {
    position: relative;
}

/* Wrapper: badge image as-is + optional text pill — anchored to stage (not thumbs) */
.ois-ai-gallery-label {
    position: absolute;
    right: 10px;
    bottom: 10px;
    z-index: 20;
    display: none;
    align-items: center;
    gap: 5px;
    max-width: calc(100% - 20px);
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
    pointer-events: none;
    box-sizing: border-box;
}

.ois-ai-gallery-label.is-visible {
    display: inline-flex;
}

/* Text pill only (disclaimer / „Produkt mit KI umgefärbt“) */
.ois-ai-gallery-label__pill--text {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.82);
    color: #fff;
    line-height: 1.2;
    padding-top: 6px;
    padding-bottom: 6px;
    padding-left: 18px;
    padding-right: 18px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: min(240px, 55vw);
    border: 0;
    box-shadow: none;
}

/*
 * AI-MODIFIED asset: already a finished pill graphic — no extra border/bg/radius.
 * Beat Magento/Fotorama img { height:auto; max-width:100% } rules.
 */
.ois-ai-gallery-label__badge,
.ois-ai-gallery-label .ois-ai-gallery-label__badge {
    display: block !important;
    width: auto !important;
    height: 28px !important;
    max-height: 28px !important;
    max-width: none !important;
    flex: 0 0 auto !important;
    object-fit: contain !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}

/* Mobile: after base rules so overrides win; more horizontal padding in the pill */
@media (max-width: 767px) {
    .ois-ai-gallery-label {
        right: 6px;
        bottom: 6px;
        gap: 4px;
        max-width: calc(100% - 12px);
    }

    .ois-ai-gallery-label__pill--text {
        font-size: 10px;
        padding-top: 5px;
        padding-bottom: 5px;
        padding-left: 16px;
        padding-right: 16px;
        max-width: min(230px, 82vw);
    }

    .ois-ai-gallery-label__badge,
    .ois-ai-gallery-label .ois-ai-gallery-label__badge {
        height: 24px !important;
        max-height: 24px !important;
    }
}

/*
 * Round icon-only "click the swatches" badge, top-right of the stage.
 * Independent of the AI badge (bottom-right, active-frame only). No visible
 * label text — explanation is a tooltip on hover/focus (tap-toggle on touch).
 */
.ois-hint-button {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 21;
    display: none;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 40px;
    height: 40px;
    padding: 0;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid #cfd8de;
    border-radius: 50%;
    cursor: pointer;
    pointer-events: auto;
}

.ois-hint-button.is-visible {
    display: inline-flex;
}

.ois-hint-button__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
}

.ois-hint-button__icon svg {
    display: block;
    width: 100%;
    height: 100%;
}

.ois-hint-button__tooltip {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 22;
    display: block;
    width: max-content;
    max-width: min(220px, 70vw);
    padding: 8px 16px;
    background: rgba(0, 0, 0, 0.88);
    color: #fff;
    /* Pillshape statt Rundrechteck - 999px greift unabhaengig von der tatsaechlichen
     * Boxhoehe (auch bei zweizeiligem, laengerem Admin-Text) und ergibt immer
     * vollstaendig abgerundete Enden. */
    border-radius: 999px;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.4;
    letter-spacing: normal;
    text-align: left;
    white-space: normal;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.12s ease;
    pointer-events: none;
}

.ois-hint-button:hover .ois-hint-button__tooltip,
.ois-hint-button:focus-visible .ois-hint-button__tooltip,
.ois-hint-button.is-open .ois-hint-button__tooltip {
    opacity: 1;
    visibility: visible;
}

@media (max-width: 767px) {
    .ois-hint-button {
        top: 6px;
        right: 6px;
        width: 34px;
        height: 34px;
    }

    .ois-hint-button__icon {
        width: 18px;
        height: 18px;
    }

    .ois-hint-button__tooltip {
        max-width: min(200px, 82vw);
    }
}

/* Secondary to .cdv2-card-label label (12px / 500 / #00446a) */
.cdv2-card-label .ois-ai-option-hint,
.cdv2-option-card .ois-ai-option-hint,
label.optionlist .ois-ai-option-hint,
.ois-ai-option-hint {
    display: block !important;
    margin-top: 3px !important;
    font-size: 11px !important;
    font-weight: 400 !important;
    line-height: 1.3 !important;
    color: #5a7585 !important;
}

/*
 * Reduced/selected row: option <label> uses margin: 5px 15px —
 * indent hint so its left edge lines up with the option name.
 */
.customdesign-pdp-v2 .prod_option.selected.reduced .cdv2-option-card.active .cdv2-card-label .ois-ai-option-hint {
    margin-left: 15px !important;
    margin-right: 15px !important;
    width: auto !important;
    max-width: calc(100% - 30px);
    box-sizing: border-box;
}
