/* AliviaTuPanza IA — estilos compartidos de marca (crema + naranja), mobile-first */
:root {
  --crema: #FBF5EC;
  --tinta: #23201B;
  --naranja: #FF6600;
  --verde: #2E7D32;
  --burbuja-bot: #FFFFFF;
  --borde: rgba(35, 32, 27, 0.12);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--crema);
  color: var(--tinta);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-width: 640px;
  margin: 0 auto;
}

.header {
  padding: 12px 16px 10px;
  border-bottom: 1px solid var(--borde);
  background: var(--crema);
}
.header h1 {
  margin: 0;
  font-size: 17px;
  line-height: 1.3;
}
.header p {
  margin: 2px 0 0;
  font-size: 13px;
  opacity: 0.75;
}

.chat {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  -webkit-overflow-scrolling: touch;
}

.bubble {
  max-width: 85%;
  padding: 10px 13px;
  border-radius: 16px;
  font-size: 15px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: break-word;
}
.bubble.user {
  align-self: flex-end;
  background: var(--naranja);
  color: #fff;
  border-bottom-right-radius: 5px;
}
.bubble.bot {
  align-self: flex-start;
  background: var(--burbuja-bot);
  border: 1px solid var(--borde);
  border-bottom-left-radius: 5px;
}
.bubble.system {
  align-self: center;
  background: transparent;
  border: 1px dashed var(--borde);
  font-size: 13.5px;
  text-align: center;
}
.bubble a { color: var(--naranja); font-weight: 600; }
.bubble.user a { color: #fff; text-decoration: underline; }
.bubble img.attached {
  display: block;
  max-width: 180px;
  border-radius: 10px;
  margin-bottom: 6px;
}

.typing {
  align-self: flex-start;
  padding: 12px 16px;
}
.typing span {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin: 0 2px;
  border-radius: 50%;
  background: var(--tinta);
  opacity: 0.35;
  animation: blink 1.2s infinite;
}
.typing span:nth-child(2) { animation-delay: 0.2s; }
.typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 0.9; } }

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 6px 12px 8px;
}
.chip {
  border: 1px solid var(--naranja);
  background: #fff;
  color: var(--tinta);
  border-radius: 999px;
  padding: 8px 13px;
  font-size: 13.5px;
  font-family: inherit;
  cursor: pointer;
}
.chip:active { background: #ffe8d9; }

.cta {
  padding: 8px 12px;
  text-align: center;
}
.cta a {
  display: block;
  background: var(--verde);
  color: #fff;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 14px;
  border-radius: 12px;
}
.cta.pro-note {
  font-size: 13px;
  color: var(--verde);
  font-weight: 600;
}

.preview {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 12px 6px;
  padding: 6px 10px;
  background: #fff;
  border: 1px solid var(--borde);
  border-radius: 12px;
}
.preview img {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 8px;
}
.preview-label { flex: 1; font-size: 13px; opacity: 0.8; }
.preview button {
  border: none;
  background: transparent;
  font-size: 18px;
  cursor: pointer;
  color: var(--tinta);
  padding: 6px 10px;
}
.hidden { display: none !important; }

.composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 8px 12px;
  background: var(--crema);
  border-top: 1px solid var(--borde);
}
.composer textarea {
  flex: 1;
  resize: none;
  border: 1px solid var(--borde);
  border-radius: 18px;
  padding: 10px 14px;
  font-size: 16px; /* evita el zoom automático de iOS */
  font-family: inherit;
  background: #fff;
  color: var(--tinta);
  max-height: 110px;
  outline: none;
}
.composer textarea:focus { border-color: var(--naranja); }
.icon-btn {
  border: 1px solid var(--borde);
  background: #fff;
  border-radius: 50%;
  width: 42px;
  height: 42px;
  font-size: 19px;
  cursor: pointer;
  flex-shrink: 0;
}
.send-btn {
  border: none;
  background: var(--naranja);
  color: #fff;
  border-radius: 50%;
  width: 42px;
  height: 42px;
  font-size: 18px;
  cursor: pointer;
  flex-shrink: 0;
}
.send-btn:disabled, .icon-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.disclaimer {
  padding: 7px 14px calc(7px + env(safe-area-inset-bottom));
  font-size: 11px;
  line-height: 1.4;
  text-align: center;
  opacity: 0.7;
  border-top: 1px solid var(--borde);
  background: var(--crema);
}
