:root {
  --primary: #0066ff;
  --primary-dark: #0052cc;
  --secondary: #00c9b7;
  --dark: #1a1a2e;
  --light: #f8f9fa;
  --gray: #6c757d;
  --gradient: linear-gradient(135deg, var(--primary), var(--secondary));
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  --transition: all 0.3s ease;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Poppins', sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.chat-container {
  width: 100%;
  max-width: 800px;
  height: 90vh;
  background: white;
  border-radius: 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Header del Chat */
.chat-header {
  background: var(--gradient);
  color: white;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.back-button {
  color: white;
  font-size: 1.2rem;
  padding: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  transition: var(--transition);
}

.back-button:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateX(-3px);
}

.chat-title {
  display: flex;
  align-items: center;
  gap: 15px;
}

.chat-avatar {
  width: 50px;
  height: 50px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.chat-title h1 {
  font-family: 'Montserrat', sans-serif;
  font-size: 1.5rem;
  margin-bottom: 2px;
}

.chat-title p {
  font-size: 0.9rem;
  opacity: 0.9;
}

.restart-chat {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  padding: 10px;
  border-radius: 50%;
  cursor: pointer;
  transition: var(--transition);
  font-size: 1rem;
}

.restart-chat:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: rotate(180deg);
}

/* Mensajes del Chat */
.chat-messages {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  background: #f8f9fa;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.message {
  display: flex;
  gap: 12px;
  max-width: 80%;
  animation: fadeInUp 0.3s ease;
}

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

.message.ai-message {
  align-self: flex-start;
}

.message-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.user-message .message-avatar {
  background: var(--gradient);
  color: white;
}

.ai-message .message-avatar {
  background: #e9ecef;
  color: var(--dark);
}

.message-content {
  background: white;
  padding: 15px;
  border-radius: 18px;
  box-shadow: var(--shadow);
  position: relative;
}

.user-message .message-content {
  background: var(--gradient);
  color: white;
  border-bottom-right-radius: 5px;
}

.ai-message .message-content {
  border-bottom-left-radius: 5px;
  border: 1px solid #e9ecef;
}

.message-content p {
  margin-bottom: 5px;
  line-height: 1.4;
}

.message-time {
  font-size: 0.75rem;
  opacity: 0.7;
}

/* Input del Chat */
.chat-input-container {
  padding: 20px;
  background: white;
  border-top: 1px solid #e9ecef;
}

.input-wrapper {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
}

#inputUsuario {
  flex: 1;
  padding: 15px 20px;
  border: 2px solid #e9ecef;
  border-radius: 25px;
  font-family: 'Poppins', sans-serif;
  font-size: 14px;
  transition: var(--transition);
  background: #f8f9fa;
}

#inputUsuario:focus {
  outline: none;
  border-color: var(--primary);
  background: white;
  box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1);
}

.send-button {
  background: var(--gradient);
  color: white;
  border: none;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.send-button:hover {
  transform: scale(1.05);
  box-shadow: 0 5px 15px rgba(0, 102, 255, 0.3);
}

.send-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Acciones Rápidas */
.quick-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.quick-action {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  padding: 8px 15px;
  border-radius: 20px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--dark);
}

.quick-action:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  transform: translateY(-2px);
}

/* Mensaje Legal */
.legal-notice {
  background: #fff3cd;
  border-left: 4px solid #ffa500;
  padding: 15px;
  margin: 0 20px 20px;
  border-radius: 8px;
}

.legal-notice p {
  font-size: 0.8rem;
  color: #856404;
  margin: 0;
  line-height: 1.4;
}

.legal-notice strong {
  font-weight: 600;
}

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

@keyframes typing {
  0%, 60%, 100% {
    opacity: 0.4;
  }
  30% {
    opacity: 1;
  }
}

.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 10px 0;
}

.typing-dot {
  width: 8px;
  height: 8px;
  background: var(--gray);
  border-radius: 50%;
  animation: typing 1.4s infinite;
}

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

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

/* Responsive */
@media (max-width: 768px) {
  body {
    padding: 10px;
    height: 100vh;
  }
  
  .chat-container {
    height: 95vh;
    border-radius: 15px;
  }
  
  .message {
    max-width: 90%;
  }
  
  .chat-header {
    padding: 15px;
  }
  
  .chat-title h1 {
    font-size: 1.3rem;
  }
  
  .quick-actions {
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 5px;
  }
  
  .quick-action {
    flex-shrink: 0;
  }
}

@media (max-width: 480px) {
  .chat-messages {
    padding: 15px;
  }
  
  .chat-input-container {
    padding: 15px;
  }
  
  .message {
    max-width: 95%;
  }
  
  .message-content {
    padding: 12px;
  }
  
  .legal-notice {
    margin: 0 15px 15px;
  }
}