﻿#chat-icon {
    display: flex;
    align-items: center;
    padding: 0 25px 0 5px; /* Added more right padding for balance */
    height: 65px; /* Increased slightly to give the avatar room */
    min-width: 190px;
    background: linear-gradient(135deg, #0078d4, #00bcf2);
    border-radius: 50px;
    position: fixed;
    bottom: 25px;
    right: 25px;
    box-shadow: 0 8px 20px rgba(0, 120, 212, 0.3);
    cursor: pointer;
    z-index: 1000;
    transition: all 0.3s ease;
    z-index: 9998 !important; /* Just behind the chatbox, but above the menu */
}

.avatar-container {
    position: relative;
    width: 70px; /* Slightly larger container */
    height: 70px;
    margin-right: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.human-avatar-img {
    width: 65px;
    height: 65px;
    object-fit: cover;
    border-radius: 50%;
    border: 3px solid white; /* Thick white border makes it "pop" against the blue */
    background-color: #fff;
    /* This makes it sit slightly higher than the button for a 3D effect */
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.online-status {
    position: absolute;
    bottom: 8px; /* Adjusted to fit the new border size */
    right: 8px;
    width: 14px;
    height: 14px;
    background-color: #28a745;
    border: 2px solid white;
    border-radius: 50%;
    z-index: 1001;
}

.icon-text {
    font-size: 16px; /* Slightly larger for readability */
    font-weight: 600;
    color: white;
    letter-spacing: 0.5px;
    line-height: 1; /* Ensures it stays centered */
}

#chat-icon:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 25px rgba(0, 120, 212, 0.5);
}

@keyframes chatPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(0,120,212,0.7);
    }

    70% {
        box-shadow: 0 0 0 15px rgba(0,120,212,0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(0,120,212,0);
    }
}

#chatbox {
    position: fixed;
    bottom: 90px;
    right: 30px;
    width: 360px;
    height: 560px;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    border: 1px solid rgba(0,120,212,0.1);
    box-shadow: 0 15px 35px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 9999 !important; /* Forces it to the very front */
}

#chatbox-header {
    background: linear-gradient(135deg, #0078d4, #005a9e);
    color: white;
    padding: 15px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#messages {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 15px;
    overflow-y: auto;
    max-height: 400px;
    background-color: #f9fafb; /* Light professional background */
}

.message {
    margin-bottom: 12px;
    padding: 10px 15px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.5;
    max-width: 95%;
}

    .message.bot-style {
        align-self: flex-start;
        max-width: 95%;
        background-color: #ffffff;
        color: #24292e;
        padding: 12px 16px;
        border-radius: 2px 16px 16px 16px; /* Chat-style asymmetric corners */
        font-size: 14px;
        line-height: 1.5;
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
        border: 1px solid #e1e4e8;
        position: relative;
        font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    }

/* Style for Markdown elements inside bot messages */
.bot-style p {
    margin: 0 0 8px 0;
}

    .bot-style p:last-child {
        margin-bottom: 0;
    }

/* Professional styling for bullet points (Markdown) */
.bot-style ul, .bot-style ol {
    margin: 8px 0;
    padding-left: 20px;
}

.bot-style li {
    margin-bottom: 4px;
}

/* Styling for bold text in technical responses */
.bot-style strong {
    color: #0078d4; /* Azure Blue for emphasis */
    font-weight: 600;
}

/* --- Added Extras for Professional Look --- */

/* User message style for comparison */
.message.user-style {
    align-self: flex-end;
    max-width: 80%;
    background: linear-gradient(135deg, #0078d4, #005a9e); /* Azure Gradient */
    color: white;
    padding: 10px 14px;
    border-radius: 16px 16px 2px 16px;
    font-size: 14px;
    box-shadow: 0 3px 8px rgba(0, 120, 212, 0.2);
}

/* Typing Indicator Styling */
#chat-typing-indicator {
    padding: 8px 15px;
    font-size: 12px;
    color: #6a737d;
    font-style: italic;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        opacity: 0.5;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0.5;
    }
}




.user-style {
    align-self: flex-end;
    background: #0078d4;
    color: white;
}

.bot-style {
    align-self: flex-start;
    background: white;
    border: 1px solid #e1e8ed;
    border-bottom-left-radius: 2px;
    border-radius: 18px 18px 18px 2px; /* Sharp bottom-left */
}

.chat-input-area {
    display: flex;
    align-items: center;
    padding: 10px 15px; /* Added horizontal padding */
    background: #fff;
    border-top: 1px solid #eee;
    gap: 10px; /* Space between input and send button */
}

#userInput {
    flex: 1; /* This is better than width: 100% inside flex containers */
    min-width: 0; /* Prevents flex items from overflowing */

    box-sizing: border-box;
    padding: 10px 18px;
    border: 1px solid #d1d1d1;
    border-radius: 25px; /* This creates the full roundness */

    outline: none;
    font-size: 14px;
    background-color: #fdfdfd;
}

    #userInput:focus {
        border-color: #0078d4;
        background-color: #fff;
        box-shadow: 0 0 4px rgba(0, 120, 212, 0.2);
    }

.quick-actions button {
    background: white;
    border: 1px solid #0078d4;
    color: #0078d4;
    border-radius: 15px;
    padding: 4px 10px;
    font-size: 11px;
    cursor: pointer;
    margin: 2px;
}

#sendBtn {
    background: none;
    border: none;
    color: #0078d4;
    font-size: 20px;
    cursor: pointer;
    flex-shrink: 0; /* Prevents the button from being squashed */
    padding: 0;
}
#chat-typing-indicator {
    padding: 10px 16px;
    font-size: 13px;
    color: #5f6368; /* Professional muted grey */
    background-color: #f1f3f4; /* Light grey bubble */
    border-radius: 15px;
    margin: 5px 20px;
    display: inline-block; /* Keeps the bubble size tight to the text */
    align-self: flex-start; /* Aligns it with other bot messages */
    font-style: italic;
    border: 1px solid #e0e0e0;
    animation: pulse-light 1.5s infinite ease-in-out;
}

/* Subtle pulse animation to show activity */
@keyframes pulse-light {
    0% {
        opacity: 0.5;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0.5;
    }
}

/* Optional: Add three animated dots after the text */
#chat-typing-indicator::after {
    content: '...';
    display: inline-block;
    width: 12px;
    animation: ellipsis 1.5s infinite;
    text-align: left;
}

@keyframes ellipsis {
    0% {
        content: '.';
    }

    33% {
        content: '..';
    }

    66% {
        content: '...';
    }
}

.bot-style a {
    color: #0078d4; /* Your Azure Blue */
    text-decoration: underline;
    font-weight: 500;
}
    /* Container for the chips if they appear together */
    .bot-style a.social-link-chip {
        display: inline-flex;
        align-items: center;
        background: #f8f9fa;
        border: 1px solid #0078d4;
        color: #0078d4;
        padding: 5px 12px;
        margin: 4px 2px;
        border-radius: 20px;
        text-decoration: none;
        font-size: 13px;
        font-weight: 500;
        transition: all 0.2s ease;
    }

.bot-style a.social-link-chip:hover {
    background: #0078d4;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 120, 212, 0.3);
    transform: translateY(-1px);
}

/* The "Online" Text */
.status-text {
    font-size: 11px;
    font-weight: 500;
    color: #ffffff; /* Or #28a745 if on a white background */
    opacity: 0.9;
   /* text-transform: uppercase;*/
    letter-spacing: 0.5px;
}

.chat-header {
    background: linear-gradient(135deg, #0078d4 0%, #005a9e 100%); /* Azure Gradient */
    color: #ffffff;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between; /* Pushes X to the right */
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* The "RM" Profile Circle */
.header-avatar {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 0.5px;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.header-info {
    display: flex;
    flex-direction: column;
}

    .header-info h3 {
        margin: 0;
        font-size: 15px;
        font-weight: 600;
        letter-spacing: 0.3px;
    }

/* Status Alignment */
.status-container {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 2px;
}

.status-dot {
    width: 7px;
    height: 7px;
    background-color: #4ec9b0; /* Mint Green for visibility */
    border-radius: 50%;
    box-shadow: 0 0 4px #4ec9b0;
}

.status-text {
    font-size: 10px;
    font-weight: 400;
    /*text-transform: uppercase;*/
    letter-spacing: 0.8px;
    opacity: 0.9;
}

/* The Close Button */
.close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
    padding: 5px;
}

    .close-btn:hover {
        opacity: 1;
    }

.brain-pulse {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: #e6f4ea;
    border-radius: 50%;
    animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.7);
    }

    70% {
        transform: scale(1);
        box-shadow: 0 0 0 10px rgba(40, 167, 69, 0);
    }

    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(40, 167, 69, 0);
    }
}

/* --- Mobile Responsive Fix --- */
@media screen and (max-width: 480px) {
    #chatbox {
        /*width: calc(100% - 30px);*/ /* Leaves 15px gap on each side */
        /*right: 15px;
        bottom: 15px;
        height: 80vh;*/ /* Takes up 80% of screen height on mobile */
        /*max-height: 550px;
        z-index: 9999 !important;*/
        width: 85% !important;
        right: 4% !important;
        left: 8% !important;
        height: 75vh !important; /* Uses 75% of screen height */
        bottom: 85px !important;
        border-radius: 15px !important;
    }
    quick-actions button {
        padding: 8px 12px !important;
        font-size: 12px !important;
        margin: 4px 2px !important;
    }
    #chat-icon {
        min-width: 140px !important;
        height: 55px !important;
        padding: 0 15px 0 5px !important;
    }
    .human-avatar-img {
        width: 45px !important;
        height: 45px !important;
    }
    /* Adjust the header padding for smaller screens */
    .chat-header {
        padding: 12px 15px;
    }

    /* Ensure the input area doesn't get squashed */
    .chat-input-area {
        padding: 10px;
    }

    #userInput {
        padding: 8px 14px;
        font-size: 16px; /* Prevents iOS from zooming in when typing */
    }
    icon-text {
        font-size: 13px !important;
    }
    .chat-input-area {
        padding: 10px;
    }
    #messages {
        display: flex;
        flex-direction: column;
        padding-bottom: 40px !important; /* Extra space at bottom for the indicator */
    }

    #chat-typing-indicator {
        margin: 5px 5px !important; /* Even smaller margins for very thin phones */
        font-size: 11px !important;
    }
    .brain-pulse {
        width: 28px; /* Slightly smaller to fit mobile chat bubbles better */
        height: 28px;
    }

    @keyframes pulse-green {
        0% {
            transform: scale(0.95);
            box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.7);
        }

        70% {
            transform: scale(1);
            box-shadow: 0 0 0 6px rgba(40, 167, 69, 0);
        }
        /* Reduced spread */
        100% {
            transform: scale(0.95);
            box-shadow: 0 0 0 0 rgba(40, 167, 69, 0);
        }
    }
}