/* chatbot changes */
/* Chatbot container */
.cb-chatbot-root {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    contain: layout paint;
}

.cb-chatbot-root.cb-open {
    opacity: 1;
    visibility: visible;
}

.cb-chat-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 10000;
    -webkit-tap-highlight-color: transparent;
    cursor: pointer;
    appearance: none;
    border: 0;
    outline: 0;
    height: 56px;
    width: 56px;
    border-radius: 50%;
    background: #1f2331;
    color: #e7e9ee;
    box-shadow: 0 18px 40px -15px rgba(0, 0, 0, 0.45), 0 0 0 0 rgba(124, 140, 255, 0.0);
    display: grid;
    place-items: center;
    transition: transform .2s ease, box-shadow .3s ease, background .2s ease;
    isolation: isolate;
}

@media (prefers-color-scheme: light) {
    .cb-chat-toggle {
        background: #22092B;
        color: #12131a;
        box-shadow: 0 18px 40px -15px rgba(7, 10, 40, 0.25), 0 0 0 0 rgba(79, 93, 255, 0.0);
    }
}

.cb-chat-toggle::after {
    content: "";
    position: absolute;
    inset: -2px;
    border-radius: inherit;
    background: conic-gradient(from 180deg at 50% 50%, rgba(124, 140, 255, .45), rgba(124, 140, 255, 0) 30%, rgba(124, 140, 255, .45));
    filter: blur(14px);
    opacity: .0;
    z-index: -1;
    transition: opacity .3s ease;
    pointer-events: none;
}

.cb-chat-toggle:hover {
    transform: translateY(-2px) scale(1.02);
}

.cb-chat-toggle:hover::after {
    opacity: .55;
}

.cb-chat-toggle:focus-visible {
    box-shadow: 0 0 0 4px rgba(124, 140, 255, 0.45), 0 18px 40px -15px rgba(0, 0, 0, 0.45);
}

@media (prefers-color-scheme: light) {
    .cb-chat-toggle:focus-visible {
        box-shadow: 0 0 0 4px rgba(79, 93, 255, 0.35), 0 18px 40px -15px rgba(7, 10, 40, 0.25);
    }
}

/* Panel */
.cb-chat-panel {
    position: relative;
    width: 75vw;
    height: 90vh;
    max-width: 1200px;
    max-height: none;
    min-width: 320px;
    min-height: 400px;
    border-radius: 10px;
    background: #171923;
    box-shadow: 0 18px 40px -15px rgba(0, 0, 0, 0.45);
    overflow: hidden;
    transform: scale(0.9);
    transition: transform 0.3s ease;
    display: grid;
    grid-template-rows: auto 1fr auto;
}

@media (prefers-color-scheme: light) {
    .cb-chat-panel {
        background: #ffffff;
        box-shadow: 0 18px 40px -15px rgba(7, 10, 40, 0.25);
    }
}

.cb-chatbot-root.cb-open .cb-chat-panel {
    transform: scale(1);
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .cb-chat-panel {
        width: 95vw;
        height: 92vh;
        min-width: 280px;
    }
}

@media (max-width: 480px) {
    .cb-chat-panel {
        width: 98vw;
        height: 95vh;
        border-radius: 12px;
    }
}

.cb-chat-header {
    background: #22092B;
    padding: 14px 14px 14px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid rgba(124, 140, 255, 0.18);
}

@media (prefers-color-scheme: light) {
    .cb-chat-header {
        background: #22092B;
        border-bottom: 1px solid rgba(79, 93, 255, 0.18);
    }
}

.cb-chat-avatar {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #22092B;
    overflow: hidden;
}

.cb-chat-avatar img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: inherit;
}

@media (prefers-color-scheme: light) {
    .cb-chat-avatar {
        background: #22092B;
    }
}

.cb-chat-title {
    font-size: 15px;
    color: #e5e3e3;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.cb-chat-sub {
    font-size: 12px;
    color: #b5b5b5;
    font-weight: 400;
}

.cb-grow {
    flex: 1;
}

.cb-icon-btn {
    border: 0;
    background: transparent;
    color: #9aa3b2;
    height: 32px;
    width: 32px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    cursor: pointer;
    transition: background .2s ease, color .2s ease;
}

.cb-icon-btn:hover {
    background: rgba(124, 140, 255, .12);
    color: #e7e9ee;
}

.cb-icon-btn:focus-visible {
    outline: 4px solid rgba(124, 140, 255, 0.45);
}

@media (prefers-color-scheme: light) {
    .cb-chat-sub {
        color: #b5b5b5;
    }

    .cb-icon-btn {
        color: #596273;
    }

    .cb-icon-btn:hover {
        background: rgba(79, 93, 255, .12);
        color: #12131a;
    }

    .cb-icon-btn:focus-visible {
        outline: 4px solid rgba(79, 93, 255, 0.35);
    }
}

.cb-chat-messages {
    padding: 16px;
    overflow: auto;
    background: #ededed;
    scroll-behavior: smooth;
}

.cb-msg {
    display: grid;
    gap: 3px;
    margin: 6px 0 10px;
}

.cb-msg .cb-bubble {
    max-width: 85%;
    display: flex;
    flex-direction: column;
    padding: 10px;
    border-radius: 8px;
    background: #1f2331;
    border: 1px solid rgba(124, 140, 255, 0.16);
    font-size: 14px;
    line-height: 1.3;
    font-weight: 400;
    letter-spacing: -0.002em;
    white-space: pre-wrap;
    word-break: break-word;
    backdrop-filter: blur(8px);
    overflow: hidden;
}

.cb-msg.cb-user {
    justify-items: end;
}

.cb-msg.cb-user .cb-bubble {
    background: #fff;
    border-color: rgba(124, 140, 255, 0.4);
}

.cb-msg.cb-bot {
    justify-items: start;
}

@media (prefers-color-scheme: light) {
    .cb-msg .cb-bubble {
        padding: 20px;
        background: #ffffff;
        border: 1px solid rgba(79, 93, 255, 0.16);
    }

    .cb-msg.cb-user .cb-bubble {
        background: #fff;
        border-color: rgba(79, 93, 255, 0.4);
    }
}

/* Markdown content inside bubbles */
.cb-bubble h1,
.cb-bubble h2,
.cb-bubble h3 {
    line-height: 1.2;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.cb-bubble h1 {
    font-size: 18px;
    color: #1a1a1a;
}

.cb-bubble h2 {
    font-size: 16px;
    color: #1a1a1a;
}

.cb-bubble h3 {
    font-size: 15px;
    color: #1a1a1a;
}

.cb-bubble p {
    display: inline;
    margin: 0 0 6px;
    font-weight: 400;
    line-height: 1.3;
    color: inherit;
}

.cb-bubble p:last-child {
    margin-bottom: 0;
}

.cb-bubble ul,
.cb-bubble ol {
    margin: 0 0 4px 0;
    padding: 0;
    line-height: 1.2;
    list-style: none;
}

.cb-bubble li {
    margin-bottom: 2px;
    position: relative;
    overflow-wrap: break-word;
}

.cb-bubble ul>li::before {
    content: "• ";
    color: #4a5568;
    font-weight: bold;
    font-size: 0.9em;
    margin-right: 4px;
}

.cb-bubble ol>li::before {
    content: "• ";
    color: #4a5568;
    font-weight: bold;
    font-size: 0.9em;
    margin-right: 4px;
}

.cb-bubble ul ul>li::before {
    content: "◦ ";
    color: #6b7280;
    font-size: 0.8em;
    font-weight: bold;
}

.cb-bubble ul ul ul>li::before {
    content: "▪ ";
    color: #9ca3af;
    font-size: 0.7em;
    font-weight: bold;
}

.cb-bubble ol ol>li::before {
    content: "◦ ";
    color: #6b7280;
    font-size: 0.8em;
    font-weight: bold;
}

.cb-bubble ol ol ol>li::before {
    content: "▪ ";
    color: #9ca3af;
    font-size: 0.7em;
    font-weight: bold;
}

.cb-bubble li>ul,
.cb-bubble li>ol {
    margin-left: 20px;
    margin-top: 2px;
}

.cb-bubble strong {
    font-weight: 700;
    color: #2d3748;
    letter-spacing: -0.01em;
}

.cb-bubble em {
    font-style: italic;
    color: #4a5568;
    font-weight: 500;
    letter-spacing: 0.01em;
}

.cb-bubble code {
    font-family: 'JetBrains Mono', 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    background: rgba(255, 107, 107, 0.15);
    color: #ff8a95;
    padding: 2px 4px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid rgba(255, 107, 107, 0.25);
}

.cb-bubble pre {
    margin: 6px 0;
    background: #1a1f2e;
    color: #e6e1dc;
    padding: 10px;
    border-radius: 8px;
    overflow-x: auto;
    border: 1px solid rgba(78, 205, 196, 0.2);
    font-family: 'JetBrains Mono', 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.3;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.cb-bubble pre code {
    background: none;
    border: none;
    padding: 0;
    color: #4ecdc4;
    font-size: inherit;
}

.cb-bubble blockquote {
    margin: 6px 0;
    padding: 8px 12px;
    border-left: 3px solid #45b7d1;
    background: rgba(69, 183, 209, 0.1);
    border-radius: 0 6px 6px 0;
    font-style: italic;
    color: #9dcfeb;
    line-height: 1.2;
}

.cb-bubble a {
    color: #2563eb;
    text-decoration: underline;
    text-decoration-color: rgba(37, 99, 235, 0.6);
    text-underline-offset: 2px;
    transition: all 0.2s ease;
    font-weight: 500;
}

.cb-bubble a:hover {
    color: #1d4ed8;
    text-decoration-color: #1d4ed8;
    transform: translateY(-1px);
}

.cb-bubble hr {
    margin: 8px 0;
    border: none;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(199, 162, 255, 0.4), transparent);
}

@media (prefers-color-scheme: light) {
    .cb-bubble h1 {
        color: #000000;
    }

    .cb-bubble h2 {
        color: #000000;
    }

    .cb-bubble h3 {
        color: #000000;
    }

    .cb-bubble strong {
        color: #1a202c;
        font-weight: 700;
        letter-spacing: -0.01em;
    }

    .cb-bubble em {
        color: #4a5568;
        font-style: italic;
        font-weight: 500;
        letter-spacing: 0.01em;
    }

    .cb-bubble code {
        background: rgba(231, 76, 60, 0.12);
        color: #c0392b;
        border: 1px solid rgba(231, 76, 60, 0.2);
    }

    .cb-bubble pre {
        background: #f8f9fa;
        color: #2d3748;
        border: 1px solid rgba(22, 160, 133, 0.2);
        box-shadow: 0 2px 8px rgba(22, 160, 133, 0.1);
    }

    .cb-bubble pre code {
        color: #16a085;
    }

    .cb-bubble blockquote {
        border-left-color: #3498db;
        background: rgba(52, 152, 219, 0.1);
        color: #2980b9;
    }

    .cb-bubble a {
        color: #2563eb;
        text-decoration-color: rgba(37, 99, 235, 0.6);
    }

    .cb-bubble a:hover {
        color: #1d4ed8;
        text-decoration-color: #1d4ed8;
    }

    .cb-bubble hr {
        background: linear-gradient(90deg, transparent, rgba(155, 89, 182, 0.4), transparent);
    }
}

.cb-chat-input {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid rgba(124, 140, 255, 0.18);
    background: linear-gradient(0deg, rgba(0, 0, 0, .03), rgba(0, 0, 0, 0));
}

.cb-chat-input input {
    height: 44px;
    border-radius: 8px;
    padding: 0 12px 0 12px;
    border: 1px solid rgba(124, 140, 255, 0.25);
    background: #1f2331;
    color: #e7e9ee;
    outline: none;
    transition: box-shadow .2s ease, border-color .2s ease;
}

.cb-chat-input input::placeholder {
    color: #9aa3b2;
}

.cb-chat-input input:focus {
    border-color: #22092B;
}

@media (prefers-color-scheme: light) {
    .cb-chat-input {
        border-top: 1px solid rgba(79, 93, 255, 0.18);
        background: linear-gradient(0deg, rgba(255, 255, 255, .03), rgba(255, 255, 255, 0));
    }

    .cb-chat-input input {
        border: 1px solid rgba(79, 93, 255, 0.25);
        background: #ffffff;
        color: #12131a;
    }

    .cb-chat-input input::placeholder {
        color: #596273;
    }

    .cb-chat-input input:focus {
        border-color: #22092B;
    }
}

.cb-send-btn {
    height: 44px;
    padding: 0 14px;
    border-radius: 8px;
    border: 0;
    background: #22092B;
    color: white;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 14px;
    letter-spacing: -0.01em;
    cursor: pointer;
    transition: transform .12s ease, filter .2s ease, box-shadow .2s ease;
    box-shadow: 0 8px 18px -6px rgba(124, 140, 255, 0.55);
}

.cb-send-btn:hover {
    filter: brightness(1.05);
    transform: translateY(-1px);
}

.cb-send-btn:active {
    transform: translateY(0);
}

.cb-send-btn:focus-visible {
    outline: 4px solid rgba(124, 140, 255, 0.45);
}

.cb-send-btn {
    background: #22092B;

    .cb-send-btn:focus-visible {
        outline: 4px solid rgba(79, 93, 255, 0.35);
    }
}

.cb-typing {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    opacity: .8;
}

.cb-typing-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #9aa3b2;
    animation: cb-bounce 1.2s infinite ease-in-out;
}

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

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

@keyframes cb-bounce {

    0%,
    80%,
    100% {
        transform: translateY(0);
        opacity: .6;
    }

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

@media (prefers-color-scheme: light) {
    .cb-typing-dot {
        background: #596273;
    }
}


.cb-user-status-indicator {
    border-radius: 50%;
    background-color: #28c940;
    /* Green */
    display: inline-block;
    margin-right: 8px;
    box-shadow: 0 0 4px #28c940;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #28c940;
    display: inline-block;
    margin-right: 8px;
    box-shadow: 0 0 6px 0 #28c94066;
    border: 2px solid #fff;
    vertical-align: middle;
}

.cb-user-status-text {
    display: inline-block;
    color: #222;
    font-size: 13px;
    font-family: 'Inter', 'Source Sans Pro', Arial, sans-serif;
    font-weight: 500;
    vertical-align: middle;
    margin-left: 2px;
}

.cb-user-status {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 2px 10px;
    border-radius: 16px;
    background: #f6f8fa;
    box-shadow: 0 1px 4px 0 #0001;
    font-size: 13px;
    font-family: 'Inter', 'Source Sans Pro', Arial, sans-serif;
    width: fit-content;
}


/* Login Box Styles */
.cb-login-box {
    margin: 16px auto;
    width: 30%;
    padding: 20px;
    background: #1f2331;
    border: 1px solid rgba(124, 140, 255, 0.25);
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .12), 0 1px 4px rgba(0, 0, 0, .08);
}

.cb-login-box-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
}

.cb-login-box-title {
    font-size: 16px;
    font-weight: 600;
    color: #e7e9ee;
    margin: 0;
    letter-spacing: -0.01em;
}

.cb-login-box-message {
    font-size: 13px;
    color: #9aa3b2;
    margin: 0;
    line-height: 1.4;
    max-width: 300px;
}

.cb-login-box-btn {
    padding: 10px 20px;
    border-radius: 8px;
    border: 0;
    background: #22092B;
    color: white;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 14px;
    letter-spacing: -0.01em;
    cursor: pointer;
    transition: transform .12s ease, filter .2s ease, box-shadow .2s ease;
    box-shadow: 0 4px 12px -3px rgba(34, 9, 43, 0.4);
}

.cb-login-box-btn:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px -3px rgba(34, 9, 43, 0.5);
}

.cb-login-box-btn:active {
    transform: translateY(0);
}

.cb-login-box-btn:focus-visible {
    outline: 3px solid rgba(124, 140, 255, 0.45);
}

.cb-login-box.cb-hidden {
    display: none;
}

.cb-hidden {
    display: none !important;
}

@media (prefers-color-scheme: light) {
    .cb-login-box {
        background: #ffffff;
        border: 1px solid rgba(79, 93, 255, 0.25);
    }

    .cb-login-box-title {
        color: #12131a;
    }

    .cb-login-box-message {
        color: #596273;
    }

    .cb-login-box-btn {
        background: #22092B;
        box-shadow: 0 4px 12px -3px rgba(79, 93, 255, 0.4);
    }

    .cb-login-box-btn:hover {
        box-shadow: 0 6px 16px -3px rgba(79, 93, 255, 0.5);
    }

    .cb-login-box-btn:focus-visible {
        outline: 3px solid rgba(79, 93, 255, 0.35);
    }
}


.cb-logout-btn {
    background: none;
    border: none;
    outline: none;
    cursor: pointer;
    margin-left: 8px;
    padding: 2px 4px;
    border-radius: 6px;
    transition: background 0.2s;
    display: flex;
    align-items: center;
}

.cb-logout-btn:hover {
    background: #ffeaea;
}

.cb-logout-btn svg {
    display: block;
}

.cb-user-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #f6f8fa;
    border-radius: 16px;
    padding: 2px 12px;
    box-shadow: 0 1px 4px 0 #0001;
    font-size: 13px;
    font-family: 'Inter', 'Source Sans Pro', Arial, sans-serif;
    font-weight: 500;
    color: #222;
    width: fit-content;
}

.cb-badge-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
}

.cb-badge-text {
    margin-left: 2px;
}

.cb-form-disabled {
    filter: blur(0.3px) grayscale(0.1);
    pointer-events: none;
    opacity: 0.7;
    transition: filter 0.3s, opacity 0.3s;
}
.cb-chatbot-logout-warning {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.4s cubic-bezier(.4,0,.2,1), transform 0.4s cubic-bezier(.4,0,.2,1);
    pointer-events: none;
}
.cb-chatbot-logout-warning-container{
    background-color: #ededed;
}
.cb-chatbot-logout-warning:not(.cb-hidden) {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}
.cb-chatbot-logout-warning .cb-modal-btn,
.cb-chatbot-logout-warning .cb-modal-btn-danger {
    /* Inherit login button styles */
    @extend .cb-login-box-btn;
}

/* If @extend is not supported, copy styles directly */
.cb-chatbot-logout-warning .cb-modal-btn,
.cb-chatbot-logout-warning .cb-modal-btn-danger {
    background: linear-gradient(90deg, #fe5000 0%, #ff7a00 100%);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    padding: 10px 28px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(254,80,0,0.08);
    transition: background 0.2s, box-shadow 0.2s;
    margin: 0 8px;
}
.cb-chatbot-logout-warning .cb-modal-btn:hover,
.cb-chatbot-logout-warning .cb-modal-btn-danger:hover {
    background: linear-gradient(90deg, #ff7a00 0%, #fe5000 100%);
    box-shadow: 0 4px 16px rgba(254,80,0,0.12);
}
.cb-chatbot-logout-warning .cb-modal-btn:focus-visible,
.cb-chatbot-logout-warning .cb-modal-btn-danger:focus-visible {
    outline: 2px solid #fe5000;
    outline-offset: 2px;
}
.cb-modal-btn-container {
    display: flex;
    justify-content: center;
    margin-top: 12px;
    gap: 7px;
    flex-direction: column;
}

.cb-logout-confirm-btn{
    background: #22092B;
    color: white;
    padding: 5px;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
}
.cb-chatbot-logout-warning {
    background: #fff6f6;
    color: #a94442;
    border: 1px solid #e74c3c;
    border-radius: 8px;
    padding: 18px 24px;
    margin: 18px auto;
    font-size: 16px;
    font-family: 'Inter', 'Source Sans Pro', Arial, sans-serif;
    box-shadow: 0 2px 12px rgba(231,76,60,0.08);
    text-align: center;
    width: 60%;
    display: flex;
    align-items: center;
    gap: 12px;
}
.cb-chatbot-logout-warning svg {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    margin-right: 8px;
    fill: #e74c3c;
}