/* Chat Interface Styles */
.chat-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 10000;
    font-family: Arial, sans-serif;
}

.chat-box {
    width: 350px;
    height: 500px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #e0e0e0;
}

.chat-box.active {
    display: flex !important;
}

.chat-header {
    background: #462710;
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
}

.chat-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f8f9fa;
}

/* Message container with timestamp */
.message-container {
    margin-bottom: 15px;
    position: relative;
}

.message {
    padding: 12px 16px;
    border-radius: 18px;
    max-width: 80%;
    word-wrap: break-word;
    line-height: 1.4;
    animation: messageAppear 0.3s ease-out;
}

.bot-message {
    background: white;
    border: 1px solid #e0e0e0;
    border-top-left-radius: 5px;
    margin-right: auto;
}

.user-message {
    background: #468300ff;
    color: white;
    margin-left: auto;
    border-top-right-radius: 5px;
}

/* Timestamp styles */
.message-time {
    font-size: 10px;
    color: #999;
    margin-top: 4px;
    text-align: right;
}

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

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

.chat-input {
    display: flex;
    padding: 15px;
    background: white;
    border-top: 1px solid #e0e0e0;
    gap: 10px;
}

.chat-input input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 25px;
    outline: none;
    font-size: 14px;
    color: #333; /* Text color when typing */
    background: white;
}

/* Placeholder text - light gray */
.chat-input input::placeholder {
    color: #999; /* Light gray placeholder */
    opacity: 1;
}

.chat-input input:focus {
    border-color: #257400ff;
    color: #333; /* Text color when focused */
}

/* Ensure text is visible when typing */
.chat-input input:not(:placeholder-shown) {
    color: #333; /* Dark gray for user text */
}

.chat-input button {
    background: #257400ff;
    color: white;
    border: none;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s;
}

.chat-input button:hover {
    background: #462710;
;
}

.chat-toggle {
    background: #9b4d00ff;
    color: white;
    border: none;
    border-radius: 25px;
    padding: 12px 20px;
    cursor: pointer;
    font-weight: bold;
    box-shadow: 0 4px 15px rgba(92, 30, 1, 0.3);
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
    margin-left: auto;
    margin-top: 10px;
}

.chat-toggle:hover {
    background: #257400ff;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(34, 99, 4, 0.4);
}

/* Loading animation for initial state */
.loading-message {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 18px;
    border-top-left-radius: 5px;
}

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

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

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

.loading-dot:nth-child(2) {
    animation-delay: 0.3s;
}

.loading-dot:nth-child(3) {
    animation-delay: 0.6s;
}

@keyframes loading-pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 0.7;
    }
    50% {
        transform: scale(1.2);
        opacity: 1;
    }
}

/* Typing animation */
.typing-indicator {
    display: inline-flex;
    align-items: center;
    padding: 12px 16px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 18px;
    border-top-left-radius: 5px;
}

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

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

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

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

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

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

/* Loading state for send button */
.send-button-loading {
    opacity: 0.7;
    pointer-events: none;
}

.send-button-loading svg {
    animation: spin 1s linear infinite;
}

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

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

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

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

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

/* Mobile responsive */
@media (max-width: 768px) {
    .chat-container {
        right: 10px;
        bottom: 10px;
        left: 10px;
    }
    
    .chat-box {
        width: 100%;
        height: 70vh;
    }
    
    .chat-toggle {
        font-size: 14px;
        padding: 10px 16px;
    }
    
    .message {
        max-width: 85%;
    }
}