/* =========================================================
   1. GLOBAL & BACKGROUND LOCK
========================================================= */
body.vinsinfo-chat-active {
    pointer-events: none;
}

/* =========================================================
   2. MODERN FLOATING WIDGET (Panel Structure)
========================================================= */
#vinsinfo-chatbot-panel {
    position: fixed;
    bottom: 30px;
    right: -450px;
    width: 400px; 
    height: 80vh;
    max-height: 800px;
    min-height: 500px;
    background-color: #fcfcfd; 
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.15), 0 0 20px rgba(0, 0, 0, 0.03); 
    border-radius: 20px; 
    overflow: hidden;
    transition: right 0.4s cubic-bezier(0.2, 0.8, 0.2, 1), height 0.3s ease;
    z-index: 999999;
    display: flex;
    flex-direction: column;
    pointer-events: auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

#vinsinfo-chatbot-panel.chatbot-open {
    right: 30px; 
}

#vinsinfo-chatbot-panel.minimized {
    height: 65px;
    min-height: 65px;
    border-radius: 16px;
}

/* =========================================================
   3. SLEEK HEADER
========================================================= */
.chatbot-header {
    background: linear-gradient(135deg, #1A489C 100%);
    color: #ffffff;
    padding: 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 65px;
    min-height: 65px;
    box-sizing: border-box;
    z-index: 2;
}

.chatbot-title-area {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chatbot-logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

.chatbot-header h4 {
    margin: 0;
    color: #ffffff;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

/* =========================================================
   FIX: ALIGN & RESIZE CONTROL BUTTONS
========================================================= */
.chatbot-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chatbot-controls button {
    width: 32px !important;
    height: 32px !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    border-radius: 6px; /* Modern slightly rounded corners */
    padding: 0 !important;
    margin: 0 !important;
    line-height: 1 !important;
    transition: all 0.2s ease;
}

/* Minimize Button Hover Effect */
#minimize-chatbot:hover {
    background-color: rgba(255, 255, 255, 0.2); 
}

/* Close Button Red Background Fix */
#close-chatbot {
    background-color: #e63946 !important; /* Nice, professional red */
}

#close-chatbot:hover {
    background-color: #d62828 !important; /* Slightly darker red on hover */
}


/* =========================================================
   4. BODY LAYOUT
========================================================= */
.chatbot-body {
    padding: 0;
    flex-grow: 1;
    display: block; 
    overflow: hidden;
}

#vinsinfo-chatbot-panel .c3-section {
    display: flex;
    flex-direction: column;
    height: 100%;
    margin: 0;
    padding: 20px 24px 24px 24px; /* Padding inside the panel */
    box-sizing: border-box;
}

/* =========================================================
   5. CHAT ANSWERS (Flows at the TOP to push input down)
========================================================= */
#vinsinfo-chatbot-panel #c3-answer {
    order: 1; /* Forces chat history to the top */
    flex-grow: 1; /* Pushes the pills and search bar down */
    overflow-y: auto;
    padding-bottom: 20px;
    margin: 0;
}

/* Scrollbar beautification */
#vinsinfo-chatbot-panel #c3-answer::-webkit-scrollbar {
    width: 6px;
}
#vinsinfo-chatbot-panel #c3-answer::-webkit-scrollbar-track {
    background: transparent;
}
#vinsinfo-chatbot-panel #c3-answer::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 10px;
}

/* =========================================================
   6. QUICK ACTION PILLS (Just above Search Bar)
========================================================= */
#vinsinfo-chatbot-panel .c3-quick-actions {
    order: 2; /* Sits below the chat, but above the input */
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex-shrink: 0;
    padding-bottom: 15px;
}

#vinsinfo-chatbot-panel .c3-pill {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    color: #4a5568;
    border-radius: 12px; 
    padding: 12px 18px;
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s ease;
    width: 100%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.01);
}

#vinsinfo-chatbot-panel .c3-pill:hover {
    background: #f7fafc;
    color: #0073aa;
    border-color: #cbd5e0;
    transform: translateY(-1px); 
    box-shadow: 0 4px 6px rgba(0,0,0,0.03);
}

/* =========================================================
   7. RESPONSIVE SEARCH BAR (Anchored at the BOTTOM)
========================================================= */
#vinsinfo-chatbot-panel .c3-search-wrap {
    order: 3; /* Anchors it to the absolute bottom */
    display: flex;
    align-items: center;
    background: #ffffff;
    border: 1px solid #eef0f4;
    border-radius: 100px;
    padding: 8px 8px 8px 20px;
    margin: 0; /* Removed bottom margin so it sits on the padding floor */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
    width: 100%;
    box-sizing: border-box;
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
    flex-shrink: 0;
}

#vinsinfo-chatbot-panel .c3-search-wrap:focus-within {
    border-color: #1A489C;
    box-shadow: 0 6px 16px rgba(0, 115, 170, 0.1);
}

#vinsinfo-chatbot-panel .chatbot-icon {
    width: 26px;
    height: 26px;
    margin-right: 12px;
}

#vinsinfo-chatbot-panel .c3-search-wrap input {
    flex-grow: 1;
    border: none !important;
    outline: none !important;
    background: transparent;
    font-size: 14px;
    color: #2d3748;
    padding: 6px 0;
    width: 100%; 
}

#vinsinfo-chatbot-panel .c3-search-wrap input::placeholder {
    color: #a0aec0;
}

#vinsinfo-chatbot-panel .c3-button {
    background: #f0f4f8 !important;
    border: none !important;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}

#vinsinfo-chatbot-panel .c3-button:hover {
    background: #0073aa !important;
}

#vinsinfo-chatbot-panel .c3-button:hover img {
    filter: brightness(0) invert(1); 
}

/* =========================================================
   UPDATE: MAKE ROBOT AND SEND ICON EXACTLY 52px
========================================================= */
/* Targets both the robot image AND the image inside the send button */
.c3-search-wrap .chatbot-icon,
.c3-search-wrap .c3-button img {
    width: 52px !important;
    height: 52px !important;
    object-fit: contain !important;
    margin: 0 !important;
}

/* Ensure the button container expands to fit the new 52px icon */
.c3-search-wrap .c3-button {
    width: auto !important;
    height: auto !important;
    padding: 0 !important; 
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    background-color: transparent !important;
}

/* Removes the red outline when you click on it */
.c3-search-wrap .c3-button:focus,
.c3-search-wrap .c3-button:active {
    border: none !important;
    outline: none !important;
}

/* =========================================================
   FIX: REMOVE ALL HOVER/COLOR-CHANGING EFFECTS ON SEND BUTTON
========================================================= */
/* Stops the background from changing color on hover */
#vinsinfo-chatbot-panel .c3-search-wrap .c3-button:hover,
#vinsinfo-chatbot-panel .c3-search-wrap .c3-button:focus,
#vinsinfo-chatbot-panel .c3-search-wrap .c3-button:active {
    background-color: transparent !important;
}

/* Stops the image icon from applying weird filters/turning white on hover */
#vinsinfo-chatbot-panel .c3-search-wrap .c3-button:hover img {
    filter: none !important; 
    transform: none !important;
}

/* Hide ANY suggestion grids that appear inside the active chat history */
.conversation-history .c3-grid,
.conversation-history .c3-follow-up-grid,
.c3-follow-up-grid {
    display: none !important;
}

/* Hide ANY button-like elements that appear inside the chat history, 
   except for the helpful/not-helpful action buttons */
.conversation-history .c3-item,
.conversation-history .c3-pill,
.conversation-history .c3-follow-up-grid {
    display: none !important;
}

/* Force the quick actions to actually hide when the JS adds the hidden class */
.c3-quick-actions.c3-quick-actions-hidden {
    display: none !important;
}

/* Position the container absolutely over the chat body */
.new-chat-section {
    position: absolute;
    top: 65px; /* Adjust this so it sits just below the blue header */
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
}

/* Style the button as a sleek, modern pill */
button#c3-new-chat {
    background-color: #ffffff !important;
    color: #cc3366 !important;
    border: 1px solid #cc3366 !important;
    border-radius: 20px !important;
    padding: 6px 16px !important;
    font-size: 13px !important;
    font-weight: 500;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease-in-out;
}

/* Add a hover effect for better UX */
button#c3-new-chat:hover {
    background-color: #cc3366 !important;
    color: #ffffff !important;
    box-shadow: 0 6px 8px rgba(0, 0, 0, 0.15);
}

/* Ensure the controls wrapper aligns properly */
.chatbot-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Style the New Chat button to match the header icons */
button#c3-new-chat {
    background: rgba(255, 255, 255, 0.1) !important;
    border: none !important;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex !important;
    align-items: center;
    justify-content: center;
    cursor: pointer !important;
    padding: 0 !important;
    transition: background 0.2s ease, transform 0.2s ease;
}

/* Ensure mouse clicks pass cleanly through the inner SVG graphics to the button */
button#c3-new-chat svg {
    pointer-events: none;
    width: 16px;
    height: 16px;
}

/* Hover effects */
button#c3-new-chat:hover {
    background: rgba(255, 255, 255, 0.25) !important;
    transform: scale(1.05);
}

/* =========================================================
   VINSINFO GLOBAL CHATBOT TRIGGER
   Home page keeps the existing search-box trigger.
   Inner pages use the mascot image as a floating icon.
========================================================= */
.vinsinfo-floating-chat {
    position: fixed !important;
    right: 28px !important;
    bottom: 28px !important;
    width: 78px !important;
    height: 78px !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    outline: none !important;
    background: transparent !important;
    box-shadow: none !important;
    cursor: pointer !important;
    z-index: 999998 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.25s ease, filter 0.25s ease;
}

.vinsinfo-floating-chat img {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
    pointer-events: none !important;
    user-select: none !important;
    -webkit-user-drag: none !important;
    filter: drop-shadow(0 8px 18px rgba(26, 72, 156, 0.28));
}

.vinsinfo-floating-chat:hover {
    transform: translateY(-3px) scale(1.04);
    filter: brightness(1.03);
}

.vinsinfo-floating-chat:active {
    transform: translateY(0) scale(0.97);
}

.vinsinfo-floating-chat:focus-visible {
    box-shadow: 0 0 0 4px rgba(22, 170, 238, 0.28) !important;
    border-radius: 50% !important;
}

/* Keep the floating trigger above Elementor and common sticky UI. */
@media (max-width: 767px) {
    .vinsinfo-floating-chat {
        right: 16px !important;
        bottom: 16px !important;
        width: 66px !important;
        height: 66px !important;
    }
}
