/* //chatbot.css--->start */
/* Universal box-sizing for consistent layout */
* {
    box-sizing: border-box;
}

/* General Body Styling with a modern font and color */
body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    /* background-color: #f4f7f6;
    color: #ffffff; */
}

/* --- Chat Widget Container --- */
/* Positions the entire widget at the bottom right and stacks its children */
#chat-widget-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 1000;
    display: flex;
    flex-direction: column-reverse;
    align-items: flex-end;
}

/* --- Animated Chat Icon --- */
#chat-icon-button {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: linear-gradient(135deg, #00bfa6 0%, #0a0a0a 100%);
    color: white;
    border: none;
    box-shadow: none;
    font-size: 1.8em;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

#chat-icon-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.3) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

#chat-icon-button:hover::before {
    opacity: 1;
}

#chat-icon-button:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: none;
}

#chat-icon-button:active {
    transform: translateY(0) scale(0.98);
}

/* Pulsing animation when new message arrives */
@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

#chat-icon-button.pulse {
    animation: pulse 1s ease-in-out;
}

/* --- Chat Container --- */
#chat-container {
    width: 100%;
    max-width: 380px;
    height: 500px;
    background-color: #ffffff;
    border-radius: 20px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    display: none;
    flex-direction: column;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.3s ease-out, transform 0.3s ease-out;

    margin-bottom: 15px;
}

#chat-container.open {
    /* Add these properties */
    display: flex;
    /* <-- UPDATED: show flex container when open */
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
    /* allow clicks only when open */
    visibility: visible;
    /* ensure visible */
}

/* Chat header */
.chat-header {
    background: linear-gradient(135deg, #00bfa6 0%, #2c3e50 100%);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.chat-header h3 {
    margin: 0;
    font-weight: 600;
    font-size: 1.2em;
}

.chat-header .close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.2em;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.chat-header .close-btn:hover {
    transform: scale(1.1);
}

/* Chat box */
#chat-box {
    height: calc(100% - (55px + 75px));
    padding: 15px;
    overflow-y: auto;
    background-color: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Message Styling */
.message {
    margin-bottom: 5px;
    padding: 12px 18px;
    border-radius: 20px;
    max-width: 80%;
    word-wrap: break-word;
    font-size: 0.95em;
    line-height: 1.4;
    position: relative;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.user-message {
    align-self: flex-end;
    background: linear-gradient(135deg, #00bfa6 0%, #2c3e50 100%);
    color: white;
    border-bottom-right-radius: 5px;
    animation: slideInRight 0.3s ease-out forwards;
}

.bot-message {
    align-self: flex-start;
    background: #ffffff;
    color: #34495e;
    border: 1px solid #e0e0e0;
    border-bottom-left-radius: 5px;
    animation: slideIn 0.3s ease-out forwards;
}

/* Timestamp */
.message-timestamp {
    display: block;
    font-size: 0.7em;
    opacity: 0.7;
    margin-top: 5px;
    text-align: right;
}

/* Typing indicator */
.typing-indicator {
    display: flex;
    align-self: flex-start;
    padding: 10px 15px;
    background: #ffffff;
    border-radius: 20px;
    border: 1px solid #e0e0e0;
    margin-bottom: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.typing-dot {
    width: 8px;
    height: 8px;
    background-color: #00bfa6;
    border-radius: 50%;
    margin: 0 2px;
    animation: typingAnimation 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) {
    animation-delay: 0s;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingAnimation {

    0%,
    60%,
    100% {
        transform: translateY(0);
    }

    30% {
        transform: translateY(-5px);
    }
}

/* Chat Input Container */
#chat-input-container {
    display: flex;
    padding: 15px;
    align-items: center;
    background-color: #ffffff;
    border-top: 1px solid #eee;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
    min-height: 50px;
    gap: 10px;
}

/* User Input Field */
#user-input {
    flex-grow: 1;
    min-width: 0;
    padding: 12px 15px;
    border: 1px solid #e0e0e0;
    border-radius: 25px;
    font-size: 0.95em;
    outline: none;
    transition: all 0.3s ease;
    background-color: #f8f9fa;
}

/* Button group container */
.input-buttons {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

/* Buttons (Send, Mike, File) */
#send-button,
#mike-button,
#file-button {
    width: 42px;
    height: 42px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #00bfa6 0%, #2c3e50 100%);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.1em;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}

#send-button::before,
#mike-button::before,
#file-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0.4) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

#send-button:hover::before,
#mike-button:hover::before,
#file-button:hover::before {
    opacity: 1;
}

#send-button:hover,
#mike-button:hover,
#file-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 191, 166, 0.4);
}

#send-button:active,
#mike-button:active,
#file-button:active {
    transform: translateY(0);
}

/* Recording state */
#mike-button.recording {
    background: linear-gradient(135deg, #ff4757 0%, #cc2e3d 100%);
    animation: pulse 1.5s infinite;
}

/* Hidden File Input */
#file-input {
    display: none;
}

/* Scrollbar Styling */
#chat-box::-webkit-scrollbar {
    width: 6px;
}

#chat-box::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

#chat-box::-webkit-scrollbar-thumb {
    background: #00bfa6;
    border-radius: 10px;
}

#chat-box::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* New CSS for icon visibility within send-button */
#send-button i {
    display: none;
}

#send-button .active-icon {
    display: inline-block;
}

/* Optional: Colors for specific icons when they are active */
#send-button .stop-icon.active-icon {
    color: #ff4757;
}

#send-button .pause-icon.active-icon {
    color: #ffc107;
}

@media (max-width: 600px) {
    #chat-widget-container {
        bottom: 15px;
        /* Slightly more space from bottom */
        right: 15px;
        /* Slightly more space from right */
        left: 15px;
        /* Added left to keep it centered on smaller screens */
        width: auto;
        /* Allow width to be determined by children */
        align-items: flex-end;
        /* Align to the right */
    }

    #chat-container {
        width: 90vw;
        /* Use viewport width for better responsiveness */
        max-width: 320px;
        /* Adjust max-width for typical phone sizes */
        height: 480px;
        max-height: 75vh;
        /* Center horizontally when width is less than max-width */
        margin-left: auto;
        margin-right: auto;
        margin-bottom: 15px;
        /* Maintain space from icon */
        border-radius: 15px;
        box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
    }

    #chat-icon-button {
        width: 55px;
        /* Slightly larger icon */
        height: 55px;
        font-size: 1.5em;
        /* Adjusted font size */
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
        /* Add a subtle shadow */
    }

    .chat-header {
        padding: 12px 15px;
    }

    .chat-header h3 {
        font-size: 1.1em;
    }

    .chat-header .close-btn {
        font-size: 1.1em;
    }

    #chat-box {
        height: calc(100% - 110px);
        /* Adjust based on header/input changes */
        padding: 10px;
        gap: 8px;
    }

    .message {
        padding: 10px 15px;
        font-size: 0.9em;
        border-radius: 18px;
    }

    .message-timestamp {
        font-size: 0.65em;
    }

    .typing-indicator {
        padding: 8px 12px;
        border-radius: 18px;
    }

    .typing-dot {
        width: 6px;
        height: 6px;
    }

    #chat-input-container {
        padding: 10px;
        min-height: 55px;
        gap: 8px;
    }

    #user-input {
        padding: 10px 14px;
        border-radius: 22px;
        font-size: 0.9em;
    }

    #send-button,
    #mike-button,
    #file-button {
        width: 40px;
        /* Slightly larger buttons */
        height: 40px;
        font-size: 1em;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    }
}

@media (max-width: 360px) {
    #chat-widget-container {
        bottom: 10px;
        /* Even less space for very small screens */
        right: 10px;
        left: 10px;
    }

    #chat-container {
        width: 95vw;
        /* Almost full width for tiny screens */
        max-width: 280px;
        /* A safe max-width */
        height: 400px;
        /* Reduced height for very small screens */
        max-height: 80vh;
        /* Allow it to shrink more relative to viewport */
        margin-bottom: 10px;
        border-radius: 12px;
    }

    #chat-icon-button {
        width: 48px;
        /* Smaller icon for very small screens */
        height: 48px;
        font-size: 1.3em;
    }

    .chat-header {
        padding: 10px 12px;
    }

    .chat-header h3 {
        font-size: 1em;
    }

    .chat-header .close-btn {
        font-size: 1em;
    }

    #chat-box {
        height: calc(100% - 95px);
        /* Adjusted height calculation */
        padding: 8px;
        gap: 6px;
    }

    .message {
        padding: 8px 12px;
        font-size: 0.85em;
        border-radius: 15px;
    }

    .message-timestamp {
        font-size: 0.6em;
    }

    .typing-indicator {
        padding: 7px 10px;
    }

    .typing-dot {
        width: 5px;
        height: 5px;
    }

    #chat-input-container {
        padding: 8px;
        min-height: 50px;
        gap: 6px;
    }

    #user-input {
        padding: 8px 12px;
        border-radius: 20px;
        font-size: 0.85em;
    }

    #send-button,
    #mike-button,
    #file-button {
        width: 36px;
        /* Smaller buttons */
        height: 36px;
        font-size: 0.9em;
    }
}


