/* ============================================================================
   CORTANA VIRTUAL ASSISTANT - WIDGET DE CHAT SOBERANO (ENTIDAD #21 DE LA COLMENA)
   JC PATH LAB - Arquitectura Sovereign Clinical Glass / Halo Biotech
   ============================================================================ */

/* BOTÓN FLOTANTE (FAB) */
.cortana-fab-btn {
  position: fixed;
  bottom: 84px;
  right: 18px;
  z-index: 990;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px 8px 10px;
  background: linear-gradient(135deg, #0284c7 0%, #1d61d8 50%, #4338ca 100%);
  color: #ffffff;
  border: 1px solid rgba(56, 189, 248, 0.5);
  border-radius: 9999px;
  box-shadow: 0 4px 20px rgba(2, 132, 199, 0.45), 0 0 15px rgba(56, 189, 248, 0.3);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.cortana-fab-btn:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 6px 25px rgba(2, 132, 199, 0.6), 0 0 20px rgba(56, 189, 248, 0.45);
}

.cortana-fab-btn:active {
  transform: scale(0.95);
}

.cortana-fab-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: radial-gradient(circle, #38bdf8 0%, #0369a1 70%, #082f49 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.8);
}

.cortana-fab-ring {
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 2px dashed rgba(56, 189, 248, 0.7);
  animation: cortanaRingSpin 8s linear infinite;
}

@keyframes cortanaRingSpin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.cortana-fab-label {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.cortana-fab-badge {
  font-size: 0.65rem;
  background: rgba(16, 185, 129, 0.9);
  color: #ffffff;
  padding: 2px 6px;
  border-radius: 6px;
  font-weight: 800;
}

/* OVERLAY MODAL DEL CHAT */
.cortana-chat-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(4, 8, 16, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.cortana-chat-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

/* CONTENEDOR PRINCIPAL DEL CHAT */
.cortana-chat-container {
  width: 100%;
  max-width: 440px;
  height: 92vh;
  max-height: 720px;
  background: linear-gradient(180deg, #0e172a 0%, #090e1a 100%);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-bottom: none;
  border-top-left-radius: 24px;
  border-top-right-radius: 24px;
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.6), 0 0 30px rgba(2, 132, 199, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.cortana-chat-overlay.active .cortana-chat-container {
  transform: translateY(0);
}

/* CABECERA DEL CHAT */
.cortana-header {
  padding: 14px 18px;
  background: rgba(15, 23, 42, 0.85);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  backdrop-filter: blur(8px);
}

.cortana-profile {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cortana-avatar-large {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: radial-gradient(circle, #38bdf8 0%, #0284c7 60%, #032b43 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.7);
}

.cortana-avatar-icon {
  font-size: 1.25rem;
  color: #ffffff;
}

.cortana-title-wrap h4 {
  font-size: 0.98rem;
  font-weight: 700;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 6px;
}

.cortana-title-wrap p {
  font-size: 0.72rem;
  color: #94a3b8;
}

.cortana-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 9999px;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(52, 211, 153, 0.35);
  color: #34d399;
}

.cortana-header-close-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #94a3b8;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.cortana-header-close-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.4);
}

/* BARRA DE PREGUNTAS FRECUENTES (CHIPS) */
.cortana-chips-bar {
  padding: 10px 14px;
  background: rgba(15, 23, 42, 0.5);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}

.cortana-chips-bar::-webkit-scrollbar {
  display: none;
}

.cortana-chip {
  flex-shrink: 0;
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(56, 189, 248, 0.2);
  color: #cbd5e1;
  font-size: 0.75rem;
  padding: 6px 12px;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.cortana-chip:hover, .cortana-chip:active {
  background: rgba(2, 132, 199, 0.35);
  border-color: #38bdf8;
  color: #ffffff;
}

/* CUERPO DE MENSAJES */
.cortana-messages-body {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
}

.cortana-msg-row {
  display: flex;
  gap: 10px;
  max-width: 88%;
}

.cortana-msg-row.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.cortana-msg-row.bot {
  align-self: flex-start;
}

.cortana-bot-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: radial-gradient(circle, #38bdf8 0%, #0284c7 70%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 0.8rem;
  flex-shrink: 0;
  margin-top: 2px;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.5);
}

.cortana-bubble {
  padding: 12px 14px;
  border-radius: 16px;
  font-size: 0.85rem;
  line-height: 1.45;
  word-break: break-word;
}

.cortana-msg-row.user .cortana-bubble {
  background: linear-gradient(135deg, #1d61d8 0%, #2563eb 100%);
  color: #ffffff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 2px 10px rgba(37, 99, 235, 0.25);
}

.cortana-msg-row.bot .cortana-bubble {
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(56, 189, 248, 0.2);
  color: #f1f5f9;
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

.cortana-bubble p {
  margin-bottom: 6px;
}

.cortana-bubble p:last-child {
  margin-bottom: 0;
}

.cortana-bubble strong {
  color: #38bdf8;
  font-weight: 700;
}

/* BOTONES DE ACCIÓN RÁPIDA DENTRO DE MENSAJES */
.cortana-msg-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.cortana-btn-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
}

.cortana-btn-pdf {
  background: linear-gradient(135deg, #059669 0%, #10b981 100%);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.35);
}

.cortana-btn-360 {
  background: rgba(14, 165, 233, 0.2);
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: #38bdf8;
}

.cortana-btn-action:hover {
  filter: brightness(1.15);
  transform: translateY(-1px);
}

/* TELEMETRÍA EN PIE DE BURBUJA */
.cortana-msg-meta {
  font-size: 0.65rem;
  color: #64748b;
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* INDICADOR DE ESCRITURA */
.cortana-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  background: rgba(30, 41, 59, 0.6);
  border-radius: 16px;
  width: fit-content;
}

.cortana-dot {
  width: 6px;
  height: 6px;
  background-color: #38bdf8;
  border-radius: 50%;
  animation: cortanaBounce 1.4s infinite ease-in-out both;
}

.cortana-dot:nth-child(1) { animation-delay: -0.32s; }
.cortana-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes cortanaBounce {
  0%, 80%, 100% { transform: scale(0); opacity: 0.3; }
  40% { transform: scale(1); opacity: 1; }
}

/* BARRA DE ENTRADA / INPUT */
.cortana-input-bar {
  padding: 12px 14px;
  background: rgba(15, 23, 42, 0.95);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 8px;
}

.cortana-input-field {
  flex: 1;
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 12px;
  padding: 10px 14px;
  color: #ffffff;
  font-size: 0.85rem;
  outline: none;
  font-family: inherit;
  transition: all 0.2s ease;
}

.cortana-input-field:focus {
  border-color: #38bdf8;
  background: rgba(30, 41, 59, 0.95);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.25);
}

.cortana-input-field::placeholder {
  color: #64748b;
}

.cortana-btn-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.cortana-btn-mic {
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #94a3b8;
}

.cortana-btn-mic:hover {
  background: rgba(2, 132, 199, 0.25);
  color: #38bdf8;
}

.cortana-btn-send {
  background: linear-gradient(135deg, #0284c7 0%, #1d61d8 100%);
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(2, 132, 199, 0.35);
}

.cortana-btn-send:hover {
  transform: scale(1.04);
  box-shadow: 0 3px 14px rgba(2, 132, 199, 0.5);
}

.cortana-btn-send:active {
  transform: scale(0.94);
}
