/* ===========================
   Chat Icon Animation
=========================== */
#chat-icon {
    position: fixed;
    bottom: 5px;
    right: 12px;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 28px;
    cursor: pointer;
    z-index: 1000;
}
#chat-icon:hover {
    transform: scale(1.15);
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}


/* Chat container */
#chat-container {
    position: fixed;
    bottom: 20px; /* Adjusted to be above the smaller icon */
    right: 20px;
    width: 450px; /* Slightly wider */
    height: 500px; /* Slightly taller */
    background-color: #ffffff;
    border-radius: 16px; /* Smoother corners */
    box-shadow: 0 10px 30px rgba(0,0,0,0.15), 0 0 0 1px rgba(0,0,0,0.05); /* Professional shadow */
    display: none;
    flex-direction: column;
    overflow: hidden;
    font-family: 'Inter', "Segoe UI", Roboto, sans-serif; /* Modern font choice */
    z-index: 1000;
    transform: translateY(30px);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94); /* Smooth transition */
}
#chat-container.chat-open {
    display: flex;
    transform: translateY(0);
    opacity: 1;
}

/* Chat header */
#chat-header {
    padding: 16px 20px;
    background: linear-gradient(90deg, #007bff, #0056b3); /* Gradient for premium feel */
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    font-size: 16px;
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
#chat-header h4 {
    margin: 0;
}
.header-icons {
    display: flex;
    gap: 15px;
}
/* --- HEADER ICONS --- */

.header-icons span {
    cursor: pointer;
    font-size: 1.2em;
    color: #ffffff; /* Ensure icons are white */
    transition: color 0.3s ease, transform 0.3s ease; /* Smoother transitions */
    will-change: transform, color; /* Optimization hint */
}
.header-icons span:hover {
    color: #ffc107; /* Bright accent on hover */
    transform: scale(1.2); /* More noticeable scale */
}

/* Exit icon animation */
#exit-btn {
    font-weight: bold;
    /* Add a subtle rotation on hover for closure */
}
#exit-btn:hover {
    transform: rotate(90deg) scale(1.2);
    color: #ff4d4f; /* Reddish accent for 'close' action */
}

/* Voice icon animation (Active & Inactive) */
#voice-icon {
    /* Subtle heartbeat animation when voice is NOT active, inviting the user to click */
    animation: heartbeat 3s infinite ease-in-out; 
}

#voice-icon.active {
    color: #8bc34a; /* Green for active state */
    /* Use the existing pulse effect for the active state */
    animation: voicePulse 1.2s infinite ease-in-out;
}

/* Chat body */
#chat-body {
    flex-grow: 1;
    padding: 15px 12px;
    overflow-y: auto;
    background-color: #eef1f4; /* Very light background for better contrast */
    display: flex;
    flex-direction: column;
    gap: 12px; /* Increased gap for better separation */
}
#chat-body::-webkit-scrollbar {
    width: 6px;
}
#chat-body::-webkit-scrollbar-thumb {
    background: #c5c5c5;
    border-radius: 3px;
}

/* Message Containers (The row that holds avatar and message) */
.chat-message-container {
    display: flex;
    align-items: flex-end; /* Align avatar and message bubble at the bottom */
    gap: 8px;
    max-width: 95%;
    animation: fadeInDown 0.3s ease-out; /* Subtle message drop-in */
}
.user-container {
    align-self: flex-end;
    flex-direction: row-reverse; /* Put message on right for user */
}
.bot-container {
    align-self: flex-start;
    flex-direction: row; /* Put message on right for bot */
}

/* Avatars */
.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 16px;
    font-weight: bold;
    flex-shrink: 0; /* Prevents avatar from shrinking */
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.bot-avatar {
    background-color: #007bff;
    color: #ffffff;
    /* Optional: Add an image background instead of a symbol */
    /* background-image: url('bot-image.png'); background-size: cover; */
}
.user-avatar {
    background-color: #b1e3ff;
    color: #0056b3;
}

/* Message Wrapper (Contains text and timestamp) */
.message-content-wrapper {
    display: flex;
    flex-direction: column;
    padding: 10px 14px;
    max-width: 100%;
    word-wrap: break-word;
    font-size: 14px;
    line-height: 1.4;
    position: relative;
    box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}
.message-text {
    margin-bottom: 4px; /* Space between text and timestamp */
    text-align: left;
}


/* Message Bubbles */
.user-message {
    background-color: #c9e6ff; /* Soft primary color */
    color: #1a1a1a;
    border-radius: 18px 18px 4px 18px; /* Tail at bottom right */
    align-items: flex-end; /* Align timestamp to the right */
}
.bot-message {
    background-color: #ffffff; /* White for a clean, professional bot */
    color: #1a1a1a;
    border-radius: 18px 18px 18px 4px; /* Tail at bottom left */
    align-items: flex-start; /* Align timestamp to the left */
}
.highlight-speech {
    background-color: #fff9e0; /* Subtle yellow highlight */
    border: 1px solid #ffcc00;
}

/* Timestamps */
.message-timestamp {
    font-size: 10px;
    color: #888; /* Subtle gray */
    opacity: 0.8;
    text-align: right;
    width: 100%; /* Ensure it spans the bubble width */
    margin-top: 2px;
}
.bot-container .message-timestamp {
    text-align: left;
}

/* Chat input */
#chat-input {
    display: flex;
    padding: 12px 15px;
    background-color: #ffffff;
    border-top: 1px solid #e0e0e0;
    align-items: center;
}
#user-input {
    flex-grow: 1;
    border: 1px solid #d4d4d4;
    border-radius: 22px; /* More rounded */
    padding: 10px 16px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s;
}
#user-input:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.15);
}
#user-input:disabled {
    background-color: #f7f7f7;
    cursor: not-allowed;
}
#send-btn {
    margin-left: 10px;
    padding: 10px 18px;
    background-color: #007bff;
    color: #fff;
    border-radius: 22px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s, box-shadow 0.2s;
}
#send-btn:hover {
    background-color: #0056b3;
    box-shadow: 0 4px 10px rgba(0, 86, 179, 0.2);
}
#send-btn:disabled {
    background-color: #c0c0c0;
    cursor: not-allowed;
    box-shadow: none;
}

/* Menu buttons */
.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}
/* --- 1. BASE STYLES (Applies to ALL buttons - Keep this as your existing block) --- */
.menu-btn, .nav-btn {
    background-color: #ffffff;
    color: #007bff;
    border: 1px solid #b3d7ff; /* Lighter border for subtlety */
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: all 0.3s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05); /* Added subtle shadow back */
}

/* --- 2. HOVER STYLES (Applies to ALL buttons) --- */
.menu-btn:hover, .nav-btn:hover {
    background-color: #e6f3ff;
    border-color: #007bff;
    color: #0056b3;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1); /* Slightly more pronounced shadow on hover */
}

/* ---------------------------------------------------- */
/* 🌟 3. Differentiated NAVIGATION BUTTON STYLES (.nav-btn) 🌟 */
/* Override specific properties for navigation controls */
/* ---------------------------------------------------- */
/* 🌟 NEW Differentiated NAVIGATION BUTTON STYLES (.nav-btn) 🌟 */
/* 🌟 NEW Differentiated NAVIGATION BUTTON STYLES (Light Orange/Amber) 🌟 */
.nav-btn {
    /* Set a contrasting, distinct background: Light Orange/Amber */
    background-color: #fff8e1; /* Very light yellow/cream */
    color: #ff8f00; /* Medium Orange text color */
    border: 1px solid #ffe082; /* Light Amber border */
    font-weight: 500; /* Bolder text for clear action */
    transform: none;
}

/* Override the HOVER for navigation buttons */
.nav-btn:hover {
    background-color: #ffecb3; /* Medium Amber on hover */
    border-color: #ff8f00; /* Medium Orange hover border */
    color: #e65100; /* Darker orange text */
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* Add an active/press state for feedback */
.nav-btn:active {
    background-color: #ffd54f; /* Darker color on press */
    transform: translateY(1px);
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* Typing indicator */
.typing-indicator {
    display: flex;         /* Use Flexbox for alignment */
    flex-direction: row;   /* KEY CHANGE: Arranges the dots horizontally */
    justify-content: center;
    align-items: center;
    gap: 6px;              /* Space between dots */
    padding: 8px 14px;     /* Smaller padding for a compact look */
    border-radius: 16px 16px 16px 2px;
    background-color: #ffffff;
    max-width: fit-content;
    height: 34px;          /* Fixed height for a stable horizontal bubble */
}

/* Typing indicator animation (dots remain the same) */
.typing-indicator span {
    width: 6px;
    height: 6px;
    background-color: #3f51b5;
    border-radius: 50%;
    display: block;
    opacity: 0.6;
    /* The bounce animation will still create a vertical pulse, but the dots are arranged horizontally */
    animation: modernBounce 1.2s infinite ease-in-out; 
    margin: 0; 
}
.typing-indicator span:nth-child(1) { animation-delay: 0.1s; }
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.3s; }

/* Notification form (Optional Styling) */
.notification-form-container {
    /* Use the same style as bot message for consistency */
    background-color: #ffffff; 
    border-radius: 18px;
    padding: 15px;
    margin-top: 12px;
}
/* ... rest of your form styles (input, select, button) ... */


/* Animations */
@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* The modernBounce keyframe already creates the vertical 'bounce' effect: */
@keyframes modernBounce {
    0%, 100% { transform: translateY(0); opacity: 0.6; }
    50% { transform: translateY(-3px); opacity: 1; }
}

@keyframes heartbeat {
    0%, 100% { transform: scale(1); }
    10% { transform: scale(1.1); }
    20% { transform: scale(1); }
    90% { transform: scale(1); }
}

/* Existing voicePulse keyframe (ensure it's in your CSS file) */
@keyframes voicePulse {
    0% { box-shadow: 0 0 0 0 rgba(139, 195, 74, 0.7); }
    70% { box-shadow: 0 0 0 8px rgba(139, 195, 74, 0); }
    100% { box-shadow: 0 0 0 0 rgba(139, 195, 74, 0); }
}
#voice-icon.active {
    animation: voicePulse 1.5s infinite, color-change 1.5s infinite alternate;
}

/* CSS for Speech Highlighting */

/* The highlight-speech class is applied to the message-text container */
/* when the voice assistant starts speaking. */
.bot-message .message-text.highlight-speech {
    /* Subtle background color to highlight the entire text block */
    background-color: #fffacd; /* Light Yellow/Lemon Chiffon */
    padding: 2px 0; /* Add a bit of vertical padding for visual comfort */
    border-radius: 4px; /* Soft rounding */
    /* Add a subtle animation/transition for a smooth effect */
    transition: background-color 0.2s ease-in-out;
}

/* Optional: To highlight the text itself, you could change the font weight or color */
.bot-message .message-text.highlight-speech {
    font-weight: 600; /* Bolder text while speaking */
    color: #333; /* Ensure dark, readable text */
}