/* Nam — Assistente pré-vendas THE LED */
#cb-widget {
  --cb-brand: #8B2BE2;
  --cb-brand2: #6B1FBD;
  --cb-glass: rgba(255, 255, 255, 0.72);
  --cb-glass-border: rgba(255, 255, 255, 0.45);
  --cb-shadow: 0 12px 40px rgba(0, 0, 0, 0.28);
  position: fixed;
  right: 20px;
  bottom: max(80px, calc(env(safe-area-inset-bottom, 0px) + 64px));
  z-index: 10050;
  font-family: 'Inter', -apple-system, sans-serif;
}

#cb-widget.cb-hidden {
  display: none !important;
}

#cb-fab {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: linear-gradient(135deg, var(--cb-brand) 0%, var(--cb-brand2) 100%);
  color: #fff;
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 0.04em;
  cursor: pointer;
  box-shadow: var(--cb-shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

#cb-fab:hover {
  transform: scale(1.06);
  box-shadow: 0 16px 48px rgba(139, 43, 226, 0.45);
}

#cb-fab.cb-open {
  transform: rotate(0deg);
}

#cb-panel {
  display: none;
  position: absolute;
  right: 0;
  bottom: 68px;
  width: min(380px, calc(100vw - 32px));
  height: min(520px, calc(100vh - 120px));
  flex-direction: column;
  border-radius: 18px;
  overflow: hidden;
  background: var(--cb-glass);
  backdrop-filter: blur(22px) saturate(1.35);
  -webkit-backdrop-filter: blur(22px) saturate(1.35);
  border: 1px solid var(--cb-glass-border);
  box-shadow: var(--cb-shadow), 0 0 0 1px rgba(255, 255, 255, 0.15) inset;
}

#cb-panel.cb-visible {
  display: flex;
  animation: cbSlideUp 0.28s ease;
}

@keyframes cbSlideUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

#cb-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.35);
  border-bottom: 1px solid rgba(255, 255, 255, 0.3);
  flex-shrink: 0;
}

#cb-panel-header .cb-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cb-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

#cb-clear {
  background: none;
  border: none;
  font-size: 18px;
  line-height: 1;
  color: #6B7280;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
}

#cb-clear:hover {
  background: rgba(0, 0, 0, 0.06);
  color: var(--cb-brand);
}

#cb-panel-header .cb-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--cb-brand), var(--cb-brand2));
  color: #fff;
  font-weight: 800;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#cb-panel-header h3 {
  font-size: 14px;
  font-weight: 700;
  color: #1C1D26;
  margin: 0;
}

#cb-panel-header p {
  font-size: 11px;
  color: #6B7280;
  margin: 2px 0 0;
}

#cb-close {
  background: none;
  border: none;
  font-size: 22px;
  line-height: 1;
  color: #6B7280;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
}

#cb-close:hover {
  background: rgba(0, 0, 0, 0.06);
  color: #1C1D26;
}

#cb-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

.cb-msg {
  max-width: 92%;
  padding: 10px 13px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.5;
  word-wrap: break-word;
  white-space: pre-wrap;
}

.cb-msg-user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--cb-brand), var(--cb-brand2));
  color: #fff;
  border-bottom-right-radius: 4px;
}

.cb-msg-bot {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.85);
  color: #1C1D26;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-bottom-left-radius: 4px;
}

.cb-summary {
  background: linear-gradient(135deg, rgba(139, 43, 226, 0.12), rgba(107, 31, 189, 0.08));
  border: 1px solid rgba(139, 43, 226, 0.28);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 10px;
}

.cb-summary-title {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--cb-brand);
  margin-bottom: 8px;
}

.cb-detail {
  font-size: 12px;
  color: #374151;
}

.cb-msg-error {
  align-self: flex-start;
  background: rgba(220, 38, 38, 0.1);
  color: #991b1b;
  border: 1px solid rgba(220, 38, 38, 0.2);
  font-size: 12px;
}

.cb-retry-btn {
  margin-top: 8px;
  padding: 6px 12px;
  border: none;
  border-radius: 8px;
  background: var(--cb-brand);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.cb-retry-btn:hover {
  background: var(--cb-brand2);
}

.cb-action-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.cb-orc-btn {
  flex: 1;
  padding: 9px 10px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #16a34a, #15803d);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.cb-orc-btn:hover {
  filter: brightness(1.05);
}

.cb-etp-btn {
  flex: 1;
  padding: 9px 10px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--cb-brand), var(--cb-brand2));
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.cb-etp-btn:hover {
  filter: brightness(1.05);
}

.cb-typing {
  align-self: flex-start;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 14px;
  font-size: 12px;
  color: #6B7280;
}

.cb-typing span {
  animation: cbDot 1.2s infinite;
  opacity: 0.3;
}

.cb-typing span:nth-child(2) { animation-delay: 0.2s; }
.cb-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes cbDot {
  0%, 60%, 100% { opacity: 0.3; }
  30% { opacity: 1; }
}

#cb-input-area {
  padding: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.25);
  flex-shrink: 0;
}

#cb-input-form {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

#cb-input {
  flex: 1;
  resize: none;
  min-height: 40px;
  max-height: 100px;
  padding: 10px 12px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 12px;
  font-family: inherit;
  font-size: 13px;
  background: rgba(255, 255, 255, 0.9);
  outline: none;
}

#cb-input:focus {
  border-color: var(--cb-brand);
  box-shadow: 0 0 0 2px rgba(139, 43, 226, 0.15);
}

#cb-send {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 12px;
  background: var(--cb-brand);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

#cb-send:hover:not(:disabled) {
  background: var(--cb-brand2);
}

#cb-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

@media (max-width: 480px) {
  #cb-widget {
    right: 12px;
    bottom: max(72px, calc(env(safe-area-inset-bottom, 0px) + 56px));
  }
  #cb-panel {
    width: calc(100vw - 24px);
    height: calc(100vh - 100px);
  }
  .cb-action-btns {
    flex-direction: column;
  }
  .cb-orc-btn,
  .cb-etp-btn {
    width: 100%;
    flex: none;
  }
}
