/* Widget assistant — thème luxe premium (cohérent avec style.css) */

.chat-widget-root .visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.chat-widget-root {
  --chat-gold: #b8956a;
  --chat-gold-hover: #d4b896;
  --chat-gold-glow: rgba(184, 149, 106, 0.25);
  --chat-bg: #0c0c0e;
  --chat-surface: #141418;
  --chat-bot: #1e1e24;
  --chat-user: #f0ebe4;
  --chat-text: #f0ebe4;
  --chat-muted: #8a8580;
  --chat-radius: 20px;
  --chat-shadow: 0 20px 56px rgba(0, 0, 0, 0.55);
  --chat-ease: cubic-bezier(0.22, 1, 0.36, 1);

  position: fixed;
  right: max(1rem, env(safe-area-inset-right, 0px));
  bottom: max(1rem, env(safe-area-inset-bottom, 0px));
  z-index: 85;
  font-family: inherit;
  font-size: 0.9375rem;
  line-height: 1.45;
}

.chat-fab {
  position: relative;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: 1px solid rgba(184, 149, 106, 0.35);
  cursor: pointer;
  background: linear-gradient(145deg, #141418 0%, #0c0c0e 100%);
  color: var(--chat-text);
  box-shadow: var(--chat-shadow), 0 0 24px var(--chat-gold-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    transform 0.3s var(--chat-ease),
    box-shadow 0.3s ease,
    border-color 0.25s ease;
  -webkit-tap-highlight-color: transparent;
}

.chat-fab:hover {
  transform: translateY(-3px) scale(1.04);
  box-shadow: var(--chat-shadow), 0 0 36px var(--chat-gold-glow);
  border-color: var(--chat-gold);
}

.chat-fab:active {
  transform: translateY(0) scale(0.98);
}

.chat-fab-icon {
  font-size: 1.45rem;
  line-height: 1;
  filter: grayscale(0.2);
}

.chat-fab-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--chat-gold);
  border: 2px solid var(--chat-bg);
  box-shadow: 0 0 8px var(--chat-gold-glow);
  animation: chat-badge-pulse 2.5s ease-in-out infinite;
}

.chat-fab-badge[hidden] {
  display: none !important;
}

@keyframes chat-badge-pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.1);
    opacity: 0.85;
  }
}

.chat-panel {
  position: absolute;
  right: 0;
  bottom: calc(58px + 0.85rem);
  width: min(100vw - 2rem, 400px);
  max-height: min(72vh, 560px);
  display: flex;
  flex-direction: column;
  background: var(--chat-bg);
  border-radius: var(--chat-radius);
  box-shadow: var(--chat-shadow);
  border: 1px solid rgba(184, 149, 106, 0.15);
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(16px) scale(0.96);
  transform-origin: bottom right;
  transition:
    opacity 0.35s var(--chat-ease),
    transform 0.35s var(--chat-ease),
    visibility 0.35s;
  pointer-events: none;
}

.chat-widget-root.is-open .chat-panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.chat-widget-root.is-open .chat-fab {
  border-color: var(--chat-gold);
  box-shadow: var(--chat-shadow), 0 0 32px var(--chat-gold-glow);
}

.chat-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1.1rem 1.15rem 0.95rem;
  background: var(--chat-surface);
  border-bottom: 1px solid rgba(184, 149, 106, 0.2);
}

.chat-panel-title {
  display: block;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 600;
  font-size: 1.1rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--chat-text);
}

.chat-panel-sub {
  display: block;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--chat-muted);
  margin-top: 0.2rem;
}

.chat-panel-sub::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #52b788;
  margin-right: 0.4rem;
  vertical-align: middle;
  box-shadow: 0 0 6px rgba(82, 183, 136, 0.5);
}

.chat-panel-close {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 50%;
  background: rgba(240, 235, 228, 0.06);
  color: var(--chat-muted);
  font-size: 1.1rem;
  cursor: pointer;
  line-height: 1;
  transition:
    background 0.2s ease,
    color 0.2s ease,
    transform 0.25s var(--chat-ease);
}

.chat-panel-close:hover {
  background: rgba(184, 149, 106, 0.15);
  color: var(--chat-gold-hover);
  transform: rotate(90deg);
}

.chat-messages {
  flex: 1;
  min-height: 200px;
  max-height: 360px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  -webkit-overflow-scrolling: touch;
}

.chat-messages::-webkit-scrollbar {
  width: 5px;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: rgba(184, 149, 106, 0.25);
  border-radius: 99px;
}

.chat-msg {
  max-width: 88%;
  padding: 0.7rem 0.95rem;
  border-radius: 16px;
  word-wrap: break-word;
  animation: chat-msg-in 0.3s var(--chat-ease);
}

@keyframes chat-msg-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.chat-msg--bot {
  align-self: flex-start;
  background: var(--chat-bot);
  color: #d4cfc8;
  border-bottom-left-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.chat-msg--user {
  align-self: flex-end;
  background: var(--chat-user);
  color: #1a1816;
  border-bottom-right-radius: 4px;
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.chat-msg--bot strong,
.chat-msg--user strong {
  color: inherit;
}

.chat-msg-inline-link {
  display: inline;
  margin: 0;
  padding: 0;
  border: none;
  background: none;
  color: var(--chat-gold);
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  vertical-align: baseline;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.2s ease;
}

.chat-msg-inline-link:hover {
  color: var(--chat-gold-hover);
}

.chat-msg-inline-link:focus-visible {
  outline: 2px solid var(--chat-gold);
  outline-offset: 2px;
  border-radius: 4px;
}

.chat-form {
  display: flex;
  gap: 0.55rem;
  padding: 0.85rem;
  background: var(--chat-surface);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.chat-input {
  flex: 1;
  min-width: 0;
  border: 1px solid rgba(240, 235, 228, 0.1);
  border-radius: 14px;
  padding: 0.7rem 0.95rem;
  font: inherit;
  font-size: 0.88rem;
  background: rgba(8, 8, 10, 0.6);
  color: var(--chat-text);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.chat-input::placeholder {
  color: var(--chat-muted);
}

.chat-input:focus {
  border-color: var(--chat-gold);
  box-shadow: 0 0 0 3px var(--chat-gold-glow);
}

.chat-send {
  flex-shrink: 0;
  border: none;
  border-radius: 14px;
  padding: 0.7rem 1.1rem;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  background: linear-gradient(135deg, var(--chat-gold-hover) 0%, var(--chat-gold) 100%);
  color: #0c0c0e;
  transition:
    transform 0.2s var(--chat-ease),
    box-shadow 0.25s ease;
}

.chat-send:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px var(--chat-gold-glow);
}

.chat-send:active {
  transform: scale(0.97);
}

@media (max-width: 480px) {
  .chat-widget-root {
    right: max(0.75rem, env(safe-area-inset-right, 0px));
    bottom: max(0.75rem, env(safe-area-inset-bottom, 0px));
  }

  .chat-panel {
    width: calc(100vw - 1.5rem);
    max-height: min(78vh, 620px);
    bottom: calc(58px + 0.65rem);
  }

  .chat-messages {
    max-height: min(42vh, 320px);
    min-height: 180px;
  }

  .chat-fab {
    width: 54px;
    height: 54px;
  }

  .chat-panel {
    bottom: calc(54px + 0.65rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  .chat-panel,
  .chat-fab,
  .chat-msg,
  .chat-fab-badge {
    animation: none;
    transition-duration: 0.01ms !important;
  }
}
