.gsc-root {
  --gsc-color: #c9a227;
  --gsc-link: #c9a227;
  --gsc-panel: #f7f5f0;
  --gsc-header: #ffffff;
  --gsc-text: #1a2332;
  --gsc-muted: #6b7a8c;
  --gsc-bot: #ebe6dc;
  --gsc-user: #e8f0e9;
  --gsc-line: rgba(255, 255, 255, 0.1);
  --gsc-fab: 60px;
  --gsc-width: 380px;
  --gsc-radius: 22px;
  --gsc-font: 14px;
  --gsc-bottom: 22px;
  --gsc-side: 22px;
  font-family: "Vazirmatn", "IBM Plex Sans", Tahoma, sans-serif;
  position: fixed;
  inset: 0;
  width: 0;
  height: 0;
  overflow: visible;
  z-index: 2147483000;
  pointer-events: none;
  line-height: 1.6;
  text-align: initial;
  letter-spacing: normal;
  text-transform: none;
}

.gsc-root[dir="ltr"] {
  font-family: "IBM Plex Sans", "Vazirmatn", Tahoma, sans-serif;
}

.gsc-root[dir="ltr"] .gsc-panel {
  direction: ltr;
}

.gsc-root[dir="ltr"] .gsc-msg--bot .gsc-bubble {
  border-bottom-right-radius: 16px;
  border-bottom-left-radius: 5px;
}

.gsc-root[dir="ltr"] .gsc-msg--user .gsc-bubble {
  border-bottom-left-radius: 16px;
  border-bottom-right-radius: 5px;
}

.gsc-root *,
.gsc-root *::before,
.gsc-root *::after {
  box-sizing: border-box;
}

.gsc-fab {
  position: fixed;
  bottom: var(--gsc-bottom);
  width: var(--gsc-fab);
  height: var(--gsc-fab);
  min-width: var(--gsc-fab);
  min-height: var(--gsc-fab);
  max-width: var(--gsc-fab);
  max-height: var(--gsc-fab);
  padding: 0 !important;
  border: 0 !important;
  border-radius: 50% !important;
  background: linear-gradient(145deg, var(--gsc-color), #a8841a);
  color: #1a1205;
  cursor: pointer;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.28);
  display: grid;
  place-items: center;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  pointer-events: auto;
  z-index: 2147483001;
  overflow: hidden;
  line-height: 0;
  appearance: none;
  -webkit-appearance: none;
}

.gsc-root[data-position="right"] .gsc-fab { right: var(--gsc-side); left: auto; }
.gsc-root[data-position="left"] .gsc-fab { left: var(--gsc-side); right: auto; }

.gsc-fab:hover { transform: translateY(-2px) scale(1.03); }
.gsc-fab svg { width: 46%; height: 46%; fill: currentColor; }

.gsc-panel {
  position: fixed;
  bottom: calc(var(--gsc-bottom) + var(--gsc-fab) + 14px);
  width: min(var(--gsc-width), calc(100vw - 24px));
  max-width: calc(100vw - 24px);
  height: min(620px, calc(100vh - 120px));
  background: var(--gsc-panel);
  color: var(--gsc-text);
  border: 1px solid var(--gsc-line);
  border-radius: var(--gsc-radius);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  display: none;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  grid-template-columns: minmax(0, 1fr);
  overflow: hidden;
  direction: inherit;
  font-size: var(--gsc-font);
  pointer-events: auto;
  z-index: 2147483002;
  min-width: 0;
}

.gsc-root.is-open .gsc-panel { display: grid; }
.gsc-root[data-position="right"] .gsc-panel { right: var(--gsc-side); left: auto; }
.gsc-root[data-position="left"] .gsc-panel { left: var(--gsc-side); right: auto; }

.gsc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--gsc-line);
  background: var(--gsc-header);
  min-width: 0;
}

.gsc-head > div {
  min-width: 0;
  flex: 1 1 auto;
  overflow-wrap: anywhere;
}

.gsc-head strong {
  display: block;
  font-size: 1.05em;
  overflow-wrap: anywhere;
}

.gsc-head span {
  color: var(--gsc-muted);
  font-size: 0.85em;
}

.gsc-close {
  border: 1px solid var(--gsc-line);
  background: transparent;
  color: var(--gsc-text);
  width: 34px;
  height: 34px;
  min-width: 34px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  flex: 0 0 auto;
}

.gsc-body {
  overflow-x: hidden;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  width: 100%;
  max-width: 100%;
}

.gsc-msg {
  max-width: min(92%, 100%);
  width: fit-content;
  min-width: 0;
  clear: both;
}

/* ربات سمت شروع، کاربر سمت پایان — در RTL کاربر چپ دیده می‌شود */
.gsc-msg--bot {
  align-self: flex-start;
  margin-inline-end: auto;
}

.gsc-msg--user {
  align-self: flex-end;
  margin-inline-start: auto;
}

/* در فارسی/عربی: سؤال کاربر سمت راست بماند تا همیشه مشخص باشد */
.gsc-root[dir="rtl"] .gsc-msg--bot {
  align-self: flex-end;
  margin-inline-start: auto;
  margin-inline-end: 0;
}

.gsc-root[dir="rtl"] .gsc-msg--user {
  align-self: flex-start;
  margin-inline-end: auto;
  margin-inline-start: 0;
}

.gsc-bubble {
  display: block;
  max-width: 100%;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 16px;
  line-height: 1.85;
  font-size: 0.96em;
  color: var(--gsc-text) !important;
  white-space: normal !important;
  overflow-wrap: anywhere !important;
  word-wrap: break-word !important;
  word-break: break-word !important;
  hyphens: auto;
  overflow: visible;
  text-align: justify;
  text-justify: inter-word;
  text-align-last: start;
}

.gsc-bubble-text {
  white-space: pre-wrap;
  text-align: justify;
  text-justify: inter-word;
  text-align-last: start;
  line-height: 1.85;
}

.gsc-bubble a {
  color: var(--gsc-link, var(--gsc-color)) !important;
  text-decoration: underline;
  overflow-wrap: anywhere;
  word-break: break-all;
}

.gsc-msg--bot .gsc-bubble {
  background: var(--gsc-bot) !important;
  border-bottom-right-radius: 5px;
}

.gsc-msg--user .gsc-bubble {
  background: var(--gsc-user) !important;
  border: 1px solid color-mix(in srgb, var(--gsc-color) 45%, transparent);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
  border-bottom-left-radius: 5px;
  text-align: start;
  text-align-last: start;
}

.gsc-msg--user .gsc-bubble-text {
  text-align: start;
}

.gsc-root[dir="rtl"] .gsc-msg--bot .gsc-bubble {
  border-bottom-right-radius: 16px;
  border-bottom-left-radius: 5px;
}

.gsc-root[dir="rtl"] .gsc-msg--user .gsc-bubble {
  border-bottom-left-radius: 16px;
  border-bottom-right-radius: 5px;
}

.gsc-cards {
  display: grid;
  gap: 8px;
  margin-top: 8px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.gsc-page-link-wrap {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid color-mix(in srgb, var(--gsc-line) 80%, transparent);
  width: 100%;
  text-align: start;
}

.gsc-page-link {
  display: inline-block;
  color: var(--gsc-link, var(--gsc-color)) !important;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.gsc-page-link:hover {
  opacity: 0.85;
}

.gsc-card {
  display: block;
  text-decoration: none;
  color: inherit;
  border: 1px solid color-mix(in srgb, var(--gsc-color) 35%, transparent);
  background: color-mix(in srgb, var(--gsc-color) 12%, transparent);
  border-radius: 12px;
  padding: 10px;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.gsc-card strong {
  display: block;
  margin-bottom: 4px;
  font-size: 0.95em;
  overflow-wrap: anywhere;
}

.gsc-card span {
  color: var(--gsc-muted);
  font-size: 0.86em;
  line-height: 1.6;
  white-space: normal !important;
  overflow-wrap: anywhere;
}

.gsc-form {
  display: grid;
  gap: 10px;
  padding: 6px 2px 10px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.gsc-form h3 { margin: 0; font-size: 1.05em; }
.gsc-form p {
  margin: 0;
  color: var(--gsc-muted);
  font-size: 0.9em;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.gsc-form label {
  display: grid;
  gap: 6px;
  font-size: 0.9em;
  color: var(--gsc-muted);
  min-width: 0;
}

.gsc-form input,
.gsc-form textarea {
  width: 100%;
  max-width: 100%;
  border: 1px solid var(--gsc-line);
  background: rgba(0, 0, 0, 0.18);
  color: var(--gsc-text);
  border-radius: 12px;
  padding: 11px 12px;
  font-family: inherit;
  font-size: 1em;
  outline: none;
  min-width: 0;
}

.gsc-root[data-theme="light"] .gsc-form input,
.gsc-root[data-theme="light"] .gsc-form textarea {
  background: rgba(255, 255, 255, 0.8);
}

.gsc-form input:focus {
  border-color: color-mix(in srgb, var(--gsc-color) 70%, white);
}

.gsc-form button,
.gsc-send {
  border: 0;
  border-radius: 12px;
  background: linear-gradient(145deg, var(--gsc-color), color-mix(in srgb, var(--gsc-color) 70%, #000));
  color: #1a1205;
  font-weight: 700;
  font-family: inherit;
  padding: 12px 14px;
  cursor: pointer;
}

.gsc-privacy {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--gsc-line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  min-width: 0;
}

.gsc-privacy__check {
  display: flex !important;
  align-items: flex-start;
  gap: 8px;
  color: var(--gsc-text) !important;
  font-size: 0.92em;
  line-height: 1.6;
}

.gsc-privacy__check input {
  width: auto !important;
  margin-top: 3px;
}

.gsc-privacy__notice {
  margin: 0 !important;
  color: var(--gsc-muted) !important;
  font-size: 0.86em !important;
  line-height: 1.7 !important;
  overflow-wrap: anywhere;
}

.gsc-privacy__notice a {
  color: var(--gsc-color);
  text-decoration: underline;
}

.gsc-error {
  color: #ff7d7d;
  font-size: 0.9em;
  min-height: 18px;
  overflow-wrap: anywhere;
}

.gsc-suggestions-wrap {
  border-top: 1px solid var(--gsc-line);
  padding: 10px 12px 8px;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.gsc-suggestions-wrap small {
  display: block;
  color: var(--gsc-muted);
  margin-bottom: 8px;
  font-size: 0.82em;
}

.gsc-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: 100%;
  min-width: 0;
}

.gsc-suggestions button {
  flex: 1 1 auto;
  max-width: 100%;
  border: 1px solid var(--gsc-line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--gsc-text);
  border-radius: 999px;
  padding: 7px 11px;
  font-family: inherit;
  font-size: 0.86em;
  cursor: pointer;
  white-space: normal !important;
  overflow-wrap: anywhere;
  word-break: break-word;
  text-align: center;
  line-height: 1.45;
}

.gsc-composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 10px 12px 12px;
  border-top: 1px solid var(--gsc-line);
  min-width: 0;
  max-width: 100%;
}

.gsc-composer textarea {
  resize: none;
  min-height: 44px;
  max-height: 110px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  border-radius: 12px;
  border: 1px solid var(--gsc-line);
  background: rgba(0, 0, 0, 0.18);
  color: var(--gsc-text);
  padding: 10px 12px;
  font-family: inherit;
  font-size: 0.96em;
  line-height: 1.6;
  outline: none;
  white-space: pre-wrap !important;
  overflow-wrap: anywhere;
}

.gsc-root[data-theme="light"] .gsc-composer textarea {
  background: rgba(255, 255, 255, 0.85);
}

.gsc-composer textarea:focus {
  border-color: color-mix(in srgb, var(--gsc-color) 70%, white);
}

.gsc-send { min-width: 72px; }
.gsc-send:disabled,
.gsc-form button:disabled { opacity: 0.6; cursor: wait; }

.gsc-typing {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  height: 16px;
}
.gsc-typing i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--gsc-muted);
  animation: gscBlink 1s infinite ease-in-out;
}
.gsc-typing i:nth-child(2) { animation-delay: 0.15s; }
.gsc-typing i:nth-child(3) { animation-delay: 0.3s; }

@keyframes gscBlink {
  0%, 80%, 100% { opacity: 0.25; }
  40% { opacity: 1; }
}

.gsc-hidden { display: none !important; }

@media (max-width: 480px) {
  .gsc-panel {
    bottom: 0;
    width: 100vw;
    max-width: 100vw;
    height: min(100vh, 100dvh);
    border-radius: 18px 18px 0 0;
  }
  .gsc-root[data-position="right"] .gsc-panel,
  .gsc-root[data-position="left"] .gsc-panel {
    right: 0;
    left: 0;
  }
}
