/* ابرسازان — chatbot widget */

.cb-root {
  position: fixed;
  z-index: 9999;
  inset-inline-start: 20px;
  bottom: 20px;
  font-family: var(--font-fa, Vazirmatn, Tahoma, sans-serif);
}

.cb-launcher {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  width: 54px;
  height: 54px;
  padding: 0;
  border: 1px solid var(--gold-border, rgba(201, 162, 39, 0.45));
  background: linear-gradient(135deg, #1a1a1a, #0d0d0d);
  color: var(--gold-light, #e0c35a);
  border-radius: 999px;
  cursor: pointer;
  overflow: hidden;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
  transition:
    width 0.35s ease,
    padding 0.35s ease,
    gap 0.35s ease,
    transform 0.2s ease,
    box-shadow 0.2s ease,
    border-color 0.2s ease;
}

.cb-launcher:hover {
  transform: translateY(-2px);
  border-color: var(--gold, #c9a227);
  box-shadow: 0 14px 32px rgba(201, 162, 39, 0.22);
}

.cb-launcher i {
  font-size: 1.15rem;
  flex-shrink: 0;
  transition: transform 0.35s ease;
}

.cb-launcher-label {
  max-width: 0;
  opacity: 0;
  overflow: hidden;
  white-space: nowrap;
  font-size: 0.9rem;
  font-weight: 600;
  transition:
    max-width 0.35s ease,
    opacity 0.25s ease,
    margin 0.35s ease;
  margin-inline-start: 0;
}

/* Expanded hint while scrolling */
.cb-launcher.is-expanded {
  width: auto;
  padding: 0 16px 0 14px;
  gap: 10px;
}

.cb-launcher.is-expanded i {
  transform: rotate(-20deg) scale(1.05);
}

.cb-launcher.is-expanded .cb-launcher-label {
  max-width: 140px;
  opacity: 1;
  margin-inline-start: 0;
}

.cb-panel {
  position: absolute;
  inset-inline-start: 0;
  bottom: 64px;
  width: min(380px, calc(100vw - 32px));
  height: min(520px, calc(100vh - 120px));
  display: none;
  flex-direction: column;
  background: #121212;
  border: 1px solid var(--border-gold, rgba(201, 162, 39, 0.35));
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}

.cb-panel.is-open {
  display: flex;
}

.cb-panel[hidden] {
  display: none !important;
}

.cb-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 14px 12px;
  background: linear-gradient(180deg, rgba(201, 162, 39, 0.12), transparent);
  border-bottom: 1px solid rgba(201, 162, 39, 0.25);
}

.cb-header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cb-logo {
  width: 36px;
  height: 36px;
  object-fit: contain;
  border-radius: 8px;
}

.cb-header h2 {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 700;
  color: #f5f5f5;
}

.cb-subtitle {
  margin: 2px 0 0;
  font-size: 0.72rem;
  color: #b8b8b8;
}

.cb-close {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: #ddd;
  cursor: pointer;
}

.cb-close:hover {
  background: rgba(255, 255, 255, 0.12);
}

.cb-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background:
    radial-gradient(ellipse 70% 40% at 100% 0%, rgba(201, 162, 39, 0.06), transparent 60%),
    #0f0f0f;
}

.cb-msg {
  max-width: 88%;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 0.88rem;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}

.cb-msg p {
  margin: 0;
}

.cb-msg-bot {
  align-self: flex-start;
  background: #1c1c1c;
  border: 1px solid rgba(201, 162, 39, 0.2);
  color: #ececec;
  border-bottom-right-radius: 4px;
}

.cb-msg-user {
  align-self: flex-end;
  background: linear-gradient(135deg, rgba(201, 162, 39, 0.28), rgba(201, 162, 39, 0.14));
  border: 1px solid rgba(201, 162, 39, 0.4);
  color: #fff8df;
  border-bottom-left-radius: 4px;
}

.cb-msg-error {
  align-self: stretch;
  background: rgba(231, 76, 60, 0.12);
  border: 1px solid rgba(231, 76, 60, 0.35);
  color: #ffb0a8;
  font-size: 0.82rem;
}

.cb-typing {
  align-self: flex-start;
  color: #b8b8b8;
  font-size: 0.8rem;
  padding: 4px 8px;
}

.cb-form {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid rgba(201, 162, 39, 0.22);
  background: #141414;
}

.cb-input {
  flex: 1;
  resize: none;
  min-height: 42px;
  max-height: 110px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(201, 162, 39, 0.28);
  background: #0d0d0d;
  color: #f2f2f2;
  font-family: inherit;
  font-size: 0.88rem;
  line-height: 1.5;
}

.cb-input:focus {
  outline: none;
  border-color: var(--gold, #c9a227);
}

.cb-send {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--gold, #c9a227), #a8861d);
  color: #111;
  cursor: pointer;
  flex-shrink: 0;
}

.cb-send:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.cb-root .sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@media (max-width: 480px) {
  .cb-root {
    inset-inline-start: 12px;
    bottom: 12px;
  }

  .cb-launcher {
    width: 52px;
    height: 52px;
  }

  .cb-launcher.is-expanded {
    padding: 0 14px 0 12px;
  }

  .cb-panel {
    position: fixed;
    inset: auto 12px 76px 12px;
    width: auto;
    height: min(70vh, 560px);
  }
}
