:root {
    --primary-color: #8B4513; /* SaddleBrown - matches traditional sweets vibe */
    --secondary-color: #f39c12; /* Orange - for highlights */
    --bg-color: #f5f6fa;
    --chat-bg: #ffffff;
    --text-main: #2f3640;
    --text-muted: #7f8c8d;
    --bot-msg-bg: #FFF9F2; /* Creamy warm tone to complement SaddleBrown */
    --user-msg-bg: #8B4513;
    --user-msg-text: #ffffff;
    --shadow: 0 5px 15px rgba(0,0,0,0.1);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    margin: 0;
    padding: 0;
}

#chat-toggle-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 65px;
    height: 65px;
    background-color: var(--primary-color);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(139, 69, 19, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease, background-color 0.3s ease;
    z-index: 1000;
}

#chat-toggle-btn:hover {
    transform: scale(1.1);
    background-color: #a0522d;
}

#chat-toggle-btn img {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

#chat-widget {
    position: fixed;
    bottom: 110px;
    right: 30px;
    width: 380px;
    height: 550px;
    max-height: calc(100vh - 150px);
    border-radius: 20px;
    box-shadow: var(--shadow);
    display: none;
    flex-direction: column;
    background-color: var(--chat-bg);
    overflow: hidden;
    z-index: 1000;
    animation: slideUp 0.3s ease-out;
}

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

#chat-header {
    background-color: var(--primary-color);
    color: white;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

#chat-header .header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

#chat-header img {
    width: 35px;
    height: 35px;
    background: white;
    border-radius: 50%;
    padding: 2px;
}

#chat-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

#close-chat {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s;
}

#close-chat:hover {
    opacity: 1;
}

#chat-body {
    flex-grow: 1;
    padding: 20px;
    overflow-y: auto;
    background-color: #f9f9f9;
    display: flex;
    flex-direction: column;
}

#chat-messages {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-message {
    padding: 12px 16px;
    border-radius: 15px;
    font-size: 14.5px;
    line-height: 1.5;
    max-width: 85%;
    position: relative;
    word-wrap: break-word;
}

.user-message {
    background-color: var(--user-msg-bg);
    color: var(--user-msg-text);
    align-self: flex-end;
    border-bottom-right-radius: 2px;
}

.bot-message {
    background-color: var(--bot-msg-bg);
    color: var(--text-main);
    align-self: flex-start;
    border-bottom-left-radius: 2px;
}

.chat-product-image {
    max-width: 80%;
    border-radius: 10px;
    margin-bottom: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    align-self: flex-start;
    border: 2px solid #fff;
}

.lead-form-container {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 15px;
    width: 85%;
    align-self: flex-start;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.lead-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.lead-form input {
    padding: 10px;
    border: 1px solid #eee;
    border-radius: 5px;
    font-size: 14px;
}

.lead-form button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 10px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s;
}

.lead-form button:hover {
    background-color: #a0522d;
}

.form-success {
    color: #27ae60;
    font-size: 14px;
    margin: 0;
    text-align: center;
    font-weight: 500;
}

.typing-indicator {
    font-style: italic;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 10px;
    display: none;
}

#chat-footer {
    padding: 15px;
    background: white;
    border-top: 1px solid #eee;
    display: flex;
    gap: 10px;
    align-items: center;
}

#chat-input {
    flex-grow: 1;
    border: 1px solid #e1e8ed;
    border-radius: 25px;
    padding: 12px 20px;
    outline: none;
    transition: border-color 0.2s;
}

#chat-input:focus {
    border-color: var(--primary-color);
}

#send-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.2s;
}

#send-btn:hover {
    background-color: #a0522d;
    transform: rotate(-10deg);
}

.quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
    margin-bottom: 10px;
}

.quick-reply-btn {
    background: white;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.quick-reply-btn:hover {
    background: var(--primary-color);
    color: white;
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
    #chat-widget {
        width: 100%;
        height: 100%;
        bottom: 0;
        right: 0;
        border-radius: 0;
        max-height: 100%;
    }
    
    #chat-header {
        border-radius: 0;
    }
}

/* Custom Scrollbar */
#chat-body::-webkit-scrollbar {
    width: 5px;
}

#chat-body::-webkit-scrollbar-track {
    background: transparent;
}

#chat-body::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 10px;
}
