/* Widget de chat de manuales myApps - usa la paleta de colores del sitio (main.css) */
.myapps-chat-toggle {
  position: fixed;
  bottom: 32px;
  right: 90px;
  width: 50px;
  height: 50px;
  box-sizing: border-box;
  border-radius: 50%;
  border: 2px solid var(--color-navbar, #35D5DF);
  background: var(--color-background, #fff);
  color: var(--color-foreground, #171816);
  padding: 2px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  z-index: 1000;
  transition: transform 0.15s ease, opacity 0.15s ease;
}
.myapps-chat-toggle:hover {
  transform: scale(1.06);
}
.myapps-chat-toggle.hidden {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.8);
}

.myapps-chat-panel {
  position: fixed;
  bottom: 92px;
  right: 26px;
  width: 360px;
  max-width: calc(100vw - 32px);
  height: min(440px, calc(100vh - 140px));
  max-height: calc(100vh - 140px);
  background: var(--color-background, #fff);
  color: var(--color-foreground, #171816);
  border: 1px solid var(--color-underline, #216672);
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 9999;
}
.myapps-chat-panel.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.myapps-chat-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--color-background-dark, #3A5C74);
  color: #fff;
  font-weight: 600;
}
.myapps-chat-header span {
  flex: 1;
}
.myapps-chat-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 16px;
  cursor: pointer;
}

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

.myapps-chat-bubble {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  max-width: 90%;
}
.myapps-chat-bubble-content {
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.4;
  word-wrap: break-word;
}
.myapps-chat-user {
  align-self: flex-end;
  flex-direction: row-reverse;
}
.myapps-chat-user .myapps-chat-bubble-content {
  background: linear-gradient(135deg, #3A5C74 0%, #216672 50%, #35D5DF 100%);
  color: #fff;
  border-bottom-right-radius: 2px;
}
.myapps-chat-assistant {
  align-self: flex-start;
}
.myapps-chat-assistant .myapps-chat-bubble-content {
  background: var(--color-background-table-alt, rgba(58, 92, 116, 0.12));
  border-bottom-left-radius: 2px;
}

.myapps-chat-inputbar {
  display: flex;
  border-top: 1px solid var(--color-underline, #216672);
  padding: 8px;
  gap: 8px;
}
.myapps-chat-input {
  flex: 1;
  border: 1px solid var(--color-underline, #216672);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 14px;
  background: transparent;
  color: inherit;
}
.myapps-chat-send {
  border: none;
  background: linear-gradient(135deg, #3A5C74 0%, #216672 50%, #35D5DF 100%);
  color: #fff;
  font-weight: 600;
  border-radius: 8px;
  padding: 0 14px;
  cursor: pointer;
  font-size: 14px;
}
.myapps-chat-send:disabled {
  opacity: 0.6;
  cursor: default;
}

/* Mascota robot de myApps (misma que en la página 404), alterna según el tema activo */
.myapps-chat-robot {
  display: inline-flex;
  width: 100%;
  height: 100%;
}
.myapps-chat-robot img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.myapps-chat-robot-dark {
  display: none;
}
.myapps-chat-robot-light {
  display: block;
}
html[data-bs-theme="dark"] .myapps-chat-robot-light,
body.dark-theme .myapps-chat-robot-light {
  display: none;
}
html[data-bs-theme="dark"] .myapps-chat-robot-dark,
body.dark-theme .myapps-chat-robot-dark {
  display: block;
}

.myapps-chat-header .myapps-chat-robot {
  width: 40px;
  height: 40px;
}
.myapps-chat-bubble .myapps-chat-robot {
  width: 36px;
  height: 36px;
}

/* Feedback (👍/👎) bajo cada respuesta de Mía */
.myapps-chat-feedback-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  padding-left: 42px;
}
.myapps-chat-feedback-btn {
  background: none;
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1;
  padding: 2px 6px;
  cursor: pointer;
  opacity: 0.7;
}
.myapps-chat-feedback-btn:hover:not(:disabled) {
  opacity: 1;
  border-color: var(--color-underline, #216672);
}
.myapps-chat-feedback-btn:disabled {
  cursor: default;
  opacity: 0.4;
}
.myapps-chat-feedback-status {
  font-size: 11px;
  opacity: 0.75;
}

.myapps-chat-feedback-form {
  margin: 4px 0 4px 42px;
  padding: 8px;
  border: 1px solid var(--color-underline, #216672);
  border-radius: 8px;
  background: var(--color-background-table-alt, rgba(58, 92, 116, 0.08));
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: calc(100% - 50px);
}
.myapps-chat-feedback-hint {
  font-size: 11px;
  opacity: 0.8;
}
.myapps-chat-feedback-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.myapps-chat-chip {
  border: 1px solid var(--color-underline, #216672);
  background: transparent;
  color: inherit;
  border-radius: 14px;
  padding: 3px 10px;
  font-size: 11px;
  cursor: pointer;
}
.myapps-chat-chip.selected {
  background: linear-gradient(135deg, #3A5C74 0%, #216672 50%, #35D5DF 100%);
  color: #fff;
  border-color: transparent;
}
.myapps-chat-feedback-comment {
  resize: vertical;
  min-height: 36px;
  border: 1px solid var(--color-underline, #216672);
  border-radius: 6px;
  padding: 6px;
  font-size: 12px;
  background: transparent;
  color: inherit;
  font-family: inherit;
}
.myapps-chat-feedback-send {
  align-self: flex-end;
  border: none;
  background: linear-gradient(135deg, #3A5C74 0%, #216672 50%, #35D5DF 100%);
  color: #fff;
  font-weight: 600;
  border-radius: 8px;
  padding: 5px 12px;
  cursor: pointer;
  font-size: 12px;
}

