/* CSS Custom Properties for Theming */
:root {
    --iw-headless-chatbot-primary-color: #CF1622;
    --iw-headless-chatbot-secondary-color: #FFFFFF;
    --iw-headless-chatbot-tertiary-color: #e5e7eb;
    --iw-headless-chatbot-secondary-background-color: #93000f;
    --iw-headless-chatbot-primary-contrast-color: #FFFFFF;
    --iw-headless-chatbot-secondary-contrast-color: #333333;
    --iw-headless-chatbot-label-color: #4a4a4a;
    --iw-headless-chatbot-send-btn-bg-url: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M2.01 21L23 12 2.01 3 2 10l15 2-15 2z'/%3E%3C/svg%3E");
    --iw-headless-chatbot-close-btn-url: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='17' height='17' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z'/%3E%3C/svg%3E");
    --iw-headless-chatbot-empty-message-content: "Start a conversation";
}

.iw-headless-chatbot__chat[data-state="open"][data-maxi="false"] {
    display: flex;
    width: 450px;
    height: 65vh;
    box-shadow: rgba(0, 0, 0, 0.35) 0px 5px 15px;
}

@media only screen and (max-width: 500px) {
    .iw-headless-chatbot__chat[data-state="open"][data-maxi="false"] {
        width: 65vw;
    }
}

.iw-headless-chatbot__chat[data-maxi="true"] {
    display: flex;
    width: 80vw;
    height: 65vh;
    box-shadow: rgba(0, 0, 0, 0.35) 0px 5px 15px;
}

.iw-headless-chatbot__chat[data-fullscreen="true"] {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    max-width: none !important;
    max-height: none !important;
    z-index: 999999 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

.iw-headless-chatbot__chat[data-state="closed"] {
    display: none;
}

.iw-headless-chatbot__root {
    display: flex;
    flex-direction: column;
    align-items: end;
    gap: 20px;
    transition-duration: 150ms;
}

.iw-headless-chatbot__chatbot-header {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    justify-content: space-between;
    gap: 10px;
    transition-duration: 150ms;
    background: linear-gradient(135deg,
            var(--iw-headless-chatbot-primary-color) 0%,
            var(--iw-headless-chatbot-secondary-background-color) 100%);
    border-radius: 10px 10px 0px 0px;
    padding: 0.75rem 1rem;
    color: var(--iw-headless-chatbot-secondary-color);
    vertical-align: middle;
}

.iw-headless-chatbot__header-text {
    position: relative;
    display: block;
}

@media only screen and (max-width: 500px) {
    .iw-headless-chatbot__header-text {
        display: none;
    }
}

.iw-headless-chatbot__trigger {
    background: linear-gradient(135deg,
            var(--iw-headless-chatbot-primary-color) 0%,
            var(--iw-headless-chatbot-secondary-background-color) 100%);
    cursor: pointer;
    width: 65px;
    height: 65px;
    border-radius: 50%;
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
}

.iw-headless-chatbot__trigger:hover,
.iw-headless-chatbot__trigger[data-state="open"] {
    box-shadow: rgba(0, 0, 0, 0.35) 0px 5px 15px;
}

.iw-headless-chatbot__chat {
    flex-direction: column;
    gap: 16px;
    border: 1px solid var(--iw-headless-chatbot-tertiary-color);
    padding-bottom: 16px;
    border-radius: 8px;
    background-color: var(--iw-headless-chatbot-secondary-color);
    width: 100%;
}

.iw-headless-chatbot__chat form {
    display: flex;
    gap: 10px;
    align-items: center;
}

.iw-headless-chatbot__prompt {
    outline: none;
    height: 38px;
    border-radius: 25px !important;
    border: 1px solid gray !important;
    background-color: white !important;
    padding: 0 16px !important;
    width: 100% !important;
}

.iw-headless-chatbot__prompt:hover {
    box-shadow: 0 0 0 1px var(--iw-headless-chatbot-tertiary-color) inset;
}

.iw-headless-chatbot__prompt:focus-visible {
    border-color: var(--iw-headless-chatbot-primary-color);
    box-shadow: 0 0 0 1px var(--iw-headless-chatbot-primary-color) inset;
}

.iw-headless-chatbot__send-btn {
    cursor: pointer;
    background: var(--iw-headless-chatbot-send-btn-bg-url) var(--iw-headless-chatbot-primary-color);
    background-position: center;
    background-repeat: no-repeat;
    background-size: 20px 20px;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 50%;
    margin: 0 auto;
}

.iw-headless-chatbot__send-btn[data-disabled="true"] {
    cursor: pointer;
    background: var(--iw-headless-chatbot-send-btn-bg-url) var(--iw-headless-chatbot-tertiary-color);
    background-position: center;
    background-repeat: no-repeat;
    background-size: 20px 20px;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 50%;
    margin: 0 auto;
}

.iw-headless-chatbot__send-btn[data-active="true"] {
    background: var(--iw-headless-chatbot-send-btn-bg-url) var(--iw-headless-chatbot-primary-color);
    background-position: center;
    background-repeat: no-repeat;
    background-size: 20px 20px;
}

.iw-headless-chatbot__empty-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.iw-headless-chatbot__empty {
    position: relative;
    padding: 16px;
    width: 100%;
}

.iw-headless-chatbot__box-logo-img {
    object-fit: contain;
    width: 50%;
}

.iw-headless-chatbot__empty::after {
    content: var(--iw-headless-chatbot-empty-message-content);
    font-size: 16px;
    position: absolute;
    display: block;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    text-align: center;
}

.iw-headless-chatbot__messages {
    display: flex;
    flex-direction: column;
    overflow: auto;
    gap: 12px;
    padding: 0 16px;
    width: 100%;
    box-sizing: border-box;
}

.iw-headless-chatbot__messages[data-fullscreen="false"] {
    margin: auto;
}

.iw-headless-chatbot__messages[data-fullscreen="true"] {
    height: 100%;
}

.iw-headless-chatbot__messages[data-maxi="true"] {
    max-height: 60vh;
}

@media only screen and (max-width: 500px) {
    .iw-headless-chatbot__messages[data-fullscreen="true"] {
        width: 80%;
    }
}

.iw-headless-chatbot__block-messages {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.iw-headless-chatbot__message {
    padding: 8px;
    width: 90%;
    border-radius: 8px;
    font-size: 12px;
    word-break: break-word;
    min-height: 21.59px;
    padding: 16px;
}

.iw-headless-chatbot__message[data-sender="user"] {
    margin-left: auto;
    border-radius: 2rem 0px 2rem 2rem;
    background-color: var(--iw-headless-chatbot-primary-color);
    color: var(--iw-headless-chatbot-primary-contrast-color);
}

.iw-headless-chatbot__user-msg {
    text-align: right;
    font-size: 12px;
}

.iw-headless-chatbot__bot-msg {
    color: var(--iw-headless-chatbot-label-color);
    text-align: left;
    font-size: 12px;
}

.iw-headless-chatbot__message[data-sender="chatbot"] {
    margin-right: auto;
    background-color: var(--iw-headless-chatbot-tertiary-color);
    color: var(--iw-headless-chatbot-secondary-contrast-color);
    border-radius: 0px 2rem 2rem 2rem;
    padding-left: 10px;
    line-height: 1.4;
}

/* Sources Message */
.sources-message {
    background: #f8f9fa;
    border: 1px solid #e1e1e1;
    border-radius: 8px;
    padding: 12px 16px;
    margin: 8px 0;
    max-width: 90%;
    font-size: 13px;
    margin-right: auto;
    width: auto;
}

.sources-message p {
    margin: 0 0 8px 0;
    font-weight: 600;
    color: #333;
}

.sources-list {
    margin: 0;
    padding-left: 16px;
    list-style-type: disc;
}

.sources-list li {
    margin-bottom: 4px;
}

.sources-list a {
    color: var(--iw-headless-chatbot-primary-color);
    text-decoration: none;
    font-weight: 500;
}

.sources-list a:hover {
    text-decoration: underline;
}

.iw-headless-chatbot__header-logo {
    width: 35px;
    height: 35px;
    background-color: var(--iw-headless-chatbot-secondary-color);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.iw-headless-chatbot__header-logo img {
    width: 80%;
}

.iw-headless-chatbot__close-btn {
    background-image: var(--iw-headless-chatbot-close-btn-url);
    background-repeat: no-repeat;
    background-size: 27px 27px;
    width: 24px;
    height: 24px;
    margin: 0 auto;
    background-position: center;
    cursor: pointer;
    position: relative;
    top: 7px;
    left: 3%;
}

.iw-headless-chatbot__send-messages-container {
    padding: 0 15px;
    margin-top: auto;
}

/* loader component css */
.iw-headless-chatbot__loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    /* Full screen height */
}

.iw-headless-chatbot__loading-dots {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 60px;
    /* Adjust width to control spacing between dots */
}

.iw-headless-chatbot__loading-dots div {
    width: 8px;
    height: 8px;
    background-color: #bbb;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.iw-headless-chatbot__loading-dots div:nth-child(1) {
    animation-delay: -0.32s;
}

.iw-headless-chatbot__loading-dots div:nth-child(2) {
    animation-delay: -0.16s;
}

.iw-headless-chatbot__loading-dots div:nth-child(3) {
    animation-delay: 0s;
}

@keyframes bounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

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

@keyframes typing {

    0%,
    80%,
    100% {
        transform: scale(0);
        opacity: 0.5;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* collapsible component css */
.iw-headless-chatbot__collapsibleRoot {
    width: 100%;
}

.iw-headless-chatbot__iconButton {
    font-family: inherit;
    border-radius: 100%;
    height: 25px;
    width: 25px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--iw-headless-chatbot-secondary-background-color);
}

.iw-headless-chatbot__text {
    color: var(--iw-headless-chatbot-secondary-background-color);
    font-size: 14px;
    line-height: 25px;
}

.iw-headless-chatbot__repository {
    background-color: white;
    border-radius: 4px;
    margin: 10px 0;
    padding: 10px;
    box-shadow: 0 2px 10px var(--iw-headless-chatbot-tertiary-color);
}

.iw-headless-chatbot__link {
    font-size: 11px !important;
    line-height: 12px !important;
    color: var(--iw-headless-chatbot-secondary-contrast-color) !important;
}

/* fullscreen */
.iw-headless-chatbot__fullscreen-btn {
    cursor: pointer;
    position: relative;
    top: 7px;
    left: 23%;
}

@media only screen and (max-width: 500px) {
    .iw-headless-chatbot__fullscreen-btn {
        top: 13px;
    }
}

.iw-headless-chatbot__buttons-container {
    display: flex;
    flex-direction: row;
    justify-content: flex-end;
    gap: 10px;
}

.iw-headless-chatbot__header-container {
    display: flex;
    flex-direction: row;
    justify-content: flex-start;
    gap: 10px;
}

.iw-headless-chatbot__chatbot-info {
    padding: 0 15px;
    font-size: 11px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    /* Bottom shadow */
    padding-bottom: 20px;
    color: var(--iw-headless-chatbot-label-color);
}

.iw-headless-chatbot__chatbot-info div:last-child {
    margin-top: 15px;
    line-height: 1.8;
}

@media only screen and (max-width: 500px) {
    .iw-headless-chatbot__chatbot-info {
        max-height: 50px;
        overflow: auto;
    }

    .iw-headless-chatbot__messages {
        overflow: auto;
    }
}

@media only screen and (min-width: 500px) and (max-width: 932px) and (orientation: landscape) {
    .iw-headless-chatbot__chatbot-info {
        max-height: 50px;
        overflow: auto;
    }

    .iw-headless-chatbot__messages {
        overflow: auto;
    }
}

.full-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw !important;
    min-width: 100vw !important;
    max-width: 100vw !important;
    min-height: 100vh !important;
    max-height: 100vh !important;
    height: -webkit-fill-available !important;
    z-index: 9999 !important;
    transition: all 0.3s;
}

/* iOS-specific adjustment */
@supports (-webkit-touch-callout: none) {
    .full-screen {
        height: -webkit-fill-available !important;
        min-height: -webkit-fill-available !important;
        max-height: -webkit-fill-available !important;
        width: -webkit-fill-available !important;
        min-width: -webkit-fill-available !important;
        max-width: -webkit-fill-available !important;
    }
}

.iw-headless-chatbot__prompt {
    font-size: 14px;
    font-family: Poppins, sans-serif;
}

div#iw-headless-chatbot-container {
    position: fixed;
    bottom: 15px;
    right: 15px;
    z-index: 99999;
}