/* ═══════════════════════════════════════════════════
   RoiT — Asistente Inteligente SoluiT
   Archivo: assets/css/roit.css
═══════════════════════════════════════════════════ */

/* ── Launcher ── */
#roit-launcher {
  position: fixed;
  bottom: 26px;
  right: 26px;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f5c400 0%, #ffdf4d 100%);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 0 rgba(245, 196, 0, 0.5), 0 10px 30px rgba(245, 196, 0, 0.4);
  z-index: 9999;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  outline: none;
  animation: roit-pulse 3.5s ease infinite;
}

@keyframes roit-pulse {

  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(245, 196, 0, 0.6), 0 10px 30px rgba(245, 196, 0, 0.4);
  }

  55% {
    box-shadow: 0 0 0 18px rgba(245, 196, 0, 0), 0 10px 30px rgba(245, 196, 0, 0.4);
  }
}

#roit-launcher:hover {
  transform: scale(1.1) translateY(-4px);
  box-shadow: 0 15px 40px rgba(245, 196, 0, 0.6);
}

#roit-launcher svg {
  width: 32px;
  height: 32px;
  fill: #0f172a;
  transition: transform 0.3s ease;
}

#roit-launcher:hover svg {
  transform: scale(1.1);
}

/* ESTADO ABIERTO (DIBUJO DE LA X Y TRANSFORMACIÓN) */
#roit-launcher.open {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%) !important;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4) !important;
  transform: scale(0.85) !important;
  animation: none !important;
  /* Detiene el pulso al abrir */
}

#roit-launcher.open:hover {
  transform: scale(0.9) !important;
  background: linear-gradient(135deg, #334155 0%, #1e293b 100%) !important;
}

#roit-launcher.open svg {
  display: none !important;
}

#roit-launcher.open::after {
  content: '';
  position: absolute;
  width: 26px;
  height: 26px;
  background: transparent;
  background-image:
    linear-gradient(45deg, transparent 44%, #fff 44%, #fff 56%, transparent 56%),
    linear-gradient(-45deg, transparent 44%, #fff 44%, #fff 56%, transparent 56%);
  border-radius: 2px;
  animation: x-spin-in 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes x-spin-in {
  from {
    opacity: 0;
    transform: rotate(-90deg) scale(0);
  }

  to {
    opacity: 1;
    transform: rotate(0deg) scale(1);
  }
}

.roit-notif {
  position: absolute;
  top: 0px;
  right: 0px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ff3b30;
  /* Rojo notificación estilo iOS */
  border: 3px solid #f5c400;
  /* Borde amarillo para integrarse perfecto al botón */
  box-shadow: 0 0 0 0 rgba(255, 59, 48, 0.7);
  animation: roit-notif-pulse 2s infinite;
  z-index: 10;
}

@keyframes roit-notif-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 59, 48, 0.7);
  }

  70% {
    box-shadow: 0 0 0 12px rgba(255, 59, 48, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(255, 59, 48, 0);
  }
}

/* ── Ventana ── */
#roit-window {
  position: fixed;
  bottom: 104px;
  right: 26px;
  width: 390px;
  max-height: 620px;
  background: #0c1829;
  border: 1px solid rgba(50, 110, 185, 0.22);
  border-radius: 22px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 36px 90px rgba(0, 0, 0, 0.72), 0 0 0 1px rgba(43, 111, 212, 0.06);
  z-index: 9998;
  overflow: hidden;
  font-family: 'DM Sans', 'Segoe UI', system-ui, sans-serif;
  transform: scale(0.91) translateY(22px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.3s cubic-bezier(.34, 1.5, .64, 1), opacity 0.22s;
}

#roit-window.open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

/* ── Header ── */
.roit-hdr {
  background: linear-gradient(135deg, #0c1e3e 0%, #081428 100%);
  padding: 13px 15px;
  display: flex;
  align-items: center;
  gap: 11px;
  border-bottom: 1px solid rgba(50, 110, 185, 0.20);
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

.roit-hdr::after {
  content: '';
  position: absolute;
  top: -60%;
  right: -5%;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(43, 111, 212, 0.09), transparent 70%);
  pointer-events: none;
}

.roit-av {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(145deg, #1a4daa, #2b6fd4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(27, 77, 170, 0.45);
  position: relative;
}

.roit-av::after {
  content: '';
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #00ddb8;
  border: 2.5px solid #081428;
}

.roit-av img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 14px;
}

.roit-av svg {
  width: 100%;
  height: 100%;
  padding: 6px;
  box-sizing: border-box;
}

.roit-hdr-info .roit-nm {
  font-weight: 700;
  font-size: 0.93rem;
  color: #fff;
  letter-spacing: -0.2px;
}

.roit-hdr-info .roit-tg {
  font-size: 0.67rem;
  color: #00ddb8;
  font-family: 'DM Mono', monospace;
  margin-top: 1px;
}

.roit-hdr-acts {
  margin-left: auto;
  display: flex;
  gap: 6px;
  align-items: center;
}

.roit-mpill {
  background: rgba(43, 111, 212, 0.13);
  border: 1px solid rgba(60, 140, 255, 0.40);
  color: #4a90f5;
  padding: 5px 12px;
  border-radius: 99px;
  font-size: 0.68rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  font-family: 'DM Sans', 'Segoe UI', system-ui, sans-serif;
}

.roit-mpill:hover {
  background: rgba(43, 111, 212, 0.24);
}

.roit-hbtn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(50, 110, 185, 0.20);
  color: #607a96;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  font-size: 0.78rem;
}

.roit-hbtn:hover {
  background: rgba(255, 255, 255, 0.09);
  color: #fff;
}

/* ── Mensajes ── */
.roit-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 14px 13px 8px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  scroll-behavior: smooth;
}

.roit-msgs::-webkit-scrollbar {
  width: 3px;
}

.roit-msgs::-webkit-scrollbar-thumb {
  background: rgba(50, 110, 185, 0.22);
  border-radius: 4px;
}

.roit-ts {
  text-align: center;
  font-size: 0.63rem;
  color: #334d66;
  font-family: 'DM Mono', monospace;
  margin: 3px 0;
}

.roit-brow {
  display: flex;
  align-items: flex-end;
  gap: 7px;
}

.roit-brow.user {
  flex-direction: row-reverse;
}

.roit-mav {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: #0f172a;
  /* Fondo oscuro para contrastar con el robot amarillo */
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  flex-shrink: 0;
  margin-bottom: 2px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.roit-mav img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.roit-mav svg {
  width: 100%;
  height: 100%;
  padding: 3px;
  box-sizing: border-box;
}

.roit-bubble {
  max-width: 84%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 0.8rem;
  line-height: 1.65;
  animation: roit-bIn 0.24s cubic-bezier(.34, 1.4, .64, 1);
}

@keyframes roit-bIn {
  from {
    opacity: 0;
    transform: scale(0.93) translateY(7px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

.roit-bubble.bot {
  background: #101f35;
  border: 1px solid rgba(50, 110, 185, 0.22);
  color: #d8e8f8;
  border-bottom-left-radius: 4px;
}

.roit-bubble.bot strong {
  color: #4a90f5;
  font-weight: 600;
}

.roit-bubble.bot .roit-hi {
  color: #4a90f5;
  font-weight: 600;
}

.roit-bubble.bot .roit-warn {
  color: #f0a030;
}

.roit-bubble.bot .roit-ok {
  color: #00ddb8;
}

.roit-bubble.bot .roit-red {
  color: #f05060;
}

.roit-bubble.bot a {
  color: #00ddb8;
  text-decoration: none;
}

.roit-bubble.user {
  background: linear-gradient(135deg, #1845b8, #2258d4);
  color: #fff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 16px rgba(24, 69, 184, 0.32);
}

/* ── Chips ── */
.roit-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-self: flex-start;
  padding-left: 33px;
  animation: roit-bIn 0.3s ease;
}

.roit-chip {
  background: transparent;
  border: 1px solid rgba(60, 140, 255, 0.40);
  color: #4a90f5;
  padding: 7px 13px;
  border-radius: 99px;
  font-size: 0.73rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  font-family: 'DM Sans', 'Segoe UI', system-ui, sans-serif;
  white-space: nowrap;
}

.roit-chip:hover {
  background: rgba(74, 144, 245, 0.10);
  transform: translateY(-1px);
}

.roit-chip.ac {
  border-color: #00ddb8;
  color: #00ddb8;
}

.roit-chip.ac:hover {
  background: rgba(0, 221, 184, 0.10);
}

.roit-chip.warn {
  border-color: #f0a030;
  color: #f0a030;
}

.roit-chip.warn:hover {
  background: rgba(240, 160, 48, 0.10);
}

.roit-chip.red {
  border-color: #f05060;
  color: #f05060;
}

.roit-chip.red:hover {
  background: rgba(240, 80, 96, 0.10);
}

/* ── Indicador escribiendo ── */
.roit-typr {
  display: flex;
  align-items: flex-end;
  gap: 7px;
}

.roit-typb {
  background: #101f35;
  border: 1px solid rgba(50, 110, 185, 0.22);
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  padding: 12px 15px;
  display: flex;
  align-items: center;
  gap: 5px;
  animation: roit-bIn 0.2s ease;
}

.roit-typb span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #2b6fd4;
  animation: roit-tb 1.1s infinite ease;
}

.roit-typb span:nth-child(2) {
  animation-delay: .18s;
}

.roit-typb span:nth-child(3) {
  animation-delay: .36s;
}

@keyframes roit-tb {

  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: .5;
  }

  30% {
    transform: translateY(-5px);
    opacity: 1;
  }
}

/* ── Footer ── */
.roit-footer {
  padding: 11px 13px;
  border-top: 1px solid rgba(50, 110, 185, 0.20);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  background: rgba(7, 16, 30, 0.6);
}

.roit-input {
  flex: 1;
  background: #101f35;
  border: 1px solid rgba(50, 110, 185, 0.22);
  border-radius: 11px;
  padding: 10px 13px;
  font-size: 0.79rem;
  font-family: 'DM Sans', 'Segoe UI', system-ui, sans-serif;
  color: #d8e8f8;
  outline: none;
  resize: none;
  max-height: 100px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.roit-input::placeholder {
  color: #334d66;
}

.roit-input:focus {
  border-color: #2b6fd4;
  box-shadow: 0 0 0 3px rgba(43, 111, 212, 0.11);
}

.roit-input:disabled {
  opacity: 0.5;
}

.roit-send {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: linear-gradient(135deg, #2b6fd4, #1a4daa);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(43, 111, 212, 0.38);
  transition: opacity 0.15s, transform 0.15s;
}

.roit-send:hover {
  opacity: .88;
  transform: scale(1.05);
}

.roit-send:disabled {
  opacity: .35;
  cursor: not-allowed;
  transform: none;
}

.roit-send svg {
  width: 17px;
  height: 17px;
  fill: #fff;
}

.roit-pow {
  text-align: center;
  padding: 6px;
  font-size: 0.6rem;
  color: #334d66;
  font-family: 'DM Mono', monospace;
  letter-spacing: 0.3px;
}

/* ── Tarjeta de info ── */
.roit-card {
  background: rgba(43, 111, 212, 0.07);
  border: 1px solid rgba(43, 111, 212, 0.18);
  border-radius: 12px;
  padding: 10px 12px;
  margin-top: 6px;
  font-size: 0.76rem;
  line-height: 1.6;
}

.roit-card-title {
  font-weight: 700;
  color: #4a90f5;
  font-size: 0.78rem;
  margin-bottom: 4px;
}

/* ── Responsive ── */
@media (max-width: 430px) {
  #roit-window {
    width: calc(100vw - 16px);
    right: 8px;
    bottom: 86px;
  }
}