/* ==========================================================================
   NIA CHATBOT WIDGET STYLES (HUGGING FACE SPACES INTEGRATION)
   ISTCGE ASCEND - Asistente Virtual Inteligente "NIA"
   Launcher: Cara (widget_ia_face.png) + Pill ("Aclaro tus dudas")
   Mascota Animada: cedepro_ia_1.png con el chat debajo de su brazo
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. FLOATING LAUNCHER BUTTON & PILL TAG
   -------------------------------------------------------------------------- */
.cedepro-launcher-wrap {
  position: fixed;
  bottom: 26px;
  right: 26px;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  font-family: var(--font-body, 'Exo 2', sans-serif);
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.cedepro-launcher-wrap.hidden {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.85) translateY(15px);
}

/* Pill "Aclaro tus dudas" */
.cedepro-pill-tag {
  background: linear-gradient(135deg, rgba(8, 28, 76, 0.96) 0%, rgba(3, 12, 34, 0.98) 100%);
  border: 1.5px solid #00D2FF;
  padding: 0.55rem 1.15rem;
  border-radius: 9999px;
  color: #FFFFFF;
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  box-shadow: 0 6px 22px rgba(0, 102, 255, 0.45), 0 0 15px rgba(0, 210, 255, 0.35);
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  cursor: pointer;
  white-space: nowrap;
  animation: cedePillFloat 3.5s ease-in-out infinite;
  transition: all 0.25s ease;
  user-select: none;
}

.cedepro-pill-tag:hover {
  transform: translateY(-2px) scale(1.03);
  border-color: #5CE1E6;
  box-shadow: 0 8px 28px rgba(0, 102, 255, 0.6), 0 0 20px rgba(0, 210, 255, 0.5);
}

.cedepro-pill-pulse {
  display: inline-block;
  width: 9px;
  height: 9px;
  background: #10B981;
  border-radius: 50%;
  box-shadow: 0 0 8px #10B981;
  animation: cedePulseDot 2s infinite;
}

/* Launcher Button (Circular con widget_ia_face) */
.cedepro-launcher-btn {
  position: relative;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0A2560 0%, #030D22 100%);
  border: 2px solid #00D2FF;
  box-shadow: 0 8px 28px rgba(0, 102, 255, 0.55), 0 0 20px rgba(0, 210, 255, 0.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  animation: cedePulseGlow 3s infinite ease-in-out;
  padding: 0;
  outline: none;
}

.cedepro-launcher-btn:hover {
  transform: scale(1.08) translateY(-3px);
  box-shadow: 0 12px 35px rgba(0, 102, 255, 0.75), 0 0 25px rgba(0, 210, 255, 0.6);
  border-color: #5CE1E6;
}

.cedepro-launcher-face-img {
  width: 86%;
  height: 86%;
  object-fit: contain;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.4));
  transition: transform 0.3s ease;
  pointer-events: none;
}

.cedepro-launcher-btn:hover .cedepro-launcher-face-img {
  transform: scale(1.1);
}

.cedepro-online-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 15px;
  height: 15px;
  background: #10B981;
  border: 2.5px solid #030718;
  border-radius: 50%;
  box-shadow: 0 0 8px #10B981;
  z-index: 2;
}

/* --------------------------------------------------------------------------
   2. CHAT CONTAINER & MASCOT (cedepro_ia_1 SOSTENIENDO EL CHAT)
   -------------------------------------------------------------------------- */
.cedepro-chat-container {
  position: fixed;
  bottom: 20px;
  right: 100px;
  width: 420px;
  z-index: 10000;
  font-family: var(--font-body, 'Exo 2', sans-serif);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(25px) scale(0.95);
  transition: all 0.38s cubic-bezier(0.16, 1, 0.3, 1);
}

.cedepro-chat-container.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

/* Mascota Animada cedepro_ia_1 */
.cedepro-agent-mascot {
  position: absolute;
  top: -145px;
  right: -125px;
  width: 390px;
  height: 390px;
  pointer-events: none;
  z-index: 10003;
  filter: drop-shadow(0 14px 30px rgba(0, 102, 255, 0.55));
  animation: cedeMascotFloat 4s ease-in-out infinite;
  transform-origin: center bottom;
}

.cedepro-agent-mascot-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.cedepro-chat-window {
  position: relative;
  width: 440px;
  height: 720px;
  max-height: calc(100vh - 100px);
  background: rgba(4, 10, 26, 0.98);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 2px solid #00D2FF;
  border-radius: 22px;
  box-shadow: 0 25px 65px rgba(0, 0, 0, 0.9), 0 0 35px rgba(0, 210, 255, 0.35);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 10001;
}

/* --------------------------------------------------------------------------
   3. CHAT HEADER
   -------------------------------------------------------------------------- */
.cedepro-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.15rem;
  background: linear-gradient(90deg, rgba(8, 26, 72, 0.96) 0%, rgba(3, 11, 32, 0.98) 100%);
  border-bottom: 1.5px solid rgba(0, 210, 255, 0.3);
  flex-shrink: 0;
  position: relative;
  z-index: 10002;
}

.cedepro-header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.cedepro-header-face-wrap {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0D3888 0%, #031435 100%);
  border: 1.5px solid #00D2FF;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 12px rgba(0, 210, 255, 0.4);
  overflow: hidden;
}

.cedepro-header-face-img {
  width: 88%;
  height: 88%;
  object-fit: contain;
}

.cedepro-header-info {
  display: flex;
  flex-direction: column;
}

.cedepro-header-title {
  font-family: var(--font-display, 'Ethnocentric', sans-serif);
  font-size: 0.98rem;
  font-weight: 700;
  color: #FFFFFF;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  letter-spacing: 0.03em;
}

.cedepro-title-ai-badge {
  background: linear-gradient(135deg, #00D2FF 0%, #0066FF 100%);
  color: #FFFFFF;
  font-size: 0.62rem;
  padding: 0.15rem 0.45rem;
  border-radius: 9999px;
  font-weight: 900;
}

.cedepro-header-status {
  font-size: 0.74rem;
  color: #38BDF8;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 600;
}

.cedepro-status-dot {
  width: 7px;
  height: 7px;
  background: #10B981;
  border-radius: 50%;
  box-shadow: 0 0 6px #10B981;
}

.cedepro-header-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-right: 6px;
}

.cedepro-action-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #CBD5E1;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s ease;
  z-index: 10005;
}

.cedepro-action-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #FFFFFF;
  border-color: #00D2FF;
}

.cedepro-action-btn.close-btn:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: #EF4444;
}

/* --------------------------------------------------------------------------
   4. HUGGING FACE IFRAME CONTAINER
   -------------------------------------------------------------------------- */
.nia-iframe-wrap {
  flex: 1;
  width: 100%;
  height: 100%;
  position: relative;
  background: #030816;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 8px;
  box-sizing: border-box;
}

.nia-chat-iframe {
  width: 100%;
  height: 650px;
  max-height: 100%;
  border-radius: 16px !important;
  border: 1px solid #E2E8F0 !important;
  display: block;
  background: #FFFFFF;
  box-sizing: border-box;
}

/* Loading Overlay for Hugging Face Space boot */
.nia-loading-overlay {
  position: absolute;
  inset: 0;
  background: #040A1C;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  z-index: 5;
  transition: opacity 0.4s ease;
  pointer-events: none;
}

.nia-loading-overlay.fade-out {
  opacity: 0;
}

.nia-loading-spinner {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(0, 210, 255, 0.2);
  border-top-color: #00D2FF;
  border-radius: 50%;
  animation: cedeSpin 0.9s linear infinite;
}

.nia-loading-text {
  color: #94A3B8;
  font-size: 0.84rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.nia-loading-text span {
  color: #00D2FF;
}

.nia-fallback-link {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: #00D2FF;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.45rem 0.95rem;
  background: rgba(0, 210, 255, 0.12);
  border: 1px solid rgba(0, 210, 255, 0.35);
  border-radius: 9999px;
  text-decoration: none;
  transition: all 0.25s ease;
  margin-top: 0.5rem;
}

.nia-fallback-link:hover {
  background: rgba(0, 210, 255, 0.25);
  border-color: #00D2FF;
  color: #FFFFFF;
  box-shadow: 0 0 12px rgba(0, 210, 255, 0.4);
  transform: translateY(-1px);
}

/* --------------------------------------------------------------------------
   5. KEYFRAME ANIMATIONS
   -------------------------------------------------------------------------- */
@keyframes cedeMascotFloat {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

@keyframes cedePillFloat {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-4px);
  }
}

@keyframes cedePulseGlow {
  0%, 100% {
    box-shadow: 0 8px 28px rgba(0, 102, 255, 0.55), 0 0 20px rgba(0, 210, 255, 0.4);
  }
  50% {
    box-shadow: 0 10px 35px rgba(0, 102, 255, 0.75), 0 0 28px rgba(0, 210, 255, 0.65);
  }
}

@keyframes cedePulseDot {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.25);
    opacity: 0.7;
  }
}

@keyframes cedeSpin {
  to {
    transform: rotate(360deg);
  }
}

/* --------------------------------------------------------------------------
   6. RESPONSIVE MOBILE VIEW (SMARTPHONES)
   -------------------------------------------------------------------------- */
@media (max-width: 600px) {
  .cedepro-launcher-wrap {
    bottom: 18px;
    right: 18px;
    gap: 0.65rem;
  }

  .cedepro-pill-tag {
    font-size: 0.8rem;
    padding: 0.45rem 0.95rem;
  }

  .cedepro-launcher-btn {
    width: 60px;
    height: 60px;
  }

  /* Chat Container en Móvil */
  .cedepro-chat-container {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
  }

  .cedepro-agent-mascot {
    top: 5px;
    right: 15px;
    width: 200px;
    height: 200px;
  }

  .cedepro-chat-window {
    width: 100%;
    height: calc(100vh - 75px);
    margin-top: 75px;
    border-radius: 22px 22px 0 0;
    border-bottom: none;
    max-height: calc(100vh - 75px);
  }
}
