:root {
  --mati-primary: #22d3ee;
  --mati-bg: rgba(15, 23, 42, 0.96);
  --mati-panel: rgba(30, 41, 59, 0.95);
  --mati-border: rgba(255, 255, 255, 0.08);
  --mati-text: #ffffff;
  --mati-muted: rgba(255, 255, 255, 0.7);
}

.mati-chat {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 6000;
  font-family: 'Poppins', 'Helvetica Neue', Arial, sans-serif;
}

.mati-chat__fab {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #0ea5e9, #22d3ee);
  color: #fff;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.mati-chat.mati-chat--open .mati-chat__fab {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.9);
}

.mati-chat__fab i {
  font-size: 20px;
}

.mati-chat__panel {
  position: absolute;
  right: 0;
  bottom: 72px;
  width: 360px;
  max-height: 540px;
  display: flex;
  flex-direction: column;
  border-radius: 18px;
  overflow: hidden;
  background: var(--mati-panel);
  border: 1px solid var(--mati-border);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  transform: translateY(16px) scale(0.98);
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s ease;
}

.mati-chat.mati-chat--open .mati-chat__panel {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: auto;
  bottom: 16px;
  max-height: 596px;
}

.mati-chat__header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: var(--mati-bg);
  border-bottom: 1px solid var(--mati-border);
}

.mati-chat__header-icon {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}

.mati-chat__header-text {
  flex: 1;
  color: var(--mati-text);
}

.mati-chat__title {
  font-size: 15px;
  font-weight: 700;
}

.mati-chat__subtitle {
  font-size: 12px;
  color: var(--mati-muted);
}

.mati-chat__status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
}

.mati-chat__status i {
  color: #ffd700; /* amarillo para el icono */
}
.mati-chat__close {
  border: none;
  background: transparent;
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.mati-chat__messages {
  padding: 16px 14px;
  overflow-y: auto;
  flex: 1;
  background: rgba(15, 23, 42, 0.7);
}

.mati-chat__bubble-row {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}

.mati-chat__bubble-row--user {
  justify-content: flex-end;
}

.mati-chat__avatar {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.mati-chat__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mati-chat__bubble {
  max-width: 78%;
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--mati-text);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
  white-space: pre-wrap;
  word-break: break-word;
}

.mati-chat__bubble--user {
  background: rgba(34, 211, 238, 0.9);
  color: #0f172a;
}

.mati-chat__bubble code {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 12px;
  background: rgba(15, 23, 42, 0.35);
  padding: 2px 4px;
  border-radius: 6px;
}

.mati-chat__bubble a {
  color: #38bdf8;
  text-decoration: underline;
}

.mati-chat__typing {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.mati-chat__typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.6);
  animation: mati-typing 1s infinite ease-in-out;
}

.mati-chat__typing span:nth-child(2) {
  animation-delay: 0.15s;
}

.mati-chat__typing span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes mati-typing {
  0%, 100% { transform: translateY(0); opacity: 0.5; }
  50% { transform: translateY(-3px); opacity: 1; }
}

.mati-chat__composer {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  border-top: 1px solid var(--mati-border);
  background: var(--mati-bg);
}

.mati-chat__input {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.12);
}

.mati-chat__input i {
  color: rgba(255, 255, 255, 0.7);
}

.mati-chat__input textarea {
  flex: 1;
  background: transparent;
  border: none;
  color: #fff;
  resize: none;
  font-size: 14px;
  outline: none;
  line-height: 1.4;
  min-height: 24px;
  max-height: 72px;
  overflow-y: auto;
}

.mati-chat__icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mati-chat__icon.active {
  background: rgba(239, 68, 68, 0.9);
  color: #fff;
}

.mati-chat__icon:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.mati-chat__send {
  background: rgba(34, 211, 238, 0.9);
  color: #0f172a;
}

.mati-chat__empty {
  text-align: center;
  color: rgba(255, 255, 255, 0.6);
  padding: 18px 0;
  font-size: 13px;
}

@media (max-width: 600px) {
  .mati-chat {
    right: 14px;
    bottom: 14px;
  }

  .mati-chat__panel {
    width: min(92vw, 360px);
    max-height: 70vh;
  }
}
