/* ============================================================
   OFFIL — Assistant Technique Essentiel — Floating Chat
   Gabrielle widget — offil-at-*
   ============================================================ */
:root {
  --offil-at-primary: #0a3a76;
  --offil-at-accent: #c00000;
  --offil-at-bg: #ffffff;
  --offil-at-bubble-user: #0a3a76;
  --offil-at-bubble-assistant: #f3f4f6;
  --offil-at-radius: 16px;
  --offil-at-z: 9999;
}

/* ————————————————————————
   FAB button (floating action button)
   Note: right:0 + margin-right to avoid overflow-x:clip clipping
———————————————————————— */
.offil-at-fab {
  position: fixed;
  bottom: 28px;
  right: 0;
  margin-right: 24px;
  z-index: var(--offil-at-z);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--offil-at-primary);
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(10,58,118,.38);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s, transform .15s;
}

.offil-at-fab:hover,
.offil-at-fab:focus-visible {
  background: #0d4a99;
  transform: scale(1.06);
  outline: 2px solid #5b8dd9;
  outline-offset: 2px;
}

.offil-at-fab__icon {
  width: 26px;
  height: 26px;
  fill: #fff;
  pointer-events: none;
}

/* Unread badge */
.offil-at-fab__badge {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--offil-at-accent);
  border: 2px solid #fff;
  display: none;
}

.offil-at-fab--has-unread .offil-at-fab__badge {
  display: block;
}

/* ————————————————————————
   Panel — same fix: right:0 + margin-right
———————————————————————— */
.offil-at-panel {
  position: fixed;
  bottom: 96px;
  right: 0;
  margin-right: 24px;
  z-index: var(--offil-at-z);
  width: 364px;
  max-width: calc(100vw - 32px);
  max-height: 520px;
  background: var(--offil-at-bg);
  border-radius: var(--offil-at-radius);
  box-shadow: 0 8px 40px rgba(10,58,118,.22), 0 1px 6px rgba(0,0,0,.10);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  /* Hidden by default */
  transform: translateY(14px) scale(.97);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .22s ease;
}

.offil-at-panel--open {
  opacity: 1 !important;
  transform: translateY(0) scale(1) !important;
  pointer-events: auto !important;
}

/* ————————————————————————
   Header (Gabrielle)
———————————————————————— */
.offil-at-header {
  background: var(--offil-at-primary);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.offil-at-header__avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255,255,255,.18);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  flex-shrink: 0;
  letter-spacing: 0;
}

.offil-at-header__info {
  flex: 1;
  min-width: 0;
}

.offil-at-header__name {
  font-weight: 700;
  font-size: 14px;
  line-height: 1.2;
}

.offil-at-header__role {
  font-size: 11px;
  opacity: .70;
  margin-top: 2px;
}

.offil-at-close {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  opacity: .75;
  transition: opacity .15s;
  border-radius: 6px;
  flex-shrink: 0;
}

.offil-at-close:hover,
.offil-at-close:focus-visible {
  opacity: 1;
  outline: none;
  background: rgba(255,255,255,.15);
}

/* ————————————————————————
   Thread (conversation)
———————————————————————— */
.offil-at-thread {
  flex: 1;
  overflow-y: auto;
  padding: 14px 14px 6px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
  overscroll-behavior: contain;
}

.offil-at-thread::-webkit-scrollbar {
  width: 4px;
}

.offil-at-thread::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 2px;
}

/* ————————————————————————
   Messages (bubbles)
———————————————————————— */
.offil-at-msg {
  display: flex;
  flex-direction: column;
  max-width: 86%;
}

.offil-at-msg--assistant {
  align-self: flex-start;
}

.offil-at-msg--user {
  align-self: flex-end;
}

.offil-at-msg__bubble {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.55;
  word-break: break-word;
}

.offil-at-msg--assistant .offil-at-msg__bubble {
  background: var(--offil-at-bubble-assistant);
  color: #1a1a2e;
  border-bottom-left-radius: 4px;
}

.offil-at-msg--user .offil-at-msg__bubble {
  background: var(--offil-at-bubble-user);
  color: #fff;
  border-bottom-right-radius: 4px;
}

/* Clarification points */
.offil-at-msg__points {
  list-style: disc;
  margin: 6px 0 0 18px;
  padding: 0;
  font-size: 12.5px;
  color: #4b5563;
}

.offil-at-msg--user .offil-at-msg__points {
  color: rgba(255,255,255,.85);
}

/* ————————————————————————
   Typing indicator
———————————————————————— */
.offil-at-typing {
  align-self: flex-start;
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  background: var(--offil-at-bubble-assistant);
  border-radius: 14px;
  border-bottom-left-radius: 4px;
}

.offil-at-typing__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #9ca3af;
  animation: offil-at-bounce .9s infinite;
}

.offil-at-typing__dot:nth-child(2) { animation-delay: .15s; }
.offil-at-typing__dot:nth-child(3) { animation-delay: .30s; }

@keyframes offil-at-bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30%           { transform: translateY(-5px); }
}

/* ————————————————————————
   Input footer
———————————————————————— */
.offil-at-footer {
  padding: 10px 14px 12px;
  border-top: 1px solid #e5e7eb;
  display: flex;
  gap: 8px;
  align-items: flex-end;
  flex-shrink: 0;
  background: #fff;
}

.offil-at-input {
  flex: 1;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 13.5px;
  font-family: inherit;
  resize: none;
  outline: none;
  line-height: 1.4;
  max-height: 88px;
  overflow-y: auto;
  transition: border-color .15s;
  color: #1a1a2e;
  background: #fff;
}

.offil-at-input:focus {
  border-color: var(--offil-at-primary);
}

.offil-at-input::placeholder {
  color: #9ca3af;
}

.offil-at-send {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border: none;
  border-radius: 10px;
  background: var(--offil-at-primary);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
  padding: 0;
}

.offil-at-send:disabled {
  background: #9ca3af;
  cursor: default;
}

.offil-at-send:not(:disabled):hover,
.offil-at-send:not(:disabled):focus-visible {
  background: #0d4a99;
  outline: 2px solid #5b8dd9;
  outline-offset: 2px;
}

.offil-at-send svg {
  width: 18px;
  height: 18px;
  fill: #fff;
  pointer-events: none;
}

/* ————————————————————————
   Mobile
———————————————————————— */
@media (max-width: 480px) {
  .offil-at-panel {
    bottom: 56px;
    right: 8px;
    margin-right: 0;
    width: calc(100vw - 16px);
    max-width: 340px;
    max-height: calc(100vh - 68px);
    border-radius: var(--offil-at-radius);
  }

  .offil-at-fab {
    bottom: 12px;
    right: 8px;
    margin-right: 0;
    width: 34px;
    height: 34px;
  }

  .offil-at-fab svg {
    width: 16px;
    height: 16px;
  }

  .offil-at-fab__badge {
    width: 10px;
    height: 10px;
    top: 2px;
    right: 2px;
  }
}
