/* ============================================================
   Elektrotechnik Schwab - Chatbot "Robi" Stylesheet
   Extracted from inline styles shared across pages that use
   the chatbot (index, leistungen, kontakt, jobs, projekte,
   datenschutz).
   ============================================================ */

/* ==========================================================
   1. QUICK REPLY BUTTONS
   ========================================================== */
.quick-reply-btn {
    background: linear-gradient(135deg, #f3f4f6, #e5e7eb);
    border: 1px solid #e5e7eb;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.quick-reply-btn:hover {
    background: linear-gradient(135deg, var(--brand-yellow), #fbbf24);
    border-color: var(--brand-yellow);
    transform: scale(1.05);
}

/* ==========================================================
   2. CHAT BUBBLES
   ========================================================== */
.chat-bubble-user {
    background: linear-gradient(135deg, var(--brand-yellow), #fbbf24);
    color: #1f2937;
    padding: 10px 14px;
    border-radius: 18px 18px 4px 18px;
    max-width: 80%;
    margin-left: auto;
    font-size: 14px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.chat-bubble-bot {
    background: white;
    color: #374151;
    padding: 10px 14px;
    border-radius: 18px 18px 18px 4px;
    max-width: 80%;
    font-size: 14px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

/* ==========================================================
   3. TYPING INDICATOR
   ========================================================== */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 10px 14px;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: #9ca3af;
    border-radius: 50%;
    animation: typingBounce 1.4s ease-in-out infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

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

/* ==========================================================
   4. CHAT WINDOW STATE
   ========================================================== */
#chatWindow {
    background: #ffffff !important;
    z-index: 9999;
    isolation: isolate;
}

#chatWindow.open {
    transform: scale(1);
    opacity: 1;
    pointer-events: auto;
}

#chatbotToggle.open #chatbotIcon {
    transform: rotate(180deg);
}

/* ==========================================================
   5. CHATBOT GREETING ANIMATION
   ========================================================== */
@keyframes robi-bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-20px); }
    60% { transform: translateY(-10px); }
}

@keyframes robi-wave {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(20deg); }
    75% { transform: rotate(-20deg); }
}

@keyframes greeting-popup {
    0% { transform: scale(0) translateY(10px); opacity: 0; }
    50% { transform: scale(1.1) translateY(-5px); }
    100% { transform: scale(1) translateY(0); opacity: 1; }
}

@keyframes greeting-pulse {
    0%, 100% { box-shadow: 0 4px 20px rgba(233, 223, 60, 0.4); }
    50% { box-shadow: 0 4px 30px rgba(233, 223, 60, 0.7); }
}

#chatbotToggle.bounce {
    animation: robi-bounce 1s ease;
}

#chatbotGreeting {
    position: absolute;
    bottom: 70px;
    right: 0;
    background: linear-gradient(135deg, var(--brand-dark), #374151);
    color: white;
    padding: 12px 16px;
    border-radius: 16px 16px 4px 16px;
    font-size: 14px;
    white-space: nowrap;
    opacity: 0;
    transform: scale(0);
    pointer-events: none;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    border: 2px solid var(--brand-yellow);
}

#chatbotGreeting.show {
    animation: greeting-popup 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards,
               greeting-pulse 2s ease-in-out 0.5s infinite;
    pointer-events: auto;
}

#chatbotGreeting .wave-emoji {
    display: inline-block;
    animation: robi-wave 1s ease-in-out infinite;
}

/* ==========================================================
   6. ROBI AVATAR ANIMATION
   ========================================================== */
.robi-avatar {
    animation: robi-idle 3s ease-in-out infinite;
}

.robi-avatar-small {
    transition: transform 0.3s ease;
}

.robi-avatar-small:hover {
    transform: scale(1.1) rotate(5deg);
}

@keyframes robi-idle {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-2px); }
}

@keyframes robi-blink {
    0%, 90%, 100% { opacity: 1; }
    95% { opacity: 0.3; }
}

.robi-avatar svg rect:nth-child(2),
.robi-avatar svg rect:nth-child(3) {
    animation: robi-blink 4s infinite;
}

/* ==========================================================
   7. CHATBOT CONTAINER Z-INDEX FIX
   ========================================================== */
#chatbot {
    z-index: 9998 !important;
    isolation: isolate;
}

#chatbotToggle {
    z-index: 9998;
    position: relative;
}

/* ==========================================================
   8. CHATBOT MOBILE RESPONSIVE
   ========================================================== */
@media (max-width: 768px) {
    #chatbot {
        right: auto;
        left: auto;
    }

    #chatWindow {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-width: 100%;
        border-radius: 1rem 1rem 0 0;
        max-height: 85vh;
        z-index: 99999;
        background: #ffffff !important;
    }

    #chatbotGreeting {
        white-space: normal;
        max-width: 200px;
    }
}
