/* Sayfa içi canlı destek modal */
:root {
  --qr-lm-vv-gap: 0px;
}

#qr-live-modal-root {
  position: relative;
  z-index: 0;
  pointer-events: none;
}

#qr-live-modal-root .qr-lm-fab,
#qr-live-modal-root .qr-lm-backdrop:not([hidden]) {
  pointer-events: auto;
}

/* [hidden] + display:flex çakışmasını önle (balon stilleri .qr-lm-chat'e de uygulanıyor) */
.qr-lm-backdrop[hidden] {
  display: none !important;
}

.qr-lm-gate[hidden],
.qr-lm-chat[hidden] {
  display: none !important;
}

.qr-lm-gate:not([hidden]) {
  display: block;
}

.qr-lm-chat:not([hidden]) {
  display: flex;
}

.qr-lm-fab {
  position: fixed;
  z-index: 2147483000;
  isolation: isolate;
  right: max(clamp(0.5rem, 3vw, 1.05rem), env(safe-area-inset-right));
  bottom: calc(max(clamp(0.55rem, 2.8vw, 0.95rem), env(safe-area-inset-bottom)) + var(--qr-lm-vv-gap, 0px));
  display: inline-flex;
  align-items: center;
  gap: clamp(0.35rem, 1.8vw, 0.55rem);
  min-height: 3.375rem;
  max-width: min(18rem, calc(100vw - 1rem - env(safe-area-inset-left) - env(safe-area-inset-right)));
  padding: 0 clamp(0.75rem, 3vw, 1.05rem) 0 clamp(0.55rem, 2vw, 0.75rem);
  border: none;
  border-radius: 999px;
  cursor: pointer;
  color: #fff;
  font-family: "Plus Jakarta Sans", system-ui, sans-serif;
  font-size: clamp(0.75rem, 2.9vw, 0.8125rem);
  font-weight: 700;
  letter-spacing: 0.02em;
  background: linear-gradient(135deg, #0d9488 0%, #0ea5e9 100%);
  box-shadow: 0 10px 32px rgba(13, 148, 136, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.12) inset;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-sizing: border-box;
}

/* Sohbet paneli açıkken FAB (author display inline-flex) ile [hidden] bazen çakışıyor */
.qr-lm-fab.qr-lm-fab--during-chat {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.qr-lm-fab__txt {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.qr-lm-fab:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 40px rgba(13, 148, 136, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.18) inset;
}

.qr-lm-fab__ico {
  display: flex;
  width: 2.5rem;
  height: 2.5rem;
  align-items: center;
  justify-content: center;
}

.qr-lm-fab__ico svg {
  display: block;
}

@media (max-width: 380px) {
  .qr-lm-fab__txt {
    display: none;
  }

  .qr-lm-fab {
    width: 3.375rem;
    height: 3.375rem;
    min-height: 3.375rem;
    max-width: none;
    padding: 0;
    justify-content: center;
    border-radius: 50%;
  }
}

.qr-lm-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2147482900;
  background: rgba(15, 23, 42, 0.42);
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  padding: max(0.65rem, env(safe-area-inset-bottom)) max(0.75rem, env(safe-area-inset-right))
    max(0.65rem, env(safe-area-inset-bottom)) max(0.65rem, env(safe-area-inset-left));
  box-sizing: border-box;
}

@media (max-width: 520px) {
  .qr-lm-backdrop {
    align-items: flex-end;
    justify-content: stretch;
    padding: 0;
    padding-bottom: max(0, env(safe-area-inset-bottom));
  }
}

.qr-lm-sheet {
  box-sizing: border-box;
  width: min(400px, 100%);
  max-width: 100%;
  max-height: min(640px, 88vh);
  display: flex;
  flex-direction: column;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 24px 56px rgba(15, 23, 42, 0.22), 0 0 0 1px rgba(255, 255, 255, 0.12) inset;
  overflow: hidden;
  font-family: "Plus Jakarta Sans", system-ui, sans-serif;
}

.qr-lm-hdr {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  flex-shrink: 0;
  padding: 1rem max(0.85rem, env(safe-area-inset-right)) 1rem max(0.85rem, env(safe-area-inset-left));
  background: linear-gradient(120deg, rgba(13, 148, 136, 0.12), rgba(14, 165, 233, 0.1));
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}

.qr-lm-hdr-text {
  min-width: 0;
  flex: 1;
}

.qr-lm-hdr-text strong {
  display: block;
  font-size: 0.97rem;
  color: #0f172a;
}

.qr-lm-hdr-text span {
  display: block;
  font-size: 0.72rem;
  color: #64748b;
  margin-top: 0.2rem;
  line-height: 1.35;
}

.qr-lm-close {
  flex-shrink: 0;
  width: 2.75rem;
  height: 2.75rem;
  min-width: 2.75rem;
  border: none;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.88);
  color: #475569;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
  -webkit-tap-highlight-color: transparent;
}

.qr-lm-close svg {
  display: block;
  pointer-events: none;
}

.qr-lm-close:hover {
  background: #fff;
  color: #0f172a;
}

.qr-lm-body {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.qr-lm-gate {
  padding: 1rem 1rem 1.15rem;
  overflow-y: auto;
}

.qr-lm-gate__hint {
  margin: 0 0 0.85rem;
  font-size: 0.85rem;
  color: #475569;
}

.qr-lm-gate__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  margin-bottom: 0.85rem;
}

@media (max-width: 420px) {
  .qr-lm-gate__grid {
    grid-template-columns: 1fr;
  }
}

.qr-lm-gate__grid label span {
  display: block;
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #94a3b8;
  margin-bottom: 0.2rem;
}

.qr-lm-gate__grid label em {
  color: #dc2626;
  font-style: normal;
}

.qr-lm-gate__grid input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 10px;
  padding: 0.48rem 0.55rem;
  font-size: 0.84rem;
}

@media (max-width: 480px) {
  /* iOS: 16px altı odakta sayfa yakınlaştırmasını tetikler */
  .qr-lm-gate__grid input,
  .qr-lm-ro,
  .qr-lm-foot .qr-sw__form textarea {
    font-size: max(1rem, 16px);
  }

  .qr-lm-sheet {
    width: 100%;
    max-width: 100%;
    max-height: min(92vh, 100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    border-radius: 16px 16px 0 0;
    margin: 0;
  }
}

.qr-lm-gate-btn {
  width: 100%;
  justify-content: center;
}

.qr-lm-gate-err {
  margin: 0.65rem 0 0;
  font-size: 0.78rem;
  color: #dc2626;
}

.qr-lm-chat {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: calc(88vh - 5rem);
}

.qr-lm-chat.is-closed .qr-sw__form textarea,
.qr-lm-chat.is-closed .qr-sw__form .qr-sw__send {
  opacity: 0.55;
  pointer-events: none;
}

.qr-lm-profile {
  flex-shrink: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
  padding: 0.55rem 0.85rem 0.25rem;
  border-bottom: 1px dashed rgba(15, 23, 42, 0.06);
}

@media (max-width: 420px) {
  .qr-lm-profile {
    grid-template-columns: 1fr;
  }
}

.qr-lm-profile label span {
  display: block;
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: uppercase;
  color: #94a3b8;
}

.qr-lm-ro {
  width: 100%;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 8px;
  padding: 0.35rem 0.45rem;
  font-size: 0.78rem;
  background: rgba(248, 250, 252, 0.95);
  color: #64748b;
}

.qr-lm-msgs-wrap {
  flex: 1;
  min-height: 140px;
  overflow: hidden;
}

.qr-lm-msgs {
  max-height: min(280px, 42vh);
  max-height: min(280px, 42dvh);
  overflow-y: auto;
}

.qr-lm-foot {
  flex-shrink: 0;
}

body.qr-lm-noscroll {
  overflow: hidden;
  overflow-x: hidden;
}
