@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Zilla+Slab:wght@700&display=swap');

:root {
  --moz-black: #000000;
  --moz-white: #ffffff;
  --moz-blue: #0060df;
  --moz-blue-hover: #003eaa;
  --moz-gray-light: #f9f9fb;
  --moz-gray-border: #cfcfd8;
  --moz-text: #15141a;
  --moz-text-muted: #5b5b66;
  --moz-yellow: #ffbd4f;
  --moz-red: #ff4f5e;
  --moz-green: #3fe1b0;
  --pastel-green: #e8f5e9;
  --sidebar-width: 260px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--moz-white);
  color: var(--moz-text);
  line-height: 1.5;
  height: 100vh;
  overflow: hidden;
}

.app-layout {
  display: flex;
  height: 100vh;
}

/* Sidebar */
.app-sidebar {
  width: var(--sidebar-width);
  background: var(--moz-gray-light);
  border-right: 1px solid var(--moz-gray-border);
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
}

.sidebar-header { margin-bottom: 2rem; }

.logo {
  font-family: 'Zilla Slab', serif;
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
}

.moz-m { color: var(--moz-blue); }

.btn-new-chat {
  width: 100%;
  padding: 0.8rem;
  background: var(--moz-white);
  border: 1px solid var(--moz-gray-border);
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-new-chat:hover { border-color: var(--moz-blue); color: var(--moz-blue); }

.chat-history {
  flex: 1;
  overflow-y: auto;
  margin-bottom: 1rem;
}

.history-item {
  padding: 0.6rem 0.8rem;
  border-radius: 6px;
  font-size: 0.9rem;
  color: var(--moz-text-muted);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.2rem;
}

.history-item:hover { background: var(--moz-gray-border); color: var(--moz-text); }
.history-item.active { background: var(--moz-gray-border); color: var(--moz-text); font-weight: 600; }

.sidebar-footer {
  padding-top: 1rem;
  border-top: 1px solid var(--moz-gray-border);
}

.accessibility-tools { display: flex; gap: 0.5rem; }
.accessibility-tools button {
  flex: 1;
  padding: 0.5rem;
  border: 1px solid var(--moz-gray-border);
  background: var(--moz-white);
  border-radius: 4px;
  cursor: pointer;
}

/* Main Chat Area */
.chat-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
}

.chat-header {
  padding: 1rem 0;
  border-bottom: 1px solid var(--moz-gray-border);
  background: var(--moz-white);
  z-index: 10;
}

.edition-label {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--moz-blue);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 2rem 0;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Welcome Screen */
.welcome-screen {
  text-align: center;
  padding-top: 10vh;
}

.hero-title {
  font-family: 'Zilla Slab', serif;
  font-size: 3.5rem;
  margin-bottom: 1rem;
}

.hero-subtitle {
  font-size: 1.2rem;
  color: var(--moz-text-muted);
}

/* Chat Bubbles */
.message-row {
  margin-bottom: 3rem;
}

.message-query {
  font-family: 'Zilla Slab', serif;
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
}

.sources-row {
  display: flex;
  gap: 0.8rem;
  overflow-x: auto;
  padding-bottom: 1rem;
  margin-bottom: 1.5rem;
}

.source-mini {
  flex: 0 0 180px;
  padding: 0.8rem;
  background: var(--moz-gray-light);
  border: 1px solid var(--moz-gray-border);
  border-radius: 8px;
  font-size: 0.8rem;
  cursor: pointer;
}

.source-mini:hover { border-color: var(--moz-blue); }
.source-mini-title { font-weight: 700; margin-bottom: 0.2rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.source-mini-url { color: var(--moz-text-muted); font-size: 0.7rem; }

.answer-row {
  font-size: 1.1rem;
  line-height: 1.6;
}

.answer-row p { margin-bottom: 1.2rem; }
.highlight { background: var(--pastel-green); padding: 0 2px; border-radius: 2px; }

.image-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.image-item { aspect-ratio: 16/9; border-radius: 8px; overflow: hidden; border: 1px solid var(--moz-gray-border); }
.image-item img { width: 100%; height: 100%; object-fit: cover; }

/* Input Area */
.input-area {
  padding: 2rem 0;
  background: linear-gradient(transparent, var(--moz-white) 20%);
}

.search-box {
  display: flex;
  align-items: flex-end;
  background: var(--moz-white);
  border: 2px solid var(--moz-black);
  border-radius: 12px;
  padding: 0.8rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

#query {
  flex: 1;
  border: none;
  background: transparent;
  padding: 0.5rem;
  font-size: 1.1rem;
  font-family: inherit;
  outline: none;
  resize: none;
  max-height: 200px;
}

#search-btn {
  background: var(--moz-blue);
  color: white;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s;
}

#search-btn:hover { background: var(--moz-blue-hover); }

.input-footer {
  text-align: center;
  font-size: 0.75rem;
  color: var(--moz-text-muted);
  margin-top: 0.8rem;
}

/* Accessibility */
body.high-contrast { background: #000; color: #fff; }
body.high-contrast .app-sidebar, 
body.high-contrast .chat-header,
body.high-contrast .search-box { background: #111; border-color: #fff; color: #fff; }

.hidden { display: none; }

@media (max-width: 768px) {
  .app-sidebar { display: none; }
  .hero-title { font-size: 2.5rem; }
}
