@import url("https://fonts.googleapis.com/css2?family=Golos+Text:wght@400;500;600;700&display=swap");

:root {
  --jc-primary: #cc3340;
  --jc-primary-deep: #b32632;
  --jc-secondary: #0079c2;
  --jc-dark: #26262f;
  --jc-grey: #66656f;
  --jc-bg: #f4f4f7;
  --jc-panel: #ffffff;
  --jc-soft: #f9fafc;
  --jc-border: #e1e2e9;
  --jc-success: #14b86a;
  --jc-shadow: 0 24px 56px rgba(38, 38, 47, 0.2);
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

#jc-widget-root {
  position: fixed;
  right: 20px;
  bottom: 20px;
  font-family: "Golos Text", "Segoe UI", Tahoma, sans-serif;
  z-index: 10000;
}

#jc-widget-root.jc-iframe-mode {
  position: static;
  width: 100%;
  height: 100%;
  right: auto;
  bottom: auto;
}

#jc-widget-root.jc-iframe-mode .jc-fab {
  display: none;
}

.jc-logo-mark {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.jc-fab {
  width: 68px;
  height: 68px;
  border: 1px solid var(--jc-border);
  border-radius: 999px;
  cursor: pointer;
  background: #fff;
  position: relative;
  box-shadow: 0 14px 34px rgba(38, 38, 47, 0.2);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.jc-fab-core {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  border-radius: inherit;
  background: linear-gradient(145deg, #ffffff 0%, #f5f7fb 100%);
}

.jc-fab .jc-logo-mark {
  width: 32px;
  height: 32px;
}

.jc-fab:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 42px rgba(38, 38, 47, 0.24);
}

.jc-fab.hide {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.92);
}

.jc-fab-ring {
  position: absolute;
  inset: -4px;
  border-radius: 999px;
  border: 2px solid rgba(204, 51, 64, 0.24);
  pointer-events: none;
  animation: jcPulse 2s ease-out infinite;
}

@keyframes jcPulse {
  from {
    transform: scale(1);
    opacity: 1;
  }

  to {
    transform: scale(1.12);
    opacity: 0;
  }
}

.jc-panel {
  width: min(430px, calc(100vw - 24px));
  height: min(720px, calc(100vh - 24px));
  background: var(--jc-panel);
  border: 1px solid var(--jc-border);
  border-radius: 22px;
  overflow: hidden;
  display: none;
  flex-direction: column;
  box-shadow: var(--jc-shadow);
  transform-origin: right bottom;
  position: relative;
  animation: jcReveal 220ms ease-out;
}

.jc-panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--jc-primary) 0%, #f59128 48%, var(--jc-secondary) 100%);
  z-index: 2;
}

.jc-panel.open {
  display: flex;
}

#jc-widget-root.jc-iframe-mode .jc-panel {
  display: flex;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  animation: none;
}

@keyframes jcReveal {
  from {
    transform: scale(0.96) translateY(12px);
    opacity: 0;
  }

  to {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

.jc-header {
  background: #fff;
  border-bottom: 1px solid var(--jc-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px;
  margin-top: 3px;
}

.jc-head-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.jc-badge {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--jc-border);
  background: #fff;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.jc-badge .jc-logo-mark {
  width: 22px;
  height: 22px;
}

.jc-title-wrap {
  min-width: 0;
}

.jc-logo-text {
  width: 160px;
  max-width: 100%;
  height: auto;
  display: block;
}

.jc-title {
  display: none;
}

.jc-sub {
  margin-top: 3px;
  color: var(--jc-grey);
  font-size: 12px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.jc-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--jc-success);
  box-shadow: 0 0 0 5px rgba(20, 184, 106, 0.14);
}

.jc-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.jc-ghost,
.jc-icon {
  border: 1px solid var(--jc-border);
  color: var(--jc-dark);
  background: #fff;
  cursor: pointer;
}

.jc-ghost {
  border-radius: 999px;
  padding: 7px 11px;
  font-size: 12px;
  font-weight: 600;
}

.jc-ghost:hover,
.jc-icon:hover {
  border-color: #d4d7e0;
  background: #f8f9fc;
}

.jc-icon {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  font-size: 14px;
}

.jc-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 14px 6px;
  background: radial-gradient(circle at 12% 0, #ffffff 0%, transparent 34%), var(--jc-bg);
}

.jc-row {
  display: flex;
  gap: 8px;
  margin: 10px 0;
  align-items: flex-end;
}

.jc-row.user {
  justify-content: flex-end;
}

.jc-avatar {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.jc-avatar.bot {
  background: #fff;
  border: 1px solid var(--jc-border);
}

.jc-avatar.bot .jc-logo-mark {
  width: 18px;
  height: 18px;
}

.jc-avatar.user {
  display: none;
}

.jc-bubble-wrap {
  max-width: min(78%, 330px);
}

.jc-msg {
  border-radius: 16px;
  padding: 10px 12px;
  line-height: 1.5;
  font-size: 14px;
  border: 1px solid transparent;
  word-wrap: break-word;
}

.jc-msg p {
  margin: 0;
}

.jc-msg p + p {
  margin-top: 8px;
}

.jc-msg ul {
  margin: 6px 0 0;
  padding-left: 18px;
}

.jc-msg li + li {
  margin-top: 4px;
}

.jc-msg.bot {
  color: var(--jc-dark);
  background: #fff;
  border-color: var(--jc-border);
}

.jc-msg.bot.operator {
  border-color: #9ec8e5;
  background: #f6fbff;
}

.jc-msg.user {
  color: #fff;
  background: linear-gradient(155deg, var(--jc-primary), var(--jc-primary-deep));
  box-shadow: 0 9px 22px rgba(179, 38, 50, 0.28);
}

.jc-msg strong {
  font-weight: 700;
}

.jc-msg.typing {
  color: var(--jc-grey);
}

.jc-typing {
  display: inline-flex;
  gap: 4px;
  margin-right: 6px;
  vertical-align: middle;
}

.jc-typing i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #93a0b3;
  animation: jcDot 1.2s infinite ease-in-out;
}

.jc-typing i:nth-child(2) {
  animation-delay: 0.2s;
}

.jc-typing i:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes jcDot {
  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: 0.4;
  }

  40% {
    transform: translateY(-3px);
    opacity: 1;
  }
}

.jc-meta {
  margin-top: 4px;
  font-size: 11px;
  color: #8b8b96;
}

.jc-row.user .jc-meta {
  text-align: right;
}

.jc-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 8px 12px 10px;
  background: #fff;
  border-top: 1px solid var(--jc-border);
}

.jc-chips.used {
  display: none;
}

.jc-chip {
  border: 1px solid #d6dbe6;
  background: #fff;
  color: var(--jc-dark);
  border-radius: 999px;
  font-size: 12px;
  padding: 7px 11px;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 150ms ease, color 150ms ease, background-color 150ms ease;
}

.jc-chip:hover {
  border-color: var(--jc-primary);
  color: var(--jc-primary);
  background: #fff5f6;
}

.jc-foot {
  background: #fff;
  border-top: 1px solid var(--jc-border);
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px;
}

.jc-foot textarea {
  flex: 1;
  resize: none;
  min-height: 44px;
  max-height: 136px;
  border: 1px solid var(--jc-border);
  border-radius: 14px;
  padding: 10px 12px;
  line-height: 1.45;
  font-size: 14px;
  color: var(--jc-dark);
  background: var(--jc-soft);
  outline: none;
}

.jc-foot textarea:focus {
  border-color: #d6a7ac;
  box-shadow: 0 0 0 3px rgba(204, 51, 64, 0.14);
  background: #fff;
}

.jc-send {
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 14px;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  background: linear-gradient(155deg, var(--jc-primary), var(--jc-primary-deep));
  box-shadow: 0 10px 24px rgba(179, 38, 50, 0.3);
}

.jc-send:disabled {
  opacity: 0.55;
  cursor: default;
}

@media (max-width: 560px) {
  #jc-widget-root {
    right: 10px;
    bottom: 10px;
  }

  .jc-panel {
    width: calc(100vw - 20px);
    height: calc(100vh - 20px);
    border-radius: 18px;
  }

  .jc-logo-text {
    width: 138px;
  }

  .jc-ghost {
    display: none;
  }
}
