/* Widget chat — charte EXITECS (orange accent, bleu primary) */
.exitecs-chat-launcher {
  position: fixed;
  z-index: 9000;
  right: 1.25rem;
  bottom: 1.25rem;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--accent) 0%, #ffb53b 100%);
  color: #fff;
  box-shadow: 0 10px 28px rgba(21, 56, 120, 0.22);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.exitecs-chat-launcher:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 34px rgba(21, 56, 120, 0.28);
}

.exitecs-chat-launcher:focus-visible {
  outline: 3px solid rgba(31, 86, 181, 0.45);
  outline-offset: 3px;
}

.exitecs-chat-launcher svg {
  width: 28px;
  height: 28px;
  fill: currentColor;
}

.exitecs-chat-panel {
  position: fixed;
  z-index: 9001;
  right: 1.25rem;
  bottom: 5.5rem;
  width: min(400px, calc(100vw - 2rem));
  max-height: min(560px, calc(100vh - 7rem));
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 18px;
  border: 1px solid var(--border);
  box-shadow: 0 18px 48px rgba(15, 35, 70, 0.18);
  overflow: hidden;
}

.exitecs-chat-panel[hidden] {
  display: none !important;
}

.exitecs-chat-head {
  padding: 1rem 1.1rem;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
}

.exitecs-chat-head h2 {
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
  font-weight: 800;
  color: #fff;
}

.exitecs-chat-head p {
  margin: 0;
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.88);
  line-height: 1.4;
}

.exitecs-chat-close {
  position: absolute;
  top: 0.65rem;
  right: 0.65rem;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
  font-size: 1.35rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}

.exitecs-chat-close:hover {
  background: rgba(255, 255, 255, 0.22);
}

.exitecs-chat-messages {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 200px;
  max-height: 340px;
  background: linear-gradient(180deg, #f8fafc 0%, #f4f7fc 100%);
}

.exitecs-chat-msg {
  max-width: 92%;
  padding: 0.65rem 0.85rem;
  border-radius: 14px;
  font-size: 0.92rem;
  line-height: 1.55;
  word-wrap: break-word;
}

.exitecs-chat-msg--bot {
  align-self: flex-start;
  background: #fff;
  border: 1px solid var(--border);
  color: var(--text);
}

.exitecs-chat-msg--user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
}

.exitecs-chat-msg--thinking {
  align-self: flex-start;
  font-style: italic;
  color: var(--muted);
  font-size: 0.88rem;
  border: none;
  background: transparent;
}

.exitecs-chat-foot {
  padding: 0.5rem 1rem 0.75rem;
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.45;
  border-top: 1px solid var(--border);
  background: #fff;
}

.exitecs-chat-form {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1rem 1rem;
  border-top: 1px solid var(--border);
  background: #fff;
}

.exitecs-chat-input {
  flex: 1 1 auto;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.65rem 0.85rem;
  font-family: inherit;
  font-size: 0.92rem;
  resize: none;
  max-height: 120px;
}

.exitecs-chat-input:focus {
  outline: none;
  border-color: rgba(31, 86, 181, 0.45);
  box-shadow: 0 0 0 3px rgba(31, 86, 181, 0.12);
}

.exitecs-chat-send {
  flex-shrink: 0;
  border: none;
  border-radius: 12px;
  padding: 0 1rem;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  background: linear-gradient(135deg, var(--accent) 0%, #ffb53b 100%);
  color: #fff;
  transition: filter 0.2s ease;
}

.exitecs-chat-send:hover:not(:disabled) {
  filter: brightness(0.96);
}

.exitecs-chat-send:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.exitecs-chat-panel .exitecs-chat-head {
  position: relative;
  padding-right: 3rem;
}

@media (max-width: 540px) {
  .exitecs-chat-panel {
    right: 0.75rem;
    left: 0.75rem;
    width: auto;
    bottom: 5rem;
  }

  .exitecs-chat-launcher {
    right: 0.75rem;
    bottom: 0.75rem;
  }
}
