/* Chat Widget CSS - Text-only Standalone Styles */

.chat-widget-container {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.chat-widget-messages,
.chat-widget-input {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

.chat-widget-messages {
    -webkit-overflow-scrolling: touch;
}

/* Prevent zoom on iOS */
.chat-widget-container input[type="text"],
.chat-widget-container textarea {
    font-size: 16px;
}

/* Container */
.chat-widget-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 400px;
    max-width: calc(100vw - 40px);
    height: 550px;
    max-height: calc(100vh - 40px);  /* fallback */
    max-height: calc(100dvh - 40px); /* mobile UI-Chrome */
    background: rgba(255, 255, 255, 0.98);
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(20px);
    box-sizing: border-box;
}

.chat-widget-container *,
.chat-widget-container *::before,
.chat-widget-container *::after {
    box-sizing: border-box;
}

/* Positioning */
.chat-widget-container.top-left {
    top: 20px; left: 20px; bottom: auto; right: auto;
}

.chat-widget-container.top-right {
    top: 20px; right: 20px; bottom: auto;
}

.chat-widget-container.bottom-left {
    bottom: 20px; left: 20px; right: auto;
}

/* Minimized */
.chat-widget-container.minimized {
    height: 70px;
    width: 70px;
    border-radius: 35px;
    cursor: pointer;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(0, 0, 0, 0.05);
    background: transparent;
}

.chat-widget-container.minimized .chat-widget-header,
.chat-widget-container.minimized .chat-widget-messages,
.chat-widget-container.minimized .chat-widget-input-container {
    display: none !important;
}

/* Minimized icon */
.chat-widget-minimized-icon {
    display: none;
    width: 70px;
    height: 70px;
    /* Theme-Color schlaegt durch via --widget-primary, Fallback ist
     * der Original-Purple-Verlauf. Wenn theme_color gesetzt, wird die
     * Variable auf den Kunden-Hex umgesetzt und ueberschreibt den
     * Verlauf mit einer satten Farbe. */
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
    background: var(--widget-primary, linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%));
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    cursor: pointer;
    box-shadow: 0 6px 24px rgba(99, 102, 241, 0.3);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.chat-widget-minimized-icon::before {
    content: '';
    position: absolute;
    top: -50%; left: -50%;
    width: 200%; height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.2) 0%, transparent 70%);
    animation: chatWidgetShimmer 3s ease-in-out infinite;
}

.chat-widget-minimized-icon:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 32px rgba(99, 102, 241, 0.4);
}

.chat-widget-container.minimized .chat-widget-minimized-icon {
    display: flex !important;
}

/* Header - Theme-Color schlaegt durch ueber --widget-primary */
.chat-widget-header {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
    background: var(--widget-primary, linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%));
    color: white;
    padding: 18px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.chat-widget-header::before {
    content: '';
    position: absolute;
    top: -50%; right: -50%;
    width: 200%; height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: chatWidgetShimmer 3s ease-in-out infinite;
}

@keyframes chatWidgetShimmer {
    0%, 100% { transform: translate(50%, 50%) rotate(0deg); }
    50% { transform: translate(-50%, -50%) rotate(180deg); }
}

.chat-widget-header h3 {
    margin: 0;
    font-size: 19px;
    font-weight: 600;
    letter-spacing: -0.02em;
    z-index: 1;
    position: relative;
}

.chat-widget-header-controls {
    display: flex;
    gap: 8px;
    z-index: 1;
    position: relative;
}

.chat-widget-header-btn {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    cursor: pointer;
    font-size: 20px;
    padding: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    transition: all 0.3s ease;
}

.chat-widget-header-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.chat-widget-header-btn:active {
    transform: translateY(0);
}

/* Messages */
.chat-widget-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scrollbar-width: thin;
    scrollbar-color: #d1d5db #f3f4f6;
    min-height: 0;
    background: #fafbfc;
}

.chat-widget-messages::-webkit-scrollbar { width: 6px; }
.chat-widget-messages::-webkit-scrollbar-track { background: #f3f4f6; border-radius: 3px; }
.chat-widget-messages::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }
.chat-widget-messages::-webkit-scrollbar-thumb:hover { background: #9ca3af; }

.chat-widget-message {
    padding: 12px 18px;
    border-radius: 20px;
    max-width: 80%;
    word-wrap: break-word;
    animation: chatWidgetMessageSlide 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    font-size: 15px;
    line-height: 1.5;
    letter-spacing: -0.01em;
}

@keyframes chatWidgetMessageSlide {
    from { opacity: 0; transform: translateY(20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.chat-widget-message.user {
    background: linear-gradient(135deg, #6366f1 0%, #7c3aed 100%);
    background: var(--widget-primary, linear-gradient(135deg, #6366f1 0%, #7c3aed 100%));
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 6px;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.chat-widget-message.assistant {
    background: white;
    color: #1f2937;
    align-self: flex-start;
    border-bottom-left-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.06);
}

/* Markdown styles */
.chat-widget-message strong { font-weight: 700; color: inherit; }
.chat-widget-message em { font-style: italic; color: inherit; }

.chat-widget-message code {
    background: rgba(0, 0, 0, 0.08);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
}

.chat-widget-message.user code { background: rgba(255, 255, 255, 0.2); }

.chat-widget-message pre {
    background: rgba(0, 0, 0, 0.06);
    border-radius: 8px;
    padding: 12px;
    margin: 12px 0;
    overflow-x: auto;
    max-width: 100%;
}

.chat-widget-message pre code {
    background: transparent;
    padding: 0;
    border-radius: 0;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.85em;
    line-height: 1.5;
    display: block;
    white-space: pre;
    color: inherit;
}

.chat-widget-message.user pre { background: rgba(255, 255, 255, 0.15); }
.chat-widget-message.user pre code { color: white; }

.chat-widget-message h1,
.chat-widget-message h2,
.chat-widget-message h3,
.chat-widget-message h4,
.chat-widget-message h5,
.chat-widget-message h6 {
    margin: 12px 0 8px 0;
    font-weight: 600;
    line-height: 1.3;
}

.chat-widget-message h1 { font-size: 1.4em; }
.chat-widget-message h2 { font-size: 1.3em; }
.chat-widget-message h3 { font-size: 1.2em; }
.chat-widget-message h4 { font-size: 1.1em; }

.chat-widget-message ul,
.chat-widget-message ol {
    margin: 8px 0;
    padding-left: 24px;
}

.chat-widget-message li { margin: 4px 0; line-height: 1.5; }
.chat-widget-message ul { list-style-type: disc; }
.chat-widget-message ol { list-style-type: decimal; }

.chat-widget-message a { color: #6366f1; text-decoration: underline; transition: color 0.2s; }
.chat-widget-message a:hover { color: #7c3aed; }
.chat-widget-message.user a { color: #a5b4fc; }
.chat-widget-message.user a:hover { color: #c7d2fe; }

.chat-widget-message hr {
    margin: 12px 0;
    border: none;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.chat-widget-message.user hr { border-top-color: rgba(255, 255, 255, 0.3); }

/* Input area */
.chat-widget-input-container {
    padding: 20px;
    background: white;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    display: flex;
    gap: 12px;
    align-items: center;
    flex-shrink: 0;
}

.chat-widget-input {
    flex: 1;
    padding: 14px 20px;
    border: 2px solid #e5e7eb;
    border-radius: 16px;
    outline: none;
    font-size: 15px;
    transition: all 0.3s ease;
    background: #f9fafb;
    font-family: inherit;
    letter-spacing: -0.01em;
}

.chat-widget-input:focus {
    border-color: #6366f1;
    background: white;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.chat-widget-input::placeholder { color: #9ca3af; }

/* Buttons */
.chat-widget-button {
    padding: 12px;
    border: none;
    border-radius: 16px;
    background: linear-gradient(135deg, #6366f1 0%, #7c3aed 100%);
    background: var(--widget-primary, linear-gradient(135deg, #6366f1 0%, #7c3aed 100%));
    color: white;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    font-size: 15px;
    font-family: inherit;
    white-space: nowrap;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
    position: relative;
    overflow: hidden;
}

.chat-widget-button::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: linear-gradient(135deg, rgba(255,255,255,0.2) 0%, transparent 100%);
    opacity: 0;
    transition: opacity 0.3s;
}

.chat-widget-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.35);
}

.chat-widget-button:hover:not(:disabled)::before { opacity: 1; }
.chat-widget-button:active:not(:disabled) { transform: translateY(0); }

.chat-widget-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.chat-widget-send-btn {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    line-height: 1;
    text-align: center;
}

/* Loading */
.chat-widget-loading {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #6b7280;
    font-size: 14px;
    padding: 8px 18px;
    background: white;
    border-radius: 20px;
    border-bottom-left-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.06);
    align-self: flex-start;
    max-width: 75%;
    animation: chatWidgetMessageSlide 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-widget-loading-dots {
    display: flex;
    gap: 4px;
}

.chat-widget-loading-dots span {
    width: 8px;
    height: 8px;
    background: linear-gradient(135deg, #6366f1 0%, #7c3aed 100%);
    background: var(--widget-primary, linear-gradient(135deg, #6366f1 0%, #7c3aed 100%));
    border-radius: 50%;
    animation: chatWidgetLoadingDot 1.4s infinite ease-in-out both;
}

.chat-widget-loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.chat-widget-loading-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes chatWidgetLoadingDot {
    0%, 80%, 100% { transform: scale(0.7); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

@keyframes chatWidgetSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Streaming styles */
.chat-widget-message.streaming { position: relative; }

.chat-widget-message.streaming .streaming-cursor {
    animation: chatWidgetBlink 1s infinite;
    font-weight: bold;
    color: #2563eb;
    margin-left: 2px;
}

@keyframes chatWidgetBlink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

.chat-widget-message.streaming .streaming-content { display: inline; }

.chat-widget-message.streaming {
    animation: chatWidgetFadeIn 0.3s ease-in;
}

@keyframes chatWidgetFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Privacy consent */
.chat-widget-privacy-consent {
    flex: 1;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 20px;
    background: #fafbfc;
    overflow: hidden;
}

.chat-widget-privacy-content {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.06);
    text-align: center;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #d1d5db #f3f4f6;
}

.chat-widget-privacy-content h4 {
    color: #1f2937;
    font-size: 20px;
    font-weight: 600;
    margin: 0 0 16px 0;
    letter-spacing: -0.02em;
}

.chat-widget-privacy-content::-webkit-scrollbar { width: 6px; }
.chat-widget-privacy-content::-webkit-scrollbar-track { background: #f3f4f6; border-radius: 3px; }
.chat-widget-privacy-content::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }

.chat-widget-privacy-text { text-align: left; }

.chat-widget-privacy-text p {
    color: #4b5563;
    font-size: 14px;
    line-height: 1.6;
    margin: 0 0 16px 0;
}

.chat-widget-privacy-text p:last-child { margin-bottom: 0; }
.chat-widget-privacy-text strong { color: #1f2937; font-weight: 600; }

.chat-widget-checkbox-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    color: #374151;
    line-height: 1.5;
}

.chat-widget-checkbox-container input[type="checkbox"] {
    width: 18px;
    height: 18px;
    border: 2px solid #d1d5db;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    margin: 0;
    flex-shrink: 0;
    accent-color: #6366f1;
}

.chat-widget-checkbox-text { flex: 1; text-align: left; }
.chat-widget-checkbox-text a { color: #6366f1; text-decoration: none; font-weight: 500; }
.chat-widget-checkbox-text a:hover { text-decoration: underline; }

.chat-widget-accept-button {
    margin-top: 8px;
    min-width: 200px;
    padding: 14px 24px !important;
}

.chat-widget-accept-button:disabled {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
    transform: none !important;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15) !important;
}

/* ── Responsive ── */

/* Tablets */
@media (max-width: 768px) and (min-width: 481px) {
    .chat-widget-container {
        width: 360px;
        height: 500px;
        bottom: 15px; right: 15px;
    }

    .chat-widget-header { padding: 16px 20px; }
    .chat-widget-header h3 { font-size: 17px; }

    .chat-widget-header-btn { width: 32px; height: 32px; font-size: 18px; }

    .chat-widget-messages { padding: 16px; gap: 10px; }
    .chat-widget-message { padding: 10px 16px; font-size: 14px; }

    .chat-widget-input-container { padding: 16px; gap: 10px; }
    .chat-widget-input { padding: 12px 16px; font-size: 14px; }

    .chat-widget-send-btn { width: 42px; height: 42px; font-size: 18px; }

    .chat-widget-privacy-content { border-radius: 16px; }
    .chat-widget-privacy-content h4 { font-size: 18px; }
    .chat-widget-accept-button { min-width: auto; width: 100%; padding: 12px 20px !important; font-size: 14px; }
}

/* Mobile large */
@media (max-width: 480px) and (min-width: 376px) {
    .chat-widget-container {
        position: fixed;
        width: calc(100vw - 20px);
        height: calc(100vh - 20px);  /* fallback fuer alte Browser */
        height: calc(100dvh - 20px); /* dvh respektiert mobile UI-Chrome */
        max-height: 700px;
        bottom: 10px; right: 10px; left: 10px;
        margin: 0 auto;
    }

    .chat-widget-container.top-left,
    .chat-widget-container.top-right,
    .chat-widget-container.bottom-left {
        top: auto; bottom: 10px; left: 10px; right: 10px;
    }

    .chat-widget-header { padding: 14px 18px; }
    .chat-widget-header h3 { font-size: 16px; }
    .chat-widget-header-btn { width: 30px; height: 30px; font-size: 16px; border-radius: 10px; }

    .chat-widget-messages { padding: 14px; gap: 10px; }
    .chat-widget-message { max-width: 85%; padding: 10px 14px; font-size: 14px; border-radius: 18px; }
    .chat-widget-message.user { border-bottom-right-radius: 4px; }
    .chat-widget-message.assistant { border-bottom-left-radius: 4px; }

    .chat-widget-input-container { padding: 12px; gap: 8px; }
    .chat-widget-input { padding: 12px 14px; font-size: 14px; border-radius: 14px; min-width: 0; flex: 1; }
    .chat-widget-send-btn { width: 40px; height: 40px; font-size: 16px; }
    .chat-widget-loading { font-size: 13px; padding: 8px 14px; }
    .chat-widget-loading-dots span { width: 6px; height: 6px; }

    .chat-widget-privacy-consent { padding: 16px; }
    .chat-widget-privacy-content { padding: 20px 16px; border-radius: 14px; }
}

/* Mobile small */
@media (max-width: 375px) {
    .chat-widget-container {
        position: fixed;
        width: 100vw;
        height: 100vh;  /* fallback */
        height: 100dvh; /* mobile UI-Chrome (Adressleiste, Tastatur) */
        bottom: 0; right: 0; left: 0; top: 0;
        border-radius: 0;
        max-height: none;
    }

    .chat-widget-container.minimized {
        width: 60px; height: 60px;
        border-radius: 30px;
        bottom: 20px; right: 20px;
        left: auto; top: auto;
    }

    .chat-widget-minimized-icon { width: 60px; height: 60px; font-size: 28px; }

    .chat-widget-container.top-left,
    .chat-widget-container.top-right,
    .chat-widget-container.bottom-left {
        top: 0; bottom: 0; left: 0; right: 0;
    }

    .chat-widget-header { padding: 12px 16px; border-radius: 0; }
    .chat-widget-header h3 { font-size: 15px; }
    .chat-widget-header-controls { gap: 6px; }
    .chat-widget-header-btn { width: 28px; height: 28px; font-size: 16px; border-radius: 8px; }

    .chat-widget-messages { padding: 12px; gap: 8px; }
    .chat-widget-message { max-width: 90%; padding: 9px 13px; font-size: 13px; border-radius: 16px; line-height: 1.4; }

    .chat-widget-input-container { padding: 10px; gap: 6px; border-top: 1px solid rgba(0, 0, 0, 0.08); }
    .chat-widget-input { padding: 10px 12px; font-size: 13px; border-radius: 12px; border-width: 1.5px; }
    .chat-widget-send-btn { width: 36px; height: 36px; font-size: 16px; }
    .chat-widget-loading { font-size: 12px; padding: 6px 12px; }
    .chat-widget-loading-dots span { width: 5px; height: 5px; }

    .chat-widget-privacy-consent { padding: 12px; }
    .chat-widget-privacy-content { padding: 20px 14px; border-radius: 14px; }
    .chat-widget-privacy-content h4 { font-size: 16px; }
    .chat-widget-privacy-text p { font-size: 13px; line-height: 1.5; }
    .chat-widget-checkbox-container { font-size: 12px; gap: 8px; }
    .chat-widget-checkbox-container input[type="checkbox"] { width: 16px; height: 16px; }
}

/* Landscape mobile */
@media (max-width: 896px) and (max-height: 414px) and (orientation: landscape) {
    .chat-widget-container {
        width: 50vw; max-width: 400px;
        height: calc(100vh - 20px);  /* fallback */
        height: calc(100dvh - 20px);
        right: 10px; bottom: 10px;
    }

    .chat-widget-messages { padding: 10px; }
    .chat-widget-message { padding: 8px 12px; font-size: 12px; }
    .chat-widget-input-container { padding: 10px; }
    .chat-widget-input { padding: 8px 12px; font-size: 12px; }
    .chat-widget-send-btn { width: 34px; height: 34px; font-size: 14px; }
}

/* Very small */
@media (max-width: 320px) {
    .chat-widget-container { font-size: 12px; }
    .chat-widget-header h3 { font-size: 14px; }
    .chat-widget-header-btn { width: 26px; height: 26px; font-size: 14px; }
    .chat-widget-message { font-size: 12px; padding: 8px 11px; }
    .chat-widget-input { font-size: 12px; padding: 9px 11px; }
    .chat-widget-send-btn { width: 32px; height: 32px; font-size: 14px; }
}

/* Touch devices */
@media (hover: none) and (pointer: coarse) {
    .chat-widget-header-btn,
    .chat-widget-button { min-width: 44px; min-height: 44px; }
    .chat-widget-input { min-height: 44px; font-size: 16px; }
}

/* High DPI */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .chat-widget-container { border-width: 0.5px; }
    .chat-widget-message { border-width: 0.5px; }
}

/* === UI Block Renderers (tool-emitted render_blocks) ============== */
.avatar-widget-block {
    margin: 8px 0;
    animation: fadeIn 0.3s ease-in;
}

.avatar-widget-block-products-compact {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.avatar-widget-product-compact {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: #f8f9fa;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    text-decoration: none;
    color: inherit;
    transition: background 0.15s, border-color 0.15s;
}
a.avatar-widget-product-compact:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}
.avatar-widget-product-compact-image {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
}
.avatar-widget-product-compact-info { flex: 1; min-width: 0; }
.avatar-widget-product-compact-title {
    font-size: 14px;
    font-weight: 600;
    color: #111827;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.avatar-widget-product-compact-desc {
    font-size: 12px;
    color: #4b5563;
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.avatar-widget-product-compact-price {
    font-size: 13px;
    font-weight: 600;
    color: #2563eb;
    margin-top: 3px;
}

/* Country-Flag-Emojis auch unter Windows */
@font-face {
    font-family: "Twemoji Country Flags";
    unicode-range: U+1F1E6-1F1FF, U+1F3F4, U+E0062-E007F;
    src: url('https://cdn.jsdelivr.net/npm/country-flag-emoji-polyfill@0.1/dist/TwemojiCountryFlags.woff2') format('woff2');
}

/* === Sprach-Selector im Header (Dropdown) ===================== */
.chat-widget-lang-dropdown {
    position: relative;
    display: inline-flex;
    align-items: center;
    z-index: 2147483000;
}
/* Toggle erbt das Aussehen von .chat-widget-header-btn */
.chat-widget-lang-toggle {
    font-size: 18px;
    font-family: "Twemoji Country Flags", "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", system-ui, sans-serif;
}
.chat-widget-lang-flag-emoji {
    font-size: 18px;
    line-height: 1;
    font-family: "Twemoji Country Flags", "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", system-ui, sans-serif;
}
.chat-widget-lang-code { font-size: 11px; font-weight: 600; letter-spacing: 0.5px; }
.chat-widget-lang-menu {
    position: fixed;
    top: 0;
    left: 0;
    min-width: 140px;
    max-height: 280px;
    overflow-y: auto;
    margin: 0;
    padding: 6px;
    list-style: none;
    background: #ffffff;
    color: #1f2937;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 10px;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.18), 0 2px 6px rgba(15, 23, 42, 0.08);
    z-index: 2147483000;
    display: none;
    font-family: "Twemoji Country Flags", "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", system-ui, sans-serif;
}
.chat-widget-lang-dropdown.open .chat-widget-lang-menu { display: block; }
.chat-widget-lang-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    margin: 2px 0;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.2;
    color: #1f2937;
    border-radius: 6px;
    transition: background 0.12s ease, color 0.12s ease;
}
.chat-widget-lang-item:hover { background: #f3f4f6; }
.chat-widget-lang-item.active {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    background: var(--widget-primary, linear-gradient(135deg, #6366f1, #8b5cf6));
    color: #fff;
    font-weight: 600;
}
.chat-widget-lang-item.active::after {
    content: "✓";
    margin-left: auto;
    font-size: 12px;
}
.chat-widget-lang-item .chat-widget-lang-flag-emoji { font-size: 18px; }
.chat-widget-lang-item .chat-widget-lang-code {
    font-size: 11px;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    opacity: 0.85;
}
.chat-widget-lang-item.active .chat-widget-lang-code { opacity: 1; }

/* ============================================================
 * Live-Chat Eskalation
 *   - Mit-Mitarbeiter-sprechen-Form (E-Mail-Anfrage)
 *   - "Doch nicht"-Cancel-Button
 * Spiegel zur avatar-widget.css mit chat-widget-* Praefix.
 * ============================================================ */

.chat-widget-escalation-form {
    align-self: stretch;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    padding: 14px;
    margin: 8px 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.chat-widget-escalation-form.offline {
    background: #fff7ed;
    border-color: #fdba74;
}

.chat-widget-escalation-form.offline .chat-widget-escalation-title {
    color: #c2410c;
}

.chat-widget-escalation-title {
    font-weight: 600;
    color: #059669;
    margin-bottom: 6px;
}

.chat-widget-escalation-hint {
    font-size: 0.85em;
    color: #6b7280;
    margin: 0 0 10px 0;
}

.chat-widget-escalation-form input {
    width: 100%;
    padding: 8px 10px;
    margin-bottom: 8px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.9em;
    box-sizing: border-box;
}

.chat-widget-escalation-form input:focus {
    outline: none;
    border-color: #10b981;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.chat-widget-escalation-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.chat-widget-escalation-actions button {
    padding: 7px 14px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 500;
}

#agentEscalationCancel {
    background: #f3f4f6;
    color: #374151;
}

#agentEscalationCancel:hover {
    background: #e5e7eb;
}

#agentEscalationSubmit {
    background: #10b981;
    color: white;
}

#agentEscalationSubmit:hover {
    background: #059669;
}

.chat-widget-escalation-error {
    color: #dc2626;
    font-size: 0.85em;
    margin-top: 6px;
    min-height: 1.2em;
}

.chat-widget-cancel-wrap {
    align-self: center;
    margin: 4px 0 8px;
}

.chat-widget-cancel-btn {
    background: transparent;
    color: #6b7280;
    border: 1px solid #d1d5db;
    border-radius: 16px;
    padding: 5px 12px;
    font-size: 0.8em;
    cursor: pointer;
    transition: background 0.15s;
}

.chat-widget-cancel-btn:hover {
    background: #f3f4f6;
    color: #1f2937;
}

/* ============================================================
 * Starter-Fragen-Buttons (klickbare Vorschlaege beim Chat-Start)
 * ============================================================ */
.chat-widget-starter-questions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 0;
    margin: 4px 12px 8px 12px;
}

.chat-widget-starter-question {
    background: white;
    color: var(--widget-primary, #4CAF93);
    border: 1px solid var(--widget-primary, #4CAF93);
    border-radius: 14px;
    padding: 6px 12px;
    font-size: 0.85em;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    line-height: 1.3;
    max-width: 100%;
    text-align: left;
}

.chat-widget-starter-question:hover {
    background: var(--widget-primary, #4CAF93);
    color: white;
}

/* Theme-Color injection: bestehende Primaerfarben-Refs nutzen die Variable */
.chat-widget-header,
.chat-widget-send-btn,
.chat-widget-accept-button {
    background: var(--widget-primary, #4CAF93);
}

.chat-widget-input:focus {
    border-color: var(--widget-primary, #4CAF93);
    box-shadow: 0 0 0 2px rgba(var(--widget-primary-rgb, 76,175,147), 0.15);
}
