/* dorli-chat.css — widget Célia (chat dorli.co)
   Identité visuelle Dorli Talk : orange #F25C1F, bulles arrondies, ombre douce. */

.dc-root {
  --dc-orange: #F25C1F;
  --dc-orange-dark: #D14E14;
  --dc-orange-soft: #FEEDD9;
  --dc-bg: #F4F5F7;
  --dc-text-1: #0F1115;
  --dc-text-2: #6B7280;
  --dc-sep: #E5E7EB;
  --dc-shadow-btn: 0 4px 12px rgba(242, 92, 31, 0.35);
  --dc-shadow-panel: 0 16px 40px rgba(15, 17, 21, 0.18);
  --dc-font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "SF Pro Text", "Helvetica Neue", sans-serif;

  font-family: var(--dc-font);
  color: var(--dc-text-1);
  -webkit-font-smoothing: antialiased;
}

.dc-root *,
.dc-root *::before,
.dc-root *::after { box-sizing: border-box; }

/* ───── Floating button ───── */
.dc-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--dc-orange);
  border: none;
  cursor: pointer;
  z-index: 9998;
  box-shadow: var(--dc-shadow-btn);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .18s ease, box-shadow .18s ease;
  padding: 0;
}
.dc-fab:hover { transform: scale(1.05); box-shadow: 0 8px 20px rgba(242, 92, 31, 0.45); }
.dc-fab:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.dc-fab svg { width: 26px; height: 26px; color: #fff; }

.dc-fab .dc-fab-close { display: none; }
.dc-fab.dc-open .dc-fab-bubble { display: none; }
.dc-fab.dc-open .dc-fab-close { display: block; }

.dc-fab-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: #E11D48;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  line-height: 18px;
  text-align: center;
  display: none;
  animation: dc-pulse 1.6s ease-in-out infinite;
}
.dc-fab-badge.dc-show { display: block; }
@keyframes dc-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(225, 29, 72, 0.6); }
  50%      { box-shadow: 0 0 0 8px rgba(225, 29, 72, 0); }
}

/* ───── Panel ───── */
.dc-panel {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 340px;
  max-width: calc(100vw - 32px);
  max-height: 70vh;
  background: #fff;
  border-radius: 16px;
  box-shadow: var(--dc-shadow-panel);
  z-index: 9999;
  display: none;
  flex-direction: column;
  overflow: hidden;
  transform-origin: bottom right;
}
.dc-panel.dc-open {
  display: flex;
  animation: dc-slidein .35s cubic-bezier(.2,.9,.3,1.2);
}
@keyframes dc-slidein {
  0%   { opacity: 0; transform: translateY(20px) scale(.96); }
  60%  { opacity: 1; transform: translateY(-4px) scale(1.01); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* ───── Header ───── */
.dc-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: #fff;
  border-bottom: 1px solid var(--dc-sep);
}
.dc-avatar {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #0F1115;
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-family: var(--dc-font);
  cursor: pointer;
}
.dc-root .dc-avatar img {
  position: absolute !important;
  top: 0;
  left: 0;
  width: 40px !important;
  height: 40px !important;
  max-width: none !important;
  max-height: none !important;
  min-width: 0 !important;
  min-height: 0 !important;
  object-fit: cover;
  display: block;
  border-radius: 50%;
  transition: width .22s cubic-bezier(.2,.9,.3,1.1), height .22s cubic-bezier(.2,.9,.3,1.1), border-radius .22s ease, box-shadow .22s ease, top .22s ease, left .22s ease;
  z-index: 1;
}
.dc-root .dc-avatar:hover img,
.dc-root .dc-avatar:focus-visible img {
  width: 160px !important;
  height: 160px !important;
  border-radius: 16px;
  z-index: 10;
  top: -4px;
  left: -4px;
  box-shadow: 0 12px 32px rgba(15, 17, 21, 0.28), 0 0 0 4px #fff;
}
.dc-header-text { flex: 1; min-width: 0; }
.dc-header-name {
  font-weight: 600;
  font-size: 15px;
  color: var(--dc-text-1);
  line-height: 1.2;
}
.dc-header-sub {
  font-size: 12px;
  color: var(--dc-text-2);
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.dc-header-sub::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10B981;
}
.dc-close {
  background: none;
  border: none;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  color: var(--dc-text-2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .15s;
}
.dc-close:hover { background: var(--dc-bg); }
.dc-close svg { width: 18px; height: 18px; }

/* ───── Messages ───── */
.dc-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: var(--dc-bg);
  display: flex;
  flex-direction: column;
  gap: 8px;
  scroll-behavior: smooth;
}
.dc-msg {
  display: flex;
  flex-direction: column;
  max-width: 85%;
  word-wrap: break-word;
  animation: dc-msg-in .25s ease;
}
@keyframes dc-msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.dc-msg-celia { align-self: flex-start; }
.dc-msg-user  { align-self: flex-end; }

.dc-bubble {
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
  position: relative;
}
.dc-msg-celia .dc-bubble {
  background: #fff;
  color: var(--dc-text-1);
  border-bottom-left-radius: 4px;
  border-left: 3px solid var(--dc-orange);
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.dc-msg-user .dc-bubble {
  background: linear-gradient(180deg, var(--dc-orange) 0%, var(--dc-orange-dark) 100%);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.dc-link {
  color: var(--dc-orange);
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 500;
  word-break: break-word;
}
.dc-link:hover { color: var(--dc-orange-dark); }
.dc-msg-user .dc-link { color: #fff; text-decoration-color: rgba(255,255,255,0.7); }

.dc-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: flex-start;
  margin-top: 8px;
  padding: 9px 14px;
  background: var(--dc-orange);
  color: #fff !important;
  text-decoration: none;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  box-shadow: 0 2px 8px rgba(242, 92, 31, 0.28);
  transition: transform .12s ease, box-shadow .15s ease, background .15s;
}
.dc-cta::after {
  content: "→";
  font-weight: 600;
  transition: transform .15s ease;
}
.dc-cta:hover { transform: translateY(-1px); background: var(--dc-orange-dark); box-shadow: 0 4px 12px rgba(242, 92, 31, 0.4); }
.dc-cta:hover::after { transform: translateX(2px); }
.dc-cta:focus-visible { outline: 2px solid var(--dc-orange); outline-offset: 2px; }

.dc-msg-meta {
  font-size: 11px;
  color: var(--dc-text-2);
  margin-top: 4px;
  padding: 0 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.dc-msg-user .dc-msg-meta { justify-content: flex-end; }
.dc-msg-celia .dc-msg-meta::before {
  content: "✨ AI";
  background: var(--dc-bg);
  color: var(--dc-text-2);
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 500;
}

/* ───── Typing indicator ───── */
.dc-typing {
  align-self: flex-start;
  display: none;
  align-items: center;
  gap: 4px;
  padding: 12px 16px;
  background: #fff;
  border-radius: 18px;
  border-bottom-left-radius: 4px;
  border-left: 3px solid var(--dc-orange);
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.dc-typing.dc-show { display: flex; }
.dc-typing span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--dc-text-2);
  animation: dc-bounce 1.2s ease-in-out infinite;
}
.dc-typing span:nth-child(2) { animation-delay: .15s; }
.dc-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes dc-bounce {
  0%, 60%, 100% { opacity: .4; transform: translateY(0); }
  30%           { opacity: 1;  transform: translateY(-4px); }
}

/* ───── Input ───── */
.dc-input-wrap {
  padding: 10px 12px;
  background: #fff;
  border-top: 1px solid var(--dc-sep);
  display: flex;
  align-items: flex-end;
  gap: 8px;
}
.dc-input {
  flex: 1;
  border: 1px solid var(--dc-sep);
  border-radius: 20px;
  padding: 9px 14px;
  font-family: var(--dc-font);
  font-size: 14px;
  line-height: 1.4;
  resize: none;
  outline: none;
  max-height: 96px;
  min-height: 38px;
  background: var(--dc-bg);
  color: var(--dc-text-1);
  transition: border-color .15s, background .15s;
}
.dc-input:focus { border-color: var(--dc-orange); background: #fff; }
.dc-send {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--dc-orange);
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .12s, background .15s, opacity .15s;
}
.dc-send:hover:not(:disabled) { transform: scale(1.06); }
.dc-send:disabled { background: var(--dc-sep); cursor: not-allowed; }
.dc-send svg { width: 16px; height: 16px; color: #fff; }

.dc-counter {
  position: absolute;
  bottom: -16px;
  right: 14px;
  font-size: 10px;
  color: var(--dc-text-2);
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s;
}
.dc-counter.dc-show { opacity: 1; }

.dc-error {
  margin: 0 16px 8px;
  padding: 8px 12px;
  background: #FEE2E2;
  color: #991B1B;
  border-radius: 8px;
  font-size: 12px;
  display: none;
}
.dc-error.dc-show { display: block; }

/* ───── Mobile fullscreen ───── */
@media (max-width: 640px) {
  .dc-panel {
    bottom: 0;
    right: 0;
    left: 0;
    top: 0;
    width: 100vw;
    max-width: 100vw;
    max-height: 100vh;
    height: 100vh;
    border-radius: 0;
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
  .dc-fab { bottom: 16px; right: 16px; }
}

/* ───── Reduced motion ───── */
@media (prefers-reduced-motion: reduce) {
  .dc-panel.dc-open,
  .dc-msg,
  .dc-fab-badge,
  .dc-typing span {
    animation: none !important;
  }
  .dc-fab { transition: none; }
}
