/* AI Chat Widget Styling */

/* Chat Button - Floating action button rechtsonder */
#ai-chat-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2D8655 0%, #2B7A88 100%);
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    transition: all 0.3s ease;
    z-index: 1000;
    animation: pulse 2s infinite;
}

#ai-chat-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

#ai-chat-button.active {
    background: linear-gradient(135deg, #2B7A88 0%, #294E89 100%);
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    }
    50% {
        box-shadow: 0 4px 20px rgba(102, 126, 234, 0.8);
    }
}

/* Chat notification badge */
#ai-chat-button .notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff4444;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    border: 2px solid white;
}

/* Chat Container */
#ai-chat-container {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 550px;
    max-height: calc(100vh - 120px);
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 999;
    animation: slideUp 0.3s ease;
}

#ai-chat-container.show {
    display: flex;
}

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

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

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

.ai-chat-avatar {

    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.ai-chat-title h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.ai-chat-status {
    font-size: 12px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 4px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4ade80;
    animation: blink 2s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.ai-chat-actions {
    display: flex;
    gap: 8px;
}

.ai-chat-actions button {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.ai-chat-actions button:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Chat Messages */
.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ai-chat-message {
    display: flex;
    gap: 12px;
    animation: fadeIn 0.3s ease;
}

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

.ai-chat-message.user {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 32px;
    height: 32px;    
    border-radius: 50%;
    background: linear-gradient(135deg, #2D8655 0%, #2B7A88 100%); 
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.ai-chat-message.user .message-avatar {
    background: linear-gradient(135deg, #2B7A88 0%, #294E89 100%);
}

.message-bubble {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 16px;
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    word-wrap: break-word;
}

.ai-chat-message.user .message-bubble {
    background: linear-gradient(135deg, #2D8655 0%, #2B7A88 100%);
    color: white;
}

.message-content {
    font-size: 14px;
    line-height: 1.5;
    margin: 0;
}

.message-time {
    font-size: 11px;
    opacity: 0.6;
    margin-top: 4px;
    text-align: right;
}

/* Welcome Message */
.ai-chat-welcome {
    background: linear-gradient(135deg, #667eea20 0%, #764ba220 100%);
    border: 1px solid #667eea40;
    border-radius: 12px;
    padding: 16px;
    text-align: center;
}

.ai-chat-welcome-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.ai-chat-welcome-text {
    font-size: 14px;
    color: #495057;
    line-height: 1.5;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
}

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

.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);
    }
    30% {
        transform: translateY(-10px);
    }
}

/* Chat Input */
.ai-chat-input-container {
    padding: 16px 20px;
    background: white;
    border-top: 1px solid #e9ecef;
    border-radius: 0 0 16px 16px;
}

.ai-chat-input-wrapper {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

#ai-chat-input {
    flex: 1;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 10px 16px;
    font-size: 14px;
    resize: none;
    max-height: 100px;
    font-family: inherit;
    transition: border-color 0.2s;
}

#ai-chat-input:focus {
    outline: none;
    border-color: #2B7A88;
}

#ai-chat-input::placeholder {
    color: #adb5bd;
}

#ai-chat-send-btn {
    background: linear-gradient(135deg, #2D8655 0%, #2B7A88 100%);
    color: white;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
    flex-shrink: 0;
}

#ai-chat-send-btn:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

#ai-chat-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Quick Actions */
.ai-chat-quick-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.quick-action-btn {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 13px;
    color: #495057;
    cursor: pointer;
    transition: all 0.2s;
}

.quick-action-btn:hover {
    background: #36A066;
    color: white;
    border-color: #36A066;
}

/* Error Message */
.ai-chat-error {
    background: #fff5f5;
    border: 1px solid #feb2b2;
    border-radius: 12px;
    padding: 12px;
    color: #c53030;
    font-size: 13px;
    margin-top: 8px;
}

/* Loading State */
.ai-chat-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    font-size: 14px;
    color: #6c757d;
}

.ai-chat-loading .spinner {
    border: 3px solid #f3f4f6;
    border-top-color: #36A066;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    animation: spin 1s linear infinite;
    margin-right: 12px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

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

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

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

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

/* Mobile Responsive */
@media (max-width: 768px) {
    #ai-chat-container {
        width: calc(100vw - 20px);
        height: calc(100vh - 100px);
        bottom: 10px;
        right: 10px;
    }
    
    #ai-chat-button {
        bottom: 10px;
        right: 10px;
        width: 56px;
        height: 56px;
    }
    
    .message-bubble {
        max-width: 80%;
    }
}

/* Print Styles */
@media print {
    #ai-chat-button,
    #ai-chat-container {
        display: none !important;
    }
}
