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

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background-color: #ffffff;
  color: #333;
  line-height: 1.6;
}

.container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header IRTA */
.irta-header {
  background: linear-gradient(135deg, #c41e3a 0%, #a01729 100%);
  color: white;
  padding: 1rem 0;
  box-shadow: 0 2px 10px rgba(196, 30, 58, 0.3);
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo-section {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo-icon {
  background: rgba(255, 255, 255, 0.2);
  padding: 0.5rem;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-section h1 {
  font-size: 2rem;
  font-weight: bold;
  letter-spacing: 2px;
}

.subtitle {
  background: rgba(255, 255, 255, 0.2);
  padding: 0.3rem 0.8rem;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 500;
}

.header-nav {
  display: flex;
  gap: 2rem;
}

.nav-item {
  color: white;
  text-decoration: none;
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: 5px;
  transition: background-color 0.3s ease;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Main Content */
.main-content {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 2rem;
}

.chat-container {
  background: white;
  border-radius: 15px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  width: 100%;
  max-width: 800px;
  height: 760px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-header {
  background: linear-gradient(135deg, #c41e3a 0%, #a01729 100%);
  color: white;
  padding: 0.6rem 1rem;
  text-align: right;
}

.chat-header.compact { min-height: unset; }

.chat-header .header-actions { display: inline-flex; gap: 0.5rem; align-items: center; }

.btn-light {
  background: #ffffff;
  color: #a01729;
  border: 2px solid #ffffff;
  padding: 0.35rem 0.8rem;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
}

.btn-ghost {
  background: transparent;
  color: #ffffff;
  border: 2px solid rgba(255,255,255,0.6);
  padding: 0.35rem 0.8rem;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  text-decoration: none;
  display: inline-block;
}

.chat-messages {
  flex: 1;
  padding: 1.5rem;
  overflow-y: auto;
  background: #fafafa;
}

.message {
  display: flex;
  margin-bottom: 1.5rem;
  animation: fadeIn 0.3s ease-in;
}

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

.bot-message .message-avatar {
  background: linear-gradient(135deg, #c41e3a 0%, #a01729 100%);
  color: white;
}

.bot-message .message-avatar i {
  font-size: 1.2rem;
  color: white;
}

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

.user-message .message-avatar {
  background: #ffffff;
  color: #333;
  margin-right: 0;
  margin-left: 1rem;
  overflow: hidden;
  border: 2px solid #ff6b6b;
}

.user-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.message-content {
  flex: 1;
  background: white;
  padding: 1rem 1.2rem;
  border-radius: 15px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  position: relative;
}

.user-message .message-content {
  background: #ff6b6b;
  color: white;
}

.message-content p {
  margin-bottom: 0.5rem;
  word-wrap: break-word;
}

.message-meta { display: flex; align-items: center; justify-content: flex-start; gap: 0.75rem; margin-top: 0.25rem; }
.message-time { font-size: 0.8rem; opacity: 0.7; }

/* Valoracions */
.rating-controls {
  display: inline-flex;
  gap: 0.5rem;
  margin-top: 0.6rem;
}

.rating-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: #f3f3f3;
  color: #333;
  border: 1px solid #e3e3e3;
  border-radius: 999px;
  padding: 0.25rem 0.6rem;
  cursor: pointer;
  font-size: 0.85rem;
}

.rating-btn.selected {
  background: #e7f0ff;
  border-color: #c6d6ff;
}

.rating-btn.up:hover {
  background: #e7f6ec;
  border-color: #b6e0c8;
}

.rating-btn.down:hover {
  background: #fdeaea;
  border-color: #f1c2c2;
}

.rating-btn i {
  font-size: 0.95rem;
}

.rating-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.chat-input-container {
  padding: 1.5rem;
  background: white;
  border-top: 1px solid #eee;
}

.input-group {
  display: flex;
  gap: 1rem;
  align-items: center;
}

#messageInput {
  flex: 1;
  padding: 1rem 1.2rem;
  border: 2px solid #ddd;
  border-radius: 25px;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.3s ease;
}

#messageInput:focus {
  border-color: #c41e3a;
}

#sendButton {
  background: linear-gradient(135deg, #c41e3a 0%, #a01729 100%);
  color: white;
  border: none;
  padding: 1rem 1.5rem;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.1rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

#sendButton:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(196, 30, 58, 0.4);
}

#sendButton:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.typing-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-style: italic;
  color: #666;
}

.typing-dots {
  display: flex;
  gap: 0.2rem;
}

.typing-dots span {
  width: 6px;
  height: 6px;
  background: #c41e3a;
  border-radius: 50%;
  animation: typing 1.4s infinite ease-in-out;
}

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

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

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

@keyframes typing {
  0%,
  60%,
  100% {
    transform: translateY(0);
  }
  30% {
    transform: translateY(-10px);
  }
}

/* Responsive */
@media (max-width: 768px) {
  .header-nav {
    display: none;
  }

  .logo-section h1 {
    font-size: 1.5rem;
  }

  .chat-container {
    height: calc(100vh - 60px);
    margin: 1rem;
    border-radius: 10px;
  }

  .main-content {
    padding: 1rem;
  }
}
