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

:root {
  --bg-primary: #e5ddd5;
  --bg-white: #ffffff;
  --bg-bot: #ffffff;
  --bg-user: #dcf8c6;
  --text-primary: #303030;
  --text-secondary: #667781;
  --text-time: #667781;
  --accent: #128c7e;
  --accent-dark: #075e54;
  --border: #e0e0e0;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg-primary);
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
}

.chat-container {
  width: 100%;
  max-width: 450px;
  height: 100vh;
  max-height: 800px;
  background: var(--bg-white);
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.chat-header {
  background: var(--accent);
  color: white;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

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

.avatar svg {
  width: 24px;
  height: 24px;
}

.header-text h1 {
  font-size: 16px;
  font-weight: 600;
}

.status {
  font-size: 12px;
  opacity: 0.8;
}

.session-info {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
}

.session-id {
  font-family: monospace;
  background: rgba(255, 255, 255, 0.2);
  padding: 2px 6px;
  border-radius: 4px;
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-reset {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
}

.btn-reset:hover {
  background: rgba(255, 255, 255, 0.3);
}

.chat-estado {
  background: #f0f0f0;
  padding: 8px 16px;
  display: flex;
  justify-content: center;
  border-bottom: 1px solid var(--border);
}

.estado-badge {
  background: var(--accent);
  color: white;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--bg-primary);
}

.message {
  max-width: 80%;
  display: flex;
  flex-direction: column;
}

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

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

.message-content {
  padding: 8px 12px;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.message.bot .message-content {
  background: var(--bg-bot);
  border-top-left-radius: 0;
}

.message.user .message-content {
  background: var(--bg-user);
  border-top-right-radius: 0;
}

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

.message-content p:last-child {
  margin-bottom: 0;
}

.message-time {
  font-size: 10px;
  color: var(--text-time);
  margin-top: 2px;
}

.message.user .message-time {
  text-align: right;
}

.input-container {
  background: var(--bg-white);
  padding: 12px;
  display: flex;
  gap: 8px;
  border-top: 1px solid var(--border);
}

#message-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

#message-input:focus {
  border-color: var(--accent);
}

.btn-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.btn-send:hover {
  background: var(--accent-dark);
}

.btn-send svg {
  width: 20px;
  height: 20px;
}

.typing {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  background: var(--bg-bot);
  border-radius: 8px;
  width: fit-content;
  box-shadow: var(--shadow);
}

.typing-dot {
  width: 8px;
  height: 8px;
  background: var(--text-secondary);
  border-radius: 50%;
  animation: typing-bounce 1.4s infinite ease-in-out;
}

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

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

@media (max-width: 480px) {
  .chat-container {
    max-width: 100%;
    max-height: 100%;
  }
}