/* Chatbot Styles */
:root {
    --chat-primary: #EB5E28;
    --chat-secondary: #A99985;
    --chat-bg: #ffffff;
    --chat-text: #333333;
    --chat-bubble-user: #A99985;
    --chat-bubble-bot: #f0f0f0;
}

/* Chat Toggle Button - OVERRIDDEN BY JS INLINE STYLES */
.chat-toggle {
    /* All styles are applied via JavaScript inline styles for maximum priority */
    z-index: 10001 !important; /* Höher als Info-Button */
}

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

.chat-toggle:hover {
    transform: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.chat-toggle.active {
    animation: none;
}

.chat-toggle svg {
    width: 35px !important;
    height: 35px !important;
    fill: white !important;
}

/* Removed fallback icon - only use SVG */

.chat-notification {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 20px;
    height: 20px;
    background: #ff4444;
    border-radius: 50%;
    display: none;
    animation: bounce 1s infinite;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-5px);
    }
}

/* Chat Window */
.chat-window {
    position: fixed;
    bottom: 115px;
    left: 20px;
    width: 650px;
    height: 850px;
    max-height: 90vh;
    background: var(--chat-bg);
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    z-index: 10002; /* Höher als Info-Modal */
    overflow: hidden;
}

.chat-window.active {
    display: flex;
    animation: slideUp 0.3s ease-out;
}

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

/* Chat Header */
.chat-header {
    background: linear-gradient(135deg, var(--chat-primary), var(--chat-secondary));
    padding: 20px;
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.chat-email,
.chat-print,
.chat-whatsapp,
.chat-clear {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.chat-email:hover,
.chat-print:hover,
.chat-whatsapp:hover,
.chat-clear:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.chat-whatsapp:hover {
    background: rgba(37, 211, 102, 0.3);
}

.chat-clear:hover {
    background: rgba(255, 68, 68, 0.3);
}

.chat-email svg,
.chat-print svg,
.chat-whatsapp svg,
.chat-clear svg {
    width: 20px;
    height: 20px;
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-avatar {
    width: 40px;
    height: 40px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-avatar img {
    width: 35px;
    height: 35px;
    border-radius: 50%;
}

.chat-header-text h3 {
    margin: 0;
    font-size: 0.88rem;
    font-weight: 600;
}

.chat-header-text p {
    margin: 0;
    font-size: 0.68rem;
    opacity: 0.9;
}

.chat-close {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid white;
    border-radius: 50%;
    color: white;
    font-size: 1.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.chat-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.chat-close:active {
    transform: scale(0.95);
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #fafafa;
}

.chat-message {
    margin-bottom: 15px;
    display: flex;
    animation: fadeIn 0.3s ease;
    gap: 10px;
    align-items: flex-start;
}

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

.chat-message.bot {
    justify-content: flex-start;
}

.chat-message.user {
    justify-content: flex-end;
    flex-direction: row-reverse;
}

/* Message Avatar */
.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

.chat-message.bot .message-avatar {
    background: #ffffff;
    border: 1px solid #e0e0e0;
}

.chat-message.user .message-avatar {
    background: #6c757d;
}

.message-avatar svg {
    width: 20px;
    height: 20px;
    color: white;
}

.message-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Message Content Wrapper */
.message-content-wrapper {
    display: flex;
    flex-direction: column;
    gap: 3px;
    max-width: 70%;
}

.message-bubble {
    padding: 8px 12px;
    border-radius: 18px;
    word-wrap: break-word;
    width: fit-content;
    font-size: 0.78rem;
    line-height: 1.35;
}

.chat-message.bot .message-bubble {
    background: var(--chat-bubble-bot);
    color: var(--chat-text);
    border-bottom-left-radius: 4px;
}

.chat-message.user .message-bubble {
    background: var(--chat-bubble-user);
    color: white;
    border-bottom-right-radius: 4px;
}

/* Formatierung für HTML-Inhalte in Nachrichten */
.message-bubble h1,
.message-bubble h2,
.message-bubble h3 {
    margin: 8px 0 6px 0;
    font-size: 0.95rem;
    color: inherit;
    font-weight: 600;
}

.message-bubble h1 {
    font-size: 1.1rem;
}

.message-bubble h2 {
    font-size: 1rem;
}

.message-bubble p {
    margin: 6px 0;
    line-height: 1.4;
}

.message-bubble ul,
.message-bubble ol {
    margin: 10px 0;
    padding-left: 20px;
}

.message-bubble li {
    margin: 4px 0;
}

.message-bubble strong {
    font-weight: 600;
    color: inherit;
}

.message-bubble em {
    font-style: italic;
}

.message-bubble u {
    text-decoration: underline;
}

.message-bubble strike {
    text-decoration: line-through;
    opacity: 0.7;
}

.message-bubble a {
    color: var(--chat-primary);
    text-decoration: underline;
}

.chat-message.user .message-bubble a {
    color: white;
    font-weight: 600;
}

/* Farbige Texte in Bot-Nachrichten */
.chat-message.bot .message-bubble [style*="color:"] {
    font-weight: 500;
}

/* Hintergrundfarben */
.message-bubble [style*="background-color:"] {
    padding: 2px 6px;
    border-radius: 3px;
}

.message-time {
    font-size: 0.6rem;
    color: #999;
    padding: 0 4px;
}

.chat-message.user .message-time {
    text-align: right;
}

.chat-message.bot .message-time {
    text-align: left;
}

/* Typing Indicator */
.typing-indicator {
    display: none;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    background: var(--chat-bubble-bot);
    border-radius: 20px;
    border-bottom-left-radius: 4px;
    width: fit-content;
    margin-bottom: 10px;
    animation: fadeInUp 0.3s ease;
}

.typing-indicator.active {
    display: flex;
}

.typing-avatar {
    width: 32px;
    height: 32px;
    background: #ffffff;
    border: 2px solid #e0e0e0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}

.typing-avatar svg {
    width: 18px;
    height: 18px;
    color: white;
}

.typing-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.typing-text {
    color: #666;
    font-size: 0.75rem;
    font-style: italic;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Moderne Tipp-Blasen Animation (wie WhatsApp/iMessage) */
.typing-dots {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: 2px;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: #999;
    border-radius: 50%;
    animation: typing-bounce 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) {
    animation-delay: 0s;
}

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

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

@keyframes typing-bounce {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.5;
    }
    30% {
        transform: translateY(-8px);
        opacity: 1;
    }
}

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

/* Pulsierender Effekt für das Avatar-Bild während des Tippens */
.typing-indicator.active .typing-avatar {
    animation: avatar-pulse 2s infinite ease-in-out;
}

@keyframes avatar-pulse {
    0%, 100% {
        box-shadow: 0 2px 4px rgba(0,0,0,0.08);
        border-color: #e0e0e0;
    }
    50% {
        box-shadow: 0 2px 8px rgba(235, 94, 40, 0.3);
        border-color: #EB5E28;
    }
}

/* Emergency Button */
.chat-emergency {
    padding: 8px 12px;
    background: linear-gradient(135deg, #f8f8f8, #f0f0f0);
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.emergency-button,
.directions-button {
    flex: 1;
    min-width: 120px;
    padding: 4px 9px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 15px;
    font-weight: 500;
    font-size: 0.65rem;
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 0.9;
    line-height: 1.2;
}

.emergency-button {
    color: #d32f2f;
    border-color: #ffcdd2;
    /* Dezente Animation nur bei kritischen Zeiten */
}

.directions-button {
    color: #1976d2;
    border-color: #bbdefb;
}

.emergency-button:hover {
    background: #ffebee;
    color: #c62828;
    transform: translateY(-1px);
    opacity: 1;
    box-shadow: 0 2px 5px rgba(211, 47, 47, 0.2);
}

.directions-button:hover {
    background: #e3f2fd;
    color: #1565c0;
    transform: translateY(-1px);
    opacity: 1;
    box-shadow: 0 2px 5px rgba(25, 118, 210, 0.2);
}

@keyframes pulse-emergency {
    0%, 100% {
        opacity: 0.9;
    }
    50% {
        opacity: 1;
    }
}

/* Quick Actions */
.chat-quick-actions {
    padding: 15px;
    background: white;
    border-top: 1px solid #eee;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    max-height: 180px;
    overflow-y: auto;
    position: relative;
}

.quick-action {
    padding: 6px 11px;
    background: white;
    border: 2px solid var(--chat-secondary);
    border-radius: 20px;
    color: var(--chat-primary);
    font-size: 0.7rem;
    cursor: pointer;
    transition: all 0.3s ease;
    flex: 0 1 auto;
    min-width: 100px;
    text-align: center;
    font-weight: 500;
    line-height: 1.2;
}

.quick-action:hover {
    background: var(--chat-secondary);
    color: white;
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* Scrollbar for quick actions */
.chat-quick-actions::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}

.chat-quick-actions::-webkit-scrollbar-track {
    background: transparent;
}

.chat-quick-actions::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 2px;
}

.chat-quick-actions::-webkit-scrollbar-thumb:hover {
    background: #bbb;
}

/* Chat Input */
.chat-input-container {
    padding: 15px;
    background: white;
    border-top: 1px solid #eee;
    display: flex;
    gap: 10px;
    align-items: center;
}

.chat-input {
    flex: 1;
    padding: 7px 11px;
    border: 1px solid #ddd;
    border-radius: 25px;
    outline: none;
    font-size: 0.78rem;
    transition: border-color 0.3s ease;
}

.chat-input:focus {
    border-color: var(--chat-secondary);
}

.chat-send {
    background: var(--chat-primary);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.chat-send:hover {
    background: var(--chat-secondary);
    transform: scale(1.1);
}

.chat-send svg {
    width: 20px;
    height: 20px;
    fill: white;
}

/* Responsive */
@media (max-width: 768px) {
    /* Chatbot komplett auf Mobile verstecken */
    .chat-toggle,
    .chat-window {
        display: none !important;
    }
    
    /* Alte Mobile-Anpassungen auskommentiert - nicht mehr benötigt
    .chat-window {
        position: fixed;
        top: auto !important;
        bottom: 10px !important;
        left: 50% !important;
        right: auto !important;
        width: 92% !important;
        max-width: 420px !important;
        height: 65vh !important;
        max-height: 65vh !important;
        min-height: 65vh !important;
        border-radius: 20px !important;
        border: none !important;
        z-index: 9000 !important;
        transform: translateX(-50%) !important;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3) !important;
        display: flex !important;
        flex-direction: column !important;
    }
    
    .chat-window.active {
        animation: slideUpMobile 0.3s ease-out;
    }
    
    @keyframes slideUpMobile {
        from {
            transform: translateY(100%);
        }
        to {
            transform: translateY(0);
        }
    }
    
    .chat-toggle {
        bottom: 20px;
        left: 20px;
        width: 46px !important;
        height: 46px !important;
        box-shadow: 0 2px 8px rgba(235, 94, 40, 0.25) !important;
    }
    
    .chat-toggle svg {
        width: 22px !important;
        height: 22px !important;
    }
    
    /* Chat Header mobile Anpassungen */
    .chat-header {
        padding: 12px;
        position: sticky;
        top: 0;
        z-index: 1000;
    }
    
    .chat-header-text h3 {
        font-size: 1.1rem;
    }
    
    .chat-header-text p {
        font-size: 0.85rem;
    }
    
    /* Close Button besser sichtbar auf Mobile */
    .chat-close {
        width: 40px;
        height: 40px;
        font-size: 2rem;
        background: rgba(255, 68, 68, 0.9);
        border: none;
        font-weight: normal;
    }
    
    .chat-close:hover {
        background: rgba(255, 68, 68, 1);
    }
    
    /* Messages mobile Anpassungen */
    .chat-messages {
        padding: 10px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        flex: 1;
        min-height: 0;
        max-height: 150px;
    }
    
    .message-bubble {
        max-width: 85%;
        padding: 10px 14px;
        font-size: 0.95rem;
    }
    
    .message-content-wrapper {
        max-width: 80%;
    }
    
    /* Input mobile Anpassungen */
    .chat-input-container {
        padding: 12px;
        position: sticky;
        bottom: 0;
        background: white;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    }
    
    .chat-input {
        font-size: 16px; /* Verhindert Zoom auf iOS */
        padding: 10px 15px;
        border: 2px solid #ddd;
    }
    
    .chat-send {
        width: 44px;
        height: 44px;
    }
    
    /* Quick actions on mobile */
    .quick-action {
        min-width: 100px;
        font-size: 0.8rem;
        padding: 6px 10px;
    }
    
    .chat-quick-actions {
        padding: 8px;
        max-height: 80px;
    }
    
    /* Emergency buttons mobile */
    .chat-emergency {
        padding: 8px;
        position: sticky;
        top: 0;
    }
    
    .emergency-button,
    .directions-button {
        font-size: 0.8rem;
        padding: 8px 10px;
    }
    */
}

/* Spezielle Anpassungen für sehr kleine Bildschirme */
@media (max-width: 380px) {
    /* Chatbot komplett auf Mobile verstecken */
    .chat-toggle,
    .chat-window {
        display: none !important;
    }
    
    /* Alte Mobile-Anpassungen auskommentiert - nicht mehr benötigt
    .chat-toggle {
        bottom: 20px;
        left: 20px;
        width: 46px !important;
        height: 46px !important;
    }
    
    .chat-header {
        padding: 12px;
    }
    
    .chat-header-text h3 {
        font-size: 1rem;
    }
    
    .chat-header-actions {
        gap: 5px;
    }
    
    .chat-email,
    .chat-print,
    .chat-whatsapp,
    .chat-clear {
        width: 28px;
        height: 28px;
    }
    
    .chat-close {
        width: 35px;
        height: 35px;
        font-size: 1.8rem;
    }
    
    .message-bubble {
        font-size: 0.9rem;
        padding: 8px 12px;
    }
    
    .chat-input {
        font-size: 16px;
        padding: 8px 12px;
    }
    
    .quick-action {
        font-size: 0.8rem;
        padding: 6px 10px;
        min-width: 90px;
    }
    */
}

/* Scroll Styling */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}

/* Email Dialog Styles */
.email-dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999999;
    animation: fadeIn 0.3s ease;
}

.email-dialog {
    background: white;
    border-radius: 15px;
    width: auto;
    min-width: 300px;
    max-width: 450px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    animation: slideInUp 0.3s ease;
    position: relative;
    z-index: 10000000;
    margin: 20px;
}

.email-dialog-header {
    padding: 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.email-dialog-header h3 {
    margin: 0;
    color: var(--chat-primary);
    font-size: 1.2rem;
}

.email-dialog-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.3s ease;
}

.email-dialog-close:hover {
    background: #f5f5f5;
    color: #333;
}

.email-dialog-body {
    padding: 20px;
}

.email-dialog-body p {
    margin: 0 0 15px 0;
    color: #666;
}

.email-input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
}

.email-input:focus {
    outline: none;
    border-color: var(--chat-primary);
}

.email-dialog-footer {
    padding: 15px 20px;
    background: #f9f9f9;
    border-top: 1px solid #eee;
    border-radius: 0 0 15px 15px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.email-cancel,
.email-send {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.email-cancel {
    background: #e0e0e0;
    color: #666;
}

.email-cancel:hover {
    background: #d0d0d0;
}

.email-send {
    background: var(--chat-primary);
    color: white;
}

.email-send:hover {
    background: var(--chat-secondary);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(235, 94, 40, 0.3);
}

.email-save {
    background: #28a745;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: background 0.3s;
}

.email-save:hover {
    background: #218838 !important;
}

.email-close-anyway {
    background: #ff4444;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.3s;
}

.email-close-anyway:hover {
    background: #cc0000 !important;
}

