/* ============================================================
   DIE SPIELBURG – Chatbot Widget Styles
   Floating chat widget, unobtrusive design
   ============================================================ */

.chatbot-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    font-family: 'Nunito', sans-serif;
}

/* ===== Toggle Button ===== */
.chatbot-toggle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
}

.chatbot-toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 28px rgba(99, 102, 241, 0.5);
}

.chatbot-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 12px;
    line-height: 1.3;
    pointer-events: none;
    animation: chatbot-pulse 2s infinite;
}

@keyframes chatbot-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

/* ===== Chat Window ===== */
.chatbot-window {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 360px;
    max-width: calc(100vw - 32px);
    height: 480px;
    max-height: calc(100vh - 120px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: opacity 0.25s ease, transform 0.25s ease;
    opacity: 1;
    transform: translateY(0);
}

.chatbot-hidden {
    opacity: 0;
    transform: translateY(16px);
    pointer-events: none;
}

/* ===== Header ===== */
.chatbot-header {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.chatbot-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chatbot-avatar {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.chatbot-name {
    font-weight: 700;
    font-size: 14px;
    line-height: 1.2;
}

.chatbot-status {
    font-size: 11px;
    opacity: 0.85;
}

.chatbot-close {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.chatbot-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ===== Messages Area ===== */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #f8f9fa;
}

.chatbot-quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 2px;
}

.chatbot-qr {
    border: 1px solid #e5e7eb;
    background: #fff;
    color: #111827;
    font-size: 12.5px;
    padding: 8px 10px;
    border-radius: 999px;
    cursor: pointer;
    transition: transform 0.12s ease, background 0.12s ease;
}

.chatbot-qr:hover {
    background: #f3f4f6;
    transform: translateY(-1px);
}

.chatbot-msg {
    max-width: 85%;
    line-height: 1.5;
    font-size: 13.5px;
}

.chatbot-msg span {
    display: inline-block;
    padding: 10px 14px;
    border-radius: 16px;
    word-break: break-word;
}

.chatbot-msg-bot {
    align-self: flex-start;
}

.chatbot-msg-bot span {
    background: #fff;
    color: #1f2937;
    border: 1px solid #e5e7eb;
    border-radius: 16px 16px 16px 4px;
}

.chatbot-kv {
    display: grid;
    gap: 8px;
}

.chatbot-kv-row {
    display: grid;
    grid-template-columns: minmax(120px, 1fr) minmax(120px, 1.2fr);
    gap: 10px;
    align-items: start;
}

.chatbot-kv-key {
    font-weight: 800;
    color: #111827;
}

.chatbot-kv-val {
    color: #374151;
}

.chatbot-msg-user {
    align-self: flex-end;
}

.chatbot-msg-user span {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    border-radius: 16px 16px 4px 16px;
}

/* ===== Typing Indicator ===== */
.chatbot-dots {
    display: inline-flex;
    gap: 4px;
    padding: 10px 18px !important;
}

.chatbot-dots span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #9ca3af;
    display: inline-block;
    padding: 0 !important;
    animation: chatbot-bounce 1.2s infinite;
}

.chatbot-dots span:nth-child(2) { animation-delay: 0.15s; }
.chatbot-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes chatbot-bounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-6px); }
}

/* ===== Input Area ===== */
.chatbot-input-area {
    display: flex;
    padding: 12px;
    gap: 8px;
    border-top: 1px solid #e5e7eb;
    background: #fff;
    flex-shrink: 0;
}

.chatbot-input {
    flex: 1;
    border: 1px solid #e5e7eb;
    border-radius: 24px;
    padding: 10px 16px;
    font-size: 13.5px;
    font-family: 'Nunito', sans-serif;
    outline: none;
    transition: border-color 0.2s;
}

.chatbot-input:focus {
    border-color: #6366f1;
}

.chatbot-input:disabled {
    opacity: 0.6;
}

.chatbot-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.15s;
}

.chatbot-send:hover {
    transform: scale(1.08);
}

/* ===== Scrollbar ===== */
.chatbot-messages::-webkit-scrollbar {
    width: 5px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 10px;
}

/* ===== Responsive ===== */
@media (max-width: 480px) {
    .chatbot-widget {
        bottom: 24px;
        right: 12px;
    }

    .chatbot-window {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        max-width: 100%;
        height: 100%;
        border-radius: 0;
        z-index: 10000;
    }

    .chatbot-toggle {
        width: 48px;
        height: 48px;
    }

    .chatbot-header {
        padding: 12px 14px;
        border-radius: 0;
    }

    .chatbot-messages {
        padding: 12px;
    }

    .chatbot-input-area {
        padding: 10px;
    }

    .chatbot-input {
        font-size: 16px;
        padding: 10px 14px;
    }

    .chatbot-qr {
        font-size: 12px;
        padding: 6px 8px;
    }

    .chatbot-msg {
        max-width: 92%;
        font-size: 13px;
    }

    .chatbot-kv-row {
        grid-template-columns: 1fr;
        gap: 2px;
    }

    .chatbot-kv-val {
        padding-left: 8px;
    }
}

@media (max-width: 360px) {
    .chatbot-qr {
        font-size: 11px;
        padding: 5px 7px;
    }
}
