/* ========== HERO CHAT UNIFICADO ========== */
#hero-unified-chat {
  background: #0a0a0a;
  min-height: 100vh;
  display: flex;
  align-items: stretch;
  justify-content: center;
  position: relative;
  padding: 0; 
  margin-bottom: 0rem;  /* aumento de 2rem a 3rem */
  border-bottom: none;   /* sacamos el borde */
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3); /* sombra que marca el final */
}

/* Contenedor principal */
.chat-container {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 950px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 1rem;
  overflow: hidden; 
}

.chat-container.empty {
  justify-content: center;
}

.chat-container.has-messages {
  justify-content: space-between;
   padding-top: 0.5rem;  
}

/* Header del chat */
.chat-header {
  display: none;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid rgba(139, 92, 246, 0.2);
}

.chat-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-header-logo {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.chat-header-brand {
  font-size: 1.2rem;
  font-weight: 700;
  color: white;
}

.brand-reg {
  font-size: 0.7rem;
  opacity: 0.6;
  vertical-align: super;
}

.header-mode-toggle {
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid rgba(139, 92, 246, 0.4);
  border-radius: 40px;
  padding: 0.4rem 1rem;
  cursor: pointer;
  color: white;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
}

.header-mode-toggle:hover {
  background: rgba(139, 92, 246, 0.25);
}

.header-mode-toggle.ek-mode {
  background: rgba(96, 165, 250, 0.15);
  border-color: rgba(96, 165, 250, 0.4);
}

/* Área de mensajes */
.chat-messages {
  flex: 1; 
  min-height: 0;  
  overflow-y: auto;
  display: block;
  flex-direction: column;
  
  padding: 4.5rem 0.5rem 0.5rem 0.5rem; /* ajuste fino */
  scroll-behavior: smooth;
}

.chat-container.empty .chat-messages {
  justify-content: center;
}

/* Mensaje de bienvenida */
.welcome-message {
  text-align: center;
  padding: 2rem;
  animation: fadeIn 0.5s ease;
}

.chat-container.has-messages .welcome-message {
  display: none;
}

.welcome-avatar {
  font-size: 4rem;
  margin-bottom: 1rem;
}

.welcome-title {
  font-size: 1.8rem;
  font-weight: 700;
  color: white;
  margin-bottom: 0.75rem;
}

.welcome-text {
  color: rgba(255, 255, 255, 0.6);
  font-size: 1rem;
  line-height: 1.6;
}

/* Input area */
.chat-input-area {
  flex-shrink: 0;  /* CLAVE: el input no se encoge nunca */
  width: 100%;
  margin-top: 1rem;
  margin-bottom: 0; 
}

.mode-toggle-wrapper {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0.75rem;
}

.mode-toggle {
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid rgba(139, 92, 246, 0.4);
  border-radius: 40px;
  padding: 0.4rem 1rem;
  cursor: pointer;
  color: white;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
}

.mode-toggle:hover {
  background: rgba(139, 92, 246, 0.25);
}

.mode-toggle.ek-mode {
  background: rgba(96, 165, 250, 0.15);
  border-color: rgba(96, 165, 250, 0.4);
}

.chat-input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(168, 85, 247, 0.3);
  border-radius: 20px;
  padding: 0.75rem 1rem;
  transition: all 0.2s;
}

.chat-input-wrapper:focus-within {
  border-color: rgba(168, 85, 247, 0.6);
  background: rgba(255, 255, 255, 0.08);
}

#chat-input {
  flex: 1;
  background: transparent;
  border: none;
  color: white;
  font-size: 1rem;
  resize: none;
  outline: none;
  font-family: inherit;
  max-height: 150px;
}

#chat-input::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

#chat-send {
  background: #8b5cf6;
  border: none;
  border-radius: 12px;
  color: white;
  padding: 0.5rem 1rem;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

#chat-send:hover {
  background: #7c3aed;
  transform: scale(1.02);
}

/* Mensajes */
.msg {
  padding: 0.75rem 1rem;
  border-radius: 16px;
  max-width: 85%;
  font-size: 0.95rem;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.9);
  animation: fadeInUp 0.3s ease;
}

.msg-user {
  background: rgba(96, 165, 250, 0.15);
  border: 1px solid rgba(96, 165, 250, 0.3);
  float: right;
  clear: both;
  margin: 5px 0;
}

.msg-ek, .msg-shield {
  float: left;
  clear: both;
    margin: 5px 0;
}

.msg-ek {
  background: rgba(139, 92, 246, 0.12);
  border: 1px solid rgba(139, 92, 246, 0.25);
  align-self: flex-start;
}

.msg-shield {
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid rgba(139, 92, 246, 0.2);
  align-self: flex-start;
  max-width: 95%;
}

/* Mensaje de sistema */
.msg-system {
  text-align: center;
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 1);
  padding: 0.5rem;
  letter-spacing: 1px;
  align-self: center;
  font-style: italic;
 float: left;
  clear: both;  
}

.chat-messages::after {
  content: "";
  display: table;
  clear: both;
}

/* Shield result */
.shield-result-compact {
  font-size: 0.9rem;
}

.shield-score-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-weight: bold;
  margin-right: 8px;
  font-size: 0.85rem;
}

.score-high {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

.score-medium {
  background: rgba(245, 158, 11, 0.2);
  color: #f59e0b;
}

.score-low {
  background: rgba(16, 185, 129, 0.2);
  color: #10b981;
}

/* Typing indicator */
.typing-indicator {
  display: flex;
  gap: 6px;
  padding: 0.75rem 1rem;
  background: rgba(139, 92, 246, 0.1);
  border-radius: 16px;
  float: left;        /* ← AGREGAR */
  clear: both;        /* ← AGREGAR */
  margin-bottom: 1rem; /* ← AGREGAR */
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  background: rgba(139, 92, 246, 0.6);
  border-radius: 50%;
  animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
  animation-delay: 0.4s;
}

/* Scrollbar */
.chat-messages::-webkit-scrollbar {
  width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: rgba(139, 92, 246, 0.4);
  border-radius: 10px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
  background: rgba(139, 92, 246, 0.6);
}

/* Animaciones */
@keyframes typing {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  30% {
    transform: translateY(-8px);
    opacity: 1;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive */
@media (max-width: 768px) {
  .chat-container {
    height: 100vh;
    max-width: 100%;
    padding: 0.5rem;
  }

  .welcome-avatar {
    font-size: 3rem;
  }

  .welcome-title {
    font-size: 1.4rem;
  }

  .welcome-text {
    font-size: 0.9rem;
  }

  .msg {
    max-width: 95%;
    font-size: 0.9rem;
  }

  .chat-header-brand {
    font-size: 1rem;
  }

  .header-mode-toggle,
  .mode-toggle {
    padding: 0.3rem 0.8rem;
    font-size: 0.75rem;
  }
}



/* AI Disclaimer */
.ai-disclaimer {
  text-align: center;
  padding: 0.75rem 0.5rem 0.25rem 0.5rem;
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.35);
  border-top: 1px solid rgba(139, 92, 246, 0.15);
  margin-top: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.disclaimer-text {
  line-height: 1.4;
}

.ai-disclaimer a {
  color: #c084fc;
  text-decoration: none;
  transition: color 0.2s;
  font-weight: 500;
}

.ai-disclaimer a:hover {
  color: #e9d5ff;
  text-decoration: underline;
}

/* Responsive */
@media (max-width: 768px) {
  .ai-disclaimer {
    font-size: 0.65rem;
    gap: 0.3rem;
  }
}