* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f5f6f8;
  color: #1f2933;
}

/* HEADER */
.site-header {
  background: #ffffff;
  border-bottom: 1px solid #e0e4ea;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
  position: sticky;
  top: 0;
  z-index: 999;
  transition: all 0.25s ease;
}

/* Cuando se hace scroll o se usa el chat, el hero azul desaparece */
.site-header.shrink .header-main {
  height: 0;
  opacity: 0;
  overflow: hidden;
  padding: 0;
  margin: 0;
  pointer-events: none;
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 14px 22px;
}

.header-top {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 8px;
}

.assoc-brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: #0f172a;
  font-weight: 600;
  font-size: 1.05rem;
}

.assoc-logo {
  height: 80px;
  width: auto;
  object-fit: contain;
}

/* HERO */
.header-main {
  margin-top: 14px;
  padding: 28px 26px;
  border-radius: 20px;
  background: linear-gradient(135deg, #0a3d61, #1a73b8);
  display: flex;
  align-items: center;
  gap: 28px;
  flex-wrap: wrap;
  transition: 0.2s ease;
}

.hero-text {
  flex: 1 1 320px;
}

.hero-text h1 {
  margin: 0 0 12px;
  font-size: 2.7rem;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 3px 8px rgba(0,0,0,0.45);
}

.hero-text p {
  margin: 0;
  font-size: 1.25rem;
  max-width: 520px;
  color: #f8fafc;
  line-height: 1.55;
  text-shadow: 0 2px 6px rgba(0,0,0,0.35);
}

.hero-illustration img {
  max-width: 240px;
  border-radius: 14px;
  border: 3px solid rgba(255,255,255,0.8);
  box-shadow: 0 8px 18px rgba(0,0,0,0.25);
  background: #fff;
}

/* CONTENIDO */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 22px 60px;
}

.section-card {
  background: #ffffff;
  border-radius: 18px;
  padding: 24px;
  margin-bottom: 26px;
  box-shadow: 0 4px 12px rgba(15,23,42,0.05);
  border: 1px solid #e1e4ea;
}

h2 {
  margin-top: 0;
  font-size: 1.55rem;
  color: #0f172a;
  font-weight: 700;
}

/* CHAT */
.chat-wrapper {
  border-radius: 18px;
  border: 1px solid #E4E7EB;
  background: #ffffff;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 420px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.12);
}

.chat-header {
  background: #0f172a;
  color: #f9fafb;
  padding: 14px 20px;
}

.chat-title {
  font-weight: 700;
  text-align: center;
  letter-spacing: 0.03em;
}

.chat-box {
  flex: 1;
  padding: 22px;
  overflow-y: auto;
  background: #f3f4f6;
  font-size: 1.1rem;
  line-height: 1.7;
}

.message {
  margin: 14px 0;
  padding: 14px 18px;
  border-radius: 16px;
  max-width: 90%;
  line-height: 1.7;
}

.message.user {
  margin-left: auto;
  background: #dceafe;
}

.message.bot {
  margin-right: auto;
  background: #ffffff;
  border: 1px solid #E5E7EB;
  white-space: pre-wrap;
}

.chat-input {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: #ffffff;
  border-top: 1px solid #E5E7EB;
}

.chat-input input {
  flex: 1;
  min-width: 0;
  padding: 12px 18px;
  border-radius: 999px;
  border: 1px solid #CBD5E1;
  font-size: 1.05rem;
}

.chat-input button {
  padding: 12px 20px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 1.05rem;
  border: none;
  cursor: pointer;
}

.btn-send { background: #2563EB; color: #fff; }

.btn-voice {
  background: #10b981;
  color: #fff;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

/* Micrófono agrandado y con halo cuando está grabando */
.btn-voice.recording {
  transform: scale(1.35);
  box-shadow: 0 0 0 5px rgba(16,185,129,0.4);
  background: #059669;
}

/* En móviles, el chat ocupa casi toda la pantalla y el input queda siempre visible */
@media (max-width: 768px) {
  .container {
    padding: 16px 10px 40px;
  }

  #chat-area {
    padding: 12px;
    margin-bottom: 0;
  }

  .chat-wrapper {
    min-height: calc(100vh - 170px); /* header + margen */
  }

  .chat-box {
    padding-bottom: 80px;
  }

  .chat-input {
    position: sticky;
    bottom: 0;
    z-index: 5;
  }
}

/* Botón "Volver arriba" */
#back-to-top {
  position: fixed;
  right: 16px;
  bottom: 16px;
  padding: 8px 14px;
  border-radius: 999px;
  border: none;
  background: #0f172a;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  transform: translateY(8px);
}

#back-to-top.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
