/* Chat widget — burbuja inferior derecha */
.tc-chat-root {
  --chat-red: #c41e3a;
  --chat-red-dark: #9e1830;
  --chat-bg: #fff;
  --chat-bot: #f3f4f6;
  --chat-user: #ffe8ec;
  --chat-radius: 16px;
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

.tc-chat-bubble {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--chat-red);
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(196, 30, 58, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s;
}

.tc-chat-bubble:hover {
  transform: scale(1.06);
}

.tc-chat-bubble svg {
  width: 28px;
  height: 28px;
  fill: currentColor;
}

.tc-chat-bubble-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #1a1a1a;
  color: #fff;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 8px;
  white-space: nowrap;
  pointer-events: none;
}

.tc-chat-panel {
  position: fixed;
  bottom: 96px;
  right: 24px;
  z-index: 9998;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 520px;
  max-height: calc(100vh - 120px);
  background: var(--chat-bg);
  border-radius: var(--chat-radius);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(12px) scale(0.96);
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
}

.tc-chat-panel.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.tc-chat-header {
  background: var(--chat-red);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.tc-chat-header-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tc-chat-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
}

.tc-chat-header h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.tc-chat-header p {
  margin: 0;
  font-size: 11px;
  opacity: 0.9;
}

.tc-chat-header-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.tc-chat-header-actions button {
  background: transparent;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 4px 8px;
  font-size: 18px;
  line-height: 1;
  border-radius: 4px;
}

.tc-chat-header-actions button:hover {
  background: rgba(255, 255, 255, 0.15);
}

.tc-chat-restart {
  font-size: 20px !important;
  font-weight: 600;
}

.tc-chat-progress {
  padding: 8px 16px;
  background: #fafafa;
  border-bottom: 1px solid #eee;
  font-size: 11px;
  color: #666;
}

.tc-chat-progress-bar {
  height: 3px;
  background: #eee;
  border-radius: 2px;
  margin-top: 4px;
  overflow: hidden;
}

.tc-chat-progress-fill {
  height: 100%;
  background: var(--chat-red);
  border-radius: 2px;
  transition: width 0.3s;
}

.tc-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tc-msg {
  display: flex;
  gap: 8px;
  max-width: 92%;
}

.tc-msg-bot {
  align-self: flex-start;
}

.tc-msg-user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.tc-msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--chat-red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.tc-msg-user .tc-msg-avatar {
  background: #666;
}

.tc-msg-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  background: var(--chat-bot);
  white-space: pre-wrap;
  word-break: break-word;
}

.tc-msg-user .tc-msg-bubble {
  background: var(--chat-user);
}

.tc-chat-actions {
  padding: 12px 16px;
  border-top: 1px solid #eee;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tc-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tc-chip {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid #ddd;
  background: #fff;
  cursor: pointer;
  font-size: 13px;
  transition: border-color 0.15s, background 0.15s;
}

.tc-chip:hover {
  border-color: var(--chat-red);
  background: #fff5f6;
}

.tc-chip-primary {
  background: var(--chat-red);
  color: #fff;
  border-color: var(--chat-red);
}

.tc-chip-primary:hover {
  background: var(--chat-red-dark);
}

.tc-chip-ghost {
  background: transparent;
  border-color: #ddd;
  color: #666;
  font-size: 12px;
}

.tc-chip-ghost:hover {
  border-color: var(--chat-red);
  color: var(--chat-red);
  background: #fff5f6;
}

.tc-shortcut-link {
  text-align: center;
  font-size: 12px;
  color: var(--chat-red);
  cursor: pointer;
  text-decoration: underline;
  padding: 4px;
  border: none;
  background: none;
  width: 100%;
}

.tc-shortcut-link:hover {
  color: var(--chat-red-dark);
}

.tc-chat-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 16px 16px;
}

.tc-chat-form label {
  font-size: 12px;
  font-weight: 600;
  color: #444;
}

.tc-chat-form input {
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
}

.tc-chat-form input:focus {
  outline: none;
  border-color: var(--chat-red);
  box-shadow: 0 0 0 2px rgba(196, 30, 58, 0.15);
}

.tc-chat-form button[type="submit"] {
  margin-top: 4px;
}

.tc-success-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 16px 16px;
}

@media (max-width: 480px) {
  .tc-chat-panel {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
  }

  .tc-chat-bubble {
    bottom: 16px;
    right: 16px;
  }
}
