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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Floating Toggle Button */
#chatbot-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #8B7355 0%, #8B7355 100%);
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(139, 115, 85, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 999;
}

#chatbot-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(139, 115, 85, 0.6);
}

#chatbot-toggle:active {
    transform: scale(0.95);
}

/* Chatbot Container - Much Smaller */
.chatbot-container {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 320px;
    height: 420px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    overflow: hidden;
}

.chatbot-container.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Header - Compact */
.chatbot-header {
    background: linear-gradient(135deg, #8B7355 0%, #a27e4be4 100%);
    color: white;
    padding: 14px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chatbot-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chatbot-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 12px;
    backdrop-filter: blur(10px);
}

.chatbot-header h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 2px;
}

.status {
    font-size: 11px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 5px;
}

.status::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #4ade80;
    display: inline-block;
    animation: pulse 2s infinite;
}

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

#chatbot-close {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    font-size: 18px;
}

#chatbot-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Messages Area - Compact */
.chatbot-messages {
    flex: 1;
    padding: 14px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #f9fafb;
}

.chatbot-messages::-webkit-scrollbar {
    width: 4px;
}

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

.chatbot-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

/* Message Bubbles - Compact */
.user-message,
.bot-message {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 13px;
    line-height: 1.4;
    word-wrap: break-word;
    animation: messageSlide 0.3s ease;
}

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

.user-message {
    background: linear-gradient(135deg, #8B7355 0%, #8B7355 100%);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.bot-message {
    background: white;
    color: #1f2937;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

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

.typing-indicator span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #94a3b8;
    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);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-8px);
        opacity: 1;
    }
}

/* Input Area - Compact */
.chatbot-input-area {
    padding: 12px 14px;
    background: white;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 8px;
    align-items: center;
}

#user-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    font-size: 13px;
    outline: none;
    transition: border 0.2s;
    font-family: inherit;
}

#user-input:focus {
    border-color: #8B7355;
}

#send-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #8B7355 0%, #8B7355 100%);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

#send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(139, 115, 85, 0.4);
}

#send-btn:active {
    transform: scale(0.95);
}

/* Tablet Responsive */
@media (max-width: 768px) {
    .chatbot-container {
        width: 300px;
        height: 400px;
        bottom: 75px;
    }
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .chatbot-container {
        width: calc(100vw - 24px);
        max-width: 340px;
        right: 12px;
        bottom: 75px;
        height: 450px;
    }

    #chatbot-toggle {
        bottom: 15px;
        right: 15px;
        width: 48px;
        height: 48px;
    }

    .user-message,
    .bot-message {
        max-width: 85%;
        font-size: 13px;
        padding: 9px 12px;
    }

    .chatbot-messages {
        padding: 12px;
    }

    .chatbot-input-area {
        padding: 10px 12px;
    }
}

/* Extra Small Mobile */
@media (max-width: 360px) {
    .chatbot-container {
        width: calc(100vw - 16px);
        right: 8px;
        height: 420px;
    }

    .chatbot-header {
        padding: 12px 14px;
    }

    .chatbot-avatar {
        width: 28px;
        height: 28px;
        font-size: 11px;
    }

    .chatbot-header h3 {
        font-size: 13px;
    }
}