/* Widget support — aligné sur la vitrine SignalByTeDi (sombre, rose, ardoise) */
.help-chat-panel,
.help-chat-fab {
  --hc-bg: #121722;
  --hc-surface: #0b0e14;
  --hc-elevated: #1a2233;
  --hc-border: rgba(51, 65, 85, 0.55);
  --hc-text: #e2e8f0;
  --hc-muted: #94a3b8;
  --hc-accent: #f43f5e;
  --hc-accent-soft: rgba(244, 63, 94, 0.15);
  --hc-accent-hover: #fb7185;
  --hc-bubble-in: #1e293b;
  --hc-bubble-out: #be123c;
  --hc-online: #34d399;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* —— Bouton flottant —— */
.help-chat-fab {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 190;
  width: 3.5rem;
  height: 3.5rem;
  border: 1px solid var(--hc-border);
  border-radius: 9999px;
  padding: 0;
  background: var(--hc-bg);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(244, 63, 94, 0.12);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.help-chat-fab:hover {
  transform: scale(1.04);
  border-color: rgba(244, 63, 94, 0.45);
  box-shadow: 0 14px 44px rgba(0, 0, 0, 0.5), 0 0 20px rgba(244, 63, 94, 0.2);
}
.help-chat-fab__img {
  width: 100%;
  height: 100%;
  border-radius: 9999px;
  object-fit: contain;
  background: #0b0e14;
  padding: 2px;
}
.help-chat-fab__dot {
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 11px;
  height: 11px;
  border-radius: 9999px;
  background: var(--hc-online);
  border: 2px solid var(--hc-bg);
}
.help-chat-fab__dot--off {
  background: #64748b;
}

/* —— Panneau —— */
.help-chat-panel {
  position: fixed;
  right: 1.25rem;
  bottom: 5.25rem;
  z-index: 189;
  width: min(26.25rem, calc(100vw - 1.5rem));
  height: min(38.75rem, calc(100vh - 5.5rem));
  min-width: 20rem;
  display: flex;
  flex-direction: column;
  border-radius: 1rem;
  overflow: hidden;
  background: var(--hc-bg);
  border: 1px solid var(--hc-border);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
  color: var(--hc-text);
}
.help-chat-panel.hidden {
  display: none;
}

/* —— En-tête —— */
.help-chat-head {
  flex-shrink: 0;
  background: var(--hc-elevated);
  border-bottom: 1px solid var(--hc-border);
}
.help-chat-head__main {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 0.85rem 0.5rem;
}
.help-chat-head__avatar-wrap {
  position: relative;
  flex-shrink: 0;
}
.help-chat-head__avatar {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 9999px;
  object-fit: contain;
  background: #121722;
  display: block;
}
.help-chat-head__status {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 10px;
  height: 10px;
  border-radius: 9999px;
  background: var(--hc-online);
  border: 2px solid var(--hc-elevated);
}
.help-chat-head__status--off {
  background: #64748b;
}
.help-chat-head__text {
  flex: 1;
  min-width: 0;
}
.help-chat-head__name {
  font-size: 0.8rem;
  font-weight: 600;
  margin: 0;
  line-height: 1.3;
  color: #f8fafc;
}
.help-chat-brand-signal {
  color: var(--hc-accent);
}
.help-chat-brand-by {
  color: var(--hc-muted);
}
.help-chat-brand-tedi {
  color: #f1f5f9;
}
.help-chat-head__sub {
  font-size: 0.68rem;
  color: var(--hc-muted);
  margin: 0.1rem 0 0;
}
.help-chat-head__close {
  border: none;
  background: transparent;
  color: var(--hc-muted);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.15rem 0.35rem;
  border-radius: 0.35rem;
  transition: color 0.15s, background 0.15s;
}
.help-chat-head__close:hover {
  color: #f8fafc;
  background: rgba(148, 163, 184, 0.12);
}

.help-chat-head__status--off {
  background: #64748b;
}

.help-chat-tabs {
  display: flex;
  gap: 0.35rem;
  padding: 0 0.75rem 0.65rem;
}
.help-chat-tab {
  flex: 1;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.4rem 0.65rem;
  border-radius: 0.5rem;
  border: 1px solid var(--hc-border);
  background: transparent;
  color: var(--hc-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.help-chat-tab:hover {
  color: var(--hc-text);
  border-color: rgba(148, 163, 184, 0.4);
}
.help-chat-tab.is-active {
  background: var(--hc-accent-soft);
  border-color: rgba(244, 63, 94, 0.45);
  color: #fda4af;
}

/* —— Zone messages —— */
.help-chat-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--hc-surface);
  position: relative;
}
.help-chat-view.hidden {
  display: none;
}

.help-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 0.85rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.help-chat-date {
  text-align: center;
  font-size: 0.65rem;
  color: #64748b;
  margin: 0.25rem 0;
}

.help-chat-row {
  display: flex;
  gap: 0.45rem;
  align-items: flex-end;
  width: 100%;
  max-width: 100%;
  justify-content: flex-start;
}
.help-chat-row--user {
  flex-direction: row;
  justify-content: flex-end;
  align-self: stretch;
}
.help-chat-row--system {
  justify-content: flex-start;
}
.help-chat-row__body {
  display: flex;
  flex-direction: column;
  max-width: 82%;
  min-width: 0;
  flex: 0 1 auto;
}
.help-chat-row--user .help-chat-row__body {
  align-items: flex-end;
  margin-left: auto;
}
.help-chat-row__avatar {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 9999px;
  flex-shrink: 0;
  object-fit: cover;
  border: 1px solid var(--hc-border);
}
.help-chat-row__name {
  font-size: 0.62rem;
  color: var(--hc-muted);
  margin-bottom: 0.15rem;
}

.help-chat-bubble {
  display: inline-block;
  width: fit-content;
  max-width: 100%;
  font-size: 0.875rem;
  line-height: 1.5;
  padding: 0.6rem 0.85rem;
  border-radius: 1rem;
  white-space: pre-wrap;
  word-break: normal;
  overflow-wrap: break-word;
  hyphens: none;
}
.help-chat-bubble--in {
  background: var(--hc-bubble-in);
  color: #e2e8f0;
  border: 1px solid var(--hc-border);
  border-bottom-left-radius: 0.3rem;
}
.help-chat-bubble--out {
  background: linear-gradient(145deg, #e11d48 0%, #be123c 100%);
  color: #fff;
  border-bottom-right-radius: 0.3rem;
  min-width: 2.5rem;
  box-shadow: 0 4px 14px rgba(190, 18, 60, 0.25);
}
.help-chat-bubble--system {
  background: rgba(30, 41, 59, 0.5);
  border: 1px dashed rgba(100, 116, 139, 0.45);
  color: #cbd5e1;
  max-width: 100%;
  font-size: 0.75rem;
}

.help-chat-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.45rem;
}
.help-chat-link {
  font-size: 0.68rem;
  padding: 0.35rem 0.7rem;
  border-radius: 9999px;
  border: 1px solid rgba(244, 63, 94, 0.4);
  color: #fda4af;
  text-decoration: none;
  background: rgba(15, 23, 42, 0.6);
  cursor: pointer;
  position: relative;
  z-index: 1;
  transition: background 0.15s, border-color 0.15s;
}
.help-chat-link:hover {
  background: var(--hc-accent-soft);
  border-color: var(--hc-accent);
  color: #fecdd3;
}

/* —— E-mail —— */
.help-chat-email-gate {
  padding: 0.65rem 0.75rem;
  background: var(--hc-elevated);
  border-bottom: 1px solid var(--hc-border);
}
.help-chat-email-gate__text {
  font-size: 0.75rem;
  margin: 0 0 0.45rem;
  color: var(--hc-muted);
}
.help-chat-email-gate__btn {
  font-size: 0.75rem;
  padding: 0.35rem 0.75rem;
  border-radius: 0.5rem;
  border: 1px solid rgba(244, 63, 94, 0.4);
  background: transparent;
  color: #fda4af;
  cursor: pointer;
  font-weight: 600;
}
.help-chat-email-gate__btn:hover {
  background: var(--hc-accent-soft);
}
.help-chat-email-form {
  display: flex;
  gap: 0.35rem;
  margin-top: 0.35rem;
}
.help-chat-email-input {
  flex: 1;
  font-size: 0.75rem;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--hc-border);
  border-radius: 0.45rem;
  background: var(--hc-surface);
  color: var(--hc-text);
}
.help-chat-email-input:focus {
  outline: none;
  border-color: rgba(244, 63, 94, 0.5);
}
.help-chat-email-submit {
  font-size: 0.72rem;
  padding: 0.45rem 0.7rem;
  border: none;
  border-radius: 0.45rem;
  background: var(--hc-accent);
  color: #fff;
  cursor: pointer;
  font-weight: 600;
}
.help-chat-email-submit:hover {
  background: var(--hc-accent-hover);
}

.help-chat-email-banner {
  margin: 0;
  padding: 0.45rem 0.75rem;
  font-size: 0.72rem;
  background: rgba(234, 179, 8, 0.12);
  color: #fde68a;
  border-bottom: 1px solid rgba(234, 179, 8, 0.25);
}

/* —— Composer —— */
.help-chat-compose {
  display: flex;
  align-items: flex-end;
  gap: 0.35rem;
  padding: 0.55rem 0.7rem 0.7rem;
  background: var(--hc-elevated);
  border-top: 1px solid var(--hc-border);
}
.help-chat-compose__tools {
  display: flex;
  gap: 0.15rem;
  flex-shrink: 0;
  align-items: center;
  align-self: flex-end;
  margin-bottom: 0.15rem;
}
.help-chat-tool-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: none;
  border-radius: 0.45rem;
  background: transparent;
  color: var(--hc-muted);
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}
.help-chat-tool-btn:hover:not(:disabled) {
  color: var(--hc-accent-hover);
  background: var(--hc-accent-soft);
}
.help-chat-tool-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.help-chat-tool-btn.is-active {
  color: var(--hc-accent);
  background: var(--hc-accent-soft);
}
.help-chat-file-input {
  display: none;
}

.help-chat-compose__input {
  flex: 1;
  min-width: 0;
  font-size: 0.8rem;
  line-height: 1.35;
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--hc-border);
  border-radius: 0.75rem;
  outline: none;
  background: var(--hc-surface);
  color: var(--hc-text);
  resize: none;
  overflow-x: hidden;
  overflow-y: hidden;
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 2.35rem;
  max-height: calc(0.8rem * 1.35 * 5 + 1.1rem);
  font-family: inherit;
}
.help-chat-compose__input.is-scrollable {
  overflow-y: auto;
  overscroll-behavior: contain;
}
.help-chat-compose__input::placeholder {
  color: #64748b;
}
.help-chat-compose__input:focus {
  border-color: rgba(244, 63, 94, 0.5);
  box-shadow: 0 0 0 2px rgba(244, 63, 94, 0.12);
}
.help-chat-compose__send {
  flex-shrink: 0;
  align-self: flex-end;
  margin-bottom: 0.15rem;
  border: none;
  background: transparent;
  color: var(--hc-accent);
  font-size: 1.15rem;
  cursor: pointer;
  padding: 0.25rem;
  line-height: 1;
}
.help-chat-compose__send:hover {
  color: var(--hc-accent-hover);
}

/* —— Picker emoji / GIF —— */
.help-chat-picker {
  position: absolute;
  left: 0.5rem;
  right: 0.5rem;
  bottom: 4.5rem;
  z-index: 5;
  display: flex;
  flex-direction: column;
  max-height: min(16rem, 42vh);
  border-radius: 0.75rem;
  background: var(--hc-elevated);
  border: 1px solid var(--hc-border);
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}
.help-chat-picker.hidden {
  display: none;
}
.help-chat-picker__search-wrap {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.55rem;
  border-bottom: 1px solid var(--hc-border);
}
.help-chat-picker__search-icon {
  font-size: 0.75rem;
  opacity: 0.45;
}
.help-chat-picker__search {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  font-size: 0.78rem;
  color: var(--hc-text);
  background: transparent;
}
.help-chat-picker__search::placeholder {
  color: #64748b;
}
.help-chat-picker__body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0.35rem 0.5rem 0.5rem;
}
.help-chat-picker__body.is-loading {
  opacity: 0.6;
}
.help-chat-picker__cat {
  font-size: 0.62rem;
  font-weight: 600;
  color: #64748b;
  margin: 0.35rem 0 0.2rem;
}
.help-chat-picker__grid--emoji {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 0.1rem;
}
.help-chat-picker__emoji {
  border: none;
  background: transparent;
  font-size: 1.35rem;
  line-height: 1.2;
  padding: 0.15rem;
  border-radius: 0.35rem;
  cursor: pointer;
}
.help-chat-picker__emoji:hover {
  background: var(--hc-accent-soft);
}
.help-chat-picker__grid--gif {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.35rem;
}
.help-chat-picker__gif {
  border: none;
  padding: 0;
  border-radius: 0.45rem;
  overflow: hidden;
  cursor: pointer;
  background: var(--hc-surface);
  aspect-ratio: 1;
}
.help-chat-picker__gif img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.help-chat-picker__gif:hover {
  outline: 2px solid var(--hc-accent);
}
.help-chat-picker__empty {
  font-size: 0.72rem;
  color: var(--hc-muted);
  text-align: center;
  padding: 1rem 0.5rem;
  margin: 0;
}
.help-chat-picker__more {
  display: block;
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.4rem;
  font-size: 0.72rem;
  border: 1px solid var(--hc-border);
  border-radius: 0.5rem;
  background: var(--hc-surface);
  color: #fda4af;
  cursor: pointer;
}
.help-chat-picker__more:hover {
  border-color: rgba(244, 63, 94, 0.4);
}
.help-chat-picker__tabs {
  display: flex;
  justify-content: center;
  gap: 0.25rem;
  padding: 0.45rem 0.5rem 0.55rem;
  border-top: 1px solid var(--hc-border);
  background: var(--hc-surface);
}
.help-chat-picker__tab {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.35rem 0.85rem;
  border-radius: 9999px;
  border: 1px solid var(--hc-border);
  background: transparent;
  color: var(--hc-muted);
  cursor: pointer;
}
.help-chat-picker__tab.is-active {
  background: var(--hc-accent-soft);
  border-color: rgba(244, 63, 94, 0.45);
  color: #fda4af;
}
.help-chat-picker__gif-label {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.help-chat-bubble__gif {
  display: block;
  max-width: min(220px, 100%);
  border-radius: 0.5rem;
  margin-top: 0.35rem;
  border: 1px solid var(--hc-border);
}
.help-chat-bubble__file {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-top: 0.35rem;
  font-size: 0.75rem;
  color: #fda4af;
  text-decoration: underline;
}
.help-chat-bubble__text {
  white-space: pre-wrap;
}

/* —— Articles —— */
.help-chat-articles {
  flex: 1;
  overflow-y: auto;
  padding: 0.65rem;
}
.help-chat-article {
  display: block;
  padding: 0.65rem 0.75rem;
  margin-bottom: 0.45rem;
  border-radius: 0.65rem;
  background: var(--hc-elevated);
  border: 1px solid var(--hc-border);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, background 0.15s;
}
.help-chat-article:hover {
  border-color: rgba(244, 63, 94, 0.4);
  background: rgba(26, 34, 51, 0.95);
}
.help-chat-article__title {
  font-size: 0.8rem;
  font-weight: 600;
  color: #f1f5f9;
  margin: 0 0 0.25rem;
}
.help-chat-article__excerpt {
  font-size: 0.72rem;
  color: var(--hc-muted);
  margin: 0;
  line-height: 1.4;
}

@media (max-width: 520px) {
  .help-chat-panel {
    right: 0.5rem;
    left: 0.5rem;
    width: auto;
    min-width: 0;
    height: min(34rem, calc(100vh - 5rem));
  }
}
