/* Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    overflow-x: hidden;
}

/* Chat Trigger Button */
.chat-trigger {
    position: fixed;
    bottom: 90px; /* Moved up from 24px to avoid covering scroll button */
    right: 24px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #C5A960, #B8993D);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(197, 169, 96, 0.4);
    transition: all 0.3s ease;
    z-index: 1000010;
}

.chat-trigger:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(197, 169, 96, 0.5);
}

.chat-icon {
    width: 28px;
    height: 28px;
    color: white;
}

.notification-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 20px;
    height: 20px;
    background: #dc3545;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    border: 2px solid white;
}

/* Chat Widget */
.chat-widget {
    position: fixed;
    bottom: 90px; /* Moved up to match the trigger button position */
    right: 24px;
    width: 400px;
    height: 600px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    z-index: 1000011;
    transition: all 0.3s ease;
    overflow: hidden;
}

.chat-widget.hidden {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
}

.chat-widget.minimized {
    height: 70px;
    cursor: pointer;
}

.chat-widget.minimized .chat-messages,
.chat-widget.minimized .quick-replies,
.chat-widget.minimized .chat-input-container {
    display: none;
}

/* Chat Header */
.chat-header {
    background: linear-gradient(135deg, #C5A960, #B8993D);
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: white;
}

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

.assistant-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.assistant-info h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.minimize-btn,
.close-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: background-color 0.2s ease;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.minimize-btn svg,
.close-btn svg {
    width: 20px;
    height: 20px;
}

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

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

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

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

.message-content {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

.bot-message .message-content {
    background: #e9ecef;
    color: #333;
    border-bottom-left-radius: 4px;
}

.user-message .message-content {
    background: linear-gradient(135deg, #C5A960, #B8993D);
    color: white;
    border-bottom-right-radius: 4px;
}

.message-time {
    font-size: 11px;
    color: #6c757d;
    margin-left: 16px;
}

.user-message .message-time {
    text-align: right;
    margin-left: 0;
    margin-right: 16px;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: #e9ecef;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    max-width: 80px;
}

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

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

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot: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;
    }
}

/* Quick Replies */
.quick-replies {
    padding: 10px 20px 15px; /* Reduced padding from 0 20px 20px */
    display: flex;
    flex-direction: column;
    gap: 6px; /* Reduced gap from 8px */
    background: #fafafa;
    max-height: 150px; /* Add max height to prevent overflow */
    overflow-y: auto; /* Allow scrolling if needed */
}

.quick-reply-btn {
    background: linear-gradient(135deg, #C5A960, #B8993D);
    color: white;
    border: none;
    padding: 10px 14px; /* Reduced padding from 12px 16px */
    border-radius: 18px; /* Reduced border radius from 20px */
    cursor: pointer;
    font-size: 13px; /* Reduced font size from 14px */
    line-height: 1.3; /* Added line height for better text spacing */
    transition: all 0.2s ease;
    text-align: left;
    font-family: inherit;
    word-wrap: break-word;
    white-space: normal; /* Allow text wrapping */
}

.quick-reply-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(197, 169, 96, 0.3);
}

.quick-reply-btn:active {
    transform: translateY(0);
}

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

.chat-input-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 24px;
    padding: 4px 4px 4px 16px;
    transition: border-color 0.2s ease;
}

.chat-input-wrapper:focus-within {
    border-color: #C5A960;
    box-shadow: 0 0 0 3px rgba(197, 169, 96, 0.1);
}

#chat-input {
    flex: 1;
    border: none;
    background: none;
    padding: 12px 0;
    font-size: 14px;
    outline: none;
    color: #333;
    font-family: inherit;
}

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

.send-btn {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #C5A960, #B8993D);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.send-btn:hover {
    transform: scale(1.05);
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.send-btn svg {
    width: 20px;
    height: 20px;
}

/* Responsive Design */
@media (max-width: 480px) {
    .chat-widget {
        width: calc(100vw - 24px);
        height: calc(100vh - 48px);
        bottom: 12px;
        right: 12px;
        border-radius: 12px;
    }
    
    .chat-trigger {
        bottom: 80px; /* Adjusted for mobile to avoid scroll button */
        right: 16px;
    }
}

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

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

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

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