/*
 * Eurostarling Assistant — floating bubble (Pax)
 * Design DNA: Inter + IBM Plex Mono, r-3 cards, dot-prefixed eyebrows,
 * Petrol accent, light section feel.
 */

.es-asst {
  --asst-bg: #ffffff;
  --asst-fg: #0f1b22;
  --asst-muted: #5d6c75;
  --asst-border: #e3e8eb;
  --asst-petrol: #1e5e6e;
  --asst-petrol-soft: #e7f1f3;
  --asst-shadow: 0 24px 60px -16px rgba(15, 27, 34, 0.28),
                 0 6px 16px -6px rgba(15, 27, 34, 0.12);

  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 9000; /* below cookie banner (9999), above page content */
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: var(--asst-fg);
}

/* Pill — collapsed */
.es-asst__pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--asst-petrol);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 14px 22px;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: var(--asst-shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.es-asst__pill:hover { transform: translateY(-1px); box-shadow: 0 28px 68px -16px rgba(15, 27, 34, 0.32), 0 8px 18px -6px rgba(15, 27, 34, 0.15); }
.es-asst__pill:focus-visible { outline: 2px solid var(--asst-petrol); outline-offset: 3px; }

.es-asst__pill-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #5fd3a8;
  box-shadow: 0 0 0 3px rgba(95, 211, 168, 0.25);
}

.es-asst__pill-icon {
  width: 18px; height: 18px;
  stroke: currentColor; fill: none; stroke-width: 1.8;
}

/* Panel — expanded */
.es-asst__panel {
  position: absolute;
  bottom: 0; right: 0;
  width: 380px;
  height: 560px;
  max-height: calc(100vh - 48px);
  background: var(--asst-bg);
  border-radius: 16px;
  box-shadow: var(--asst-shadow);
  display: none;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--asst-border);
}
.es-asst.is-open .es-asst__panel { display: flex; }
.es-asst.is-open .es-asst__pill { display: none; }

/* Header */
.es-asst__head {
  background: var(--asst-petrol);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.es-asst__head-eyebrow {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: inline-flex; align-items: center; gap: 6px;
  opacity: 0.85;
}
.es-asst__head-eyebrow::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%; background: #5fd3a8;
}
.es-asst__head-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-left: 4px;
  flex: 1;
}
.es-asst__head-btn {
  background: transparent; border: none; color: #fff;
  width: 28px; height: 28px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  opacity: 0.8;
}
.es-asst__head-btn:hover { background: rgba(255,255,255,0.12); opacity: 1; }
.es-asst__head-btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; }

/* Body — message stream */
.es-asst__body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #fafbfc;
}
.es-asst__msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
}
.es-asst__msg--user {
  align-self: flex-end;
  background: var(--asst-petrol);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.es-asst__msg--assistant {
  align-self: flex-start;
  background: #fff;
  color: var(--asst-fg);
  border: 1px solid var(--asst-border);
  border-bottom-left-radius: 4px;
}
.es-asst__msg p { margin: 0 0 6px 0; }
.es-asst__msg p:last-child { margin-bottom: 0; }
.es-asst__msg ul, .es-asst__msg ol { margin: 4px 0; padding-left: 22px; }
.es-asst__msg li { margin: 2px 0; }
.es-asst__msg a { color: var(--asst-petrol); text-decoration: underline; }
.es-asst__msg--user a { color: #fff; text-decoration: underline; }
.es-asst__msg code {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 12px;
  background: rgba(0,0,0,0.05);
  padding: 1px 5px;
  border-radius: 4px;
}
.es-asst__msg--user code { background: rgba(255,255,255,0.18); }

/* Loading dots */
.es-asst__loading {
  align-self: flex-start;
  display: inline-flex; align-items: center; gap: 4px;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid var(--asst-border);
  border-radius: 12px;
  border-bottom-left-radius: 4px;
}
.es-asst__loading span {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--asst-muted);
  animation: es-asst-bounce 1.2s infinite ease-in-out;
}
.es-asst__loading span:nth-child(2) { animation-delay: 0.15s; }
.es-asst__loading span:nth-child(3) { animation-delay: 0.3s; }
@keyframes es-asst-bounce {
  0%, 80%, 100% { opacity: 0.3; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}

/* Greeting / empty-state */
.es-asst__hello {
  text-align: center;
  padding: 28px 16px 20px;
  color: var(--asst-muted);
}
.es-asst__hello-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--asst-fg);
  margin: 8px 0 4px;
}
.es-asst__hello-sub {
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 16px;
}
.es-asst__suggestions { display: flex; flex-direction: column; gap: 8px; }
.es-asst__suggestion {
  background: #fff;
  border: 1px solid var(--asst-border);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--asst-fg);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.1s, background 0.1s;
}
.es-asst__suggestion:hover { border-color: var(--asst-petrol); background: var(--asst-petrol-soft); }

/* Footer / input */
.es-asst__foot {
  border-top: 1px solid var(--asst-border);
  padding: 12px;
  background: #fff;
}
.es-asst__input-wrap {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.es-asst__textarea {
  flex: 1;
  border: 1px solid var(--asst-border);
  border-radius: 10px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.4;
  resize: none;
  outline: none;
  max-height: 120px;
  min-height: 40px;
}
.es-asst__textarea:focus { border-color: var(--asst-petrol); }
.es-asst__send {
  background: var(--asst-petrol);
  color: #fff;
  border: none;
  border-radius: 10px;
  width: 40px; height: 40px;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: opacity 0.15s;
}
.es-asst__send:disabled { opacity: 0.4; cursor: not-allowed; }
.es-asst__send svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; }

.es-asst__disclaimer {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--asst-muted);
  text-align: center;
  margin-top: 8px;
  text-transform: uppercase;
}

.es-asst__error {
  background: #fff4f4;
  color: #8a2929;
  border: 1px solid #f5d2d2;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  align-self: stretch;
}

/* Mobile: full-screen takeover */
@media (max-width: 640px) {
  .es-asst { right: 16px; bottom: 16px; }
  .es-asst.is-open { right: 0; bottom: 0; left: 0; top: 0; }
  .es-asst.is-open .es-asst__panel {
    width: 100%; height: 100%;
    max-height: none;
    border-radius: 0;
    border: none;
  }
}
