/* Yapay destek asistanı — Faz 1 (SSS tabanlı) */
.app-fab-stack {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 10040;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
}

/* Sipariş / çerçeve düzenleme alt çubuğundaki Kaydet’i örtmesin */
body:has(#view_order_edit:not(.hidden)) .app-fab-stack,
body:has(#edit_line_modal:not(.hidden)) .app-fab-stack {
  bottom: 5.25rem;
}

body:has(#view_order_edit:not(.hidden)) .support-assistant-panel,
body:has(#edit_line_modal:not(.hidden)) .support-assistant-panel {
  bottom: 8.75rem;
}

.app-fab-stack:not(:has(.cookie-prefs-fab:not(.hidden), .support-assistant-fab:not(.hidden))) {
  display: none;
}

.support-assistant-fab {
  position: static;
  right: auto;
  bottom: auto;
  z-index: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 2.75rem;
  padding: 0.45rem 0.95rem 0.45rem 0.7rem;
  border: 1px solid rgba(42, 63, 84, 0.18);
  border-radius: 999px;
  background: linear-gradient(145deg, #2a3f54 0%, #384f6c 100%);
  color: #f8fafc;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.22);
  transition: transform 0.15s, box-shadow 0.15s;
}

.support-assistant-fab:hover,
.support-assistant-fab:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.28);
}

.support-assistant-fab.hidden {
  display: none !important;
}

.support-assistant-fab-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.18), rgba(15, 23, 42, 0.35));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
  overflow: hidden;
  line-height: 0;
}

.support-assistant-orb {
  width: 1.7rem;
  height: 1.7rem;
  display: block;
  pointer-events: none;
  filter: drop-shadow(0 0 6px rgba(56, 189, 248, 0.35));
}

.support-assistant-orb--sm {
  width: 1.35rem;
  height: 1.35rem;
}

.app-sidebar-icon--orb {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

.support-assistant-fab:hover .support-assistant-orb,
.support-assistant-fab:focus-visible .support-assistant-orb {
  filter: drop-shadow(0 0 10px rgba(232, 121, 249, 0.45));
}

.support-assistant-panel {
  position: fixed;
  right: 1rem;
  bottom: 4.25rem;
  z-index: 10045;
  display: flex;
  flex-direction: column;
  width: min(26rem, calc(100vw - 1.5rem));
  max-height: min(42rem, calc(100dvh - 5rem));
  border: 1px solid rgba(42, 63, 84, 0.14);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 16px 48px rgba(15, 23, 42, 0.2);
  overflow: hidden;
}

.support-assistant-panel.hidden {
  display: none !important;
}

.support-assistant-head {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.85rem 0.95rem 0.75rem;
  background: linear-gradient(145deg, #2a3f54 0%, #3f5874 100%);
  color: #f1f5f9;
}

.support-assistant-avatar {
  flex-shrink: 0;
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.16), rgba(15, 23, 42, 0.4));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
  overflow: hidden;
  line-height: 0;
}

.support-assistant-head-text {
  flex: 1;
  min-width: 0;
}

.support-assistant-head-text strong {
  display: block;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.25;
}

.support-assistant-head-text span {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.72rem;
  line-height: 1.35;
  opacity: 0.88;
}

.support-assistant-close {
  flex-shrink: 0;
  width: 1.85rem;
  height: 1.85rem;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
}

.support-assistant-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.support-assistant-messages {
  flex: 1 1 14rem;
  min-height: 12rem;
  max-height: min(24rem, 48dvh);
  overflow-y: auto;
  padding: 0.75rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  background: #f8fafc;
  scroll-behavior: smooth;
}

.support-assistant-msg {
  max-width: 92%;
  padding: 0.55rem 0.7rem;
  border-radius: 12px;
  font-size: 0.8125rem;
  line-height: 1.45;
  white-space: pre-wrap;
}

.support-assistant-msg--bot {
  align-self: flex-start;
  background: #fff;
  border: 1px solid rgba(42, 63, 84, 0.1);
  color: #1e293b;
}

.support-assistant-msg--user {
  align-self: flex-end;
  background: #2a3f54;
  color: #f8fafc;
}

.support-assistant-msg-meta {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.68rem;
  font-weight: 700;
  opacity: 0.75;
}

.support-assistant-chips {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0 0.85rem 0.55rem;
  max-height: 6.5rem;
  overflow-y: auto;
  background: #f8fafc;
}

.support-assistant-chip {
  border: 1px solid rgba(42, 63, 84, 0.16);
  border-radius: 999px;
  background: #fff;
  color: #334155;
  font: inherit;
  font-size: 0.72rem;
  line-height: 1.3;
  padding: 0.3rem 0.55rem;
  cursor: pointer;
}

.support-assistant-chip:hover {
  border-color: #2a3f54;
  color: #2a3f54;
}

.support-assistant-form {
  display: flex;
  gap: 0.45rem;
  padding: 0.65rem 0.75rem;
  border-top: 1px solid rgba(42, 63, 84, 0.1);
  background: #fff;
}

.support-assistant-input {
  flex: 1;
  min-width: 0;
  border: 1px solid rgba(42, 63, 84, 0.18);
  border-radius: 10px;
  padding: 0.45rem 0.6rem;
  font: inherit;
  font-size: 0.8125rem;
}

.support-assistant-send {
  flex-shrink: 0;
  border: none;
  border-radius: 10px;
  background: #2a3f54;
  color: #fff;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 0.45rem 0.75rem;
  cursor: pointer;
}

.support-assistant-send:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.support-assistant-whatsapp {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem 0.75rem;
  padding: 0.55rem 0.75rem;
  border-top: 1px solid rgba(42, 63, 84, 0.08);
  background: #f8fafc;
}

.support-assistant-whatsapp.hidden {
  display: none !important;
}

.support-assistant-whatsapp-text {
  margin: 0;
  font-size: 0.72rem;
  line-height: 1.35;
  color: #475569;
}

.support-assistant-whatsapp-link {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.28rem 0.55rem;
  border-radius: 8px;
  background: #25d366;
  color: #fff !important;
  font-size: 0.72rem;
  font-weight: 650;
  text-decoration: none;
  line-height: 1.2;
}

.support-assistant-whatsapp-link:hover,
.support-assistant-whatsapp-link:focus-visible {
  background: #1ebe57;
  text-decoration: none;
}

.support-assistant-foot {
  padding: 0.45rem 0.75rem 0.65rem;
  font-size: 0.68rem;
  line-height: 1.35;
  color: #64748b;
  background: #fff;
  border-top: 1px solid rgba(42, 63, 84, 0.06);
}

.support-assistant-typing {
  font-size: 0.75rem;
  color: #64748b;
  font-style: italic;
  padding: 0 0.85rem 0.35rem;
  background: #f8fafc;
}

.support-assistant-typing.hidden {
  display: none;
}

.support-assistant-teach {
  flex: 0 0 auto;
  margin: 0;
  padding: 0;
  background: #f1f5f9;
  border-top: 1px solid rgba(42, 63, 84, 0.08);
}

.support-assistant-teach.hidden {
  display: none;
}

.support-assistant-teach > summary {
  list-style: none;
  cursor: pointer;
  padding: 0.65rem 0.75rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: #1e293b;
  user-select: none;
}

.support-assistant-teach > summary::-webkit-details-marker {
  display: none;
}

.support-assistant-teach > summary::after {
  content: "▸";
  float: right;
  opacity: 0.55;
}

.support-assistant-teach[open] > summary::after {
  content: "▾";
}

.support-assistant-teach-body {
  padding: 0 0.75rem 0.75rem;
  max-height: 11rem;
  overflow-y: auto;
}

.support-assistant-teach-title {
  margin: 0 0 0.25rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: #1e293b;
}

.support-assistant-teach-hint {
  margin: 0 0 0.55rem;
  font-size: 0.72rem;
  line-height: 1.35;
  color: #64748b;
}

.support-assistant-teach-field {
  display: block;
  margin-bottom: 0.5rem;
}

.support-assistant-teach-field span {
  display: block;
  font-size: 0.72rem;
  color: #475569;
  margin-bottom: 0.2rem;
}

.support-assistant-teach-field input,
.support-assistant-teach-field textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid rgba(42, 63, 84, 0.15);
  border-radius: 8px;
  padding: 0.45rem 0.55rem;
  font: inherit;
  font-size: 0.82rem;
  background: #fff;
}

.support-assistant-teach-actions {
  margin-top: 0.35rem;
}

.support-assistant-teach-save {
  border: none;
  border-radius: 8px;
  padding: 0.45rem 0.75rem;
  background: #2a3f54;
  color: #fff;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.support-assistant-teach-save:disabled {
  opacity: 0.55;
}

.support-assistant-teach-msg {
  margin: 0.45rem 0 0;
  font-size: 0.72rem;
  color: #166534;
}

.support-assistant-teach-msg.hidden {
  display: none;
}

.support-assistant-msg .support-app-link {
  display: inline;
  margin: 0 0.1rem;
  padding: 0;
  border: none;
  background: none;
  color: #1565c0;
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
}

.support-assistant-msg a {
  color: #1565c0;
  font-weight: 600;
}

.support-assistant-teach-link {
  display: inline-block;
  margin-top: 0.45rem;
  padding: 0;
  border: none;
  background: none;
  color: #2a3f54;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
}

@media (max-width: 720px) {
  .app-fab-stack {
    display: none !important;
  }

  .support-assistant-panel {
    right: 0.65rem;
    left: 0.65rem;
    width: auto;
    bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
  }
}
