/* HizmetPazaryeri destek asistanı — açık, sakin ve mobil öncelikli arayüz */
.sw-root,
.sw-root * {
  box-sizing: border-box;
}

.sw-root {
  --sw-primary: #2563eb;
  --sw-primary-strong: #1d4ed8;
  --sw-primary-soft: #eff6ff;
  --sw-surface: #ffffff;
  --sw-canvas: #f8fafc;
  --sw-text: #172033;
  --sw-muted: #667085;
  --sw-line: #e4e7ec;
  --sw-success: #16a36a;
  --sw-danger: #c4324b;
  --sw-shadow: 0 24px 70px rgba(15, 23, 42, .18), 0 4px 18px rgba(15, 23, 42, .08);
  position: fixed;
  right: 22px;
  bottom: max(22px, env(safe-area-inset-bottom));
  z-index: 9998;
  color: var(--sw-text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.45;
  isolation: isolate;
}

.sw-root button,
.sw-root textarea,
.sw-root a {
  font: inherit;
}

.sw-root button,
.sw-root a {
  -webkit-tap-highlight-color: transparent;
}

.sw-panel {
  position: absolute;
  right: 0;
  bottom: 72px;
  display: flex;
  width: min(440px, calc(100vw - 28px));
  height: auto;
  max-height: min(700px, calc(100dvh - 100px));
  min-height: 0;
  overflow: hidden;
  flex-direction: column;
  border: 1px solid rgba(15, 23, 42, .09);
  border-radius: 28px;
  background: var(--sw-surface);
  box-shadow: var(--sw-shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(18px) scale(.975);
  transform-origin: right bottom;
  transition: opacity .2s ease, transform .2s ease, visibility .2s ease;
  pointer-events: none;
}

.sw-root.open .sw-panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.sw-head {
  position: relative;
  flex: 0 0 auto;
  min-height: 102px;
  padding: 14px 16px 18px;
  border-bottom: 1px solid var(--sw-line);
  background:
    radial-gradient(circle at 15% 10%, rgba(37, 99, 235, .08), transparent 38%),
    linear-gradient(180deg, #fcfdff 0%, #f7f8fb 100%);
}

.sw-brand {
  position: absolute;
  left: 50%;
  top: 46px;
  z-index: 1;
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 15px;
  background: linear-gradient(145deg, #15203a, #30446e);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: -.02em;
  box-shadow: 0 7px 16px rgba(15, 23, 42, .2);
  transform: translateX(-118px);
}

.sw-brand::after {
  position: absolute;
  right: -3px;
  top: -3px;
  width: 11px;
  height: 11px;
  border: 2px solid #fff;
  border-radius: 999px;
  background: #22c783;
  content: "";
}

.sw-brand.sw-brand-image {
  overflow: hidden;
  background: #14264b;
}

.sw-brand.sw-brand-image::after {
  display: none;
}

.sw-brand img,
.sw-avatar img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sw-head-copy {
  position: absolute;
  left: 50%;
  top: 42px;
  display: flex;
  min-width: 244px;
  min-height: 52px;
  flex-direction: column;
  justify-content: center;
  padding: 7px 18px 7px 58px;
  border: 1px solid rgba(15, 23, 42, .07);
  border-radius: 19px;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 9px 24px rgba(15, 23, 42, .12);
  transform: translateX(-50%);
}

.sw-head-copy strong {
  overflow: hidden;
  color: var(--sw-text);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sw-head-copy small {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  color: var(--sw-muted);
  font-size: 11px;
  white-space: nowrap;
}

.sw-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: #22c783;
  box-shadow: 0 0 0 3px rgba(34, 199, 131, .13);
}

.sw-head-actions {
  position: absolute;
  right: 14px;
  top: 14px;
  z-index: 3;
  display: flex;
  gap: 5px;
}

.sw-icon-btn {
  display: grid;
  width: 32px;
  height: 32px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: rgba(15, 23, 42, .055);
  color: #344054;
  cursor: pointer;
  font-size: 16px;
  transition: background .16s ease, color .16s ease, transform .16s ease;
}

.sw-icon-btn:hover {
  background: #e8ecf3;
  color: #101828;
  transform: translateY(-1px);
}

.sw-icon-btn:focus-visible,
.sw-btn:focus-visible,
.sw-ask:focus-within,
.sw-category:focus-visible,
.sw-topic-card:focus-visible,
.sw-suggestion:focus-visible,
.sw-action:focus-visible,
.sw-cta:focus-visible,
.sw-link:focus-visible,
.sw-feedback button:focus-visible {
  outline: 3px solid rgba(37, 99, 235, .25);
  outline-offset: 2px;
}

.sw-body {
  display: flex;
  min-height: 0;
  flex: 0 1 auto;
  flex-direction: column;
  background: var(--sw-surface);
}

.sw-chat {
  display: flex;
  min-height: clamp(260px, 36dvh, 300px);
  flex: 1 1 auto;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 22px 16px 12px;
  overscroll-behavior: contain;
  scrollbar-color: #cbd5e1 transparent;
  scrollbar-width: thin;
  scroll-behavior: smooth;
}

.sw-chat > .sw-message:first-child {
  margin-top: auto;
}

.sw-chat::-webkit-scrollbar,
.sw-topic-list::-webkit-scrollbar,
.sw-categories::-webkit-scrollbar {
  width: 6px;
  height: 5px;
}

.sw-chat::-webkit-scrollbar-thumb,
.sw-topic-list::-webkit-scrollbar-thumb,
.sw-categories::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: #cbd5e1;
}

.sw-chat > .sw-message:last-child {
  margin-bottom: 0;
}

.sw-message {
  display: flex;
  flex: 0 0 auto;
  align-items: flex-end;
  gap: 9px;
  margin: 0 0 16px;
  animation: sw-message-in .2s ease both;
}

.sw-message-user {
  justify-content: flex-end;
}

.sw-avatar {
  display: grid;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  overflow: hidden;
  place-items: center;
  border-radius: 11px;
  background: linear-gradient(145deg, #273756, #1b2740);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  box-shadow: 0 4px 10px rgba(15, 23, 42, .14);
}

.sw-bubble {
  max-width: min(88%, 340px);
  padding: 11px 13px;
  border: 1px solid var(--sw-line);
  border-radius: 18px 18px 18px 5px;
  background: #f7f8fb;
  color: #283548;
  font-size: 13px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.sw-message-user .sw-bubble {
  border-color: var(--sw-primary);
  border-radius: 18px 18px 5px 18px;
  background: var(--sw-primary);
  color: #fff;
  box-shadow: 0 5px 14px rgba(37, 99, 235, .15);
}

.sw-message-warning .sw-bubble {
  border-color: #fed7aa;
  background: #fff7ed;
  color: #9a3412;
}

.sw-actions {
  margin-top: 10px;
}

.sw-action {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 34px;
  padding: 7px 11px;
  border: 1px solid #bfd3ff;
  border-radius: 11px;
  background: #fff;
  color: var(--sw-primary-strong);
  font-size: 12px;
  font-weight: 750;
  text-decoration: none;
}

.sw-action:hover {
  border-color: #8fb0ff;
  background: var(--sw-primary-soft);
}

.sw-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

.sw-suggestion {
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid #d8dee9;
  border-radius: 999px;
  background: #fff;
  color: #344054;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  transition: border-color .15s ease, background .15s ease, color .15s ease;
}

.sw-suggestion:hover {
  border-color: #a7c0fc;
  background: var(--sw-primary-soft);
  color: var(--sw-primary-strong);
}

.sw-feedback {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  color: #98a2b3;
  font-size: 10px;
}

.sw-feedback button {
  display: grid;
  width: 27px;
  height: 27px;
  padding: 0;
  place-items: center;
  border: 1px solid #e4e7ec;
  border-radius: 9px;
  background: #fff;
  cursor: pointer;
  transition: background .15s ease, transform .15s ease;
}

.sw-feedback button:hover {
  background: #f2f4f7;
  transform: translateY(-1px);
}

.sw-time {
  display: block;
  margin-top: 6px;
  color: #98a2b3;
  font-size: 9px;
}

.sw-message-user .sw-time {
  color: rgba(255, 255, 255, .75);
  text-align: right;
}

.sw-explorer {
  flex: 0 0 auto;
  margin: 0 14px 10px;
  padding: 12px;
  border: 1px solid var(--sw-line);
  border-radius: 18px;
  background: var(--sw-canvas);
}

.sw-explorer[hidden] {
  display: none !important;
}

.sw-root.topics-open .sw-chat {
  display: none;
}

.sw-root.topics-open .sw-explorer {
  display: flex;
  min-height: 0;
  flex-direction: column;
  margin-top: 14px;
}

.sw-root.topics-open .sw-topic-list {
  max-height: none;
  flex: 1 1 auto;
  align-content: start;
}

.sw-explorer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 9px;
}

.sw-explorer-head strong {
  font-size: 12px;
  font-weight: 800;
}

.sw-explorer-head span {
  color: #98a2b3;
  font-size: 10px;
}

.sw-categories {
  display: flex;
  overflow-x: auto;
  gap: 6px;
  padding: 1px 1px 7px;
  scrollbar-width: none;
}

.sw-categories::-webkit-scrollbar {
  display: none;
}

.sw-category {
  flex: 0 0 auto;
  min-height: 31px;
  padding: 5px 10px;
  border: 1px solid #d9dee7;
  border-radius: 999px;
  background: #fff;
  color: #475467;
  cursor: pointer;
  font-size: 10px;
  font-weight: 750;
  white-space: nowrap;
}

.sw-category:hover,
.sw-category.active {
  border-color: var(--sw-primary);
  background: var(--sw-primary-soft);
  color: var(--sw-primary-strong);
}

.sw-topic-list {
  display: grid;
  max-height: 102px;
  overflow-y: auto;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  padding: 1px;
}

.sw-topic-card {
  display: flex;
  min-width: 0;
  min-height: 42px;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
  padding: 8px 9px;
  border: 1px solid #e3e7ee;
  border-radius: 12px;
  background: #fff;
  color: #344054;
  cursor: pointer;
  text-align: left;
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}

.sw-topic-card:hover {
  border-color: #b9ccfa;
  box-shadow: 0 4px 10px rgba(15, 23, 42, .06);
  transform: translateY(-1px);
}

.sw-topic-card strong {
  overflow: hidden;
  font-size: 10px;
  line-height: 1.3;
  text-overflow: ellipsis;
}

.sw-topic-card span {
  flex: 0 0 auto;
  color: var(--sw-primary);
  font-size: 13px;
}

.sw-typing {
  display: none;
  flex: 0 0 auto;
  align-items: center;
  gap: 4px;
  margin: 0 20px 8px;
  color: #98a2b3;
  font-size: 10px;
}

.sw-typing.show {
  display: flex;
}

.sw-typing > span {
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: #98a2b3;
  animation: sw-pulse 1s infinite ease-in-out;
}

.sw-typing > span:nth-child(2) { animation-delay: .12s; }
.sw-typing > span:nth-child(3) { animation-delay: .24s; }
.sw-typing em { margin-left: 4px; font-style: normal; }

.sw-ask {
  display: flex;
  min-height: 52px;
  flex: 0 0 auto;
  align-items: flex-end;
  gap: 8px;
  margin: 0 14px 10px;
  padding: 6px 7px 6px 13px;
  border: 1px solid #cdd5df;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 3px 10px rgba(15, 23, 42, .04);
  transition: border-color .16s ease, box-shadow .16s ease;
}

.sw-ask:focus-within {
  border-color: var(--sw-primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, .09);
  outline: 0;
}

.sw-ask textarea {
  min-width: 0;
  min-height: 38px;
  max-height: 104px;
  flex: 1 1 auto;
  resize: none;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--sw-text);
  font-size: 13px;
  line-height: 1.4;
  padding: 10px 0 7px;
}

.sw-ask textarea::placeholder {
  color: #98a2b3;
}

.sw-ask-meta {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
}

.sw-ask-meta > span {
  color: #98a2b3;
  font-size: 9px;
}

.sw-ask-meta button {
  display: grid;
  width: 39px;
  height: 39px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 13px;
  background: var(--sw-primary);
  color: #fff;
  cursor: pointer;
  font-size: 20px;
  font-weight: 800;
  box-shadow: 0 5px 12px rgba(37, 99, 235, .2);
  transition: background .15s ease, transform .15s ease;
}

.sw-ask-meta button:hover {
  background: var(--sw-primary-strong);
  transform: translateY(-1px);
}

.sw-ask-meta button:disabled {
  cursor: wait;
  opacity: .62;
}

.sw-human {
  display: grid;
  flex: 0 0 auto;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 12px;
  margin: 0 14px 10px;
  padding: 11px 12px;
  border: 1px solid var(--sw-line);
  border-radius: 16px;
  background: #fafbfc;
}

.sw-human > div {
  min-width: 0;
}

.sw-human strong,
.sw-human span {
  display: block;
}

.sw-human strong {
  margin-bottom: 2px;
  font-size: 11px;
}

.sw-human span {
  color: var(--sw-muted);
  font-size: 9px;
  line-height: 1.35;
}

.sw-cta {
  display: inline-flex;
  min-height: 35px;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 7px 11px;
  border-radius: 11px;
  background: var(--sw-primary);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.sw-cta:hover {
  background: var(--sw-primary-strong);
}

.sw-link {
  grid-column: 1 / -1;
  color: var(--sw-primary-strong);
  font-size: 9px;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
}

.sw-link:hover {
  text-decoration: underline;
}

.sw-foot {
  display: flex;
  min-height: 42px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 15px;
  border-top: 1px solid var(--sw-line);
  background: #fbfcfd;
}

.sw-foot small {
  color: #7a8699;
  font-size: 9px;
  line-height: 1.35;
}

.sw-foot button {
  padding: 3px 0;
  border: 0;
  background: transparent;
  color: var(--sw-primary);
  cursor: pointer;
  font-size: 9px;
  font-weight: 700;
}

.sw-btn {
  position: relative;
  display: grid;
  width: 58px;
  height: 58px;
  margin-left: auto;
  place-items: center;
  border: 0;
  border-radius: 20px;
  background: linear-gradient(145deg, #2f6ff2, #1f57d6);
  color: #fff;
  cursor: pointer;
  font-size: 0;
  box-shadow: 0 14px 30px rgba(37, 99, 235, .3);
  transition: transform .18s ease, box-shadow .18s ease, border-radius .18s ease;
}

.sw-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 17px 34px rgba(37, 99, 235, .35);
}

.sw-root.open .sw-btn {
  border-radius: 999px;
  background: #344054;
  box-shadow: 0 10px 24px rgba(15, 23, 42, .2);
}

.sw-icon-chat,
.sw-icon-close {
  display: grid;
  place-items: center;
  font-size: 0;
}

.sw-icon-chat::before {
  width: 24px;
  height: 20px;
  border: 2px solid currentColor;
  border-radius: 8px;
  content: "";
}

.sw-icon-chat::after {
  position: absolute;
  width: 7px;
  height: 7px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  content: "";
  transform: translate(-6px, 8px) rotate(28deg);
}

.sw-icon-close {
  display: none;
  font-size: 20px;
}

.sw-root.open .sw-icon-chat { display: none; }
.sw-root.open .sw-icon-close { display: grid; }

.sw-unread {
  position: absolute;
  right: -5px;
  top: -6px;
  display: grid;
  min-width: 22px;
  height: 22px;
  padding: 0 5px;
  place-items: center;
  border: 2px solid #fff;
  border-radius: 999px;
  background: #e5484d;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
}

.sw-unread[hidden] {
  display: none;
}

.sw-root .sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
}

@keyframes sw-message-in {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes sw-pulse {
  0%, 60%, 100% { opacity: .35; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-2px); }
}

@media (max-width: 640px) {
  .sw-root {
    right: 10px;
    bottom: max(10px, env(safe-area-inset-bottom));
  }

  .sw-panel {
    position: fixed;
    inset: auto 8px max(78px, calc(env(safe-area-inset-bottom) + 68px)) 8px;
    width: auto;
    height: auto;
    max-height: calc(100dvh - 86px - env(safe-area-inset-bottom));
    min-height: 0;
    border-radius: 25px;
    transform-origin: right bottom;
  }

  .sw-head {
    min-height: 88px;
  }

  .sw-head-copy {
    top: 33px;
    min-width: min(244px, calc(100vw - 120px));
  }

  .sw-brand {
    top: 37px;
    transform: translateX(calc(-50% - 96px));
  }

  .sw-chat {
    padding: 18px 14px 8px;
  }

  .sw-bubble {
    max-width: calc(100% - 39px);
    font-size: 13px;
  }

  .sw-message-user .sw-bubble {
    max-width: 90%;
  }

  .sw-category,
  .sw-topic-card strong {
    font-size: 11px;
  }

  .sw-ask-meta > span,
  .sw-human span,
  .sw-link,
  .sw-foot small,
  .sw-foot button {
    font-size: 10px;
  }

  .sw-human strong,
  .sw-cta {
    font-size: 11px;
  }

  .sw-topic-list {
    max-height: 92px;
  }

  .sw-human {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 10px 8px;
    padding: 7px 8px;
  }

  .sw-human > div {
    display: none;
  }

  .sw-human .sw-cta {
    min-width: 0;
    min-height: 38px;
    flex: 1 1 auto;
  }

  .sw-human .sw-link {
    display: inline-flex;
    min-height: 38px;
    flex: 0 0 auto;
    align-items: center;
    padding: 6px 5px;
    white-space: nowrap;
  }

  .sw-ask {
    margin: 0 10px 8px;
  }

  .sw-foot {
    min-height: 38px;
    padding: 7px 12px;
  }

  .sw-btn {
    width: 56px;
    height: 56px;
    border-radius: 19px;
  }
}

@media (max-width: 390px) {
  .sw-head-copy {
    min-width: 218px;
    padding-left: 53px;
  }

  .sw-brand {
    width: 40px;
    height: 40px;
    top: 45px;
    transform: translateX(calc(-50% - 85px));
  }

  .sw-head-copy strong { font-size: 12px; }
  .sw-head-copy small { font-size: 10px; }
  .sw-topic-list { grid-template-columns: 1fr; }
  .sw-topic-card:nth-child(n + 4) { display: none; }
  .sw-human { gap: 5px; }
  .sw-human .sw-cta { padding-inline: 8px; }
  .sw-human .sw-link { padding-inline: 3px; font-size: 9px; }
}

@media (max-height: 620px) and (max-width: 640px) {
  .sw-head { min-height: 82px; }
  .sw-head-copy { top: 31px; }
  .sw-brand { top: 35px; }
  .sw-explorer { display: none; }
  .sw-human { padding: 8px 10px; }
  .sw-link { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .sw-panel,
  .sw-btn,
  .sw-message,
  .sw-topic-card,
  .sw-icon-btn,
  .sw-typing > span {
    animation: none !important;
    scroll-behavior: auto !important;
    transition: none !important;
  }
}

@media print {
  .sw-root { display: none !important; }
}
