/* AI Chat Widget Styles */

.ai-chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Chat Toggle Button */
.chat-toggle-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #5A9E2F 0%, #33750a 100%);
    border: none;
    box-shadow: 0 4px 12px rgba(35, 152, 63, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
}

.chat-toggle-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(35, 152, 63, 0.4);
}

.chat-toggle-btn:active {
    transform: scale(0.95);
}

.chat-toggle-btn svg {
    width: 28px;
    height: 28px;
    color: white;
    transition: all 0.3s ease;
}

.chat-toggle-btn .chat-icon {
    display: block;
}

.chat-toggle-btn .close-icon {
    display: none;
    position: absolute;
}

.chat-toggle-btn.active .chat-icon {
    display: none;
}

.chat-toggle-btn.active .close-icon {
    display: block;
}

/* Chat Window */
.chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    height: 550px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(35, 152, 63, 0.4);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Chat Header */
.chat-header {
    background: linear-gradient(135deg, #5A9E2F 0%, #33750a 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-avatar {
    width: 40px;
    height: 40px;
    background: rgba(35, 152, 63, 0.4);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-avatar svg {
    width: 22px;
    height: 22px;
    color: white;
}

.chat-header-text h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: white;
}

.chat-status {
    margin: 4px 0 0 0;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    opacity: 0.9;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4ade80;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.minimize-btn {
    background: rgba(35, 152, 63, 0.4);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.minimize-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.minimize-btn svg {
    width: 18px;
    height: 18px;
    color: white;
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f9fafb;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Messages */
.message {
    display: flex;
    gap: 8px;
    max-width: 85%;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-content {
    background: white;
    padding: 12px 16px;
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(35, 152, 63, 0.4);
    line-height: 1.5;
    font-size: 14px;
}

.message-content p {
    margin: 0 0 8px 0;
}

.message-content p:last-child {
    margin-bottom: 0;
}

.bot-message {
    align-self: flex-start;
}

.bot-message .message-content {
    background: white;
    border-left: 3px solid #5A9E2F;
}

.user-message {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.user-message .message-content {
    background: linear-gradient(135deg, #5A9E2F 0%, #33750a 100%);
    color: white;
}

/* Suggested Questions */
.suggested-questions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

.suggested-question {
    background: white;
    border: 1px solid #e5e7eb;
    padding: 10px 14px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 13px;
    text-align: left;
    color: #4b5563;
}

.suggested-question:hover {
    background: #f3f4f6;
    border-color: #5A9E2F;
    transform: translateX(4px);
}

/* Typing Indicator */
.typing-indicator {
    padding: 0 20px 10px 20px;
    background: #f9fafb;
}

.typing-dots {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    background: white;
    border-radius: 12px;
    width: fit-content;
    box-shadow: 0 1px 2px rgba(35, 152, 63, 0.4);
}

.typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #9ca3af;
    animation: typing 1.4s infinite;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Chat Input */
.chat-input-container {
    background: white;
    border-top: 1px solid #e5e7eb;
    padding: 12px 16px;
}

.chat-input-wrapper {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.chat-input {
    flex: 1;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 14px;
    resize: none;
    max-height: 100px;
    font-family: inherit;
    transition: border-color 0.2s;
}

.chat-input:focus {
    outline: none;
    border-color: #5A9E2F;
}

.send-btn {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, #5A9E2F 0%, #33750a 100%);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.send-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(35, 152, 63, 0.4);
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.send-btn svg {
    width: 20px;
    height: 20px;
    color: white;
}

.chat-footer-text {
    margin: 8px 0 0 0;
    text-align: center;
}

/* Error Message */
.error-message {
    background: #fee2e2;
    border-left: 3px solid #ef4444;
    color: #991b1b;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .ai-chat-widget {
        bottom: 10px;
        right: 10px;
        left: 10px;
    }

    .chat-window {
        width: 100%;
        height: 500px;
        max-width: 100%;
        bottom: 70px;
        left: 0;
        right: 0;
    }

    .chat-toggle-btn {
        width: 56px;
        height: 56px;
    }
}

@media (max-width: 768px) {
    .chat-window {
        width: 340px;
    }
}

/* Accessibility */
.chat-toggle-btn:focus,
.minimize-btn:focus,
.send-btn:focus,
.suggested-question:focus {
    outline: 2px solid #5A9E2F;
    outline-offset: 2px;
}

/* Loading State */
.loading {
    opacity: 0.6;
    pointer-events: none;
}
