﻿:root {
    --sib-chat-primary: #1d4ed8;
    --sib-chat-primary-dark: #163ea8;
    --sib-chat-primary-soft: #eff6ff;
    --sib-chat-navy: #0f2744;
    --sib-chat-text: #334155;
    --sib-chat-muted: #64748b;
    --sib-chat-border: #dde5ef;
    --sib-chat-background: #f4f7fb;
    --sib-chat-surface: #ffffff;
    --sib-chat-font: "Segoe UI", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
}


/* ============================================================
   CHATBOT ROOT
   ============================================================ */

.sib-chatbot-widget {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 10000;
    font-family: var(--sib-chat-font);
}


/* ============================================================
   FLOATING BUTTON
   ============================================================ */

.sib-chatbot-floating-button {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: linear-gradient( 145deg, var(--sib-chat-navy), var(--sib-chat-primary) );
    box-shadow: 0 10px 30px rgba(15, 39, 68, 0.28);
    color: #ffffff;
    cursor: pointer;
    transition: transform .18s ease, box-shadow .18s ease;
}


    .sib-chatbot-floating-button:hover {
        transform: translateY(-2px) scale(1.03);
        box-shadow: 0 14px 34px rgba(15, 39, 68, 0.34);
    }


    .sib-chatbot-floating-button:focus {
        outline: none;
    }


.sib-chatbot-floating-icon {
    font-size: 25px;
    line-height: 1;
}


/* ============================================================
   CHATBOT PANEL
   ============================================================ */

.sib-chatbot-panel {
    position: absolute;
    right: 0;
    bottom: 76px;
    width: 430px;
    height: min( 650px, calc(100vh - 120px) );
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    overflow: hidden;
    border: 1px solid var(--sib-chat-border);
    border-radius: 18px;
    background: var(--sib-chat-surface);
    box-shadow: 0 22px 60px rgba(15, 39, 68, 0.20);
    opacity: 0;
    visibility: hidden;
    transform: translateY(15px) scale(.97);
    transform-origin: bottom right;
    pointer-events: none;
    transition: opacity .20s ease, transform .20s ease, visibility .20s ease;
}


    .sib-chatbot-panel.is-open {
        opacity: 1;
        visibility: visible;
        transform: translateY(0) scale(1);
        pointer-events: auto;
    }


/* ============================================================
   HEADER
   ============================================================ */

.sib-chatbot-header {
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid #e8edf4;
    background: #ffffff;
}


.sib-chatbot-header-left {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 11px;
}


.sib-chatbot-header-icon {
    width: 39px;
    height: 39px;
    flex: 0 0 39px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: linear-gradient( 145deg, var(--sib-chat-navy), var(--sib-chat-primary) );
    color: #ffffff;
    font-size: 10px;
    font-weight: 800;
    box-shadow: 0 7px 18px rgba(29, 78, 216, .17);
}


.sib-chatbot-header-title {
    color: #14213d;
    font-size: 15px;
    font-weight: 750;
    line-height: 1.25;
}


.sib-chatbot-header-subtitle {
    margin-top: 3px;
    color: var(--sib-chat-muted);
    font-size: 10.5px;
    line-height: 1.3;
}


.sib-chatbot-header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}


.sib-chatbot-header-button {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: none;
    border-radius: 9px;
    background: transparent;
    color: #64748b;
    font-size: 21px;
    cursor: pointer;
}


    .sib-chatbot-header-button:hover {
        background: #f1f5f9;
        color: #1e293b;
    }


    .sib-chatbot-header-button:focus {
        outline: none;
    }


/* ============================================================
   MESSAGE AREA
   ============================================================ */

.sib-chatbot-messages {
    min-height: 0;
    padding: 18px;
    overflow-x: hidden;
    overflow-y: auto;
    background: radial-gradient( circle at 95% 3%, rgba(219, 234, 254, .75), transparent 280px ), linear-gradient( 180deg, #f8fafc 0%, #f4f7fb 100% );
}


/* ============================================================
   EMPTY STATE
   ============================================================ */

.sib-chatbot-empty {
    min-height: 100%;
    padding: 20px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}


.sib-chatbot-empty-icon {
    width: 58px;
    height: 58px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 18px;
    background: var(--sib-chat-primary-soft);
    color: var(--sib-chat-primary);
    font-size: 14px;
    font-weight: 800;
}


.sib-chatbot-empty-title {
    margin-top: 15px;
    color: #14213d;
    font-size: 17px;
    font-weight: 600;
}


.sib-chatbot-empty-description {
    max-width: 320px;
    margin-top: 6px;
    color: var(--sib-chat-muted);
    font-size: 11.5px;
    line-height: 1.5;
    text-align: center;
}


/* ============================================================
   SUGGESTIONS
   ============================================================ */

.sib-chatbot-suggestions {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 7px;
    margin-top: 18px;
}


.sib-chatbot-suggestion {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid #dde5ef;
    border-radius: 9px;
    background: rgba( 255, 255, 255, .8 );
    color: #475569;
    font-family: var(--sib-chat-font);
    font-size: 10.5px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease, color .15s ease;
}


    .sib-chatbot-suggestion:hover {
        border-color: #bfdbfe;
        background: #eff6ff;
        color: #163ea8;
    }


    .sib-chatbot-suggestion:focus {
        outline: none;
    }


/* ============================================================
   COMPOSER
   ============================================================ */

.sib-chatbot-composer {
    padding: 12px 14px;
    border-top: 1px solid #e8edf4;
    background: #ffffff;
}


    .sib-chatbot-composer
    .dx-texteditor {
        border: 1px solid #cfd9e6;
        border-radius: 11px;
        background: #fbfcfe;
    }


        .sib-chatbot-composer
        .dx-texteditor.dx-state-focused {
            border-color: #60a5fa;
            background: #ffffff;
            box-shadow: 0 0 0 3px rgba(37, 99, 235, .1);
        }


.sib-chatbot-composer-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 8px;
}


.sib-chatbot-hint {
    color: #94a3b8;
    font-size: 9.5px;
    line-height: 1.3;
}


/* ============================================================
   SEND BUTTON
   ============================================================ */

.sib-chatbot-send-button.dx-button {
    min-width: 95px;
    height: 34px;
    border: none !important;
    border-radius: 9px;
    background: linear-gradient( 135deg, var(--sib-chat-primary-dark), var(--sib-chat-primary) ) !important;
    color: #ffffff !important;
}


    .sib-chatbot-send-button.dx-button
    .dx-button-content {
        color: #ffffff !important;
    }


    .sib-chatbot-send-button.dx-button
    .dx-button-text {
        color: #ffffff !important;
    }


    .sib-chatbot-send-button.dx-button:hover {
        background: linear-gradient( 135deg, #12378f, #1d4ed8 ) !important;
    }


.sib-chatbot-disclaimer {
    margin-top: 9px;
    color: #b91c1c;
    font-size: 10.5px;
    font-weight: 700;
    line-height: 1.45;
    text-align: center;
}


/* ============================================================
   MESSAGE ROW
   ============================================================ */

.sib-chatbot-widget
.mevzuat-message-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 14px;
}


.sib-chatbot-widget
.mevzuat-message-row--user {
    flex-direction: row-reverse;
}


/* ============================================================
   MESSAGE AVATAR
   ============================================================ */

.sib-chatbot-widget
.mevzuat-message-avatar {
    width: 31px;
    height: 31px;
    flex: 0 0 31px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    font-size: 9px;
    font-weight: 800;
}


.sib-chatbot-widget
.mevzuat-message-avatar--assistant {
    background: linear-gradient( 145deg, var(--sib-chat-navy), var(--sib-chat-primary) );
    color: #ffffff;
}


.sib-chatbot-widget
.mevzuat-message-avatar--user {
    background: #334155;
    color: #ffffff;
}


.sib-chatbot-widget
.mevzuat-message-avatar--error {
    background: #b91c1c;
    color: #ffffff;
}


/* ============================================================
   MESSAGE BUBBLE
   ============================================================ */

.sib-chatbot-widget
.mevzuat-message {
    max-width: calc(100% - 42px);
    padding: 10px 12px;
    border-radius: 12px;
    font-size: 12px;
}


.sib-chatbot-widget
.mevzuat-message--assistant {
    border: 1px solid #dde5ef;
    border-top-left-radius: 4px;
    background: #ffffff;
    color: var(--sib-chat-text);
}


.sib-chatbot-widget
.mevzuat-message--user {
    border-top-right-radius: 4px;
    background: linear-gradient( 135deg, var(--sib-chat-primary-dark), var(--sib-chat-primary) );
    color: #ffffff;
}


.sib-chatbot-widget
.mevzuat-message--error {
    border: 1px solid #fecaca;
    border-top-left-radius: 4px;
    background: #fff7f7;
    color: #991b1b;
}


/* ============================================================
   MESSAGE ROLE / CONTENT
   ============================================================ */

.sib-chatbot-widget
.mevzuat-message-role {
    margin-bottom: 5px;
    color: #64748b;
    font-size: 8.5px;
    font-weight: 800;
    text-transform: uppercase;
}


.sib-chatbot-widget
.mevzuat-message--user
.mevzuat-message-role {
    color: rgba( 255, 255, 255, .72 );
}


.sib-chatbot-widget
.mevzuat-message-content {
    font-size: 11.5px;
    line-height: 1.55;
    overflow-wrap: anywhere;
}


/* ============================================================
   MARKDOWN
   ============================================================ */

.sib-chatbot-widget
.mevzuat-markdown p {
    margin: 0 0 8px;
}


    .sib-chatbot-widget
    .mevzuat-markdown p:last-child {
        margin-bottom: 0;
    }


.sib-chatbot-widget
.mevzuat-markdown ul,
.sib-chatbot-widget
.mevzuat-markdown ol {
    margin: 6px 0 9px;
    padding-left: 20px;
}


.sib-chatbot-widget
.mevzuat-markdown li {
    margin-bottom: 4px;
}


.sib-chatbot-widget
.mevzuat-markdown strong {
    color: #1e293b;
    font-weight: 700;
}


.sib-chatbot-widget
.mevzuat-markdown h1,
.sib-chatbot-widget
.mevzuat-markdown h2,
.sib-chatbot-widget
.mevzuat-markdown h3,
.sib-chatbot-widget
.mevzuat-markdown h4 {
    margin: 10px 0 6px;
    color: #1e293b;
    font-weight: 700;
}


.sib-chatbot-widget
.mevzuat-markdown h1 {
    font-size: 15px;
}


.sib-chatbot-widget
.mevzuat-markdown h2 {
    font-size: 14px;
}


.sib-chatbot-widget
.mevzuat-markdown h3 {
    font-size: 13px;
}


.sib-chatbot-widget
.mevzuat-markdown h4 {
    font-size: 12px;
}


/* ============================================================
   TYPING
   ============================================================ */

.sib-chatbot-widget
.mevzuat-message--typing {
    min-width: 90px;
}


.sib-chatbot-widget
.mevzuat-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    height: 18px;
}


    .sib-chatbot-widget
    .mevzuat-typing span {
        width: 5px;
        height: 5px;
        border-radius: 50%;
        background: #64748b;
        animation: sibChatbotTyping 1.2s infinite ease-in-out;
    }


        .sib-chatbot-widget
        .mevzuat-typing span:nth-child(2) {
            animation-delay: .15s;
        }


        .sib-chatbot-widget
        .mevzuat-typing span:nth-child(3) {
            animation-delay: .30s;
        }


@keyframes sibChatbotTyping {

    0%, 60%, 100% {
        opacity: .35;
        transform: translateY(0);
    }

    30% {
        opacity: 1;
        transform: translateY(-3px);
    }
}


/* ============================================================
   SOURCE BUTTON
   ============================================================ */

.sib-chatbot-widget
.mevzuat-message-footer {
    display: flex;
    align-items: center;
    margin-top: 10px;
    padding-top: 9px;
    border-top: 1px solid #e5e7eb;
}


.sib-chatbot-widget
.mevzuat-source-button {
    appearance: none !important;
    -webkit-appearance: none !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 32px;
    padding: 6px 11px !important;
    margin: 0;
    border: none !important;
    outline: none !important;
    border-radius: 9px !important;
    background: linear-gradient( 135deg, var(--sib-chat-primary-dark), var(--sib-chat-primary) ) !important;
    background-color: var(--sib-chat-primary) !important;
    color: #ffffff !important;
    font-family: var(--sib-chat-font) !important;
    font-size: 10.5px !important;
    font-weight: 600 !important;
    line-height: 1 !important;
    text-decoration: none !important;
    cursor: pointer;
    box-shadow: 0 4px 11px rgba(29, 78, 216, .20) !important;
    transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
}


    .sib-chatbot-widget
    .mevzuat-source-button:hover {
        background: linear-gradient( 135deg, #12378f, #1d4ed8 ) !important;
        background-color: #1d4ed8 !important;
        color: #ffffff !important;
        transform: translateY(-1px);
        box-shadow: 0 6px 15px rgba(29, 78, 216, .28) !important;
    }


    .sib-chatbot-widget
    .mevzuat-source-button:active {
        transform: translateY(0);
        box-shadow: 0 3px 8px rgba(29, 78, 216, .20) !important;
    }


    .sib-chatbot-widget
    .mevzuat-source-button:focus-visible {
        outline: none !important;
        box-shadow: 0 0 0 3px rgba(37, 99, 235, .15), 0 5px 14px rgba(29, 78, 216, .25) !important;
    }


    .sib-chatbot-widget
    .mevzuat-source-button > span {
        color: #ffffff !important;
    }


.sib-chatbot-widget
.mevzuat-source-button-icon {
    width: 15px;
    height: 15px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #ffffff !important;
}


    .sib-chatbot-widget
    .mevzuat-source-button-icon svg {
        width: 15px;
        height: 15px;
        display: block;
        color: #ffffff !important;
    }


        .sib-chatbot-widget
        .mevzuat-source-button-icon svg path {
            stroke: currentColor !important;
        }


.sib-chatbot-widget
.mevzuat-source-button-count {
    min-width: 19px;
    height: 19px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    border-radius: 999px;
    background: rgba( 255, 255, 255, .20 ) !important;
    color: #ffffff !important;
    font-size: 10px;
    font-weight: 700;
}


/* ============================================================
   SOURCES POPUP
   ============================================================ */

.mevzuat-sources-list {
    width: 100%;
    height: 100%;
    padding: 4px;
    overflow-x: hidden;
    overflow-y: auto;
    box-sizing: border-box;
}


/* Accordion komple popup genişliğini kullansın */
#mevzuatSourcesAccordion {
    width: 100% !important;
    max-width: none !important;
    box-sizing: border-box;
}


    /* Accordion item */
    #mevzuatSourcesAccordion
    .dx-accordion-item {
        width: 100% !important;
        max-width: none !important;
        box-sizing: border-box;
    }


    /* Başlık */
    #mevzuatSourcesAccordion
    .dx-accordion-item-title {
        width: 100% !important;
        padding: 13px 14px;
        box-sizing: border-box;
        background: #ffffff;
    }


    /* Açılan body */
    #mevzuatSourcesAccordion
    .dx-accordion-item-body {
        width: 100% !important;
        max-width: none !important;
        padding: 0 14px 14px;
        box-sizing: border-box;
    }


        /*
 * DevExtreme template wrapper içerikte daralmayı
 * burada yapabiliyor. Özellikle bunu genişletiyoruz.
 */
        #mevzuatSourcesAccordion
        .dx-accordion-item-body
        .dx-template-wrapper {
            display: block !important;
            width: 100% !important;
            max-width: none !important;
            box-sizing: border-box;
        }


    /* Bazı DevExtreme sürümlerinde content wrapper */
    #mevzuatSourcesAccordion
    .dx-accordion-item-content {
        display: block !important;
        width: 100% !important;
        max-width: none !important;
        box-sizing: border-box;
    }


    /* Açılmış item */
    #mevzuatSourcesAccordion
    .dx-accordion-item-opened {
        width: 100% !important;
    }


/* ============================================================
   SOURCE TITLE
   ============================================================ */

.mevzuat-source-title {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}


.mevzuat-source-reference {
    min-width: 27px;
    height: 27px;
    flex: 0 0 27px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 7px;
    background: var(--sib-chat-primary-soft);
    color: var(--sib-chat-primary);
    font-size: 10px;
    font-weight: 700;
}


.mevzuat-source-title-content {
    min-width: 0;
    flex: 1;
    width: 100%;
}


.mevzuat-source-document-name {
    width: 100%;
    overflow: hidden;
    color: #1e293b;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
    text-overflow: ellipsis;
    white-space: nowrap;
}


.mevzuat-source-page {
    margin-top: 2px;
    color: #64748b;
    font-size: 10px;
}


/* ============================================================
   SOURCE DETAIL
   ============================================================ */

.mevzuat-source-detail {
    display: block;
    width: 100% !important;
    max-width: none !important;
    padding: 4px 0 2px;
    box-sizing: border-box;
}


.mevzuat-source-meta {
    width: 100%;
    margin-bottom: 10px;
    color: #64748b;
    font-size: 10px;
    line-height: 1.5;
    box-sizing: border-box;
}


/*
 * Asıl düzeltme:
 * Kaynak metni accordion'un bütün kullanılabilir
 * genişliğini kaplıyor.
 */
.mevzuat-source-content {
    display: block;
    width: 100% !important;
    max-width: none !important;
    padding: 14px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #f8fafc;
    color: #334155;
    font-family: var(--sib-chat-font);
    font-size: 11.5px;
    font-weight: 400;
    line-height: 1.7;
    white-space: normal !important;
    overflow-wrap: break-word;
    word-break: normal;
    box-sizing: border-box;
}


/* ============================================================
   EMPTY SOURCE
   ============================================================ */

.mevzuat-source-empty {
    width: 100%;
    padding: 30px;
    color: #64748b;
    font-size: 13px;
    text-align: center;
    box-sizing: border-box;
}


/* ============================================================
   SCROLLBAR
   ============================================================ */

.sib-chatbot-messages::-webkit-scrollbar,
.mevzuat-sources-list::-webkit-scrollbar {
    width: 6px;
}


.sib-chatbot-messages::-webkit-scrollbar-track,
.mevzuat-sources-list::-webkit-scrollbar-track {
    background: transparent;
}


.sib-chatbot-messages::-webkit-scrollbar-thumb,
.mevzuat-sources-list::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: #cbd5e1;
}


    .sib-chatbot-messages::-webkit-scrollbar-thumb:hover,
    .mevzuat-sources-list::-webkit-scrollbar-thumb:hover {
        background: #94a3b8;
    }


/* ============================================================
   MOBILE
   ============================================================ */

@media (max-width: 600px) {

    .sib-chatbot-widget {
        right: 12px;
        bottom: 12px;
    }


    .sib-chatbot-panel {
        position: fixed;
        top: 10px;
        right: 10px;
        bottom: 10px;
        left: 10px;
        width: auto;
        height: auto;
        transform-origin: bottom center;
    }


    .sib-chatbot-floating-button {
        width: 54px;
        height: 54px;
    }


    .sib-chatbot-hint {
        display: none;
    }


    .sib-chatbot-send-button.dx-button {
        width: 100%;
    }


    .sib-chatbot-composer-footer {
        justify-content: flex-end;
    }
}

/* =========================================================
   CHATBOT MESSAGE FOOTER
   ========================================================= */

.sib-chatbot-widget .mevzuat-message-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 10px;
    padding-top: 9px;
    border-top: 1px solid #e5e7eb;
}


.sib-chatbot-widget .mevzuat-message-footer-left {
    display: flex;
    align-items: center;
    min-width: 0;
}


/* =========================================================
   CHATBOT FEEDBACK
   ========================================================= */

.sib-chatbot-widget .mevzuat-feedback {
    display: flex;
    align-items: center;
    gap: 3px;
    margin-left: auto;
}


.sib-chatbot-widget .mevzuat-feedback-button {
    appearance: none;
    -webkit-appearance: none;
    width: 29px;
    height: 29px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 7px;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease, transform .15s ease, opacity .15s ease;
}


    .sib-chatbot-widget
    .mevzuat-feedback-button:hover:not(:disabled) {
        background: #f1f5f9;
        color: #334155;
        transform: translateY(-1px);
    }


    .sib-chatbot-widget
    .mevzuat-feedback-button:active:not(:disabled) {
        transform: translateY(0);
    }


    .sib-chatbot-widget
    .mevzuat-feedback-button:disabled {
        cursor: default;
        opacity: .55;
    }


    .sib-chatbot-widget
    .mevzuat-feedback-button svg {
        display: block;
        width: 16px;
        height: 16px;
    }


/* 👍 seçilmiş */

.sib-chatbot-widget
.mevzuat-feedback-button--positive.is-selected {
    border-color: #bbf7d0;
    background: #f0fdf4;
    color: #15803d;
}


/* 👎 seçilmiş */

.sib-chatbot-widget
.mevzuat-feedback-button--negative.is-selected {
    border-color: #fecaca;
    background: #fef2f2;
    color: #b91c1c;
}

/* =========================================================
   CHATBOT EXIT FEEDBACK POPUP
   ========================================================= */

.sib-exit-feedback {
    padding: 4px 2px 2px;
}


.sib-exit-feedback-title {
    margin-bottom: 7px;
    color: #1e293b;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
}


.sib-exit-feedback-description {
    color: #64748b;
    font-size: 13px;
    line-height: 1.55;
}


.sib-exit-feedback-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 22px;
}


    .sib-exit-feedback-actions .dx-button {
        min-width: 105px;
        min-height: 36px;
        border-radius: 8px;
    }


    .sib-exit-feedback-actions .dx-button-text {
        font-size: 12px;
        font-weight: 600;
    }