﻿.chat-widget-wrapper {
    position: fixed;
    bottom: 15px;
    right: 210px;
    display: flex;
    flex-direction: column; /* Stacks notice on top of avatar */
    align-items: flex-end; /* Aligns both to the right */
    z-index: 10001;
}

.chat-notice {
    position: relative;
    width: 220px;
    height: 70px;
    background: #ffffff;
    border-radius: 15px;
    padding: 14px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    border: 1px solid #f0f0f0;
    z-index: 10002 !important; /* Higher than the avatar button */
    /* Pushes the box to the left of the avatar button's edge */
    margin-right: 20px;
    margin-bottom: 10px; /* Space between box and avatar */
    /* If using a Flexbox container, this keeps it aligned right */
    align-self: flex-end;
}

    /* The Triangle (Pointer) - Adjusted to point to the avatar icon */
    .chat-notice::after {
        content: '';
        position: absolute;
        bottom: -10px;
        right: 40px; /* Adjust this to align exactly over Narayan's face */
        border-left: 10px solid transparent;
        border-right: 10px solid transparent;
        border-top: 10px solid #ffffff;
    }

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#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: 105px;
    right: 30px;
    width: 380px;
    /* Increase height to show more chat history + buttons */
    height: 480px;
    z-index: 9999 !important;
    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;
    transition: all 0.3s ease; /* Makes opening/closing look smooth */
}

#chatbox-header {
    background: linear-gradient(135deg, #0078d4, #005a9e);
    color: white;
    padding: 15px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#messages {
    padding: 15px;
    overflow-y: auto;
    flex-grow: 1;
    background: #f8faff;
    overflow-x: hidden !important;
}

.message {
    margin-bottom: 12px;
    padding: 10px 15px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.5;
    max-width: 85%;
}

.user-style {
    background-color: #0078d4; /*Azure Blue */
    color: white;
    align-self: flex-end;
    /* border-bottom-right-radius: 2px;*/
    margin-left: auto;
}

.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 */
    /* Primary English Font -> Professional Bengali Font -> Standard Fallbacks */
    font-family: 'Segoe UI', Roboto, 'Helvetica Neue', 'Hind Siliguri', 'Vrinda', Arial, sans-serif;
    /* Improves readability for Bengali characters */
    line-height: 1.6;
    font-size: 15px;
}
    /* Ensure Markdown Lists show up correctly */
    .bot-style ul {
        margin: 5px 0;
        padding-left: 20px;
    }

    .bot-style li {
        margin-bottom: 3px;
    }

    .bot-style strong {
        font-weight: 600;
    }

.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 CONTAINER --- */
.quick-actions {
    display: none; /* Controlled by setLanguage() */
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px;
    justify-content: center;
    background: #ffffff;
    border-top: 1px solid #e0e0e0;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05); /* Soft shadow for depth */
}

    .quick-actions button {
        /* This ensures exactly 2 buttons per row minus the gap */
        flex: 1 1 calc(50% - 10px);
        max-width: calc(50% - 10px);
        padding: 10px 5px;
        border: 1px solid #007bff;
        background: #fdfdfd;
        color: #007bff;
        border-radius: 12px; /* Slightly more modern look than full pill */
        cursor: pointer;
        font-size: 12px;
        font-weight: 600;
        text-align: center;
        transition: all 0.2s ease-in-out;
        box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    }

        .quick-actions button:hover {
            background: #007bff;
            color: white;
            transform: translateY(-1px); /* Slight lift on hover */
            box-shadow: 0 4px 8px rgba(0,123,255,0.2);
        }

        .quick-actions button:active {
            transform: translateY(0); /* Button press effect */
            background: #0056b3;
        }

#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;
    text-decoration: underline;
    font-weight: 500;
    /* FIX: Force regular links to wrap */
    word-break: break-all;
    overflow-wrap: break-word;
}

    .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;
        /* FIX: Ensure chips don't push the bubble out */
        max-width: 100%; /* Stay within bubble */
        white-space: normal; /* Allow text to wrap inside the chip if needed */
        word-break: break-all; /* Break long URLs inside the chip */
        box-sizing: border-box; /* Include padding in width calculation */
    }

        .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-char-btn {
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
    padding: 5px;
}

    .close-char-btn:hover {
        opacity: 1;
    }

/* Business Hours Card in Chat */
.business-hours-card {
    background: #ffffff;
    border-left: 5px solid #28a745; /* Green to signify "Open" */
    padding: 12px 15px;
    margin: 10px 0;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.hours-title {
    font-size: 14px;
    font-weight: 700;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
}

.hours-detail {
    font-size: 13px;
    color: #0078d4;
    font-weight: 600;
    margin-top: 5px;
}
/* Special Styling for Membership/Earnings info in chat */
.membership-highlight {
    background: #fffdf2;
    border: 1px solid #ffd700;
    color: #856404;
    padding: 12px;
    border-radius: 10px;
    margin: 10px 0;
    border-left: 5px solid #ffd700;
    font-size: 13px;
}
/* --- BUSINESS TIMING CARD --- */
.timing-card {
    background: #ffffff;
    border-left: 5px solid #28a745; /* Green to signify "Open & Active" */
    padding: 12px 15px;
    margin: 10px 0;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.timing-header {
    font-size: 14px;
    font-weight: 700;
    color: #333;
    display: flex;
    align-items: center;
    gap: 6px;
}

    .timing-header::before {
        content: "🕒";
    }

.timing-detail {
    font-size: 15px;
    color: #0078d4; /* Azure Blue */
    font-weight: 600;
    letter-spacing: 0.5px;
}

.timing-note {
    font-size: 11px;
    color: #666;
    font-style: italic;
}

.language-selection-container {
    display: flex;
    justify-content: center;
    gap: 8px; /* Space between buttons */
    flex-wrap: nowrap;
}

#lang-select {
    background: #ffffff; /* White background is much cleaner */
    border-radius: 12px;
    padding: 24px;
    margin: 10px auto;
    max-width: 350px;
    border: 1px solid #e1e8ed; /* Subtle border */
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05); /* Soft shadow for depth */
    text-align: center;
}

    #lang-select p {
        font-family: 'Segoe UI', Tahoma, sans-serif;
        color: #2d3748; /* Dark slate gray for high readability */
        font-size: 15px;
        font-weight: 600;
        margin-bottom: 20px;
        line-height: 1.5;
    }

/* Modern Professional Buttons */
.lang-btn {
    font-family: 'Segoe UI', 'Hind Siliguri', 'Noto Sans Devanagari', sans-serif;
    background-color: #0078d4; /* Microsoft Azure Blue */
    color: #ffffff;
    border: none;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
    flex: 1; /* Makes buttons equal width */
    box-shadow: 0 2px 4px rgba(0, 120, 212, 0.2);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

    /* Hover effect for Desktop */
    .lang-btn:hover {
        background-color: #005a9e; /* Slightly darker blue */
        transform: translateY(-1px); /* Subtle lift */
        box-shadow: 0 4px 8px rgba(0, 120, 212, 0.3);
    }

    /* Active effect for Mobile touch */
    .lang-btn:active {
        transform: translateY(0);
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    }

    /* Remove margin from last button */
    .lang-btn:last-child {
        margin-bottom: 0;
    }
/*Thinking animation css*/
.thinking-container {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(240, 244, 248, 0.8);
    border-radius: 8px;
    width: fit-content;
    margin: 10px 0;
}

.icon-wrapper {
    position: relative;
    width: 30px;
    height: 30px;
}

.thinking-svg {
    width: 100%;
    height: 100%;
    fill: #007bff; /* You can change this to match your logo color */
}

.scan-ring {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 2px solid #007bff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: rotate 1s linear infinite;
    /* Add this line for mobile smoothness */
    will-change: transform;
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.thinking-text {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: #444;
    letter-spacing: 0.5px;
}


/* --- Mobile Responsive Fix --- */
@media screen and (max-width: 480px) {

    /* 1. Fix the Chatbox width to prevent side-scrolling */
    #chatbox {
        width: 85% !important;
        right: 4% !important;
        left: 8% !important;
        height: 75vh !important; /* Uses 75% of screen height */
        bottom: 85px !important;
        border-radius: 15px !important;
    }

    .chat-widget-wrapper {
        bottom: 15px !important;
        right: 15px !important;
    }

    #chat-icon {
        min-width: 140px !important;
        height: 55px !important;
        padding: 0 15px 0 5px !important;
    }

    .chat-notice {
        width: 180px !important;
        padding: 10px !important;
        margin-right: 170px !important; /* Positions bubble correctly over small icon */
        margin-bottom: 5px !important;
    }

        .chat-notice::after {
            right: 15px !important; /* Re-aligns triangle for mobile */
        }

    .avatar-container {
        width: 50px !important;
        height: 50px !important;
    }

    .human-avatar-img {
        width: 45px !important;
        height: 45px !important;
    }

    .icon-text {
        font-size: 13px !important;
    }

    #userInput {
        font-size: 16px; /* Prevents mobile browser auto-zoom */
    }


    .chat-header {
        padding: 12px 15px;
    }

    .chat-input-area {
        padding: 10px;
    }

    .quick-actions {
        display: flex; /* Ensure flex is active */
        padding: 8px;
        gap: 6px; /* Slightly tighter gap to save space */
        background: #ffffff;
    }

        .quick-actions button {
            /* Force exactly 2 buttons per row with consistent height */
            flex: 1 1 calc(50% - 6px);
            max-width: calc(50% - 6px);
            height: 45px; /* Minimum height for easy thumb tapping */
            padding: 5px;
            font-size: 11px; /* Slightly smaller font to prevent text wrapping */
            line-height: 1.2;
            display: flex;
            align-items: center;
            justify-content: center;
            text-align: center;
            border-radius: 10px;
            box-shadow: 0 1px 3px rgba(0,0,0,0.1);
        }

    .icon-text {
        font-size: 13px !important;
    }

    #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;
    }

    .business-hours-card {
        padding: 10px;
        margin: 8px 0;
    }

    .hours-detail {
        font-size: 12px;
    }

    .membership-highlight {
        padding: 10px;
        font-size: 12px;
    }

    .timing-card {
        padding: 10px;
        margin: 8px 0;
    }

    .timing-detail {
        font-size: 13px;
    }

    .lang-btn {
        padding: 8px 6px;
        font-size: 11px;
        letter-spacing: -0.2px; /* Tightens text slightly to fit */
    }

    #lang-select {
        padding: 15px 10px; /* Less horizontal padding to save space */
        width: 95%;
    }

        #lang-select p {
            font-size: 13px;
        }

    .thinking-container {
        padding: 8px 10px; /* Slightly smaller padding for mobile */
        gap: 8px;
        margin: 5px 0; /* Tighter margins to save vertical space */
    }

    .icon-wrapper {
        width: 24px; /* Slightly smaller icon so it doesn't dominate the screen */
        height: 24px;
    }
}
/* Very Small Screens (e.g., iPhone SE or older) */
@media screen and (max-width: 350px) {
    .quick-actions button {
        font-size: 10px;
        height: 40px;
    }
}
