/* Reset and Base Styles */
body,
input,
textarea,
button {
    font-family: "Montserrat", sans-serif;
}

.suggestion-bubbles-img {
    height: 16px !important;
    width: 16px !important;
}

/* Reset and Base Styles */
#queryInputId:focus {
    --tw-ring-shadow: none !important;
}

.chat-msg strong {
    font-weight: 700 !important;
}

/* Utility Classes (replacing Bootstrap) */
.d-flex {
    display: flex;
}

.align-items-center {
    align-items: center;
}

.text-center {
    text-align: center;
}

.justify-content-between {
    justify-content: space-between;
}

.p-2 {
    padding: 0.5rem;
}

.p-3 {
    padding: 1rem;
}

.d-none {
    display: none !important;
}

.shadow-lg {
    box-shadow:
        0 10px 15px -3px rgba(0, 0, 0, 0.1),
        0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Chat Message Styles */
.chat-msg.bot p {
    margin-bottom: 0.5rem;
}

.chat-msg.bot ul,
.chat-msg.bot ol {
    margin-bottom: 0.5rem;
    margin-top: 0.5rem;
    padding-left: 1.5rem;
    list-style-position: outside;
}

.chat-msg.bot ul {
    list-style-type: disc;
}

.chat-msg.bot ol {
    list-style-type: decimal;
}

.chat-msg.bot li {
    margin-bottom: 0.5rem;
    padding-left: 0.25rem;
    line-height: 1.5;
}

.chat-msg.bot hr {
    margin-bottom: 0.5rem;
}

/* Nested lists */
.chat-msg.bot ul ul {
    list-style-type: circle;
    margin-top: 0.25rem;
    margin-bottom: 0.25rem;
}

.chat-msg.bot ul ul ul {
    list-style-type: square;
}

.chat-msg.bot h1,
.chat-msg.bot h2,
.chat-msg.bot h3,
.chat-msg.bot h4,
.chat-msg.bot h5,
.chat-msg.bot h6 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    font-weight: 550;
}

/* Floating Chat Button */
.chat-float-btn {
    position: fixed;
    bottom: 25px;
    right: 25px;
    width: 56px;
    height: 56px;
    background: #0FB1C7;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    cursor: pointer;
    transition: 0.3s ease;
    z-index: 10000;
    border: none;
}

.chat-float-btn img {
    width: 24px;
    height: 24px;
}

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

/* Ring animation */
.chat-float-btn::before {
    content: "";
    position: absolute;
    width: 72px;
    height: 72px;
    background: #f6902140;
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    animation: ringPulse 1.8s infinite;
    z-index: -1;
}

/* Smooth pulsating ring */
@keyframes ringPulse {
    0% {
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 0.6;
    }

    50% {
        transform: translate(-50%, -50%) scale(1.3);
        opacity: 0;
    }

    100% {
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 0.6;
    }
}

/* Chat Window */
.chat-window {
    --header-height: 70px;
    /* --footer-height: 120px; */
    /* Default, will be updated by JS */
    width: 494px;
    height: 592px;
    /* background-color: #E5F3F8; */
    position: fixed;
    bottom: 90px;
    right: 25px;
    flex-direction: column;
    overflow: hidden;
    z-index: 100000;
    border-radius: 24px;
    opacity: 0;
    transform: translateY(20px) scale(0.98);
    pointer-events: none;
    transition:
        opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1),
        transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
}

/* OPEN */
.chat-window.open {
    opacity: 1;
    transform: translateY(0px) scale(1);
    pointer-events: auto;
}

/* CLOSING STATE */
.chat-window.closing {
    opacity: 0;
    transform: translateY(20px) scale(0.98);
    pointer-events: none;
}

/* EXPAND MODE */
.chat-window.expand {
    width: 550px;
    height: 85vh;
    max-height: 85vh;
}

.chat-window.expand #chat-body {
    flex: 1;
    min-height: 0;
    max-height: calc(85vh - var(--header-height) - var(--footer-height));
    height: calc(85vh - var(--header-height) - var(--footer-height));
}

/* When chat is expanded, give the textarea more room to grow */
.chat-window.expand .chat-textarea {
    min-height: 80px;
    max-height: 300px;
}

/* Header */
.chat-header {
    background: #e5f3f8;
    color: #184859;
    padding: 20px 22px;
    /* border-radius: 16px 16px 0 0; */
    border-bottom: 0.5px solid #0fb1c7;
    overflow: visible;
    position: relative;
    z-index: 1;
    flex-shrink: 0;
}

.chat-main-title {
    gap: 8px;
}

.chat-main-title h6 {
    font-weight: 600;
    font-size: 16px;
    margin: 0;
    color: #174859;
}

.chat-avatar {
    width: 28px;
    height: 28px;
}

.icon-list {
    gap: 16px;
    overflow: visible;
    position: relative;
    z-index: 10;
}

.new-chat-wrapper {
    display: inline-flex;
    cursor: pointer;
    border-radius: 8px;
    position: relative;
    padding: 4px;
    transition: background-color 0.2s ease;
}

.new-chat-wrapper:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

/* Tooltip Styles */
.new-chat-wrapper[data-tooltip] {
    position: relative;
    overflow: visible;
}

.new-chat-wrapper[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 12px;
    background-color: #333;
    color: white;
    font-size: 12px;
    font-weight: 500;
    border-radius: 6px;
    white-space: nowrap;
    z-index: 10000;
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    min-width: max-content;
}

.new-chat-wrapper[data-tooltip]:hover::before {
    content: "";
    position: absolute;
    top: calc(100% + 3px);
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-bottom-color: #333;
    z-index: 10001;
    pointer-events: none;
}

/* Chat Messages */
.chat-msg {
    font-weight: 500;
    font-size: 15px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 60%;
    padding: 10px;
    width: fit-content;
    border-radius: 18px;
    color: #08161B;
}

/* USER MESSAGE = RIGHT SIDE */
.chat-msg.user {
    background: #164859;
    color: white;
    margin-left: auto;
    border-radius: 8px 8px 2px 8px;
    margin-bottom: 10px;
}

/* BOT MESSAGE = LEFT SIDE */
.chat-msg.bot {
    background-color: #F2F2F2;
    margin-right: auto;
    border-radius: 8px;
    max-width: 90% !important;
    /* font-size: 15px; */
    /* border: 1px solid #c2e4f0; */
}

/* Chat body scroll limit */
#chat-body {
    height: calc(500px - var(--footer-height));
    max-height: calc(500px - var(--footer-height));
    overflow-y: auto;
    padding-bottom: 15px;
    position: relative;
    display: flex;
    flex-direction: column;
    flex-shrink: 1;
    flex-grow: 1;
    background-color: #ffffff;
}

/* Typing indicator placed like bot message (left) */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    width: fit-content;
    margin-top: 6px;
    margin-bottom: 10px;
    padding: 10px 14px;
    background: #ffffff;
    border-radius: 18px 18px 18px 0;
}

/* Hide typing indicator */
.typing-indicator-hidden {
    display: none;
}

.typing-dots {
    display: flex;
    align-items: center;
    gap: 4px;
}

.typing-dots span {
    width: 10px;
    height: 10px;
    background: #D0F5FA;
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out;
}

/* Animations: delay for each dot */
.typing-dots span:nth-child(1) {
    animation-delay: 0s;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.4s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.8s;
}

@keyframes typingBounce {
    0%, 80%, 100% {
        opacity: 0.35;
        transform: translateY(0) scale(0.9);
    }

    40% {
        opacity: 1;
        transform: translateY(-6px) scale(1);
    }
}

.chat-footer-main {
    position: relative;
    flex-shrink: 0;
}

/* Footer */
.chat-footer {
    background: #ffffff;
    /* border-radius: 0 0 24px 24px; */
    flex-shrink: 0;
}

.chat-footer-divider {
    border: none;
    height: 1px;
    background-color: #E2E2E2;
    margin: auto !important;
}

.chat-input-outer-box {
    padding: 16px;
    padding-bottom: 0
}

.chat-input-box {
    /* padding: 16px; */
    position: relative;
    display: flex;
    align-items: center;
    background: #fff;
    border-radius: 12px;
    padding: 8px 12px;
    border: 1px solid #E2E2E2;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.chat-form-cls {
    width: 100%;
    position: relative;
}

.chat-textarea {
    width: 90%;
    min-height: 55px;
    max-height: 120px;
    resize: none;
    border: none;
    outline: none;
    padding-left: 0 !important;
    padding-right: 10px !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    font-size: 15px;
    line-height: 18px;
    overflow-y: auto;
    font-family: "Montserrat", sans-serif;
}

.chat-input-box:has(.chat-textarea:focus) {
    border-color: #0FB1C7;
}

.chat-textarea::placeholder {
    color: #667085;
    font-weight: 500;
    font-size: 15px;
}

.chat-send-btn {
    position: absolute;
    right: 0px;
    bottom: 0px;
    background: #0fb1c7;
    border: none;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s ease;
    flex-shrink: 0;
}

.chat-send-btn:hover {
    background: #0b8797;
}

.chat-send-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.chat-send-btn img {
    width: 18px;
}

.chat-suggestions {
    display: flex;
    gap: 8px;
    margin-left: auto;
    margin-right: auto;
    margin-bottom: 5px;
    /* overflow: auto; */
    flex-direction: column;
    padding: 4px 2px;
    width: 100%;
    margin-top: 5px;
    margin-bottom: 10px;
}

.suggestion-bubble {
    background: #FAFAFA;
    padding: 6px 8px;
    font-size: 15px;
    font-weight: 500;
    color: #164859;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    flex: 0 1 auto;
    text-align: start;
    line-height: normal;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 44px;
}

.suggestion-bubble:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    background-color: #0FB1C71A;
}

.suggestion-bubble:active {
    transform: translateY(0);
}

/* GLOBAL SCROLLBAR */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #b5c3d1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #7d8da5;
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: #b5c3d1 transparent;
}

/* Responsive — mobile full-screen chat */
@media (max-width: 600px) {
    .chat-window {
        width: 100vw !important;
        height: 100vh !important;
        height: 100dvh !important;
        bottom: 0 !important;
        right: 0 !important;
        border-radius: 0 !important;
    }

    .chat-window.closing {
        transform: none !important;
    }

    .chat-header {
        border-radius: 0 !important;
        padding-top: max(20px, env(safe-area-inset-top));
    }

    .chat-window #chat-body {
        flex: 1 !important;
        min-height: 0 !important;
        height: auto !important;
        max-height: none !important;
    }

    .chat-footer-main {
        padding-bottom: env(safe-area-inset-bottom);
    }

    #expand-chat {
        display: none !important;
    }
}