/* ===== CHAT WIDGET STYLES ===== */

/* Floating Button */
.chat-floating-btn {
    position: fixed;
    bottom: 25px;
    right: 25px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #2c5f6f 0%, #4a90a4 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(44, 95, 111, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 9998;
    color: white;
    border: none;
}

.chat-floating-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(44, 95, 111, 0.5);
}

.chat-floating-btn.chat-btn-hidden {
    transform: scale(0);
    opacity: 0;
    pointer-events: none;
}

.chat-notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #e76f51;
    color: white;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    border: 2px solid white;
    animation: pulse 2s ease-in-out infinite;
}

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

/* Chat Window */
.chat-window {
    position: fixed;
    bottom: 25px;
    right: 25px;
    width: 380px;
    height: 600px;
    max-height: calc(100vh - 50px);
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    transform: scale(0) translateY(20px);
    transform-origin: bottom right;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 9999;
    overflow: hidden;
}

.chat-window-open {
    transform: scale(1) translateY(0);
    opacity: 1;
}

/* Header */
.chat-header {
    background: linear-gradient(135deg, #2c5f6f 0%, #4a90a4 100%);
    color: white;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 20px 20px 0 0;
    flex-shrink: 0;
}

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

.chat-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

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

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

.chat-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    opacity: 0.9;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #4CAF50;
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

.chat-close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
    transition: all 0.3s ease;
}

.chat-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* Messages */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
    scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

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

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.chat-message {
    margin-bottom: 16px;
    animation: messageSlideIn 0.3s ease-out;
}

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

.message-content {
    display: flex;
    gap: 10px;
}

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

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
}

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

.message-bubble {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 18px;
    position: relative;
}

.chat-message-bot .message-bubble {
    background: white;
    border: 1px solid #e0e0e0;
    border-bottom-left-radius: 4px;
}

.chat-message-user .message-bubble {
    background: linear-gradient(135deg, #2c5f6f 0%, #4a90a4 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.message-bubble p {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.5;
}

.message-time {
    font-size: 0.75rem;
    opacity: 0.6;
    margin-top: 4px;
    display: block;
}

/* Quick Replies */
.chat-quick-replies {
    padding: 10px 20px;
    background: #f8f9fa;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    border-top: 1px solid #e0e0e0;
}

.quick-reply-btn {
    padding: 8px 16px;
    background: white;
    border: 1px solid #2c5f6f;
    color: #2c5f6f;
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.quick-reply-btn:hover {
    background: #2c5f6f;
    color: white;
    transform: translateY(-2px);
}

/* Typing Indicator */
.chat-typing {
    padding: 15px 20px;
    background: #f8f9fa;
}

.typing-indicator {
    display: flex;
    gap: 4px;
    align-items: center;
    padding: 12px 16px;
    background: white;
    border-radius: 18px;
    width: fit-content;
    border: 1px solid #e0e0e0;
}

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

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

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

/* Input Area */
.chat-input-container {
    background: white;
    border-top: 1px solid #e0e0e0;
    padding: 15px 20px 10px;
    flex-shrink: 0;
}

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

.chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 25px;
    font-size: 0.95rem;
    outline: none;
    transition: all 0.3s ease;
}

.chat-input:focus {
    border-color: #2c5f6f;
    box-shadow: 0 0 0 3px rgba(44, 95, 111, 0.1);
}

.chat-send-btn {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #2c5f6f 0%, #4a90a4 100%);
    border: none;
    border-radius: 50%;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.chat-send-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(44, 95, 111, 0.3);
}

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

.chat-powered-by {
    text-align: center;
    font-size: 0.7rem;
    color: #999;
    margin-top: 8px;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .chat-window {
        width: calc(100vw - 20px);
        height: calc(100vh - 20px);
        bottom: 10px;
        right: 10px;
        max-height: calc(100vh - 20px);
        border-radius: 15px;
    }

    .chat-floating-btn {
        bottom: 20px;
        right: 20px;
        width: 55px;
        height: 55px;
    }

    .chat-header {
        padding: 15px;
    }

    .chat-messages {
        padding: 15px;
    }

    .message-bubble {
        max-width: 85%;
    }

    .chat-input-container {
        padding: 12px 15px 8px;
    }
}

/* Markdown Formatting Styles */
.message-bubble .message-text {
    line-height: 1.6;
}

.message-bubble strong {
    font-weight: 600;
    color: #2c5f6f;
}

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

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

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

.message-bubble ul li {
    margin: 5px 0;
    list-style-type: disc;
}

.message-bubble blockquote {
    margin: 10px 0;
    padding: 10px 15px;
    border-left: 4px solid #2c5f6f;
    background: #f0f7f9;
    border-radius: 0 8px 8px 0;
    font-style: italic;
    color: #555;
}

/* Tabelle Markdown */
.message-bubble .chat-table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
    font-size: 0.9rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    overflow: hidden;
}

.message-bubble .chat-table th {
    background: linear-gradient(135deg, #2c5f6f 0%, #4a90a4 100%);
    color: white;
    padding: 12px 10px;
    text-align: left;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.message-bubble .chat-table td {
    padding: 10px;
    border-bottom: 1px solid #e0e0e0;
    color: #333;
}

.message-bubble .chat-table tr:last-child td {
    border-bottom: none;
}

.message-bubble .chat-table tr:nth-child(even) {
    background: #f8f9fa;
}

.message-bubble .chat-table tr:hover {
    background: #f0f7f9;
}

/* Print styles - hide chat */
@media print {
    .chat-floating-btn,
    .chat-window {
        display: none !important;
    }
}
