#mozar-chat-widget,
#mozar-chat-widget * {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

#mozar-chat-widget {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 999999;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  pointer-events: none;
}

#mozar-chat-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, #9333ea 0%, #a855f7 100%);
  box-shadow: 0 8px 24px rgba(147, 51, 234, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  pointer-events: auto;
  z-index: 2;
}

#mozar-chat-toggle:hover {
  transform: scale(1.08);
  box-shadow: 0 12px 30px rgba(147, 51, 234, 0.65);
}

#mozar-chat-toggle svg {
  width: 30px;
  height: 30px;
  fill: #fff;
}

#mozar-chat-toggle .mozar-chat-close-icon { display: none; }
#mozar-chat-toggle.mozar-chat-open .mozar-chat-close-icon { display: block; }
#mozar-chat-toggle.mozar-chat-open .mozar-chat-open-icon { display: none; }

#mozar-chat-toggle::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(147, 51, 234, 0.4);
  animation: mozar-chat-pulse 2s infinite;
  z-index: -1;
}

@keyframes mozar-chat-pulse {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(1.7); opacity: 0; }
}

/* Scrim oscuro estilo ChatGPT al abrir */
#mozar-chat-scrim {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
  pointer-events: none;
}
#mozar-chat-widget.mozar-chat-open #mozar-chat-scrim {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Panel centrado, estilo ChatGPT */
#mozar-chat-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.96);
  width: min(760px, 94vw);
  height: min(640px, 88vh);
  background: #1c1c1f;
  border: 1px solid rgba(160, 100, 220, 0.22);
  border-radius: 18px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.8);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: transform 0.25s ease, opacity 0.25s ease, visibility 0.25s ease;
}
#mozar-chat-widget.mozar-chat-open #mozar-chat-panel {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Header */
#mozar-chat-header {
  background: #202024;
  color: #fff;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

#mozar-chat-header img.mozar-chat-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(192, 132, 252, 0.6);
  background: #17171b;
  flex-shrink: 0;
}

#mozar-chat-header-text {
  flex: 1;
  min-width: 0;
}

#mozar-chat-header-text .mozar-chat-name {
  font-size: 15.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: 0.2px;
}

#mozar-chat-header-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 500;
  color: #b8b8c9;
  margin-top: 2px;
}
#mozar-chat-header-status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4ade80;
}

#mozar-chat-close {
  border: none;
  background: transparent;
  color: #9a9aab;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  transition: background 0.15s ease, color 0.15s ease;
  flex-shrink: 0;
}
#mozar-chat-close:hover { background: #2c2c33; color: #fff; }

/* Cuerpo del chat (estilo ChatGPT: filas a ancho completo) */
#mozar-chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 18px 6px;
  background: radial-gradient(ellipse at top, rgba(147, 51, 234, 0.05), transparent 45%), #1c1c1f;
  font-size: 14.5px;
}

#mozar-chat-body::-webkit-scrollbar { width: 8px; }
#mozar-chat-body::-webkit-scrollbar-thumb { background: #3a3a44; border-radius: 4px; }

.mozar-chat-msg {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  animation: mozar-chat-fadein 0.25s ease;
  max-width: 100%;
}

@keyframes mozar-chat-fadein {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.mozar-chat-msg.mozar-chat-bot {
  justify-content: flex-start;
  color: #e9e9ef;
}
.mozar-chat-msg.mozar-chat-user {
  justify-content: flex-end;
}

.mozar-chat-msg .mozar-chat-row {
  font-size: 14.5px;
  line-height: 1.65;
  word-break: break-word;
}

.mozar-chat-msg.mozar-chat-bot .mozar-chat-row {
  padding: 4px 0;
  max-width: 100%;
}
.mozar-chat-msg.mozar-chat-user .mozar-chat-row {
  background: #3b3b47;
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: #f2f2f7;
  padding: 9px 14px;
  border-radius: 16px;
  border-bottom-right-radius: 6px;
  max-width: 78%;
}

.mozar-chat-msg.mozar-chat-bot a {
  color: #b58df1;
  font-weight: 600;
  text-decoration: underline;
  word-break: break-word;
}
.mozar-chat-msg.mozar-chat-bot b { color: #fff; }

.mozar-chat-avatar-mini {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid rgba(192, 132, 252, 0.5);
  flex-shrink: 0;
  margin-top: 2px;
  background: #17171b;
}

.mozar-chat-typing {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 0;
}
.mozar-chat-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #a78bfa;
  animation: mozar-chat-bounce 1.2s infinite;
}
.mozar-chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.mozar-chat-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes mozar-chat-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* Composer estilo ChatGPT */
#mozar-chat-input-row {
  padding: 10px 18px 14px;
  background: transparent;
  flex-shrink: 0;
}

#mozar-chat-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px 0 10px;
}

.mozar-chat-quick-btn {
  border: 1px solid rgba(165, 132, 241, 0.4);
  background: rgba(165, 132, 241, 0.08);
  color: #d3c5f5;
  font-size: 12.5px;
  padding: 6px 12px;
  border-radius: 18px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.mozar-chat-quick-btn:hover {
  background: rgba(165, 132, 241, 0.2);
  border-color: rgba(192, 132, 252, 0.7);
  color: #fff;
}

.mozar-chat-composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: #2a2a31;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 26px;
  padding: 8px 8px 8px 18px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.mozar-chat-composer:focus-within {
  border-color: rgba(192, 132, 252, 0.55);
  box-shadow: 0 0 0 3px rgba(147, 51, 234, 0.18);
}

#mozar-chat-input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-size: 14.5px;
  color: #f2f2f7;
  padding: 8px 0;
  resize: none;
  font-family: inherit;
  min-height: 24px;
  max-height: 120px;
}
#mozar-chat-input::placeholder { color: #7d7d8c; }

#mozar-chat-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, #9333ea 0%, #a855f7 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, background 0.15s ease;
  flex-shrink: 0;
}
#mozar-chat-send:hover { transform: scale(1.08); background: linear-gradient(135deg, #a855f7, #c084fc); }
#mozar-chat-send svg { width: 19px; height: 19px; fill: #fff; margin-left: -2px; }

@media (max-width: 560px) {
  #mozar-chat-panel {
    top: 8px;
    left: 8px;
    transform: scale(0.98);
    width: calc(100vw - 16px);
    height: calc(100vh - 16px);
    border-radius: 14px;
  }
  #mozar-chat-widget.mozar-chat-open #mozar-chat-panel { transform: scale(1); }
  #mozar-chat-toggle { width: 56px; height: 56px; bottom: 16px; right: 16px; }
  #mozar-chat-body { padding: 12px 14px 4px; }
}