/* ── AI Concierge – WhatsApp floating icon + chat ──────────────────────── */
:root {
  --wa-green:      #25d366;
  --wa-green-btn:  #128c7e;
  --wa-green-dark: #075e54;
  --wa-bg:         #0b141a;
  --wa-surface:    #202c33;
  --wa-bubble-in:  #202c33;
  --wa-bubble-out: #005c4b;
  --wa-txt:        #e9edef;
  --wa-txt-dim:    #8696a0;
  --wa-border:     #2a3942;
  --wa-input:      #2a3942;
}

/* ── Contenitore fisso ─────────────────────────────────────────────────── */
.ai-concierge {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 9999;
  font-family: -apple-system, 'Segoe UI', Helvetica, Arial, sans-serif;
}

/* ── Launcher: cerchio verde flottante ────────────────────────────────── */
.ai-concierge__launcher {
  position: relative;
  width: 60px;
  height: 60px;
  border: none;
  border-radius: 50%;
  background: var(--wa-green-btn);
  box-shadow: 0 4px 18px rgba(0,0,0,.45);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, box-shadow .15s, transform .15s;
  -webkit-tap-highlight-color: transparent;
}
.ai-concierge__launcher:hover {
  background: var(--wa-green-dark);
  box-shadow: 0 6px 24px rgba(0,0,0,.55);
  transform: scale(1.05);
}
.ai-concierge__launcher svg { display: block; pointer-events: none; }

/* pulse verde in basso a destra del cerchio */
.ai-concierge__pulse {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--wa-green);
  border: 2px solid #111;
  box-shadow: 0 0 0 3px rgba(37,211,102,.25);
  animation: wa-pulse 2s infinite;
}
@keyframes wa-pulse {
  0%,100% { box-shadow: 0 0 0 3px rgba(37,211,102,.25); }
  50%      { box-shadow: 0 0 0 6px rgba(37,211,102,.06); }
}

/* ── Panel chat ────────────────────────────────────────────────────────── */
.ai-concierge__panel {
  position: absolute;
  right: 0;
  bottom: 72px;
  width: min(380px, calc(100vw - 24px));
  border-radius: 12px;
  overflow: hidden;
  background: var(--wa-bg);
  box-shadow: 0 8px 40px rgba(0,0,0,.65), 0 0 0 1px rgba(255,255,255,.04);
  display: flex;
  flex-direction: column;
  max-height: min(640px, calc(100vh - 100px));
}

/* ── Header ────────────────────────────────────────────────────────────── */
.ai-concierge__header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--wa-surface);
  border-bottom: 1px solid var(--wa-border);
  flex-shrink: 0;
}
.ai-concierge__avatar {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--wa-green-btn);
  display: flex;
  align-items: center;
  justify-content: center;
}
.ai-concierge__header-info { flex: 1; min-width: 0; }
.ai-concierge__header-info strong {
  display: block;
  font-size: 15px;
  font-weight: 600;
  color: var(--wa-txt);
  line-height: 1.25;
}
.ai-concierge__header-info span {
  display: block;
  font-size: 12px;
  color: var(--wa-txt-dim);
  margin-top: 1px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ai-concierge__header-close {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--wa-txt-dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, color .15s;
}
.ai-concierge__header-close:hover { background: rgba(255,255,255,.08); color: var(--wa-txt); }

/* ── Messaggi ──────────────────────────────────────────────────────────── */
.ai-concierge__messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px 10px;
  background: var(--wa-bg);
  min-height: 180px;
  max-height: 340px;
  scroll-behavior: smooth;
}
.ai-concierge__messages::-webkit-scrollbar { width: 3px; }
.ai-concierge__messages::-webkit-scrollbar-thumb { background: var(--wa-input); border-radius: 3px; }
/* clearfix */
.ai-concierge__messages::after { content: ''; display: table; clear: both; }

/* Bubble base */
.ai-concierge__message {
  position: relative;
  display: block;
  max-width: 80%;
  padding: 7px 11px;
  margin-bottom: 5px;
  border-radius: 8px;
  font-size: 13.5px;
  line-height: 1.5;
  word-break: break-word;
  clear: both;
}

/* Bot → sinistra, bubble grigio scuro, coda in alto-sinistra */
.ai-concierge__message--bot {
  float: left;
  background: var(--wa-bubble-in);
  color: var(--wa-txt);
  border-top-left-radius: 0;
  margin-left: 10px;
}
.ai-concierge__message--bot::before {
  content: '';
  position: absolute;
  top: 0;
  left: -9px;
  border: 9px solid transparent;
  border-top-color: var(--wa-bubble-in);
  border-right-color: var(--wa-bubble-in);
  border-radius: 0 2px 0 0;
  width: 0; height: 0;
}

/* User → destra, bubble verde scuro, coda in alto-destra */
.ai-concierge__message--user {
  float: right;
  background: var(--wa-bubble-out);
  color: #e9edef;
  border-top-right-radius: 0;
  margin-right: 10px;
}
.ai-concierge__message--user::after {
  content: '';
  position: absolute;
  top: 0;
  right: -9px;
  border: 9px solid transparent;
  border-top-color: var(--wa-bubble-out);
  border-left-color: var(--wa-bubble-out);
  border-radius: 2px 0 0 0;
  width: 0; height: 0;
}

/* Error */
.ai-concierge__message--error {
  float: left;
  background: #1e1010;
  color: #fca5a5;
  border-left: 3px solid #dc2626;
  margin-left: 10px;
}

/* ── Input ─────────────────────────────────────────────────────────────── */
.ai-concierge__form {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--wa-surface);
  border-top: 1px solid var(--wa-border);
  flex-shrink: 0;
}
.ai-concierge__form input {
  flex: 1;
  min-width: 0;
  border: none;
  border-radius: 22px;
  padding: 9px 15px;
  font-size: 14px;
  color: var(--wa-txt);
  background: var(--wa-input);
  outline: none;
  font-family: inherit;
}
.ai-concierge__form input::placeholder { color: var(--wa-txt-dim); }
.ai-concierge__form input:focus { background: #34454f; }
.ai-concierge__send-btn {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 50%;
  background: var(--wa-green-btn);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
}
.ai-concierge__send-btn:hover { background: var(--wa-green-dark); }

/* ── Fallback WhatsApp ─────────────────────────────────────────────────── */
.ai-concierge__actions {
  padding: 8px 10px;
  background: var(--wa-surface);
  border-top: 1px solid var(--wa-border);
  flex-shrink: 0;
}
.ai-concierge__handoff {
  display: block;
  width: 100%;
  padding: 11px;
  border: none;
  border-radius: 22px;
  background: var(--wa-green-btn);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s;
}
.ai-concierge__handoff:hover { background: var(--wa-green-dark); }

/* ── Privacy ───────────────────────────────────────────────────────────── */
.ai-concierge__privacy {
  text-align: center;
  padding: 5px 12px 8px;
  color: var(--wa-txt-dim);
  font-size: 10.5px;
  background: var(--wa-surface);
  border-top: 1px solid var(--wa-border);
  flex-shrink: 0;
}

/* ── Mobile ────────────────────────────────────────────────────────────── */
@media (max-width: 520px) {
  .ai-concierge { right: 14px; bottom: 14px; }
  .ai-concierge__panel {
    position: fixed;
    right: 0; left: 0; bottom: 0;
    width: 100%;
    border-radius: 18px 18px 0 0;
    max-height: 85vh;
  }
  .ai-concierge__messages { max-height: 50vh; }
}
