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

body {
  font-family: system-ui, -apple-system, sans-serif;
  background: #f5f5f5;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  background: #1a1a2e;
  color: #eee;
  padding: 12px 20px;
}

.alert-message {
  text-align: center;
  font-style: italic;
  font-size: 12px;
  padding: 10px 0px;
  background: lightpink;
}

.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0 auto;
}

.nav-title {
  font-size: 16px;
  font-weight: 600;
}

.nav-links {
  display: flex;
  gap: 20px;
}

.nav-link {
  color: #eee;
  text-decoration: none;
  font-size: 15px;
  transition: opacity 0.2s;
}

.nav-link:hover {
  opacity: 0.8;
}

#messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.msg {
  border-radius: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
  padding: 10px 14px;
}

.msg.user {
  align-self: flex-end;
  background: #1a1a2e;
  color: #fff;
}

.msg.assistant {
  align-self: flex-start;
  background: #fff;
  color: #222;
  border: 1px solid #ddd;
}

.msg.error {
  align-self: center;
  background: #fee;
  color: #900;
  border: 1px solid #fcc;
  font-size: 14px;
}

.msg.tool-info {
  align-self: center;
  background: #eef6ff;
  color: #456;
  border: 1px solid #cde;
  font-size: 13px;
  max-width: 90%;
}

#input-area {
  display: flex;
  gap: 8px;
  padding: 12px 20px;
  background: #fff;
  border-top: 1px solid #ddd;
}

#input-area textarea {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 15px;
  font-family: inherit;
  resize: none;
  min-height: 44px;
  max-height: 120px;
}

#input-area textarea:focus {
  outline: none;
  border-color: #1a1a2e;
}

#input-area button {
  padding: 10px 20px;
  background: #1a1a2e;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  cursor: pointer;
}

#input-area button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.typing {
  align-self: flex-start;
  color: #888;
  font-style: italic;
  padding: 8px 14px;
  flex-shrink: 0;
}

.typing-bar {
  margin-top: 6px;
  width: 120px;
  height: 4px;
  background: #e0e0e0;
  border-radius: 2px;
  overflow: hidden;
}

.typing-bar::after {
  content: "";
  display: block;
  width: 40%;
  height: 100%;
  background: #1a1a2e;
  border-radius: 2px;
  animation: typing-slide 1.2s ease-in-out infinite;
}

@keyframes typing-slide {
  0% { transform: translateX(-100%); }
  50% { transform: translateX(200%); }
  100% { transform: translateX(-100%); }
}

.debug-entry {
  background: #1a1a2e;
  color: #cfd8dc;
  font-family: "SF Mono", "Cascadia Mono", "Consolas", monospace;
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 6px;
  white-space: pre-wrap;
  word-break: break-all;
}

/* About page styles */
main {
  flex: 1;
  overflow-y: auto;
}

.about-section {
  max-width: 800px;
  margin: 30px auto;
  padding: 20px;
}

.about-section h1 {
  font-size: 24px;
  margin-bottom: 20px;
  color: #1a1a2e;
}

.about-section h2 {
  font-size: 18px;
  margin-top: 25px;
  margin-bottom: 10px;
  color: #333;
}

.about-section p {
  line-height: 1.6;
  color: #444;
  margin-bottom: 10px;
}

.about-section ul {
  margin-left: 20px;
  line-height: 1.8;
  color: #444;
}

.about-section li {
  margin-bottom: 8px;
}

.about-section.logos {
  display: flex;
  justify-content: center;
}

.tool-details {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 12px;
}

.tool-details[open] {
  background: #fafafa;
}

.tool-details summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 16px;
  color: #1a1a2e;
  list-style: none;
}

.tool-details summary::-webkit-details-marker {
  display: none;
}

.tool-details summary:hover {
  color: #333;
}

.tool-details summary::before {
  content: "▶ ";
  font-size: 12px;
  margin-right: 5px;
  display: inline-block;
  transition: transform 0.2s;
}

.tool-details[open] summary::before {
  transform: rotate(90deg);
}

.tool-description {
  margin-top: 10px;
  padding-left: 15px;
  color: #555;
  line-height: 1.6;
}

.about-section a {
  color: #1a1a2e;
  text-decoration: none;
}

.about-section a:hover {
  text-decoration: underline;
}

.msg summary {
  cursor: pointer;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
  font-style: italic;
  margin-bottom: 5px;
}

.msg.user summary { color: rgba(255,255,255,0.8); }
.msg.user summary::after { background: rgba(255,255,255,0.3); }

.msg.error summary { color: #900; }
.msg.error summary::after { background: #fcc; }

.msg.force {
  align-self: stretch;
  max-width: 100%;
  background: #97c2f2;
  color: #130436;
  border: 1px solid #111050;
}

.msg.table {
  max-width: 100%;
  background: #97c2f2;
  color: #130436;
  border: 1px solid #111050;
}

.msg.table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  display: table;
  white-space: normal;
  border: 1px solid #75adec;
}

.msg.table th,
.msg.table td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid #75adec;
}

.msg.table th {
  background: #75adec;
  color: #130436;
  font-weight: 600;
}

.msg.table tr:hover td {
  background: #85b8f0;
}

.msg.chart {
  align-self: stretch;
  max-width: 100%;
  background: #97c2f2;
  color: #130436;
  border: 1px solid #111050;
}

.msg.chart canvas {
  background: #fff;
  border-radius: 6px;
}

/* Markdown rendered content */
.markdown {
  white-space: normal;
}

.markdown p {
  margin-bottom: 0.5em;
}

.markdown p:last-child {
  margin-bottom: 0;
}

.markdown ul, .markdown ol {
  margin: 0.3em 0 0.5em 1.5em;
}

.markdown li {
  margin-bottom: 0.2em;
}

.markdown h1, .markdown h2, .markdown h3 {
  margin: 0.6em 0 0.3em;
}

.markdown h1 { font-size: 1.3em; }
.markdown h2 { font-size: 1.15em; }
.markdown h3 { font-size: 1.05em; }

.markdown code {
  background: rgba(0,0,0,0.06);
  padding: 2px 5px;
  border-radius: 3px;
  font-size: 0.9em;
}

.markdown pre {
  background: rgba(0,0,0,0.06);
  padding: 8px 12px;
  border-radius: 6px;
  overflow-x: auto;
  margin: 0.4em 0;
}

.markdown pre code {
  background: none;
  padding: 0;
}

.markdown a {
  color: #1a5fb4;
  text-decoration: underline;
}

.markdown strong {
  font-weight: 600;
}

.markdown table {
  border-collapse: collapse;
  margin: 0.4em 0;
  font-size: 0.9em;
}

.markdown th, .markdown td {
  border: 1px solid #ddd;
  padding: 4px 8px;
}

.markdown th {
  background: rgba(0,0,0,0.04);
}

.markdown blockquote {
  border-left: 3px solid #ccc;
  padding-left: 10px;
  margin: 0.4em 0;
  color: #555;
}
