/* === RESET GENERAL === */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Poppins", sans-serif;
}

body {
  background: linear-gradient(135deg, #0d0d0d, #1a1a1a);
  color: white;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* === HEADER === */
header {
  width: 100%;
  text-align: center;
  padding: 15px;
  background: #101010;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
}

.logo {
  max-width: 200px;
  height: auto;
}

/* === CONTENEDOR PRINCIPAL === */
main {
  display: flex;
  justify-content: center;
  align-items: center;
  flex: 1;
  width: 100%;
  padding: 20px;
}

/* === CHAT LAYOUT === */
.chat-container {
  display: flex;
  gap: 30px;
  background: rgba(30, 30, 30, 0.95);
  border-radius: 20px;
  padding: 30px;
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
  max-width: 900px;
  width: 100%;
}

/* === AVATAR SECTION === */
.avatar-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  width: 40%;
}

#avatarVideo {
  width: 220px;
  height: 220px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 30px rgba(255, 255, 255, 0.15);
  transition: all 0.7s ease;
}

/* === EFECTO DE BRILLO === */
.avatar-glow {
  box-shadow: 0 0 30px 10px rgba(0, 174, 255, 0.5);
  animation: glowPulse 2.5s infinite alternate;
}

@keyframes glowPulse {
  0% {
    box-shadow: 0 0 25px 8px rgba(0, 174, 255, 0.4);
  }
  100% {
    box-shadow: 0 0 45px 15px rgba(0, 174, 255, 0.8);
  }
}

/* === EFECTOS DE APARICIÓN Y DESVANECIDO === */
.fade-in {
  opacity: 0;
  animation: fadeIn 0.7s forwards;
}

.fade-out {
  opacity: 1;
  animation: fadeOut 0.7s forwards;
}

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

@keyframes fadeOut {
  to {
    opacity: 0;
  }
}

/* === SELECTOR DE VOZ === */
#voiceSelect {
  margin-top: 20px;
  padding: 10px 15px;
  border-radius: 10px;
  border: none;
  background: #222;
  color: white;
  font-weight: 500;
  cursor: pointer;
  outline: none;
  transition: 0.3s ease;
}

#voiceSelect:hover {
  background: #333;
}

/* === CHAT BOX === */
.chat-box {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 60%;
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 15px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  margin-bottom: 15px;
  scroll-behavior: smooth;
}

/* === MENSAJES === */
.message {
  padding: 10px 14px;
  margin-bottom: 10px;
  border-radius: 12px;
  line-height: 1.4;
}

.message.user {
  background: #007bff;
  align-self: flex-end;
  text-align: right;
  color: white;
}

.message.bot {
  background: rgba(255, 255, 255, 0.12);
  color: #ddd;
  align-self: flex-start;
}

.message.error {
  background: #ff004c;
  color: white;
}

/* === INPUT === */
.input-area {
  display: flex;
  gap: 10px;
}

#userInput {
  flex: 1;
  padding: 12px 15px;
  border-radius: 12px;
  border: none;
  outline: none;
  font-size: 15px;
  background: #2a2a2a;
  color: white;
}

#sendBtn {
  padding: 12px 20px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #00aaff, #007bff);
  color: white;
  font-weight: 600;
  cursor: pointer;
  transition: 0.3s ease;
}

#sendBtn:hover {
  background: linear-gradient(135deg, #00c6ff, #0088ff);
}

/* === SCROLL === */
.messages::-webkit-scrollbar {
  width: 8px;
}
.messages::-webkit-scrollbar-thumb {
  background: #444;
  border-radius: 10px;
}

/* === MENSAJE DE ADVERTENCIA (CRÉDITOS) === */
.credit-warning {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(90deg, #ff004c, #ff6a00);
  color: white;
  padding: 12px 20px;
  border-radius: 12px;
  font-weight: bold;
  box-shadow: 0 0 15px rgba(255, 0, 100, 0.6);
  z-index: 9999;
  animation: fadeWarning 0.5s ease-in-out;
}

@keyframes fadeWarning {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
  .chat-container {
    flex-direction: column;
    align-items: center;
  }

  .avatar-section {
    width: 100%;
  }

  .chat-box {
    width: 100%;
  }

  #avatarVideo {
    width: 180px;
    height: 180px;
  }
}
