:root {
  --bg-body: #f4f9f4;
  --bg-card: #ffffff;
  --primary: #2e7d32;
  --primary-soft: #a5d6a7;
  --accent: #ffb74d;
  --text-main: #2f3b3a;
  --text-muted: #6b7b78;
  --border-soft: #d9e4dd;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: radial-gradient(circle at top left, #e8f5e9, #f4f9f4 40%, #fff);
  color: var(--text-main);
}

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

.header {
  text-align: center;
  padding: 16px;
}

.header h1 {
  margin: 0;
  font-size: 1.8rem;
  color: var(--primary);
}

.header p {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.main {
  flex: 1;
  display: flex;
  justify-content: center;
  padding: 8px 16px 16px;
}

.chat-container {
  background: var(--bg-card);
  width: 100%;
  max-width: 500px;
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-soft);
}

.chat-window {
  flex: 1;
  border-radius: 12px;
  padding: 10px;
  background: #f8fbf8;
  overflow-y: auto;
  max-height: 450px;
  margin-bottom: 10px;
}

.message {
  margin-bottom: 8px;
  line-height: 1.4;
  font-size: 0.95rem;
  display: flex;
}

.message span {
  padding: 8px 10px;
  border-radius: 12px;
  max-width: 80%;
}

.message.user {
  justify-content: flex-end;
}

.message.user span {
  background: var(--primary);
  color: white;
  border-bottom-right-radius: 2px;
}

.message.bot {
  justify-content: flex-start;
}

.message.bot span {
  background: #ffffff;
  border: 1px solid var(--primary-soft);
  color: var(--text-main);
  border-bottom-left-radius: 2px;
}

.chat-form {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

#user-input {
  flex: 1;
  padding: 10px;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  font-size: 0.95rem;
}

#user-input:focus {
  outline: none;
  border-color: var(--primary-soft);
  box-shadow: 0 0 0 2px rgba(46, 125, 50, 0.15);
}

button {
  border: none;
  border-radius: 999px;
  padding: 10px 16px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

button:hover {
  opacity: 0.95;
}

button:active {
  transform: scale(0.98);
}

.footer {
  text-align: center;
  padding: 10px 16px 14px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Responsive */
@media (max-width: 600px) {
  .chat-container {
    padding: 12px;
  }

  .header h1 {
    font-size: 1.5rem;
  }
}

/* Estilos para la tabla de dieta dentro del mensaje del bot */
.message.bot table.dieta {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
  font-size: 0.85rem;
}

.message.bot table.dieta thead {
  background: #2e7d32;
  color: #ffffff;
}

.message.bot table.dieta th,
.message.bot table.dieta td {
  border: 1px solid #d9e4dd;
  padding: 6px 8px;
  text-align: left;
}

.message.bot table.dieta tbody tr:nth-child(even) {
  background: #f4f9f4;
}
