/* ============================================================
   CHATBOT — Widget assistant scripté
   Serruriers du Léman — charte Sombre Luxe + Or
============================================================ */

.chat-root {
  position: fixed;
  inset: auto auto 1.25rem 1.25rem;
  z-index: 9998; /* sous urgence-float (z 9999) */
  font-family: var(--font-body, 'Open Sans', sans-serif);
  pointer-events: none; /* root transparent, enfants pointer-events:auto */
}
.chat-root > * { pointer-events: auto; }

/* ============================================================
   LAUNCHER (bouton flottant gauche)
============================================================ */
.chat-launcher {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.85rem 1.1rem 0.85rem 0.95rem;
  background: linear-gradient(135deg, #1a1a1a 0%, #0d0d0d 100%);
  color: var(--color-gold, #c9a84c);
  border: 1px solid rgba(201, 168, 76, 0.4);
  border-radius: 999px;
  font-family: var(--font-heading, 'Montserrat', sans-serif);
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.03em;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35), 0 0 0 0 rgba(201, 168, 76, 0.4);
  transition: transform 0.2s ease, box-shadow 0.3s ease, border-color 0.3s ease;
  min-height: 48px;
  min-width: 48px;
}
.chat-launcher:hover {
  transform: translateY(-2px);
  border-color: var(--color-gold, #c9a84c);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45), 0 0 0 4px rgba(201, 168, 76, 0.15);
}
.chat-launcher:focus-visible {
  outline: 2px solid var(--color-gold, #c9a84c);
  outline-offset: 3px;
}
.chat-launcher__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
}
.chat-launcher__icon svg {
  width: 20px;
  height: 20px;
}
.chat-launcher__label {
  white-space: nowrap;
}
.chat-launcher__pulse {
  position: absolute;
  inset: -3px;
  border-radius: 999px;
  border: 2px solid var(--color-gold, #c9a84c);
  opacity: 0;
  pointer-events: none;
  animation: chat-pulse 2.4s ease-out infinite;
}
@keyframes chat-pulse {
  0%   { transform: scale(1);   opacity: 0.6; }
  100% { transform: scale(1.3); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .chat-launcher__pulse { animation: none; display: none; }
}

/* ============================================================
   PANEL (panneau de discussion)
============================================================ */
.chat-panel {
  position: fixed;
  bottom: 5.25rem;
  left: 1.25rem;
  width: 380px;
  max-width: calc(100vw - 2.5rem);
  height: min(620px, calc(100vh - 7rem));
  background: #0d0d0d;
  border: 1px solid var(--color-border, #2a2a2a);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transform: translateY(20px) scale(0.96);
  transform-origin: bottom left;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.chat-panel--open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* ============================================================
   HEADER
============================================================ */
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1rem;
  background: linear-gradient(135deg, #1a1a1a 0%, #0d0d0d 100%);
  border-bottom: 1px solid var(--color-border, #2a2a2a);
  flex: 0 0 auto;
}
.chat-header__title {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.chat-header__title strong {
  font-family: var(--font-heading, 'Montserrat', sans-serif);
  font-size: 0.92rem;
  color: var(--color-gold, #c9a84c);
  font-weight: 700;
  letter-spacing: 0.02em;
}
.chat-header__status {
  font-size: 0.72rem;
  color: #9a9a9a;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.chat-header__status::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 6px #4ade80;
}
.chat-header__actions {
  display: flex;
  gap: 0.25rem;
}
.chat-header__btn {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: #9a9a9a;
  cursor: pointer;
  transition: color 0.2s, background 0.2s, border-color 0.2s;
}
.chat-header__btn:hover {
  color: var(--color-gold, #c9a84c);
  border-color: rgba(201, 168, 76, 0.3);
}
.chat-header__btn:focus-visible {
  outline: 2px solid var(--color-gold, #c9a84c);
  outline-offset: 2px;
}
.chat-header__btn svg {
  width: 16px;
  height: 16px;
}

/* ============================================================
   LOG (zone messages)
============================================================ */
.chat-log {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(201, 168, 76, 0.3) transparent;
}
.chat-log::-webkit-scrollbar { width: 6px; }
.chat-log::-webkit-scrollbar-thumb {
  background: rgba(201, 168, 76, 0.3);
  border-radius: 3px;
}

.chat-msg {
  max-width: 88%;
  padding: 0.7rem 0.9rem;
  border-radius: 12px;
  font-size: 0.88rem;
  line-height: 1.5;
  animation: chat-msg-in 0.25s ease-out;
}
@keyframes chat-msg-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.chat-msg--bot {
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  color: #e8e8e8;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.chat-msg--user {
  background: linear-gradient(135deg, var(--color-gold, #c9a84c) 0%, var(--color-gold-dark, #a8883a) 100%);
  color: #0d0d0d;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
  font-weight: 600;
}
.chat-msg p { margin: 0 0 0.4rem; }
.chat-msg p:last-child { margin-bottom: 0; }
.chat-msg a { color: var(--color-gold, #c9a84c); }
.chat-msg--user a { color: #0d0d0d; text-decoration: underline; }

.chat-list {
  margin: 0.3rem 0 0.5rem;
  padding-left: 1.1rem;
  list-style: disc;
}
.chat-list li {
  margin-bottom: 0.25rem;
  font-size: 0.85rem;
}
.chat-list li strong { color: var(--color-gold, #c9a84c); }

.chat-note {
  font-size: 0.78rem;
  color: #9a9a9a;
  margin-top: 0.5rem;
  font-style: italic;
}
.chat-note a { color: var(--color-gold, #c9a84c); }

/* Call block (urgence) */
.chat-callblock {
  display: grid;
  gap: 0.5rem;
  margin: 0.4rem 0;
}
.chat-callbtn {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0.65rem 0.85rem;
  background: linear-gradient(135deg, var(--color-gold, #c9a84c) 0%, var(--color-gold-dark, #a8883a) 100%);
  color: #0d0d0d !important;
  border-radius: 10px;
  text-decoration: none !important;
  font-weight: 700;
  transition: transform 0.15s;
  min-height: 48px;
}
.chat-callbtn:hover { transform: translateY(-1px); }
.chat-callbtn__role {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  opacity: 0.8;
}
.chat-callbtn strong { font-size: 0.92rem; }
.chat-callbtn__tel {
  font-size: 1.05rem;
  font-family: var(--font-heading, 'Montserrat', sans-serif);
  letter-spacing: 0.02em;
}

/* ============================================================
   INPUT AREA (options / form / search)
============================================================ */
.chat-input-area {
  flex: 0 0 auto;
  padding: 0.75rem 1rem 0.75rem;
  border-top: 1px solid var(--color-border, #2a2a2a);
  background: #111;
  max-height: 50%;
  overflow-y: auto;
}

.chat-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.chat-option {
  display: inline-flex;
  align-items: center;
  padding: 0.55rem 0.85rem;
  background: transparent;
  border: 1px solid var(--color-gold, #c9a84c);
  color: var(--color-gold, #c9a84c);
  border-radius: 999px;
  font-size: 0.82rem;
  font-family: var(--font-body, 'Open Sans', sans-serif);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  min-height: 38px;
  text-align: left;
}
.chat-option:hover {
  background: var(--color-gold, #c9a84c);
  color: #0d0d0d;
}
.chat-option:focus-visible {
  outline: 2px solid var(--color-gold-light, #e8c97a);
  outline-offset: 2px;
}
.chat-option--urgent {
  border-color: #ef4444;
  color: #fca5a5;
  font-weight: 600;
}
.chat-option--urgent:hover {
  background: #ef4444;
  color: #fff;
}
.chat-option--ghost {
  border-color: #444;
  color: #9a9a9a;
  margin-top: 0.4rem;
}
.chat-option--ghost:hover {
  background: #2a2a2a;
  color: #e8e8e8;
  border-color: #555;
}

/* ============================================================
   FORM (devis)
============================================================ */
.chat-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.chat-form label {
  font-size: 0.75rem;
  color: #c0c0c0;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.chat-form input,
.chat-form textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  background: #0d0d0d;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  color: #e8e8e8;
  font-size: 0.88rem;
  font-family: inherit;
  min-height: 42px;
  transition: border-color 0.2s, background 0.2s;
}
.chat-form textarea {
  resize: vertical;
  min-height: 70px;
}
.chat-form input:focus,
.chat-form textarea:focus {
  outline: none;
  border-color: var(--color-gold, #c9a84c);
  background: #1a1a1a;
}
.chat-form__submit {
  margin-top: 0.4rem;
  padding: 0.75rem 1rem;
  background: linear-gradient(135deg, var(--color-gold, #c9a84c) 0%, var(--color-gold-dark, #a8883a) 100%);
  color: #0d0d0d;
  border: none;
  border-radius: 8px;
  font-family: var(--font-heading, 'Montserrat', sans-serif);
  font-weight: 700;
  font-size: 0.88rem;
  letter-spacing: 0.02em;
  cursor: pointer;
  min-height: 48px;
  transition: filter 0.2s;
}
.chat-form__submit:hover { filter: brightness(1.08); }
.chat-form__submit:disabled { opacity: 0.6; cursor: wait; }
.chat-form__status {
  margin: 0.3rem 0 0;
  font-size: 0.78rem;
  color: #9a9a9a;
}
.chat-form__status--err { color: #fca5a5; }

/* ============================================================
   SEARCH
============================================================ */
.chat-search { display: flex; flex-direction: column; gap: 0.5rem; }
.chat-search__input {
  width: 100%;
  padding: 0.65rem 0.85rem;
  background: #0d0d0d;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  color: #e8e8e8;
  font-size: 0.92rem;
  min-height: 44px;
}
.chat-search__input:focus {
  outline: none;
  border-color: var(--color-gold, #c9a84c);
  background: #1a1a1a;
}
.chat-search__results {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-height: 280px;
  overflow-y: auto;
}
.chat-search__hit {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0.55rem 0.75rem;
  background: #0d0d0d;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  text-decoration: none;
  transition: border-color 0.2s, background 0.2s;
}
.chat-search__hit:hover {
  border-color: var(--color-gold, #c9a84c);
  background: #1a1a1a;
}
.chat-search__hit strong {
  color: var(--color-gold, #c9a84c);
  font-size: 0.88rem;
}
.chat-search__hit span {
  color: #9a9a9a;
  font-size: 0.78rem;
}

/* ============================================================
   FOOTER
============================================================ */
.chat-footer {
  flex: 0 0 auto;
  padding: 0.55rem 1rem;
  background: #0d0d0d;
  border-top: 1px solid var(--color-border, #2a2a2a);
  font-size: 0.74rem;
  color: #9a9a9a;
  text-align: center;
}
.chat-footer a {
  color: var(--color-gold, #c9a84c);
  font-weight: 700;
  text-decoration: none;
}

/* ============================================================
   RESPONSIVE
============================================================ */
@media (max-width: 600px) {
  .chat-root {
    inset: auto auto 0.75rem 0.75rem;
  }
  .chat-panel {
    bottom: 4.5rem;
    left: 0.75rem;
    right: 0.75rem;
    width: auto;
    max-width: none;
    height: min(640px, calc(100vh - 6rem));
  }
  .chat-launcher__label {
    display: none;
  }
  .chat-launcher {
    padding: 0.85rem;
    border-radius: 50%;
    width: 52px;
    height: 52px;
    justify-content: center;
  }
}

/* ============================================================
   COHABITATION avec urgence-float (déjà à droite)
   urgence-float reste prioritaire visuellement (z-index plus haut)
============================================================ */
