/* istanbul.quest support chat widget — self-contained, prefixed with ec-support. */

/* Match the site's yellow primary buttons (--accent), with dark text/icons on
   the accent for contrast — same scheme as .btn-primary on the site. */
:root {
  --ec-support-accent: var(--accent, #F9E14C);
  --ec-support-on-accent: #111;
}

.ec-support__launcher {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 9998;
  width: 3.5rem;
  height: 3.5rem;
  border: none;
  border-radius: 50%;
  background: var(--ec-support-accent, #F9E14C);
  color: var(--ec-support-on-accent, #111);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 0.25rem 1rem rgba(0, 0, 0, 0.25);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.ec-support__launcher:hover {
  transform: translateY(-0.125rem);
  box-shadow: 0 0.375rem 1.25rem rgba(0, 0, 0, 0.3);
}

.ec-support__badge {
  position: absolute;
  top: -0.125rem;
  right: -0.125rem;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.25rem;
  box-sizing: border-box;
  border-radius: 0.75rem;
  background: #e0245e;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.25rem;
  text-align: center;
  box-shadow: 0 0 0 0.125rem #fff;
}

.ec-support__badge[hidden] {
  display: none;
}

.ec-support {
  position: fixed;
  right: 1.25rem;
  bottom: 5.5rem;
  z-index: 9999;
  width: min(22.5rem, 92vw);
  height: min(35rem, 70vh);
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 0.875rem;
  overflow: hidden;
  box-shadow: 0 0.75rem 2.5rem rgba(0, 0, 0, 0.28);
  opacity: 0;
  transform: translateY(0.75rem) scale(0.98);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.ec-support--open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.ec-support__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.875rem 1rem;
  background: var(--ec-support-accent, #F9E14C);
  color: var(--ec-support-on-accent, #111);
}

.ec-support__title {
  font-weight: 600;
  font-size: 1rem;
}

.ec-support__close {
  background: none;
  border: none;
  color: var(--ec-support-on-accent, #111);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.85;
}

.ec-support__close:hover { opacity: 1; }

.ec-support__list {
  flex: 1;
  overflow-y: auto;
  padding: 0.875rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: #f5f6f8;
}

.ec-support__msg {
  display: flex;
  max-width: 85%;
}

.ec-support__msg--out { align-self: flex-end; }
.ec-support__msg--in { align-self: flex-start; }

.ec-support__bubble {
  position: relative;
  padding: 0.5rem 0.75rem 1.1rem;
  border-radius: 0.875rem;
  font-size: 0.9375rem;
  line-height: 1.35;
  white-space: pre-wrap;
  word-break: break-word;
}

.ec-support__msg--out .ec-support__bubble {
  background: var(--ec-support-accent, #F9E14C);
  color: var(--ec-support-on-accent, #111);
  border-bottom-right-radius: 0.25rem;
}

.ec-support__msg--in .ec-support__bubble {
  background: #fff;
  color: #1a1a1a;
  border-bottom-left-radius: 0.25rem;
  box-shadow: 0 0.0625rem 0.25rem rgba(0, 0, 0, 0.08);
}

.ec-support__bubble--info {
  padding-bottom: 0.5rem; /* no timestamp, so drop the reserved bottom space */
}

.ec-support__time {
  position: absolute;
  right: 0.625rem;
  bottom: 0.3125rem;
  font-size: 0.6875rem;
  opacity: 0.7;
}

/* Status corner of an outgoing bubble: spinner → time → error. */
.ec-support__status {
  position: absolute;
  right: 0.625rem;
  bottom: 0.3125rem;
  font-size: 0.6875rem;
  line-height: 1;
}

.ec-support__status--time {
  opacity: 0.7;
}

.ec-support__status--sending {
  width: 0.75rem;
  height: 0.75rem;
  border: 0.125rem solid rgba(0, 0, 0, 0.25);
  border-top-color: rgba(0, 0, 0, 0.6);
  border-radius: 50%;
  animation: ec-support-spin 0.6s linear infinite;
}

.ec-support__status--error {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  background: #e0245e;
  color: #fff;
  font-weight: 800;
  font-size: 0.75rem;
  cursor: pointer;
}

@keyframes ec-support-spin {
  to { transform: rotate(360deg); }
}

.ec-support__system {
  align-self: center;
  font-size: 0.8125rem;
  color: #888;
  padding: 0.25rem 0.5rem;
}

.ec-support__footer {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  padding: 0.625rem;
  background: #fff;
  border-top: 0.0625rem solid #e6e8eb;
}

.ec-support__input {
  flex: 1;
  resize: none;
  border: 0.0625rem solid #d4d7dc;
  border-radius: 0.75rem;
  padding: 0.5rem 0.75rem;
  font: inherit;
  font-size: 0.9375rem;
  line-height: 1.35;
  max-height: 6rem;
  outline: none;
}

.ec-support__input:focus {
  border-color: var(--ec-support-accent, #F9E14C);
}

.ec-support__send {
  flex: 0 0 auto;
  width: 2.5rem;
  height: 2.5rem;
  border: none;
  border-radius: 50%;
  background: var(--ec-support-accent, #F9E14C);
  color: var(--ec-support-on-accent, #111);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* Paper-plane glyph is visually left-heavy; nudge it right to sit centred. */
.ec-support__send svg {
  transform: translateX(0.09375rem);
}

.ec-support__send:disabled { opacity: 0.5; cursor: default; }

@media (max-width: 30rem) {
  .ec-support {
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100dvh;
    border-radius: 0;
  }
}
