/* Smart Telegram Chat — front-end widget styles */

.stc-widget {
  --stc-primary: #2aabee;
  --stc-header-text: #ffffff;
  --stc-visitor: #2aabee;
  --stc-admin: #f1f3f6;
  --stc-launcher: 60px;
  --stc-radius: 18px;
  --stc-offset-x: 24px;
  --stc-offset-y: 24px;
  --stc-z: 999999;
  --stc-panel-w: 380px;
  --stc-panel-h: 560px;
  --stc-text: #101828;
  --stc-muted: #667085;
  --stc-surface: #ffffff;
  --stc-border: #e4e7ec;
  position: fixed;
  z-index: var(--stc-z);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  color: var(--stc-text);
}

.stc-widget.stc-dark {
  --stc-surface: #12161c;
  --stc-border: #262d38;
  --stc-text: #e9eef5;
  --stc-muted: #9aa7b8;
  --stc-admin: #1c232d;
}

.stc-widget.stc-pos-bottom-right { right: var(--stc-offset-x); bottom: var(--stc-offset-y); }
.stc-widget.stc-pos-bottom-left  { left: var(--stc-offset-x);  bottom: var(--stc-offset-y); }
.stc-widget.stc-pos-top-right    { right: var(--stc-offset-x); top: var(--stc-offset-y); }
.stc-widget.stc-pos-top-left     { left: var(--stc-offset-x);  top: var(--stc-offset-y); }

.stc-widget *, .stc-widget *::before, .stc-widget *::after { box-sizing: border-box; }

.stc-sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Launcher ------------------------------------------------------------- */
.stc-launcher {
  position: relative;
  width: var(--stc-launcher);
  height: var(--stc-launcher);
  border: 0;
  border-radius: 50%;
  background: var(--stc-primary);
  color: #fff;
  cursor: grab;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(16, 24, 40, .24);
  transition: transform .18s ease, box-shadow .18s ease;
  touch-action: none;
}
.stc-launcher:hover { transform: translateY(-2px) scale(1.03); }
.stc-launcher:active { cursor: grabbing; }
.stc-launcher.stc-dragging { transition: none; }

.stc-launcher-icon {
  width: 55%;
  height: 55%;
  background-color: currentColor;
  -webkit-mask: var(--stc-icon-mask) center / contain no-repeat;
  mask: var(--stc-icon-mask) center / contain no-repeat;
}

.stc-launcher.stc-has-image .stc-launcher-icon {
  background: none;
  -webkit-mask: none;
  mask: none;
  background-image: var(--stc-icon-url);
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

.stc-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: #f04438;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Respect the [hidden] attribute (author display rules would otherwise win). */
#stc-widget [hidden] { display: none !important; }

/* Panel ---------------------------------------------------------------- */
.stc-panel {
  position: absolute;
  width: var(--stc-panel-w);
  max-width: calc(100vw - 32px);
  height: var(--stc-panel-h);
  max-height: calc(100vh - 120px);
  background: var(--stc-surface);
  border: 1px solid var(--stc-border);
  border-radius: var(--stc-radius);
  box-shadow: 0 24px 60px rgba(16, 24, 40, .22);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: stc-pop .22s ease;
}
.stc-pos-bottom-right .stc-panel,
.stc-pos-bottom-left .stc-panel { bottom: calc(var(--stc-launcher) + 14px); }
.stc-pos-top-right .stc-panel,
.stc-pos-top-left .stc-panel { top: calc(var(--stc-launcher) + 14px); }
.stc-pos-bottom-right .stc-panel,
.stc-pos-top-right .stc-panel { right: 0; }
.stc-pos-bottom-left .stc-panel,
.stc-pos-top-left .stc-panel { left: 0; }

@keyframes stc-pop {
  from { opacity: 0; transform: translateY(12px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.stc-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: var(--stc-primary);
  color: var(--stc-header-text);
  flex: 0 0 auto;
}
.stc-header-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.stc-title { font-size: 16px; font-weight: 700; }
.stc-subtitle { font-size: 12px; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stc-close {
  background: rgba(255, 255, 255, .16);
  border: 0;
  color: inherit;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.stc-close:hover { background: rgba(255, 255, 255, .28); }

.stc-messages {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

.stc-msg {
  max-width: 82%;
  padding: 10px 13px;
  border-radius: 14px;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  animation: stc-fade .2s ease;
}
@keyframes stc-fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.stc-msg-visitor {
  align-self: flex-end;
  background: var(--stc-visitor);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.stc-msg-bot, .stc-msg-admin {
  align-self: flex-start;
  background: var(--stc-admin);
  color: var(--stc-text);
  border-bottom-left-radius: 4px;
}
.stc-msg-system {
  align-self: center;
  background: transparent;
  color: var(--stc-muted);
  font-size: 12px;
  text-align: center;
  max-width: 100%;
}
.stc-meta { display: block; margin-top: 5px; font-size: 10px; opacity: .6; }

.stc-typing {
  padding: 0 16px 8px;
  display: flex;
  gap: 4px;
}
.stc-typing span {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--stc-muted);
  animation: stc-blink 1.2s infinite ease-in-out;
}
.stc-typing span:nth-child(2) { animation-delay: .18s; }
.stc-typing span:nth-child(3) { animation-delay: .36s; }
@keyframes stc-blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

.stc-form {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--stc-border);
  background: var(--stc-surface);
}
.stc-input {
  flex: 1;
  resize: none;
  border: 1px solid var(--stc-border);
  border-radius: 12px;
  padding: 10px 12px;
  font: inherit;
  color: var(--stc-text);
  background: transparent;
  max-height: 120px;
  outline: none;
}
.stc-input:focus { border-color: var(--stc-primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--stc-primary) 22%, transparent); }
.stc-send {
  flex: 0 0 auto;
  width: 42px; height: 42px;
  border: 0; border-radius: 50%;
  background: var(--stc-primary);
  color: #fff;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.stc-send:disabled { opacity: .5; cursor: not-allowed; }

.stc-hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; opacity: 0; }

.stc-footer {
  padding: 0 12px 10px;
  font-size: 11px;
  color: var(--stc-muted);
  text-align: center;
}
.stc-footer:empty { display: none; }

.stc-email {
  display: flex;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--stc-border);
  background: var(--stc-surface);
}
.stc-email input { flex: 1; border: 1px solid var(--stc-border); border-radius: 10px; padding: 9px 11px; font: inherit; background: transparent; color: var(--stc-text); }
.stc-email button { border: 0; border-radius: 10px; padding: 9px 14px; font: inherit; cursor: pointer; }
.stc-email .stc-email-save { background: var(--stc-primary); color: #fff; }
.stc-email .stc-email-skip { background: transparent; color: var(--stc-muted); }

.stc-turnstile { padding: 10px 14px 0; }

.stc-notice {
  margin: 10px 14px 0;
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 12px;
  background: #fef3f2;
  color: #b42318;
}
.stc-notice.stc-ok { background: #ecfdf3; color: #027a48; }

@media (max-width: 480px) {
  .stc-panel {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }
}
