/* B.EASE Chat Widget — CSS v2.0 */

:root {
  --bc-primary:   #e63329;   /* rouge B.EASE */
  --bc-dark:      #111111;
  --bc-surface:   #ffffff;
  --bc-muted:     #f5f5f5;
  --bc-border:    #e8e8e8;
  --bc-text:      #1a1a1a;
  --bc-text-soft: #666666;
  --bc-shadow:    0 8px 32px rgba(0,0,0,.18);
  --bc-radius:    16px;
  --bc-z:         9999;
}

/* ── Bouton flottant ─────────────────────────────────────── */

#bc-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: var(--bc-z);
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--bc-primary);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(230,51,41,.45);
  transition: transform .2s ease, box-shadow .2s ease;
}

#bc-fab:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 22px rgba(230,51,41,.55);
}

#bc-fab svg {
  width: 26px;
  height: 26px;
  fill: #fff;
}

.bc-badge {
  position: absolute;
  top: 0;
  right: 0;
  width: 20px;
  height: 20px;
  background: var(--bc-dark);
  color: #fff;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  display: none;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
}

/* ── Fenêtre ─────────────────────────────────────────────── */

#bc-window {
  position: fixed;
  bottom: 96px;
  right: 24px;
  z-index: var(--bc-z);
  width: 360px;
  max-height: 560px;
  background: var(--bc-surface);
  border-radius: var(--bc-radius);
  box-shadow: var(--bc-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(16px) scale(.97);
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
}

#bc-window.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* ── Header ──────────────────────────────────────────────── */

#bc-header {
  background: var(--bc-dark);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.bc-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--bc-primary);
  color: #fff;
  font-weight: 800;
  font-size: 17px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.bc-header-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.bc-name {
  font-weight: 700;
  font-size: 14px;
}

.bc-status {
  font-size: 11px;
  opacity: .7;
  color: #4caf50;
}

#bc-close {
  background: none;
  border: none;
  cursor: pointer;
  color: rgba(255,255,255,.7);
  padding: 4px;
  display: flex;
  align-items: center;
  transition: color .15s;
}

#bc-close:hover { color: #fff; }

#bc-close svg {
  width: 18px;
  height: 18px;
}

/* ── Messages ────────────────────────────────────────────── */

#bc-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

#bc-messages::-webkit-scrollbar { width: 4px; }
#bc-messages::-webkit-scrollbar-thumb { background: var(--bc-border); border-radius: 4px; }

.bc-msg {
  max-width: 82%;
  padding: 10px 13px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.5;
  word-break: break-word;
}

.bc-msg a {
  color: inherit;
  text-decoration: underline;
}

.bc-bot {
  background: var(--bc-muted);
  color: var(--bc-text);
  border-bottom-left-radius: 4px;
  align-self: flex-start;
}

.bc-user {
  background: var(--bc-primary);
  color: #fff;
  border-bottom-right-radius: 4px;
  align-self: flex-end;
}

/* Indicateur frappe */
.bc-typing {
  display: flex;
  gap: 5px;
  align-items: center;
  padding: 12px 16px;
  background: var(--bc-muted);
  width: fit-content;
  border-radius: 14px;
  border-bottom-left-radius: 4px;
}

.bc-typing span {
  width: 7px;
  height: 7px;
  background: #bbb;
  border-radius: 50%;
  animation: bc-bounce .9s ease-in-out infinite;
}
.bc-typing span:nth-child(2) { animation-delay: .15s; }
.bc-typing span:nth-child(3) { animation-delay: .30s; }

@keyframes bc-bounce {
  0%, 80%, 100% { transform: translateY(0); }
  40%           { transform: translateY(-6px); }
}

/* ── Qualification ───────────────────────────────────────── */

.bc-qual {
  align-self: flex-start;
  max-width: 90%;
}

.bc-qual-label {
  font-size: 12px;
  color: var(--bc-text-soft);
  margin-bottom: 8px;
  font-weight: 600;
}

.bc-qual-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.bc-qbtn {
  background: var(--bc-surface);
  border: 1.5px solid var(--bc-primary);
  color: var(--bc-primary);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, color .15s;
}

.bc-qbtn:hover:not(:disabled) {
  background: var(--bc-primary);
  color: #fff;
}

/* ── Formulaire email ────────────────────────────────────── */

.bc-email-form {
  background: #fff8e1;
  border: 1.5px solid #ffe082;
  border-radius: 12px;
  padding: 12px;
  font-size: 13px;
  align-self: stretch;
}

.bc-email-form p {
  margin: 0 0 10px;
  font-weight: 600;
  color: var(--bc-text);
}

.bc-email-fields {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 10px;
}

.bc-email-fields input {
  border: 1.5px solid var(--bc-border);
  border-radius: 8px;
  padding: 8px 11px;
  font-size: 13px;
  outline: none;
  width: 100%;
  box-sizing: border-box;
  transition: border-color .15s;
}

.bc-email-fields input:focus {
  border-color: var(--bc-primary);
}

.bc-email-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.bc-btn-primary {
  background: var(--bc-primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  flex: 1;
}

.bc-btn-primary:hover { opacity: .9; }

.bc-btn-ghost {
  background: none;
  border: none;
  color: var(--bc-text-soft);
  font-size: 12px;
  cursor: pointer;
  padding: 4px 8px;
  white-space: nowrap;
}

.bc-btn-ghost:hover { color: var(--bc-text); }

/* ── Canaux escalade ─────────────────────────────────────── */

#bc-channels {
  display: flex;
  gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid var(--bc-border);
  flex-wrap: wrap;
  flex-shrink: 0;
  background: var(--bc-muted);
}

.bc-channel {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  border: 1.5px solid var(--bc-border);
  color: var(--bc-text);
  background: var(--bc-surface);
  transition: border-color .15s, color .15s;
}

.bc-channel:hover {
  border-color: var(--bc-primary);
  color: var(--bc-primary);
}

.bc-wa {
  border-color: #25d366;
  color: #25d366;
}

.bc-rdv {
  border-color: var(--bc-primary);
  color: var(--bc-primary);
}

/* ── Zone de saisie ──────────────────────────────────────── */

#bc-input-area {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--bc-border);
  background: var(--bc-surface);
  flex-shrink: 0;
}

#bc-input {
  flex: 1;
  resize: none;
  border: 1.5px solid var(--bc-border);
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 13.5px;
  line-height: 1.4;
  outline: none;
  font-family: inherit;
  color: var(--bc-text);
  background: var(--bc-surface);
  transition: border-color .15s;
  max-height: 90px;
  overflow-y: auto;
}

#bc-input:focus {
  border-color: var(--bc-primary);
}

#bc-input:disabled {
  background: var(--bc-muted);
}

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

#bc-send:hover:not(:disabled) { opacity: .85; }
#bc-send:disabled { opacity: .45; cursor: default; }

#bc-send svg {
  width: 17px;
  height: 17px;
  fill: #fff;
}

/* ── Mobile ──────────────────────────────────────────────── */

@media (max-width: 480px) {
  #bc-window {
    width: calc(100vw - 20px);
    right: 10px;
    bottom: 88px;
    max-height: 72vh;
    border-radius: 12px;
  }
  #bc-fab {
    bottom: 16px;
    right: 16px;
  }
}

/* ── Visuels Gemini ───────────────────────────────────────── */

.bc-vis-loading {
  display:flex; align-items:center; gap:10px;
  color:#666; font-size:13px; font-style:italic;
}
.bc-vis-spinner {
  width:18px; height:18px; border:2px solid #ddd;
  border-top-color:var(--bc-primary); border-radius:50%;
  animation:bc-spin .7s linear infinite; flex-shrink:0;
}
@keyframes bc-spin { to { transform:rotate(360deg); } }

.bc-vis-result { max-width:92% !important; padding:12px !important; }
.bc-vis-caption { margin:0 0 10px; font-weight:600; font-size:13px; }
.bc-vis-wrap { position:relative; border-radius:10px; overflow:hidden; background:#f9f9f9; border:1px solid var(--bc-border); line-height:0; }
.bc-vis-img { width:100%; height:auto; display:block; cursor:zoom-in; transition:opacity .2s; }
.bc-vis-img:hover { opacity:.92; }
.bc-vis-dl {
  position:absolute; bottom:8px; right:8px; background:rgba(0,0,0,.55);
  color:#fff; width:30px; height:30px; border-radius:50%;
  display:flex; align-items:center; justify-content:center;
  font-size:16px; font-weight:700; text-decoration:none; transition:background .15s; line-height:1;
}
.bc-vis-dl:hover { background:rgba(0,0,0,.8); color:#fff; }
.bc-vis-note { margin:8px 0 0; font-size:11px; color:#999; font-style:italic; line-height:1.4; }

/* ── Séparateur session restaurée ─────────────────────────── */
.bc-sep {
  text-align:center; font-size:11px; color:#aaa; margin:8px 0;
  position:relative;
}
.bc-sep::before,.bc-sep::after {
  content:''; position:absolute; top:50%;
  width:28%; height:1px; background:var(--bc-border);
}
.bc-sep::before { left:0; }
.bc-sep::after  { right:0; }

/* ── Bouton reset conversation ────────────────────────────── */
.bc-header-actions { display:flex; align-items:center; gap:4px; }
#bc-clear {
  background:none; border:none; cursor:pointer;
  color:rgba(255,255,255,.5); padding:4px;
  display:flex; align-items:center; transition:color .15s;
}
#bc-clear:hover { color:rgba(255,255,255,.9); }
