/* ── FUENTE ─────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700&display=swap');

/* ── FONDO KAWAII ───────────────────────────────────────── */
body {
  margin: 0;
  font-family: 'Nunito', sans-serif;
  background: linear-gradient(270deg, #ffd6eb, #e3c8ff, #c8e7ff);
  background-size: 600% 600%;
  animation: gradientMove 15s ease infinite;
  height: 100vh;
  display: flex;
  overflow: hidden;
}

@keyframes gradientMove {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* ── CONTENEDOR PRINCIPAL ───────────────────────────────── */
.chat-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: relative;
  overflow: hidden;
}

/* ── BOTÓN MENÚ ─────────────────────────────────────────── */
.menu-btn {
  position: fixed;
  top: 12px;
  left: 12px;
  background: rgba(255,255,255,0.92);
  border: none;
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 1.2em;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  z-index: 1100;
  transition: transform 0.2s;
}
.menu-btn:active { transform: scale(0.95); }

/* ── SIDEBAR ────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0;
  left: -300px;
  width: 280px;
  height: 100%;
  background: rgba(255,255,255,0.97);
  backdrop-filter: blur(10px);
  box-shadow: 4px 0 20px rgba(255,179,198,0.25);
  transition: left 0.3s ease;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  z-index: 1000;
}
.sidebar.open { left: 0; }

.sidebar-header {
  padding: 20px 18px 14px 18px;
  border-bottom: 2px dashed #ffe5ec;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.sidebar h2 {
  margin: 0;
  font-size: 1.3em;
  color: #ff477e;
  text-align: center;
  font-weight: 700;
}

.sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
}
.sidebar ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.sidebar ul li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 11px 12px;
  background: #ffffff;
  border: 1px solid #ffdeeb;
  border-radius: 14px;
  margin-bottom: 8px;
  cursor: pointer;
  font-size: 0.88em;
  color: #555;
  transition: all 0.2s ease;
}
.sidebar ul li:hover  { background: #fff0f3; transform: translateY(-1px); }
.sidebar ul li.pinned { background: #ffe4f0; border: 2px solid #ff69b4; }

.sidebar-actions-footer {
  padding: 14px 16px 22px 16px;
  border-top: 2px dashed #ffe5ec;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: rgba(255,255,255,0.95);
}

.kawaii-sidebar-btn {
  width: 100%;
  background: linear-gradient(135deg, #ffd6eb, #ffc8d6);
  border: none;
  border-radius: 18px;
  padding: 12px;
  font-size: 0.92em;
  font-weight: bold;
  color: #4a4a4a;
  cursor: pointer;
  box-shadow: 0 3px 8px rgba(255,179,198,0.3);
  transition: all 0.2s ease;
  box-sizing: border-box;
  font-family: inherit;
}
.kawaii-sidebar-btn:hover  { background: linear-gradient(135deg, #fffaee, #ffd6eb); transform: translateY(-2px); }
.kawaii-sidebar-btn:active { transform: translateY(0); }

.sidebar-footer {
  font-size: 0.95em;
  color: #ff477e;
  text-align: center;
  font-weight: bold;
  background: #ffe5ec;
  padding: 10px;
  border-radius: 14px;
  margin: 0;
}

/* Overlay oscuro cuando sidebar está abierto en móvil */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.3);
  z-index: 999;
}
.sidebar-overlay.active { display: block; }

/* ── HEADER ─────────────────────────────────────────────── */
.header {
  position: fixed;
  top: 10px;
  right: 16px;
  z-index: 1200;
}
.logo {
  font-size: 1.6em;
  color: #fff;
  font-weight: 700;
  text-shadow: 2px 2px 8px rgba(0,0,0,0.25);
  margin: 0;
  padding: 4px 14px;
  background: rgba(255,255,255,0.2);
  border-radius: 12px;
}

/* ── ÁREA PRINCIPAL ─────────────────────────────────────── */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 70px 10px 0 10px;
  overflow: hidden;
  min-height: 0;
}

.intro {
  font-size: 1.3em;
  text-align: center;
  color: #fff;
  margin: 0 0 14px 0;
  font-weight: 700;
  text-shadow: 2px 2px 6px rgba(0,0,0,0.2);
  background: rgba(255,255,255,0.2);
  padding: 12px 20px;
  border-radius: 18px;
  flex-shrink: 0;
}

/* ── MENSAJES ───────────────────────────────────────────── */
.messages {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  padding: 8px 4px 12px 4px;
  -webkit-overflow-scrolling: touch;
}

.bot {
  align-self: flex-start;
  background: linear-gradient(135deg, #c8e7ff, #e3c8ff);
  padding: 12px 16px;
  border-radius: 22px 22px 22px 5px;
  max-width: 82%;
  color: #333;
  font-size: 1em;
  font-weight: 500;
  box-shadow: 0 3px 10px rgba(0,0,0,0.08);
  word-wrap: break-word;
  line-height: 1.5;
}
.user {
  align-self: flex-end;
  background: linear-gradient(135deg, #ffd6eb, #ffc8d6);
  padding: 12px 16px;
  border-radius: 22px 22px 5px 22px;
  max-width: 82%;
  color: #333;
  font-size: 1em;
  font-weight: 500;
  text-align: right;
  box-shadow: 0 3px 10px rgba(0,0,0,0.08);
  word-wrap: break-word;
  line-height: 1.5;
}
.bot.thinking {
  opacity: 0.75;
  font-style: italic;
}
.bot.error {
  background: linear-gradient(135deg, #ffccd5, #ffb3c6);
  border: 1px solid #ff477e;
}

/* ── INPUT INFERIOR ─────────────────────────────────────── */
.footer {
  padding: 8px 10px 12px 10px;
  flex-shrink: 0;
}

.input-area {
  display: flex;
  align-items: center;
  background: rgba(255,255,255,0.9);
  border-radius: 28px;
  padding: 8px 12px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.1);
  gap: 8px;
}

.attach-btn {
  cursor: pointer;
  font-size: 1.2em;
  flex-shrink: 0;
  opacity: 0.7;
}

.input-area input[type="text"] {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 1em;
  outline: none;
  color: #555;
  font-family: inherit;
  min-width: 0;
}
.input-area input[type="text"]::placeholder { color: #bbb; }

.input-area button {
  background: linear-gradient(135deg, #ffd6eb, #e3c8ff);
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  cursor: pointer;
  font-size: 1.1em;
  color: #ff477e;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s;
}
.input-area button:active { transform: scale(0.92); }

/* ── RESPONSIVE MÓVIL ───────────────────────────────────── */
@media (max-width: 480px) {
  .intro {
    font-size: 1.05em;
    padding: 10px 14px;
  }
  .logo { font-size: 1.3em; }
  .bot, .user { font-size: 0.95em; max-width: 88%; }
  .main { padding-top: 65px; }
  .messages { gap: 8px; }
}
