/* KI-Bilder – Eingabefeld für alle Designer (Aussehen wie im Druckdesigner 1.13.0, passt zum Bootstrap-Theme) */

.bb-ai-panel {
    --bb-ai-accent: var(--bs-primary, #0b6bcb);
    --bb-ai-muted: #6b7280;
    position: relative;
    margin-top: 8px;
    padding: 10px;
    border: 1px solid var(--bb-ai-accent);
    border-radius: 8px;
    background: #fff;
    background: color-mix(in srgb, var(--bb-ai-accent) 5%, #fff);
    text-align: left;
}

.bb-ai-panel [hidden] {
    display: none !important;
}

.bb-ai-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 4px 8px;
    margin-bottom: 4px;
}

.bb-ai-label {
    margin: 0;
    font-size: .82rem;
    font-weight: 600;
}

/* Tipps als Textlink (kein „?“), nur per Klick */
.bb-ai-tip-link {
    padding: 0;
    border: 0;
    background: none;
    color: var(--bb-ai-accent);
    font-size: .8rem;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}

.bb-ai-tip-link[aria-expanded="true"] {
    text-decoration: none;
}

.bb-ai-tips {
    position: absolute;
    z-index: 30;
    top: 38px;
    left: 8px;
    right: 8px;
    max-height: 60vh;
    overflow: auto;
    padding: 10px 12px;
    border-radius: 8px;
    background: #22272e;
    color: #fff;
    font-size: .78rem;
    line-height: 1.45;
    white-space: pre-line;
    box-shadow: 0 6px 24px rgba(0, 0, 0, .25);
    cursor: pointer;
}

.bb-ai-prompt {
    display: block;
    width: 100%;
    box-sizing: border-box;
    resize: vertical;
    margin-bottom: 8px;
    font-family: inherit;
    font-size: .9rem;
}

/* Hinweis zu verbotenen Inhalten – direkt unter dem Prompt */
.bb-ai-content {
    margin: 0 0 8px;
    padding: 6px 8px;
    border-left: 3px solid #c0392b;
    border-radius: 4px;
    background: rgba(192, 57, 43, .06);
    font-size: .74rem;
    line-height: 1.4;
    white-space: pre-line;
}

.bb-ai-privacy {
    margin: 0 0 8px;
    padding: 6px 8px;
    border-radius: 6px;
    background: rgba(0, 0, 0, .04);
    font-size: .74rem;
    line-height: 1.4;
    color: var(--bs-secondary-color, #5c6670);
    white-space: pre-line;
}

.bb-ai-privacy a {
    color: inherit;
    text-decoration: underline;
}

.bb-ai-hint {
    margin: 0 0 8px;
    color: var(--bb-ai-muted);
    font-size: .76rem;
}

.bb-ai-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.bb-ai-info {
    font-size: .82rem;
    font-weight: 600;
}

.bb-ai-info.is-empty {
    color: var(--bs-danger, #c0392b);
}

.bb-ai-go {
    margin-left: auto;
}

/* Ladeanzeige (nur wenn der Designer keine eigene hat) */
.bb-ai-busy {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    font-size: .82rem;
    color: var(--bb-ai-muted);
}

.bb-ai-spinner {
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: bb-ai-spin .8s linear infinite;
}

@keyframes bb-ai-spin {
    to {
        transform: rotate(360deg);
    }
}

.bb-ai-panel.is-busy .bb-ai-prompt {
    opacity: .7;
}

/* Meldung (nur wenn der Designer keine eigene hat) */
.bb-ai-message {
    margin-top: 8px;
    padding: 6px 8px;
    border-radius: 6px;
    background: rgba(192, 57, 43, .08);
    color: var(--bs-danger, #c0392b);
    font-size: .8rem;
}

/* KI-Credits */
.bb-ai-credits {
    margin-top: .6rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .35rem .75rem;
    font-size: .875rem;
}

.bb-ai-credits.is-needed {
    padding: .65rem .75rem;
    border: 1px solid var(--bs-primary, #0d6efd);
    border-radius: .5rem;
    background: rgba(13, 110, 253, .05);
}

.bb-ai-credits-text {
    flex: 1 1 12rem;
}

.bb-ai-credits.is-needed .bb-ai-credits-text {
    flex-basis: 100%;
    font-weight: 600;
}

.bb-ai-credits-hint {
    flex-basis: 100%;
    color: var(--bb-ai-muted);
    font-size: .85rem;
}

.bb-ai-credits .btn-link {
    padding: 0;
}

/* Handy: größere Tippflächen, keine automatische Vergrößerung beim Tippen (iOS ab 16 px), Knopf über die ganze Breite */
@media (max-width: 575.98px) {
    .bb-ai-prompt {
        font-size: 16px;
    }

    .bb-ai-tip-link {
        padding: 4px 0;
    }

    .bb-ai-row {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
    }

    .bb-ai-go {
        width: 100%;
        min-height: 44px;
        margin-left: 0;
    }

    .bb-ai-info {
        text-align: center;
    }

    .bb-ai-credits-buy.btn-primary {
        width: 100%;
        min-height: 44px;
    }

    .bb-ai-tips {
        position: fixed;
        top: auto;
        bottom: 12px;
        left: 12px;
        right: 12px;
        max-height: 70vh;
        z-index: 1080;
    }
}
