/* ---------- Fonts ---------- */
@font-face {
  font-family: Metro;
  src: url(./Resources/Metropolis-Regular.otf);
}
@font-face {
  font-family: Metro;
  src: url(./Resources/Metropolis-ExtraBold.otf);
  font-weight: bold;
}

/* ---------- Theme Tokens ---------- */
:root {
  --ink: #031624;            /* dark text */
  --teal: #044B4A;           /* accent teal */
  --mint: #5FBE92;           /* buttons / accents */
  --neon: #30FFA4;           /* neon highlight */
  --grey: #f0f0f0;           /* light grey bubble background */

  --header-blue: #04304a;    /* lighter dark blue header */
  --surface: #ffffff;        /* main white background */
  --text: #031624;
  --muted: rgba(3, 22, 36, 0.6);
  --shadow: rgba(0, 0, 0, 0.1);
}

/* ---------- Global ---------- */
html {
  box-sizing: border-box;
  font-family: 'Metro', 'Arial', Tahoma, Geneva, Verdana, sans-serif;
  font-size: 15px;
  height: 100%;
  width: 100%;
  margin: 0;
  padding: 0;
  background-color: transparent;
}
*, *::before, *::after { box-sizing: inherit; }

body {
  margin: 0;
  padding: 0;
  color: var(--text);
  background-color: var(--surface);
}

/* ---------- Chat Layout ---------- */
#chat-container {
  position: absolute;
  height: 100%;
  width: 100%;
  bottom: 0;
  right: 0;
  margin: 0;
  padding: 0;
  border-radius: 12px;
  border: none;
  background: #ffffff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  transition: width 0.25s ease-in-out, height 0.25s ease-in-out;
}

/* ---------- Header ---------- */
.chat-header {
  position: absolute;
  min-height: 30px;
  width: 100%;
  background-color: var(--header-blue); /* lighter deep blue header */
  color: var(--neon);                   /* neon text */
  padding: 10px 0;
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 2px 8px rgba(3, 22, 36, 0.4);
}

.top-title {
  font-family: 'Metro', 'Arial', Tahoma, Geneva, Verdana, sans-serif;
  font-weight: bold;
  font-size: 2rem;
  color: var(--neon);
  padding: 10px 0;
  text-align: center;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  text-shadow: 0 0 10px rgba(48, 255, 164, 0.6);
}

/* ---------- Chat Log ---------- */
#chat-log {
  margin-top: 50px;
  height: 100%;
  overflow-y: auto;
  padding: 16px;
  scroll-behavior: smooth;
  background-color: var(--surface);
}

/* Custom scrollbar (webkit) */
#chat-log::-webkit-scrollbar { width: 8px; }
#chat-log::-webkit-scrollbar-thumb {
  background-color: var(--mint);
  border-radius: 8px;
}
#chat-log::-webkit-scrollbar-track { background: transparent; }

/* ---------- Messages ---------- */
.message {
  display: flex;
  width: 100%;
  margin-bottom: 1.5rem;
  background: none;
  border-radius: 0;
}
.message strong { font-weight: bold; color: var(--text); }

.message .typing-anim {
  opacity: 0.7;
  font-style: italic;
  animation: floating-type-bubble 2s ease-in-out infinite, fade-in 0.25s ease-in forwards;
}
.message .typing-anim em {
  opacity: 0.8;
  color: var(--mint);
}

@keyframes floating-type-bubble {
  0% { transform: translateY(0.1rem); }
  50% { transform: translateY(-0.1rem); }
  100% { transform: translateY(0.1rem); }
}
@keyframes fade-in {
  0% { opacity: 0; }
  50% { opacity: 0.5; }
  100% { opacity: 1; }
}

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

/* ---------- Bubbles ---------- */
.bubble {
  padding: 12px 14px;
  border-radius: 14px;
  box-shadow: 0 2px 6px var(--shadow);
  max-width: 90%;
  word-break: break-word;
  line-height: 1.35;
  color: var(--text);
}

/* User bubble: neon green with dark text */
.user .bubble {
  background: var(--neon);
  color: var(--ink);
  margin-right: 0.5rem;
  border-bottom-right-radius: 6px;
}

/* Bot bubble: light grey with dark text */
.bot .bubble {
  background-color: var(--grey);
  color: var(--ink);
  margin-left: 0.5rem;
  margin-right: 1rem;
  border-bottom-left-radius: 6px;
}

/* --- Fixed square bot avatar --- */
.bot .avatar {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.bot .avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  border: 2px solid var(--mint);
  display: block;
}
.bot .avatar .bot-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 2px solid var(--mint);
  font-size: 24px;
  background: #fff;
}
/* --- end avatar fix --- */

/* Headings inside bot bubble */
.bot .bubble h2,
.bot .bubble h3 {
  font-weight: 600;
  margin: 0 0 0.75rem 0;
  font-size: 0.95rem;
  color: var(--teal);
}

/* Lists inside messages */
li { list-style: none; color: var(--text); }
li li { list-style: circle; }
ul { padding-left: 1.75rem; }

/* Tip text before feedback */
ul:has(+ .feedback) {
  color: var(--muted);
  font-style: italic;
  font-size: 0.95rem;
  margin: 0;
}

/* ---------- Feedback ---------- */
.feedback {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  margin-top: 1.25rem;
  color: var(--muted);
}
.feedback .feedback-label { color: var(--muted); }

.thumb {
  border: 1px solid rgba(95, 190, 146, 0.35);
  background: #fff;
  color: var(--ink);
  border-radius: 999px;
  padding: 6px 10px;
  cursor: pointer;
  line-height: 1;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.thumb:hover {
  transform: translateY(-1px) scale(1.06);
  border-color: var(--mint);
  background: #f4faf7;
}
.thumb.active {
  border-color: var(--neon);
  background: rgba(48, 255, 164, 0.15);
}

/* ---------- Input Area ---------- */
.input-area {
  margin: 0;
  padding: 14px;
  background: var(--surface);
  border-top: 1px solid #e9efec;
  border-radius: 0 0 12px 12px;
  justify-content: space-between;
  display: flex;
  gap: 10px;
}

.input-area #question-input {
  width: 100%;
  padding: 11px 12px;
  border-radius: 8px;
  border: 1px solid #d8e6e0;
  background: #ffffff;
  color: var(--ink);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.input-area #question-input::placeholder { color: rgba(3,22,36,0.55); }

.input-area #question-input:focus {
  border-color: var(--mint);
  box-shadow: 0 0 0 3px rgba(95, 190, 146, 0.25);
}

/* Send button */
.input-area #send-btn {
  padding: 11px 16px;
  border: none;
  background-color: var(--mint);
  color: var(--ink);
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
  transition: transform 0.12s ease, background-color 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 2px 6px rgba(95, 190, 146, 0.35);
}
.input-area #send-btn:hover {
  background-color: var(--neon);
  transform: translateY(-1px);
}
.input-area #send-btn:active {
  transform: translateY(0);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2) inset;
}

/* ---------- Reduced Motion ---------- */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------- High-contrast focus (keyboard users) ---------- */
:focus-visible {
  outline: 2px solid var(--mint);
  outline-offset: 2px;
  border-radius: 6px;
}
