/* Qchat site support widget — Intercom-style, liquid glass */

.qsup-root {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 99980;
  font-family: Manrope, system-ui, sans-serif;
  pointer-events: none;
}

.qsup-root * { box-sizing: border-box; }

.qsup-launcher,
.qsup-panel {
  pointer-events: auto;
}

.qsup-launcher {
  position: relative;
  width: 68px;
  height: 68px;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(145deg, rgba(42, 171, 238, 0.35), rgba(15, 28, 42, 0.92));
  box-shadow:
    0 12px 32px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(42, 171, 238, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: box-shadow 0.2s ease, filter 0.2s ease;
  will-change: transform;
}

.qsup-launcher:hover,
.qsup-launcher:focus-visible {
  filter: brightness(1.08);
  box-shadow:
    0 16px 40px rgba(42, 171, 238, 0.28),
    0 0 0 1px rgba(42, 171, 238, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.16);
  outline: none;
}

.qsup-launcher[hidden] {
  display: none !important;
}

.qsup-launcher-pulse {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid rgba(42, 171, 238, 0.45);
  animation: qsup-pulse 2.8s ease-out infinite;
  pointer-events: none;
}

@keyframes qsup-pulse {
  0% { transform: scale(0.92); opacity: 0.7; }
  70% { transform: scale(1.18); opacity: 0; }
  100% { opacity: 0; }
}

.qsup-launcher-figure {
  position: relative;
  width: 52px;
  height: 52px;
}

.qsup-launcher-avatar {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  object-fit: contain;
  object-position: center center;
  display: block;
  /* Match dark glass launcher — no white plate behind transparent PNG */
  background:
    radial-gradient(circle at 42% 32%, rgba(74, 180, 235, 0.28), rgba(11, 22, 36, 0.92) 68%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
  filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.45));
}
.qsup-head-av,
.qsup-msg-av {
  background:
    radial-gradient(circle at 42% 32%, rgba(74, 180, 235, 0.22), rgba(11, 22, 36, 0.95) 70%);
  object-fit: contain;
}

.qsup-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: #E53935;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 10px rgba(229, 57, 53, 0.45);
}
.qsup-badge[hidden] { display: none !important; }

.qsup-panel {
  position: absolute;
  right: 0;
  bottom: 0;
  width: min(380px, calc(100vw - 28px));
  height: min(560px, calc(100dvh - 48px));
  display: flex;
  flex-direction: column;
  border-radius: 22px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(28, 42, 58, 0.92), rgba(12, 18, 28, 0.96));
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow:
    0 24px 64px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(42, 171, 238, 0.12);
  animation: qsup-panel-in 0.28s cubic-bezier(0.2, 0.9, 0.2, 1);
}

.qsup-panel[hidden] { display: none !important; }

@keyframes qsup-panel-in {
  from { opacity: 0; transform: translateY(14px) scale(0.96); }
  to { opacity: 1; transform: none; }
}

.qsup-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 14px 12px;
  background: linear-gradient(180deg, rgba(42, 171, 238, 0.18), transparent);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.qsup-head-who {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.qsup-head-av-wrap {
  position: relative;
  flex-shrink: 0;
}

.qsup-head-av {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 0 2px rgba(42, 171, 238, 0.35);
}

.qsup-online {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #3DDC97;
  box-shadow: 0 0 0 2px #132033;
}
.qsup-online.is-off {
  background: #8A94A0;
}

.qsup-head-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.qsup-head-text strong {
  color: #F2F5F7;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.qsup-head-sub {
  color: rgba(232, 236, 239, 0.62);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.qsup-close {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  color: #E8ECEF;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.qsup-close:hover { background: rgba(255, 255, 255, 0.12); }

.qsup-messages {
  flex: 1;
  overflow: auto;
  padding: 14px 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

.qsup-empty {
  margin: auto;
  color: rgba(232, 236, 239, 0.5);
  font-size: 14px;
  text-align: center;
  padding: 24px;
}

.qsup-msg {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: 92%;
}

.qsup-msg.is-mine {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.qsup-msg.is-support { align-self: flex-start; }

.qsup-msg.is-in {
  animation: qsup-msg-in 0.22s ease-out;
}

@keyframes qsup-msg-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.qsup-msg-av {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.qsup-bubble {
  padding: 10px 12px 6px;
  border-radius: 16px;
  max-width: 100%;
}

.qsup-msg.is-support .qsup-bubble {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom-left-radius: 6px;
}

.qsup-msg.is-mine .qsup-bubble {
  background: linear-gradient(145deg, #2AABEE, #1B8BC4);
  border-bottom-right-radius: 6px;
  color: #fff;
}

.qsup-bubble-text {
  color: #F2F5F7;
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.qsup-reply-quote {
  display: block;
  width: 100%;
  margin: 0 0 8px;
  padding: 6px 8px 6px 10px;
  border: 0;
  border-left: 3px solid rgba(255, 255, 255, 0.55);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.18);
  text-align: left;
  cursor: pointer;
  color: inherit;
  font: inherit;
}
.qsup-msg.is-support .qsup-reply-quote {
  border-left-color: #2AABEE;
  background: rgba(42, 171, 238, 0.12);
}
.qsup-reply-who {
  display: block;
  font-size: 11px;
  font-weight: 700;
  opacity: 0.9;
  margin-bottom: 2px;
}
.qsup-reply-body {
  display: block;
  font-size: 12px;
  line-height: 1.35;
  opacity: 0.78;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.qsup-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  margin-top: 4px;
}

.qsup-time {
  font-size: 10px;
  opacity: 0.55;
  line-height: 1;
}

.qsup-ticks {
  font-size: 11px;
  line-height: 1;
  letter-spacing: -1px;
  opacity: 0.7;
  user-select: none;
}
.qsup-ticks.is-sent { opacity: 0.55; }
.qsup-ticks.is-delivered { opacity: 0.75; }
.qsup-ticks.is-read {
  opacity: 1;
  color: #B8E7FF;
}

.qsup-msg.is-flash .qsup-bubble {
  box-shadow: 0 0 0 2px rgba(42, 171, 238, 0.85);
  transition: box-shadow 0.2s ease;
}

.qsup-typing {
  padding: 0 14px 8px;
  font-size: 12px;
  color: rgba(232, 236, 239, 0.55);
  font-style: italic;
}
.qsup-typing[hidden] { display: none !important; }

.qsup-rate {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px 10px;
}
.qsup-rate[hidden] { display: none !important; }
.qsup-rate-label {
  font-size: 12px;
  color: rgba(232, 236, 239, 0.55);
  margin-right: 4px;
}
.qsup-rate-btn {
  width: 40px;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 16px;
  cursor: pointer;
}
.qsup-rate-btn:hover {
  background: rgba(42, 171, 238, 0.18);
  border-color: rgba(42, 171, 238, 0.4);
}

.qsup-compose {
  padding: 10px 12px 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.18);
}

.qsup-contact {
  margin-bottom: 8px;
}
.qsup-contact-edit {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.qsup-contact-edit[hidden],
.qsup-name-locked[hidden] {
  display: none !important;
}
.qsup-name-locked {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
}
.qsup-name-chip {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
}
.qsup-name-chip-label {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(232, 236, 239, 0.45);
}
.qsup-name-chip-value {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 600;
  color: #E8ECEF;
}
.qsup-name-edit-btn {
  flex-shrink: 0;
  height: 40px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid rgba(42, 171, 238, 0.4);
  background: rgba(42, 171, 238, 0.14);
  color: #7DD3FC;
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
  transition: background 0.15s ease, transform 0.1s ease;
}
.qsup-name-edit-btn:hover,
.qsup-name-edit-btn:focus-visible {
  background: rgba(42, 171, 238, 0.24);
  outline: none;
}
.qsup-name-edit-btn:active {
  transform: scale(0.97);
}

.qsup-name,
.qsup-email,
.qsup-input {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  color: #F2F5F7;
  font: inherit;
  font-size: 14px;
  padding: 10px 12px;
  outline: none;
  resize: none;
}

.qsup-name:focus,
.qsup-email:focus,
.qsup-input:focus {
  border-color: rgba(42, 171, 238, 0.55);
  box-shadow: 0 0 0 3px rgba(42, 171, 238, 0.15);
}

.qsup-form {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.qsup-input {
  flex: 1;
  min-height: 44px;
  max-height: 120px;
  line-height: 1.35;
}

.qsup-send {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 14px;
  background: #2AABEE;
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.12s ease, filter 0.12s ease;
}

.qsup-send:hover { filter: brightness(1.08); }
.qsup-send:active { transform: scale(0.96); }
.qsup-send:disabled { opacity: 0.55; cursor: default; transform: none; }

.qsup-hint {
  margin: 8px 2px 0;
  font-size: 11px;
  color: rgba(232, 236, 239, 0.45);
  line-height: 1.35;
}

.qsup-error {
  align-self: center;
  padding: 8px 12px;
  border-radius: 12px;
  background: rgba(229, 57, 53, 0.18);
  color: #FFB4B0;
  font-size: 13px;
}

@media (max-width: 480px) {
  .qsup-panel {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: max(12px, env(safe-area-inset-bottom));
    width: auto;
    height: min(72dvh, 560px);
    border-radius: 18px;
  }
  .qsup-launcher {
    width: 62px;
    height: 62px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .qsup-launcher-pulse,
  .qsup-panel,
  .qsup-msg.is-in { animation: none !important; }
}
