/* Chatbot Widget Styles */
#chatbot-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1001;
    font-family: inherit;
}

/* Chat Toggle Button */
.chat-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #9B8B7A;
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(155, 139, 122, 0.3);
    transition: all 0.3s ease;
    position: relative;
}

.chat-toggle:hover {
    background: #A8998A;
    transform: scale(1.05);
    box-shadow: 0 6px 25px rgba(155, 139, 122, 0.4);
}

.chat-toggle:focus {
    outline: 2px solid #B5A394;
    outline-offset: 2px;
}

/* Chat Window */
.chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    height: 500px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.3s ease;
    transform-origin: bottom right;
}

.chat-window.hidden {
    opacity: 0;
    visibility: hidden;
    transform: scale(0.8);
}

/* Chat Header */
.chat-header {
    background: #9B8B7A;
    color: white;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.chat-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.chat-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

.chat-close:focus {
    outline: 2px solid rgba(255, 255, 255, 0.5);
}

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

.message {
    display: flex;
    flex-direction: column;
    max-width: 80%;
}

.user-message {
    align-self: flex-end;
}

.bot-message {
    align-self: flex-start;
}

.message-content {
    padding: 12px 16px;
    border-radius: 18px;
    word-wrap: break-word;
}

.user-message .message-content {
    background: #9B8B7A;
    color: white;
    border-bottom-right-radius: 4px;
}

.bot-message .message-content {
    background: white;
    color: #333;
    border: 1px solid #e5e7eb;
    border-bottom-left-radius: 4px;
}

.message-time {
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 4px;
    padding: 0 4px;
}

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

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

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

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

#chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #d1d5db;
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease;
}

#chat-input:focus {
    border-color: #9B8B7A;
    box-shadow: 0 0 0 3px rgba(155, 139, 122, 0.1);
}

#chat-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #9B8B7A;
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}

#chat-send:hover {
    background: #A8998A;
}

#chat-send:focus {
    outline: 2px solid #B5A394;
    outline-offset: 2px;
}

#chat-send:disabled {
    background: #9ca3af;
    cursor: not-allowed;
}

/* Typing Indicator */
.typing-indicator {
    padding: 12px 20px;
    background: white;
    border-top: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #6b7280;
}

.typing-indicator.hidden {
    display: none;
}

.typing-dots {
    display: flex;
    gap: 4px;
}

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

.typing-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

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

@keyframes typing {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Mobile Responsive */
@media (max-width: 480px) {
    #chatbot-container {
        bottom: 10px;
        right: 10px;
        left: 10px;
    }
    
    .chat-window {
        width: 100%;
        height: 70vh;
        bottom: 80px;
        right: 0;
        left: 0;
        border-radius: 12px 12px 0 0;
    }
    
    .chat-toggle {
        width: 56px;
        height: 56px;
        position: absolute;
        right: 0;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    .chat-toggle,
    .chat-window,
    .typing-dots span {
        animation: none;
        transition: none;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .chat-window {
        border: 2px solid #000;
    }
    
    .message-content {
        border: 1px solid #000;
    }
}