/**
 * UWK RAG Chat Widget Styles
 * Modernes, responsives Chat-Widget
 */

/* CSS Variables für einfache Anpassung */
:root {
    --uwk-primary: #0073aa;
    --uwk-primary-dark: #005a87;
    --uwk-text: #333333;
    --uwk-text-light: #666666;
    --uwk-bg: #ffffff;
    --uwk-bg-light: #f5f5f5;
    --uwk-border: #e0e0e0;
    --uwk-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    --uwk-radius: 16px;
    --uwk-radius-sm: 8px;
}

/* Chat Toggle Button */
.uwk-chat-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px !important;
    left: auto !important;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0073aa 0%, #005a87 100%);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 115, 170, 0.4);
    transition: all 0.3s ease;
    z-index: 999998;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Dezente Aufmerksamkeits-Animation */
    animation: uwk-attention 3s ease-in-out 2s infinite;
}

.uwk-chat-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(0, 115, 170, 0.5);
    animation: none; /* Animation stoppen bei Hover */
}

/* Animation stoppt wenn Chat offen */
.uwk-chat-toggle.uwk-open {
    animation: none;
}

/* Aufmerksamkeits-Animation - dezentes Bounce */
@keyframes uwk-attention {
    0%, 100% { 
        transform: scale(1) translateY(0); 
    }
    10% { 
        transform: scale(1.08) translateY(-4px); 
        box-shadow: 0 8px 30px rgba(0, 115, 170, 0.5);
    }
    20% { 
        transform: scale(1) translateY(0); 
    }
}

.uwk-chat-toggle svg {
    width: 32px;
    height: 32px;
    color: #ffffff;
    transition: transform 0.3s ease;
}

.uwk-chat-toggle.uwk-open svg {
    transform: rotate(90deg);
}

/* Activity Dot - immer sichtbar! Grün = bereit, Gelb = aktive Session */
.uwk-activity-dot {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 14px;
    height: 14px;
    background: #22c55e; /* Grün = bereit/online */
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transition: background-color 0.3s ease;
}

/* Gelb/Gold = Aktive Session mit Verlauf */
.uwk-activity-dot.active {
    background: #f59e0b;
    animation: uwk-pulse 2s infinite;
}

@keyframes uwk-pulse {
    0%, 100% { transform: scale(1); box-shadow: 0 2px 4px rgba(0,0,0,0.2); }
    50% { transform: scale(1.1); box-shadow: 0 2px 8px rgba(245, 158, 11, 0.5); }
}

/* ==========================================
   ENGAGEMENT ACTION: Tooltip-Bubble
   ========================================== */
.uwk-tooltip-bubble {
    position: fixed;
    bottom: 95px;
    right: 90px;
    max-width: 260px;
    background: #ffffff;
    border-radius: 12px;
    padding: 14px 38px 14px 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
    z-index: 2147483647; /* Maximum z-index für Mobile */
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px) scale(0.95);
    -webkit-transform: translateY(10px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    -webkit-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    /* iOS Safari Fix */
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    /* Touch-freundlich */
    -webkit-tap-highlight-color: transparent;
}

.uwk-tooltip-bubble.uwk-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    -webkit-transform: translateY(0) scale(1);
}

.uwk-tooltip-bubble:hover {
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.18), 0 0 0 1px rgba(0, 115, 170, 0.3);
    transform: translateY(-2px) scale(1.02);
}

.uwk-tooltip-text {
    display: block;
    font-size: 14px;
    line-height: 1.5;
    color: #1a1a1a;
    font-weight: 500;
}

.uwk-tooltip-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    border: none;
    background: #f0f0f0;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #666666;
    transition: all 0.2s;
    line-height: 1;
    padding: 0;
}

.uwk-tooltip-close:hover {
    background: #e0e0e0;
    color: #333333;
}

.uwk-tooltip-arrow {
    position: absolute;
    top: 50%;
    right: -8px;
    width: 16px;
    height: 16px;
    background: #ffffff;
    transform: translateY(-50%) rotate(45deg);
    box-shadow: 2px -2px 4px rgba(0, 0, 0, 0.08);
    border-radius: 2px;
}

/* Tooltip Animation - dezentes Einblenden mit Bounce */
@keyframes uwk-tooltip-appear {
    0% {
        opacity: 0;
        transform: translateY(15px) scale(0.9);
    }
    60% {
        transform: translateY(-3px) scale(1.02);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.uwk-tooltip-bubble.uwk-visible {
    animation: uwk-tooltip-appear 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* Tooltip ausblenden wenn Chat geöffnet */
body.uwk-chat-active .uwk-tooltip-bubble {
    display: none !important;
}

/* Tooltip Mobile Anpassungen */
@media (max-width: 600px) {
    .uwk-tooltip-bubble {
        /* Positionierung: Über dem Toggle-Button */
        bottom: 155px;
        right: 15px;
        left: auto;
        max-width: calc(100vw - 30px);
        width: auto;
        padding: 14px 44px 14px 16px;
        /* Touch-freundlich machen */
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        user-select: none;
    }
    
    .uwk-tooltip-text {
        font-size: 14px;
        line-height: 1.4;
    }
    
    /* Arrow zeigt nach unten zum Button */
    .uwk-tooltip-arrow {
        top: auto;
        bottom: -8px;
        right: 25px;
        transform: rotate(45deg);
        -webkit-transform: rotate(45deg);
        box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.08);
    }
    
    /* Größerer Close-Button für Touch */
    .uwk-tooltip-close {
        width: 32px;
        height: 32px;
        font-size: 20px;
        top: 8px;
        right: 8px;
        /* Touch-freundlich */
        touch-action: manipulation;
    }
}

/* Tooltip auf sehr kleinen Bildschirmen zentriert */
@media (max-width: 400px) {
    .uwk-tooltip-bubble {
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    .uwk-tooltip-arrow {
        right: 20px;
    }
}

/* Tooltip im Dark Mode */
@media (prefers-color-scheme: dark) {
    .uwk-tooltip-bubble {
        background: #2d2d2d;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    }
    
    .uwk-tooltip-text {
        color: #e0e0e0;
    }
    
    .uwk-tooltip-close {
        background: #404040;
        color: #999999;
    }
    
    .uwk-tooltip-close:hover {
        background: #505050;
        color: #ffffff;
    }
    
    .uwk-tooltip-arrow {
        background: #2d2d2d;
        box-shadow: 2px -2px 4px rgba(0, 0, 0, 0.2);
    }
}

/* Dark Mode + Mobile Arrow */
@media (prefers-color-scheme: dark) and (max-width: 600px) {
    .uwk-tooltip-arrow {
        box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
    }
}

/* Quick Reply Bubbles */
.uwk-quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 0;
    margin-top: 8px;
}

.uwk-quick-reply {
    background: linear-gradient(135deg, #f0f7ff 0%, #e6f2ff 100%);
    border: 1px solid #cce0f5;
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 500;
    color: #0073aa;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.uwk-quick-reply:hover {
    background: var(--uwk-primary);
    border-color: var(--uwk-primary);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 115, 170, 0.3);
}

/* Position: Links */
.uwk-position-left .uwk-chat-toggle,
.uwk-position-left .uwk-chat-window {
    left: 20px;
    right: auto;
}

/* Chat Window */
.uwk-chat-window {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 520px;
    max-height: calc(100vh - 120px);
    background: var(--uwk-bg);
    border-radius: var(--uwk-radius);
    box-shadow: var(--uwk-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 999999;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s ease;
}

.uwk-chat-window.uwk-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Chat Header */
.uwk-chat-header {
    background: var(--uwk-primary);
    color: #ffffff;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.uwk-chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.uwk-chat-avatar svg {
    width: 24px;
    height: 24px;
    fill: #ffffff;
}

.uwk-chat-info {
    flex: 1;
}

.uwk-chat-title {
    font-weight: 600;
    font-size: 16px;
    margin: 0;
}

.uwk-chat-subtitle {
    font-size: 12px;
    opacity: 0.8;
    margin: 2px 0 0 0;
}

.uwk-chat-header-buttons {
    display: flex;
    align-items: center;
    gap: 4px;
}

.uwk-chat-reset,
.uwk-chat-close {
    background: none;
    border: none;
    color: #ffffff;
    cursor: pointer;
    padding: 6px;
    opacity: 0.7;
    transition: all 0.2s;
    border-radius: 4px;
}

.uwk-chat-reset:hover,
.uwk-chat-close:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.15);
}

.uwk-chat-reset svg,
.uwk-chat-close svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
    display: block;
}

/* Chat Messages Container */
.uwk-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--uwk-bg-light);
}

/* Custom Scrollbar */
.uwk-chat-messages::-webkit-scrollbar {
    width: 6px;
}

.uwk-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.uwk-chat-messages::-webkit-scrollbar-thumb {
    background: var(--uwk-border);
    border-radius: 3px;
}

.uwk-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #bbb;
}

/* Message Bubbles */
.uwk-message {
    display: flex;
    flex-direction: column;
    max-width: 85%;
    animation: uwk-fadeIn 0.3s ease;
}

@keyframes uwk-fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.uwk-message-user {
    align-self: flex-end;
}

.uwk-message-assistant {
    align-self: flex-start;
}

.uwk-message-bubble {
    padding: 12px 16px;
    border-radius: var(--uwk-radius);
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.uwk-message-user .uwk-message-bubble {
    background: var(--uwk-primary);
    color: #ffffff;
    border-bottom-right-radius: 4px;
}

.uwk-message-assistant .uwk-message-bubble {
    background: var(--uwk-bg);
    color: var(--uwk-text);
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.uwk-message-time {
    font-size: 11px;
    color: var(--uwk-text-light);
    margin-top: 4px;
    padding: 0 4px;
}

.uwk-message-user .uwk-message-time {
    text-align: right;
}

/* KI Thinking Indicator - Intelligente Lade-Animation */
.uwk-thinking-indicator {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: linear-gradient(135deg, var(--uwk-bg) 0%, var(--uwk-bg-light) 100%);
    border-radius: var(--uwk-radius);
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    width: fit-content;
    border: 1px solid var(--uwk-border);
}

.uwk-thinking-brain {
    position: relative;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.uwk-thinking-icon {
    font-size: 20px;
    animation: uwk-brain-pulse 2s infinite ease-in-out;
    z-index: 2;
}

.uwk-brain-icon {
    color: var(--uwk-primary);
    animation: uwk-brain-pulse 2s infinite ease-in-out;
    z-index: 2;
}

.uwk-thinking-pulse {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--uwk-primary);
    opacity: 0.15;
    animation: uwk-pulse-ring 1.5s infinite ease-out;
}

.uwk-thinking-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.uwk-thinking-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--uwk-text);
    animation: uwk-text-fade 0.3s ease-out;
}

.uwk-thinking-dots {
    display: flex;
    gap: 2px;
    font-size: 16px;
    font-weight: bold;
    color: var(--uwk-primary);
}

.uwk-thinking-dots span {
    animation: uwk-dot-bounce 1.4s infinite ease-in-out;
}

.uwk-thinking-dots span:nth-child(1) { animation-delay: 0s; }
.uwk-thinking-dots span:nth-child(2) { animation-delay: 0.2s; }
.uwk-thinking-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes uwk-brain-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

@keyframes uwk-pulse-ring {
    0% { transform: scale(0.8); opacity: 0.3; }
    100% { transform: scale(1.8); opacity: 0; }
}

@keyframes uwk-dot-bounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-4px); }
}

@keyframes uwk-text-fade {
    from { opacity: 0; transform: translateX(-5px); }
    to { opacity: 1; transform: translateX(0); }
}

/* Alte Typing-Dots (Fallback) */
.uwk-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    background: var(--uwk-bg);
    border-radius: var(--uwk-radius);
    width: fit-content;
}

.uwk-typing-dot {
    width: 8px;
    height: 8px;
    background: var(--uwk-text-light);
    border-radius: 50%;
    animation: uwk-dot-bounce 1.4s infinite ease-in-out;
}

/* Chat Input */
.uwk-chat-input-container {
    padding: 12px 16px;
    background: var(--uwk-bg);
    border-top: 1px solid var(--uwk-border);
}

.uwk-chat-form {
    display: flex;
    gap: 8px;
}

.uwk-chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--uwk-border);
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    resize: none;
    max-height: 100px;
    min-height: 44px;
    font-family: inherit;
}

.uwk-chat-input:focus {
    border-color: var(--uwk-primary);
}

.uwk-chat-input::placeholder {
    color: #999;
}

.uwk-chat-send {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: var(--uwk-primary);
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.uwk-chat-send:hover:not(:disabled) {
    background: var(--uwk-primary-dark);
    transform: scale(1.05);
}

.uwk-chat-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.uwk-chat-send svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* DSGVO Hinweis */
.uwk-chat-gdpr {
    padding: 6px 12px;
    background: var(--uwk-bg-light);
    font-size: 10px;
    color: #999;
    text-align: center;
    border-top: 1px solid var(--uwk-border);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    flex-wrap: wrap;
}

.uwk-gdpr-sep {
    color: #ccc;
}

.uwk-chat-gdpr a {
    color: #888;
    text-decoration: none;
}

.uwk-chat-gdpr a:hover {
    color: var(--uwk-primary);
}

.uwk-chat-gdpr .uwk-contact-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    color: #555;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    padding: 4px 10px;
    margin-left: 8px;
    transition: all 0.2s;
}

.uwk-chat-gdpr .uwk-contact-link:hover {
    background: var(--uwk-primary);
    border-color: var(--uwk-primary);
    color: white;
}

.uwk-chat-gdpr .uwk-contact-link svg {
    width: 12px;
    height: 12px;
}

/* Links in Messages */
.uwk-message-bubble a {
    color: inherit;
    text-decoration: underline;
}

.uwk-message-user .uwk-message-bubble a {
    color: #ffffff;
}

.uwk-message-assistant .uwk-message-bubble a {
    color: var(--uwk-primary);
}

/* MINI Produkt-Karte - Super kompakt */
.uwk-product-box {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    margin: 8px 0;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    max-width: 280px;
    text-decoration: none !important;
    transition: box-shadow 0.2s, border-color 0.2s;
}

.uwk-product-box:hover {
    border-color: var(--uwk-primary);
    box-shadow: 0 2px 8px rgba(0,115,170,0.15);
}

.uwk-product-image {
    flex-shrink: 0;
    width: 56px;
    height: 56px;
    background: #f8f8f8;
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.uwk-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.uwk-product-image .uwk-no-image {
    font-size: 24px;
    color: #ccc;
}

.uwk-product-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.uwk-product-name {
    font-weight: 600;
    font-size: 13px;
    color: #1a1a1a;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.uwk-product-price {
    display: flex;
    align-items: center;
    gap: 6px;
}

.uwk-price-current {
    font-size: 15px;
    font-weight: 700;
    color: #c41e3a;
}

.uwk-price-uvp {
    font-size: 11px;
    color: #999;
    text-decoration: line-through;
}

.uwk-product-stock {
    font-size: 10px;
    color: #28a745;
    font-weight: 500;
}

.uwk-product-stock.out-of-stock {
    color: #dc3545;
}

.uwk-product-link {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--uwk-primary);
    color: #fff !important;
    text-decoration: none !important;
    border-radius: 50%;
    font-size: 14px;
    transition: transform 0.2s, background 0.2s;
}

.uwk-product-link:hover {
    background: var(--uwk-primary-dark);
    transform: scale(1.1);
}

/* USPs ausgeblendet für kompaktes Design */
.uwk-product-usps {
    display: none;
}

.uwk-product-bottom {
    display: none;
}

.uwk-product-link:hover {
    background: var(--uwk-primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

/* Listen in Nachrichten */
.uwk-message-bubble ul {
    margin: 8px 0;
    padding-left: 18px;
}

.uwk-message-bubble li {
    margin: 3px 0;
}

/* Error Message */
.uwk-error {
    background: #fee;
    color: #c00;
    padding: 12px 16px;
    border-radius: var(--uwk-radius-sm);
    font-size: 13px;
    text-align: center;
}

/* Mobile Responsive - Tablets */
@media (max-width: 768px) {
    .uwk-chat-window {
        width: 340px;
        height: 480px;
        bottom: 80px;
        right: 15px;
    }
    
    .uwk-product-box {
        max-width: 100%;
    }
}

/* Mobile Responsive - Smartphones */
@media (max-width: 600px) {
    /* Body-Scroll blockieren wenn Chat offen */
    body.uwk-chat-active {
        overflow: hidden !important;
        position: fixed !important;
        width: 100% !important;
        height: 100% !important;
    }
    
    /* Chat als Bottom-Sheet Popup (nicht Fullscreen!) */
    .uwk-chat-window {
        position: fixed !important;
        bottom: 0 !important;
        right: 0 !important;
        left: 0 !important;
        top: auto !important;
        width: 100vw !important;
        max-width: 100vw !important;
        height: 85vh;
        max-height: 85vh;
        border-radius: 16px 16px 0 0;
        margin: 0 !important;
        padding: 0 !important;
        box-sizing: border-box !important;
        z-index: 999999 !important;
        /* Verhindert Scroll-Durchbluten zur Seite */
        overscroll-behavior: contain;
        touch-action: pan-y;
        padding-bottom: env(safe-area-inset-bottom, 0) !important;
    }
    
    .uwk-chat-window.uwk-visible {
        transform: translateY(0);
    }
    
    /* Animation von unten hochschieben */
    .uwk-chat-window {
        transform: translateY(100%);
    }

    .uwk-chat-toggle {
        /* Höher wegen Mobile Browser-Navigation Bar */
        bottom: 80px;
        right: 15px !important;
        left: auto !important;
        width: 58px;
        height: 58px;
        margin-bottom: env(safe-area-inset-bottom, 0);
    }
    
    .uwk-chat-toggle svg {
        width: 28px;
        height: 28px;
    }
    
    .uwk-activity-dot {
        width: 12px;
        height: 12px;
        top: 2px;
        right: 2px;
        border-width: 2px;
    }

    .uwk-position-left .uwk-chat-toggle {
        left: 15px;
        right: auto;
    }
    
    /* Quick Replies auf Mobile */
    .uwk-quick-replies {
        gap: 6px;
    }
    
    .uwk-quick-reply {
        padding: 8px 12px;
        font-size: 12px;
    }

    .uwk-chat-header {
        padding: 14px 16px;
        border-radius: 20px 20px 0 0;
        flex-shrink: 0;
    }
    
    .uwk-chat-title {
        font-size: 16px;
    }
    
    .uwk-chat-subtitle {
        font-size: 12px;
    }
    
    .uwk-chat-close,
    .uwk-chat-reset {
        padding: 8px;
        min-width: 40px;
        min-height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .uwk-chat-close svg,
    .uwk-chat-reset svg {
        width: 20px;
        height: 20px;
    }

    .uwk-chat-messages {
        padding: 12px;
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        /* Verhindert Scroll-Durchbluten zur Seite dahinter */
        overscroll-behavior: contain;
        touch-action: pan-y;
    }
    
    .uwk-message {
        max-width: 90%;
    }
    
    .uwk-message-bubble {
        padding: 12px 14px;
        font-size: 14px;
    }
    
    /* Input-Bereich */
    .uwk-chat-input-container {
        padding: 10px 12px;
        padding-bottom: max(10px, calc(env(safe-area-inset-bottom, 0px) + 8px));
        background: var(--uwk-bg);
    }
    
    .uwk-chat-input {
        padding: 12px 16px;
        font-size: 16px; /* Verhindert Zoom auf iOS */
        min-height: 44px;
    }
    
    .uwk-chat-send {
        width: 44px;
        height: 44px;
    }
    
    .uwk-chat-send svg {
        width: 20px;
        height: 20px;
    }
    
    /* Produkt-Karten auf Mobile */
    .uwk-product-box {
        max-width: 100%;
        padding: 8px;
    }
    
    .uwk-product-image {
        width: 50px;
        height: 50px;
    }
    
    .uwk-product-name {
        font-size: 13px;
        white-space: normal;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    
    .uwk-price-current {
        font-size: 14px;
    }
    
    .uwk-product-link {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }
    
    /* Link-Buttons für Touch */
    .uwk-link-button {
        padding: 10px 16px;
        font-size: 13px;
        margin: 6px 4px 6px 0;
    }
    
    /* GDPR kompakt */
    .uwk-chat-gdpr {
        padding: 5px 10px;
        font-size: 9px;
        gap: 3px;
    }
    
    .uwk-chat-gdpr .uwk-contact-link {
        font-size: 10px;
        padding: 4px 8px;
        margin-left: 4px;
    }
    
    .uwk-chat-gdpr .uwk-contact-link svg {
        width: 11px;
        height: 11px;
    }
    
    /* Thinking Indicator */
    .uwk-thinking-indicator {
        padding: 10px 12px;
    }
    
    .uwk-thinking-brain {
        width: 26px;
        height: 26px;
    }
}

/* Kleine Smartphones */
@media (max-width: 360px) {
    .uwk-chat-header {
        padding: 12px;
        gap: 8px;
    }
    
    .uwk-chat-avatar {
        width: 36px;
        height: 36px;
    }
    
    .uwk-chat-title {
        font-size: 15px;
    }
    
    .uwk-message-bubble {
        padding: 12px 14px;
        font-size: 14px;
    }
    
    .uwk-product-image {
        width: 50px;
        height: 50px;
    }
}

/* Landscape Mode auf Mobile */
@media (max-width: 812px) and (orientation: landscape) {
    .uwk-chat-window {
        height: 100%;
        max-height: 100vh;
    }
    
    .uwk-chat-header {
        padding: 10px 16px;
    }
    
    .uwk-chat-messages {
        padding: 8px 12px;
    }
    
    .uwk-message-bubble {
        padding: 10px 14px;
    }
}

/* ========================================
   KONTAKTFORMULAR STYLES
   ======================================== */

/* Footer mit Kontakt-Link */
/* Footer mit Kontakt-Link - sehr dezent */
.uwk-chat-footer {
    padding: 0;
    background: transparent;
    text-align: center;
    border: none;
}

.uwk-contact-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    color: #999;
    font-size: 11px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 3px;
    transition: all 0.2s;
    opacity: 0.8;
}

.uwk-contact-link:hover {
    opacity: 1;
    color: var(--uwk-primary);
}

.uwk-contact-link svg {
    flex-shrink: 0;
    width: 12px;
    height: 12px;
}

/* Kontaktformular Overlay */
.uwk-contact-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    border-radius: inherit;
}

.uwk-contact-overlay.uwk-visible {
    opacity: 1;
    visibility: visible;
}

.uwk-contact-form-container {
    background: #ffffff;
    width: 100%;
    max-height: 85%;
    border-radius: 16px 16px 0 0;
    padding: 20px;
    overflow-y: auto;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
}

.uwk-contact-overlay.uwk-visible .uwk-contact-form-container {
    transform: translateY(0);
}

.uwk-contact-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.uwk-contact-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #1a1a1a;
}

.uwk-contact-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: #666666;
    border-radius: 4px;
    transition: all 0.2s;
}

.uwk-contact-close:hover {
    background: #f0f0f0;
    color: #333333;
}

.uwk-contact-desc {
    font-size: 13px;
    color: #666666;
    margin: 0 0 16px 0;
}

/* Formular-Felder */
.uwk-contact-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.uwk-form-row label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: #333333;
    margin-bottom: 4px;
}

.uwk-form-row input,
.uwk-form-row select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--uwk-border);
    border-radius: 8px;
    font-size: 14px;
    background: #ffffff;
    color: #333333;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.uwk-form-row select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
    cursor: pointer;
}

.uwk-form-row select option {
    background: #ffffff;
    color: #333333;
}

.uwk-form-row input:focus,
.uwk-form-row select:focus {
    outline: none;
    border-color: var(--uwk-primary);
}

.uwk-form-row input::placeholder {
    color: #888;
}

.uwk-form-row-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* Checkbox */
.uwk-form-checkbox label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    cursor: pointer;
    font-size: 12px;
    line-height: 1.4;
}

.uwk-form-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    margin-top: 2px;
    accent-color: var(--uwk-primary);
}

.uwk-form-checkbox span {
    color: #555555;
}

.uwk-form-checkbox a {
    color: var(--uwk-primary);
    text-decoration: none;
}

.uwk-form-checkbox a:hover {
    text-decoration: underline;
}

/* Fehlermeldung */
.uwk-form-error {
    color: #dc3545;
    font-size: 12px;
    min-height: 18px;
}

/* Submit Button */
.uwk-contact-submit {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px 20px;
    background: var(--uwk-primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.uwk-contact-submit:hover:not(:disabled) {
    background: var(--uwk-primary-dark);
}

.uwk-contact-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Spinner */
.uwk-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: uwk-spin 0.8s linear infinite;
}

@keyframes uwk-spin {
    to { transform: rotate(360deg); }
}

/* Erfolgsanzeige */
.uwk-contact-success {
    text-align: center;
    padding: 20px 0;
}

.uwk-success-icon {
    width: 60px;
    height: 60px;
    background: #28a745;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    margin: 0 auto 16px;
    animation: uwk-scale-in 0.3s ease;
}

@keyframes uwk-scale-in {
    from { transform: scale(0); }
    to { transform: scale(1); }
}

.uwk-contact-success h4 {
    margin: 0 0 8px 0;
    font-size: 18px;
    color: #1a1a1a;
}

.uwk-contact-success p {
    margin: 0 0 20px 0;
    color: #666666;
    font-size: 14px;
}

.uwk-contact-done {
    padding: 10px 24px;
    background: #f5f5f5;
    color: #333333;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.uwk-contact-done:hover {
    background: #e5e5e5;
}

/* Mobile Anpassungen für Kontaktformular */
@media (max-width: 600px) {
    .uwk-contact-overlay {
        border-radius: 16px 16px 0 0;
    }
    
    .uwk-contact-form-container {
        padding: 16px;
        max-height: 80%;
        border-radius: 16px 16px 0 0;
    }
    
    .uwk-form-row-2col {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .uwk-form-row input,
    .uwk-form-row select {
        font-size: 16px; /* Verhindert Zoom auf iOS */
        padding: 12px;
    }
    
    .uwk-contact-header {
        margin-bottom: 12px;
    }
    
    .uwk-contact-header h4 {
        font-size: 15px;
    }
    
    .uwk-contact-desc {
        font-size: 12px;
        margin-bottom: 14px;
    }
    
    .uwk-contact-form {
        gap: 10px;
    }
    
    .uwk-form-row label {
        font-size: 11px;
        margin-bottom: 3px;
    }
    
    .uwk-form-checkbox label {
        font-size: 11px;
        gap: 6px;
    }
    
    .uwk-form-checkbox input[type="checkbox"] {
        width: 16px;
        height: 16px;
    }
    
    .uwk-contact-submit {
        padding: 12px 16px;
        font-size: 14px;
    }
}

/* Dark Mode Support (wenn WordPress Dark Mode aktiv) */
/* Link-Buttons - auffällige klickbare Buttons für Links */
.uwk-link-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    margin: 8px 4px 8px 0;
    background: linear-gradient(135deg, #ff6b35 0%, #e55a2b 100%);
    color: #ffffff !important;
    text-decoration: none !important;
    border-radius: 25px;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 3px 10px rgba(255, 107, 53, 0.35);
    transition: all 0.2s ease;
    white-space: nowrap;
    border: none;
}

.uwk-link-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 107, 53, 0.45);
    background: linear-gradient(135deg, #ff7b4a 0%, #ff6b35 100%);
}

.uwk-link-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(255, 107, 53, 0.3);
}

/* Dark Mode */
@media (prefers-color-scheme: dark) {
    .uwk-chat-window {
        --uwk-bg: #1e1e1e;
        --uwk-bg-light: #2d2d2d;
        --uwk-text: #e0e0e0;
        --uwk-text-light: #999999;
        --uwk-border: #404040;
    }

    .uwk-message-assistant .uwk-message-bubble {
        background: #2d2d2d;
        box-shadow: none;
    }

    .uwk-thinking-indicator {
        background: linear-gradient(135deg, #2d2d2d 0%, #353535 100%);
        border-color: #404040;
    }
    
    .uwk-typing {
        background: #2d2d2d;
        box-shadow: none;
    }

    .uwk-chat-input {
        background: #2d2d2d;
        color: #e0e0e0;
    }

    .uwk-link-button {
        background: linear-gradient(135deg, #ff7b4a 0%, #e55a2b 100%);
        box-shadow: 0 2px 8px rgba(255, 107, 53, 0.4);
    }
}

/* ======================================== */
/* LIVE SUPPORT STYLES                      */
/* ======================================== */

/* Supporter Nachricht */
.uwk-message-supporter {
    margin: 12px 0;
}

.uwk-message-supporter .uwk-message-bubble,
.uwk-supporter-bubble {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%) !important;
    color: white !important;
    border-radius: 16px 16px 4px 16px !important;
    margin-left: 20px;
    box-shadow: 0 2px 12px rgba(220, 53, 69, 0.3);
}

.uwk-supporter-label {
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 6px;
    opacity: 0.9;
}

/* Supporter Takeover Ankündigung */
.uwk-message-supporter-takeover {
    margin: 16px 0;
}

.uwk-supporter-takeover-notice {
    background: linear-gradient(135deg, #28a745 0%, #218838 100%);
    color: white;
    padding: 14px 18px;
    border-radius: 12px;
    text-align: center;
    font-weight: 500;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
    animation: uwk-takeover-pulse 2s ease-in-out;
}

.uwk-supporter-icon {
    font-size: 20px;
}

@keyframes uwk-takeover-pulse {
    0% {
        transform: scale(0.95);
        opacity: 0;
    }
    50% {
        transform: scale(1.02);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Neue Nachricht Animation */
.uwk-message-supporter .uwk-message-bubble {
    animation: uwk-new-supporter-msg 0.5s ease-out;
}

@keyframes uwk-new-supporter-msg {
    0% {
        transform: translateX(20px);
        opacity: 0;
    }
    100% {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Live-Chat beendet Nachricht */
.uwk-message-supporter-end {
    margin: 16px 0;
}

.uwk-supporter-end-notice {
    background: linear-gradient(135deg, #ffc107 0%, #e0a800 100%);
    color: #212529;
    padding: 14px 18px;
    border-radius: 12px;
    text-align: center;
    font-weight: 500;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 4px 15px rgba(255, 193, 7, 0.3);
}
