@charset "UTF-8";


/* ═══════════════════════════════════════════════════════════════════════
   RAG — Recherche intelligente
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Zone conteneur ───────────────────────────────────────────────────── */
.rag-intelligent-zone {
    padding: 12px 16px 14px;
    border-bottom: 1px solid #e8edf3;
    background: #fff;
}

/* ═══════════════════════════════════════════════════════════════════════
   1. CHAMP QUESTION
   Structure : .rag-question-row > .rag-ia-icon + .rag-question-field + .rag-send-btn
   ═══════════════════════════════════════════════════════════════════════ */

.rag-question-row {
    position: relative;
    display: flex;
    align-items: center;
    border: 1.5px solid #d0d7de;
    border-radius: 24px;
    background: #f6f8fa;
    padding: 0 6px 0 0;
    margin-bottom: 10px;
    transition: border-color .15s, background .15s;
    height: 46px;
    overflow: hidden;
}

.rag-question-row:focus-within {
    border-color: #534AB7;
    background: #fff;
}

/* Icône IA ✦ à gauche */
.rag-ia-icon {
    font-size: 18px;
    color: #534AB7;
    padding: 0 10px 0 14px;
    flex-shrink: 0;
    line-height: 1;
}

/* Override GXT TextField pour s'intégrer dans le row */
.rag-question-row .rag-question-field,
.rag-question-row .rag-question-field .x-form-field-wrap,
.rag-question-row .rag-question-field .x-form-el-x-form-text {
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    flex: 1 !important;
    height: 44px !important;
}

.rag-question-row .rag-question-field .x-form-text,
.rag-question-row .rag-question-field input {
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    height: 44px !important;
    line-height: 44px !important;
    font-size: 14px !important;
    color: #24292f !important;
    padding: 0 4px !important;
    width: 100% !important;
}

/* Placeholder */
.rag-question-row .rag-question-field .x-form-empty-field {
    color: #9ca3af !important;
}

/* ── Bouton envoi ───────────────────────────────────────────────────── */

.rag-send-btn,
.rag-send-btn .x-btn-wrap,
.rag-send-btn table {
    border-radius: 50% !important;
}

.rag-send-btn {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    min-height: 44px !important;
    border-radius: 50% !important;
    overflow: hidden;
    background: #303faa !important;
    border: none !important;
    flex-shrink: 0;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 0 !important;
    padding: 0 !important;
    box-shadow:
        0 2px 4px rgba(0,0,0,.08),
        0 8px 16px rgba(109,40,217,.25);
    transition: all .2s ease;
}

.rag-send-btn:hover {
    background: #5b21b6 !important;
    transform: translateY(-1px);
    box-shadow:
        0 4px 8px rgba(0,0,0,.12),
        0 10px 20px rgba(109,40,217,.35);
}

/* Bouton interne GXT */
.rag-send-btn button {
    width: 44px !important;
    height: 44px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    background: transparent !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer;
}

/* Cache le caractère d'origine, affiche la flèche */
.rag-send-btn .lib {
    position: relative;
    font-size: 0 !important;
    color: transparent !important;
    width: 100%;
    height: 100%;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.rag-send-btn .lib:before {
    content: "➜";
    color: #ffffff;
    font-size: 20px;
    font-weight: 700;
    line-height: 1;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.rag-send-btn .x-btn-text {
    color: #fff !important;
    font-size: 18px !important;
    font-weight: 400 !important;
    line-height: 1 !important;
}

/* État désactivé */
.rag-send-btn.x-item-disabled,
.rag-send-btn[disabled] {
    background: #e5e7eb !important;
    opacity: .45;
    cursor: not-allowed;
    box-shadow: none;
}

.rag-send-btn.x-item-disabled:hover,
.rag-send-btn[disabled]:hover {
    transform: none;
}

.rag-send-btn.x-item-disabled .x-btn-text {
    color: #aaa !important;
}

/* ═══════════════════════════════════════════════════════════════════════
   2. LIGNE DOSSIER
   Structure : .rag-scope-row > .rag-scope-label + .rag-dossier-combo
   ═══════════════════════════════════════════════════════════════════════ */

.rag-scope-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.rag-scope-label {
    font-size: 13px;
    color: #656d76;
    white-space: nowrap;
    flex-shrink: 0;
}

/* LsComboBox dossier */
.rag-dossier-combo .x-form-field,
.rag-dossier-combo .x-form-text,
.rag-dossier-combo input {
    height: 34px !important;
    line-height: 34px !important;
    font-size: 13px !important;
    border: 1px solid #d0d7de !important;
    border-radius: 6px !important;
    background: #f6f8fa !important;
    padding: 0 26px 0 10px !important;
    color: #24292f !important;
    box-shadow: none !important;
    transition: border-color .15s !important;
}

.rag-dossier-combo .x-form-field:focus,
.rag-dossier-combo input:focus {
    border-color: #534AB7 !important;
    background: #fff !important;
    outline: none !important;
}

.rag-dossier-combo .x-form-field-wrap {
    border: none !important;
    box-shadow: none !important;
}

.rag-dossier-combo .x-form-trigger {
    background: transparent !important;
    border: none !important;
    width: 22px !important;
}

/* Liste déroulante */
.x-combo-list {
    border: 1px solid #d0d7de !important;
    border-radius: 8px !important;
    box-shadow: 0 4px 16px rgba(0,0,0,.10) !important;
    overflow: hidden !important;
    padding: 4px 0 !important;
}

.x-combo-list-inner {
    padding: 2px !important;
}

/* Item dans la liste */
.rag-combo-item {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    padding: 7px 10px !important;
    border-radius: 4px !important;
    cursor: pointer !important;
}

.rag-combo-num {
    font-size: 11px;
    font-weight: 600;
    background: #EEEDFE;
    color: #534AB7;
    border-radius: 4px;
    padding: 1px 5px;
    white-space: nowrap;
}

.rag-combo-title {
    font-size: 12px;
    color: #24292f;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Hover et sélection */
.x-combo-list .x-combo-selected .rag-combo-item,
.x-combo-list .x-combo-list-item:hover .rag-combo-item {
    background: #EEEDFE !important;
}

.x-combo-list .x-combo-selected .rag-combo-title,
.x-combo-list .x-combo-list-item:hover .rag-combo-title {
    color: #3C3489 !important;
}

/* ═══════════════════════════════════════════════════════════════════════
   3. SUGGESTIONS INTELLIGENTES — cards
   ═══════════════════════════════════════════════════════════════════════ */

.rag-suggestions-section {
    margin-top: 2px;
}

.rag-suggestions-title {
    display: block;
    font-size: 12px;
    color: #656d76;
    font-weight: 500;
    margin-bottom: 8px;
    letter-spacing: 0.1px;
}

/* Grille de cards */
.rag-suggestion-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

/* Card individuelle */
.rag-suggestion-card {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border: 1px solid #e0e6ed;
    border-radius: 8px;
    background: #f6f8fa;
    cursor: pointer;
    transition: background .1s, border-color .1s;
    user-select: none;
}

.rag-suggestion-card:hover {
    background: #EEEDFE;
    border-color: #AFA9EC;
}

.rag-card-label {
    font-size: 12px;
    color: #444d56;
    white-space: nowrap;
}

.rag-suggestion-card:hover .rag-card-label {
    color: #3C3489;
}

/* Icônes des cards — via background-image SVG inline */
.rag-card-icon {
    display: inline-block;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    opacity: .7;
}

.rag-suggestion-card:hover .rag-card-icon { opacity: 1; }

.rag-icon-calendar {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23534AB7' stroke-width='2'%3E%3Crect x='3' y='4' width='18' height='18' rx='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E");
}

.rag-icon-user {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23534AB7' stroke-width='2'%3E%3Cpath d='M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='12' cy='7' r='4'/%3E%3C/svg%3E");
}

.rag-icon-doc {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23534AB7' stroke-width='2'%3E%3Cpath d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z'/%3E%3Cpolyline points='14 2 14 8 20 8'/%3E%3C/svg%3E");
}

.rag-icon-clock {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23534AB7' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpolyline points='12 6 12 12 16 14'/%3E%3C/svg%3E");
}

.rag-icon-alert {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23534AB7' stroke-width='2'%3E%3Cpath d='M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z'/%3E%3Cline x1='12' y1='9' x2='12' y2='13'/%3E%3Cline x1='12' y1='17' x2='12.01' y2='17'/%3E%3C/svg%3E");
}

.rag-icon-shield {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23534AB7' stroke-width='2'%3E%3Cpath d='M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z'/%3E%3C/svg%3E");
}

/* ═══════════════════════════════════════════════════════════════════════
   4. TOGGLE MODE INTELLIGENT
   ═══════════════════════════════════════════════════════════════════════ */

.rag-mode-toggle-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
    padding: 4px 8px;
    border-radius: 6px;
    flex-shrink: 0;
    white-space: nowrap;
    min-width: 0;
}

.rag-mode-toggle-wrapper .gwt-HTML {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    overflow: visible;
    white-space: nowrap;
    min-width: 0;
    color: var(--semantique-neutral-neutral-50) ;
}

.rag-mode-toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.rag-mode-toggle-checkbox {
    display: none;
}

.rag-mode-toggle-slider {
    display: inline-block;
    flex-shrink: 0;
    width: 36px;
    height: 20px;
    border-radius: 10px;
    background: #bbb;
    position: relative;
    transition: background 0.2s;
    pointer-events: none;
    vertical-align: middle;
}

.rag-mode-toggle-slider::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: white;
    top: 2px;
    left: 2px;
    transition: left 0.2s;
}

.rag-mode-active .rag-mode-toggle-slider {
    background: #1a5fa8;
}

.rag-mode-active .rag-mode-toggle-slider::after {
    left: 18px;
}

.rag-mode-toggle-text {
    font-size: 13px;
    font-weight: 500;
    pointer-events: none;
    white-space: nowrap;
    overflow: visible;
    text-overflow: clip;
    flex-shrink: 0;
    vertical-align: middle;
    line-height: 20px;
}

/* Bouton toggle (variante GXT) */
.rag-mode-toggle-btn {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    height: 28px !important;
    padding: 0 12px !important;
    border-radius: 20px !important;
    border: 1px solid #d0d7de !important;
    background: #f6f8fa !important;
    color: #656d76 !important;
    font-size: 12px !important;
    cursor: pointer !important;
    white-space: nowrap !important;
    transition: all .15s !important;
    box-shadow: none !important;
}

.rag-mode-toggle-btn .x-btn-text::before {
    content: "";
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #d0d7de;
    margin-right: 5px;
    vertical-align: middle;
    transition: background .15s;
}

.rag-mode-toggle-btn-active {
    background: #EEEDFE !important;
    border-color: #534AB7 !important;
    color: #3C3489 !important;
}

.rag-mode-toggle-btn-active .x-btn-text::before {
    background: #534AB7 !important;
}

.rag-mode-toggle-btn-active .rag-mode-toggle-slider {
    background: #2b03cb;
}

.rag-mode-toggle-btn-active .rag-mode-toggle-slider::after {
    transform: translateX(16px);
}

/* ═══════════════════════════════════════════════════════════════════════
   5. SOURCES PANEL
   ═══════════════════════════════════════════════════════════════════════ */

.rag-sources-panel {
    margin-top: 10px;
    font-family: system-ui, sans-serif;
}

.rag-sources-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.rag-sources-title {
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.rag-sources-see-all {
    font-size: 11px;
    color: #2563eb;
    cursor: pointer;
    font-weight: 500;
}

.rag-sources-see-all:hover { text-decoration: underline; }

/* ── Card ── */
.rag-source-card {
    cursor: pointer;
    margin-bottom: 5px;
}

.rag-source-card-inner {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 8px 10px;
    background: #ffffff;
    border: 1px solid #e8edf2;
    border-left: 3px solid #2563eb;
    border-radius: 6px;
    transition: box-shadow 0.15s, border-color 0.15s;
    white-space: normal;
}

.rag-source-card-inner:hover {
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.12);
    border-color: #93c5fd;
    border-left-color: #2563eb;
    background: #fafcff;
}

/* ── Top : icône + nom + score ── */
.rag-source-card-top {
    display: flex;
    align-items: center;
    gap: 5px;
}

.rag-source-icon {
    flex-shrink: 0;
    font-size: 12px;
    opacity: 0.7;
}

.rag-source-name {
    flex: 1;
    font-size: 12px;
    font-weight: 600;
    color: #1e3a5f;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rag-source-score {
    flex-shrink: 0;
    font-size: 10px;
    font-weight: 700;
    color: #2563eb;
    background: #eff6ff;
    padding: 1px 5px;
    border-radius: 10px;
}

/* ── Meta : page ── */
.rag-source-meta {
    display: flex;
    align-items: center;
    font-size: 10px;
    color: #94a3b8;
    gap: 4px;
}

.rag-source-page::before {
    content: "📃 ";
    font-size: 10px;
}

/* ── Snippet ── */
.rag-source-snippet {
    white-space: normal;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    font-size: 11px;
    color: #64748b;
    font-style: italic;
    line-height: 1.4;
    margin-top: 2px;
}

/* ── Surbrillance sémantique (spans injectés par __ragWrapRange) ── */
.rag-highlight {
    border-radius: 3px;
    transition: background-color 0.2s ease, outline 0.15s ease;
    cursor: default;
}

/* Source card au hover quand elle est liée à un highlight actif */
.rag-source-card:hover {
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.4);
}