:root {
  --bg: #faf7fb;
  --card: #ffffff;
  --primary: #6a1b9a;
  --primary-dark: #4a148c;
  --accent: #e91e63;
  --text: #1a1a1a;
  --muted: #6b6b6b;
  --border: #e7e3ea;
  --shadow: 0 4px 14px rgba(106, 27, 154, 0.08);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
#google_translate_element { position: absolute; left: -9999px; top: -9999px; }
.goog-te-banner-frame, .skiptranslate { display: none !important; }
body { top: 0 !important; }

.topbar {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: var(--shadow);
}
.brand {
  display: flex; align-items: center; gap: 12px;
  background: none; border: none; color: inherit;
  cursor: pointer; padding: 0; text-align: left;
  font: inherit;
}
.brand:hover .logo { transform: scale(1.08); }
.brand-text { display: flex; flex-direction: column; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.eu-flag {
  height: 28px; width: auto; border-radius: 4px;
  box-shadow: 0 1px 4px rgba(0,0,0,.25);
}
.logo {
  background: rgba(255,255,255,.18);
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center; font-size: 20px;
  transition: transform .15s ease;
}
.topbar h1 { margin: 0; font-size: 1.15rem; }
.tagline { margin: 0; font-size: .78rem; opacity: .9; }
.lang-btn {
  background: rgba(255,255,255,.18);
  color: #fff; border: 1px solid rgba(255,255,255,.3);
  padding: 8px 12px; border-radius: 999px; cursor: pointer;
  font-size: .85rem;
}
.lang-btn:hover { background: rgba(255,255,255,.28); }

main {
  flex: 1;
  width: 100%;
  max-width: 880px;
  margin: 0 auto;
  padding: 18px;
}
.screen { display: none; animation: fade .25s ease; }
.screen.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

h2 { color: var(--primary-dark); margin-top: 8px; }
.muted { color: var(--muted); font-size: .92rem; }
.back {
  background: none; border: none; color: var(--primary);
  cursor: pointer; padding: 6px 0; font-size: .95rem;
}
.back:hover { text-decoration: underline; }

.grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  margin-top: 14px;
}
.grid.cards { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.card, .lang-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  text-align: left;
  cursor: pointer;
  transition: all .15s ease;
  box-shadow: var(--shadow);
  font: inherit;
  color: inherit;
}
.card:hover, .lang-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
}
.card .icon { font-size: 1.6rem; display: block; margin-bottom: 6px; }
.card-highlight {
  background: linear-gradient(135deg, #f3e5f5, #fce4ec);
  border-color: var(--primary);
}
.card-highlight strong { color: var(--primary-dark); }
.card strong { display: block; color: var(--primary-dark); }
.card small { color: var(--muted); }

.lang-card { text-align: center; }
.lang-card .native { display: block; font-weight: 600; }
.lang-card .en { display: block; font-size: .8rem; color: var(--muted); }

.more { margin-top: 16px; }
.more summary { cursor: pointer; color: var(--primary); padding: 8px 0; }

.chat {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  min-height: 320px;
  max-height: 60vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
  margin-top: 10px;
}
.msg { margin: 10px 0; display: flex; }
.msg .bubble {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 16px;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.msg.user { justify-content: flex-end; }
.msg.user .bubble { background: var(--primary); color: #fff; border-bottom-right-radius: 4px; }
.msg.bot .bubble { background: #f3eef7; border-bottom-left-radius: 4px; }
.msg.bot .source {
  display: block; margin-top: 8px; padding-top: 8px;
  border-top: 1px dashed #ccc; font-size: .82rem; color: var(--muted);
}
.msg.bot .source a { color: var(--primary); }

.composer {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.composer input {
  flex: 1;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 1rem;
  background: #fff;
}
.composer input:focus { outline: 2px solid var(--primary); }
.composer button {
  background: var(--primary); color: #fff;
  border: none; width: 48px; border-radius: 50%;
  cursor: pointer; font-size: 1.2rem;
}
.composer button:hover { background: var(--primary-dark); }

.escalate {
  display: block;
  margin: 14px auto 0;
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 12px 18px;
  border-radius: 999px;
  font-size: .95rem;
  cursor: pointer;
  box-shadow: var(--shadow);
}
.escalate:hover { filter: brightness(1.05); }

.suggestions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.suggestions button {
  background: #fff;
  border: 1px solid var(--primary);
  color: var(--primary);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: .82rem;
  cursor: pointer;
}
.suggestions button:hover { background: var(--primary); color: #fff; }

.footer {
  text-align: center;
  padding: 16px;
  color: var(--muted);
  font-size: .8rem;
  border-top: 1px solid var(--border);
  background: #fff;
}
.footer strong { color: var(--accent); }

/* Documentation list */
.doc-cat { margin-top: 16px; }
.doc-cat h3 {
  color: var(--primary-dark);
  border-bottom: 2px solid var(--border);
  padding-bottom: 6px;
  margin-bottom: 8px;
  font-size: 1.05rem;
}
.doc-cat ul { list-style: none; padding: 0; margin: 0; }
.doc-cat li {
  padding: 10px 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 6px;
  display: flex; align-items: center; gap: 10px;
  box-shadow: var(--shadow);
}
.doc-cat li a {
  flex: 1;
  color: var(--primary-dark);
  text-decoration: none;
  font-size: .92rem;
}
.doc-cat li a:hover { text-decoration: underline; }
.doc-cat li .pdf-icon { font-size: 1.3rem; }

/* Chat typing indicator */
.typing { display: inline-block; }
.typing span {
  display: inline-block; width: 6px; height: 6px;
  margin: 0 1px; background: var(--primary); border-radius: 50%;
  animation: blink 1.2s infinite;
}
.typing span:nth-child(2) { animation-delay: .2s; }
.typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 60%, 100% { opacity: .3; } 30% { opacity: 1; } }

@media (max-width: 480px) {
  .topbar h1 { font-size: 1rem; }
  .tagline { display: none; }
  main { padding: 12px; }
  .chat { min-height: 260px; }
}
