/* ===== Assistant Jimmy ===== */
.gb-launcher {
  position: fixed; right: 20px; bottom: 16px; z-index: 1045;
  width: 70px; height: 85px; padding: 0; border: 0; background: transparent;
  cursor: pointer; transition: transform var(--t);
  filter: drop-shadow(0 4px 10px rgba(15, 39, 68, .18));
}
.gb-launcher:hover { transform: scale(1.08); }
.gb-launcher:focus-visible { outline: 3px solid var(--gold); outline-offset: 4px; border-radius: 12px; }
.gb-launcher .gb-robot-full { width: 100%; height: 100%; display: block; overflow: visible; }

/* ── Animations du robot ── */
.gb-robot .gb-robot-headgroup { transform-origin: 60px 74px; }
.gb-robot .gb-robot-eyes { transform-box: fill-box; transform-origin: center; animation: gbBlink 4.6s infinite; }
.gb-robot-full .gb-robot-headgroup { animation: gbHeadTurn 5s ease-in-out infinite; }
.gb-robot-full .gb-robot-float { animation: gbFloat 3.2s ease-in-out infinite; }
.gb-robot-full .gb-robot-shadow { transform-box: fill-box; transform-origin: center; animation: gbShadow 3.2s ease-in-out infinite; }
.gb-av-bot .gb-robot-eyes { animation: none; }
@keyframes gbHeadTurn { 0%, 100% { transform: rotate(-5deg); } 50% { transform: rotate(5deg); } }
@keyframes gbFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@keyframes gbShadow { 0%, 100% { transform: scale(1); opacity: .16; } 50% { transform: scale(.82); opacity: .1; } }
@keyframes gbBlink {
  0%, 44%, 48%, 88%, 91%, 94%, 100% { transform: scaleY(1); }
  46% { transform: scaleY(.1); }
  89.5%, 92.5% { transform: scaleY(.1); }
}
/* ── Coucou de bienvenue : bras levé qui s'agite + bulle temporaire ── */
.gb-robot .gb-robot-arm-r { transform-origin: 101px 86px; }
.gb-greeting .gb-robot-arm-r { animation: gbWave 2.6s ease-in-out; }
@keyframes gbWave {
  0%   { transform: rotate(0); }
  18%  { transform: rotate(-150deg); }
  30%  { transform: rotate(-125deg); }
  42%  { transform: rotate(-160deg); }
  54%  { transform: rotate(-125deg); }
  66%  { transform: rotate(-160deg); }
  80%  { transform: rotate(-150deg); }
  100% { transform: rotate(0); }
}
.gb-hello {
  position: fixed; right: 98px; bottom: 62px; z-index: 1045;
  max-width: 290px; padding: 13px 17px; border-radius: 16px 16px 4px 16px;
  background: var(--white); color: var(--text); border: 1px solid var(--border);
  box-shadow: var(--shadow-lg); font: 500 14px/1.45 'Inter', sans-serif; cursor: pointer;
  transform-origin: bottom right; opacity: 0; transform: translateY(6px) scale(.9);
  transition: opacity .25s ease-out, transform .25s cubic-bezier(.2, .9, .3, 1.3);
}
.gb-hello::after {
  content: ''; position: absolute; right: -7px; bottom: 10px; width: 12px; height: 12px;
  background: var(--white); border-right: 1px solid var(--border); border-bottom: 1px solid var(--border);
  transform: rotate(-45deg);
}
.gb-greeting .gb-hello { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .gb-robot *, .gb-robot { animation: none !important; }
  .gb-hello { transition: opacity .2s; transform: none; }
}
.gb-robot-defs { position: absolute; width: 0; height: 0; overflow: hidden; }

.gb-panel {
  position: fixed; right: 24px; bottom: 112px; z-index: 1045;
  width: 380px; height: 560px; max-height: calc(100vh - 136px);
  background: var(--white); border-radius: 16px; overflow: hidden;
  box-shadow: 0 12px 40px rgba(15, 39, 68, .22);
  display: flex; flex-direction: column;
  font-family: 'Inter', sans-serif; color: var(--text);
  transform-origin: bottom right;
  opacity: 0; transform: translateY(12px) scale(.94); pointer-events: none; visibility: hidden;
  transition: opacity .18s ease-out, transform .18s cubic-bezier(.2, .9, .3, 1.2), visibility 0s linear .18s;
}
.gb-open .gb-panel {
  opacity: 1; transform: none; pointer-events: auto; visibility: visible;
  transition: opacity .18s ease-out, transform .18s cubic-bezier(.2, .9, .3, 1.2), visibility 0s;
}

.gb-head {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  background: var(--navy); color: #fff; flex-shrink: 0;
}
.gb-head-avatar {
  width: 38px; height: 38px; border-radius: 50%; background: rgba(255, 255, 255, .18);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.gb-head-avatar .gb-robot-head { width: 30px; height: 20px; overflow: visible; }
.gb-head-title { font-weight: 700; font-size: 15px; line-height: 1.2; }
.gb-head-sub { font-size: 11.5px; opacity: .85; }
.gb-head-actions { margin-left: auto; display: flex; gap: 4px; }
.gb-head-btn {
  width: 30px; height: 30px; border: 0; border-radius: 8px; background: transparent; color: #fff;
  display: flex; align-items: center; justify-content: center; cursor: pointer; transition: background var(--t);
}
.gb-head-btn:hover { background: rgba(255, 255, 255, .16); }
.gb-head-btn svg { width: 17px; height: 17px; }

.gb-body {
  flex: 1; overflow-y: auto; padding: 14px 14px 6px; background: var(--bg);
  scroll-behavior: smooth; overscroll-behavior: contain;
}
.gb-msg { display: flex; flex-direction: column; align-items: flex-start; margin-bottom: 14px; animation: gbIn .2s ease-out; }
.gb-msg.gb-user { align-items: flex-end; }
@keyframes gbIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.gb-meta { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; font-size: 11.5px; color: var(--text3); }
.gb-user .gb-meta { flex-direction: row-reverse; }
.gb-meta-name { font-weight: 600; color: var(--text2); }
.gb-av {
  width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: #fff; background: var(--navy);
}
.gb-av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gb-av-bot { background: var(--white); border: 1px solid var(--border); }
.gb-av-bot .gb-robot-head { width: 20px; height: 14px; }

.gb-bubble {
  max-width: 85%; padding: 9px 12px; border-radius: 14px; font-size: 13.5px; line-height: 1.5;
  background: var(--white); border: 1px solid var(--border); border-top-left-radius: 4px;
  word-wrap: break-word; overflow-wrap: anywhere;
}
.gb-user .gb-bubble {
  background: var(--navy); color: #fff; border-color: var(--navy);
  border-top-left-radius: 14px; border-top-right-radius: 4px; white-space: pre-wrap;
}
.gb-bubble p { margin: 0 0 6px; }
.gb-bubble p:last-child, .gb-bubble ol:last-child, .gb-bubble ul:last-child { margin-bottom: 0; }
.gb-bubble ol, .gb-bubble ul { margin: 0 0 6px; padding-left: 20px; }
.gb-bubble li { margin-bottom: 3px; }
.gb-cite {
  display: inline-block; min-width: 16px; padding: 0 4px; margin: 0 1px; border-radius: 4px;
  font-size: 10px; font-weight: 700; line-height: 15px; text-align: center; vertical-align: 1px;
  background: var(--blue-bg); color: var(--navy);
}
.gb-bubble.gb-error { background: #FEF2F2; border-color: #FECACA; color: #991B1B; }

.gb-sources { max-width: 85%; margin-top: 6px; display: flex; flex-direction: column; gap: 5px; width: 85%; }
.gb-sources-title { font-size: 11px; font-weight: 600; color: var(--text3); text-transform: uppercase; letter-spacing: .03em; }
.gb-source {
  display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 10px;
  background: var(--white); border: 1px solid var(--border); text-decoration: none; color: var(--text);
  font-size: 12.5px; transition: border-color var(--t), background var(--t);
}
.gb-source:hover { border-color: var(--navy); background: var(--blue-bg); color: var(--text); }
.gb-source-num {
  width: 20px; height: 20px; border-radius: 50%; flex-shrink: 0; font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; background: var(--navy); color: #fff;
}
.gb-source-txt { min-width: 0; }
.gb-source-title { font-weight: 600; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gb-source-course { font-size: 11px; color: var(--text3); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.gb-suggest { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; margin: -4px 0 14px 30px; }
.gb-chip {
  border: 1px solid var(--navy); background: var(--white); color: var(--navy);
  border-radius: 16px; padding: 5px 12px; font-size: 12.5px; font-weight: 500; text-align: left;
  cursor: pointer; transition: background var(--t), color var(--t);
}
.gb-chip:hover { background: var(--navy); color: #fff; }

.gb-typing { display: inline-flex; gap: 4px; padding: 3px 0; }
.gb-typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--text3); animation: gbDot 1.2s infinite ease-in-out; }
.gb-typing span:nth-child(2) { animation-delay: .15s; }
.gb-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes gbDot { 0%, 60%, 100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

.gb-foot { flex-shrink: 0; border-top: 1px solid var(--border); background: var(--white); padding: 8px 12px 10px; }
.gb-warn { font-size: 11px; color: #B45309; background: #FFFBEB; border-radius: 6px; padding: 4px 8px; margin-bottom: 6px; }
.gb-info { font-size: 11px; color: #0284C7; background: #edf5ff; border-radius: 6px; padding: 4px 8px; margin-bottom: 6px; }
.gb-form { display: flex; align-items: flex-end; gap: 8px; }
.gb-input {
  flex: 1; resize: none; border: 1px solid var(--border); border-radius: 12px; padding: 8px 12px;
  font: inherit; font-size: 13.5px; line-height: 1.4; max-height: 110px; min-height: 38px; outline: none;
  transition: border-color var(--t), box-shadow var(--t);
}
.gb-input:focus { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(0, 121, 191, .12); }
.gb-input:disabled { background: var(--bg); cursor: not-allowed; }
.gb-send {
  width: 38px; height: 38px; border: 0; border-radius: 50%; flex-shrink: 0; cursor: pointer;
  background: var(--navy); color: #fff; display: flex; align-items: center; justify-content: center;
  transition: background var(--t), opacity var(--t);
}
.gb-send:hover:not(:disabled) { background: var(--navy2); }
.gb-send:disabled { opacity: .45; cursor: not-allowed; }
.gb-send svg { width: 17px; height: 17px; }
.gb-quota { font-size: 11px; color: var(--text3); margin-top: 6px; text-align: right; }
.gb-quota.gb-quota-out { color: #B91C1C; font-weight: 600; }

@media (max-width: 575.98px) {
  .gb-launcher { right: 12px; bottom: 10px; width: 60px; height: 73px; }
  .gb-panel { right: 0; bottom: 0; width: 100vw; height: 100dvh; max-height: none; border-radius: 0; }
  .gb-open .gb-launcher { display: none; }
  .gb-hello { right: 80px; bottom: 50px; max-width: calc(100vw - 100px); }
}
