/*
  Агент ДЗ — warm cream theme for Chainlit 2.x
  Chainlit 2.x uses Tailwind + shadcn: theming is done by overriding
  the HSL CSS variables below (format: "H S% L%", consumed as hsl(var(--x))).
  This file is loaded AFTER the app bundle, so these overrides win by source order.
*/

:root,
.light,
html.light,
html {
  --background:            40 20% 97%;   /* #FAF9F7 page background        */
  --foreground:            40 6% 10%;    /* #1C1B19 main text              */

  --card:                  0 0% 100%;    /* white cards / inputs           */
  --card-foreground:       40 6% 10%;

  --popover:               0 0% 100%;
  --popover-foreground:    40 6% 10%;

  --primary:               35 32% 41%;   /* #8B6F47 warm brown accent      */
  --primary-foreground:    0 0% 100%;

  --muted:                 38 14% 90%;
  --muted-foreground:      40 6% 38%;

  --accent:                38 17% 92%;
  --accent-foreground:     40 8% 18%;

  --border:                40 12% 87%;
  --input:                 40 12% 87%;

  --sidebar-background:    38 17% 91%;    /* #EDE9E3 warm beige sidebar     */
  --sidebar-foreground:    40 8% 26%;
  --sidebar-accent:        38 16% 86%;
  --sidebar-accent-foreground: 40 10% 18%;
  --sidebar-border:        40 12% 84%;
}

/* Make sure the body/app surface picks up the warm background */
body,
#root {
  background-color: hsl(var(--background)) !important;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif !important;
}

/* Inline code — warm tint */
:not(pre) > code {
  background-color: hsl(38 20% 91%) !important;
  color: hsl(40 8% 18%) !important;
  padding: 1px 5px;
  border-radius: 4px;
}

/* Code blocks — dark so syntax colours are readable */
pre {
  background-color: #2a2520 !important;
  border-radius: 8px !important;
}
pre code {
  background-color: transparent !important;
  color: #f0ebe3 !important;
}

/* Confidence line */
small.conf-line {
  color: #b0a898;
  font-size: 0.78em;
  line-height: 1.4;
}

/* Collapsible details block */
details.agent-details {
  margin: 6px 0 2px;
  border: 1px solid hsl(40 12% 84%);
  border-radius: 6px;
  padding: 0 10px;
  background: hsl(38 17% 96%);
}
details.agent-details summary {
  cursor: pointer;
  font-size: 0.78em;
  color: #b0a898;
  padding: 5px 0;
  user-select: none;
  list-style: none;
  outline: none;
}
details.agent-details summary::-webkit-details-marker { display: none; }
details.agent-details summary::before { content: "▶ "; font-size: 0.7em; opacity: .7; }
details.agent-details[open] summary::before { content: "▼ "; }
details.agent-details[open] { padding-bottom: 8px; }

/* ── Hide Chainlit watermark & login brand ───────────────────────────────── */
a[href*="chainlit.io"],
a[href*="github.com/Chainlit"],
[class*="watermark"],
[class*="powered-by"],
footer a[href*="chainlit"] {
  display: none !important;
}

/* Login page: hide the default Chainlit pink-flower SVG logo */
/* Chainlit's flower/clover logo uses viewBox="0 0 56 56" */
header svg[viewBox="0 0 56 56"],
header a > svg:first-child,
header a > img[alt*="hainlit"],
header a > img[alt*="Logo"] {
  display: none !important;
}

/* Login page: replace the "Chainlit" header text with our brand */
header a[href="/"] span,
header a[href="/"] p,
header a > span:only-child {
  visibility: hidden;
  position: relative;
}
header a[href="/"] span::before,
header a[href="/"] p::before,
header a > span:only-child::before {
  content: "Агент ДЗ";
  visibility: visible;
  position: absolute;
  left: 0;
  font-weight: 700;
  color: #1C1B19;
  white-space: nowrap;
}

/* ── Markdown tables ─────────────────────────────────────────────────────── */
.message-content table,
[class*="message"] table,
.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875em;
  margin: 10px 0;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid hsl(40 12% 84%);
}
.message-content thead tr,
[class*="message"] thead tr,
.prose thead tr {
  background-color: hsl(38 17% 91%);
  color: hsl(40 8% 18%);
  font-weight: 600;
  text-align: left;
}
.message-content th,
[class*="message"] th,
.prose th {
  padding: 8px 14px;
  border-bottom: 2px solid hsl(40 12% 82%);
  white-space: nowrap;
}
.message-content td,
[class*="message"] td,
.prose td {
  padding: 7px 14px;
  border-bottom: 1px solid hsl(40 12% 89%);
  color: hsl(40 6% 18%);
}
.message-content tbody tr:last-child td,
[class*="message"] tbody tr:last-child td,
.prose tbody tr:last-child td {
  border-bottom: none;
}
.message-content tbody tr:nth-child(even),
[class*="message"] tbody tr:nth-child(even),
.prose tbody tr:nth-child(even) {
  background-color: hsl(38 17% 97%);
}
.message-content tbody tr:hover,
[class*="message"] tbody tr:hover,
.prose tbody tr:hover {
  background-color: hsl(38 20% 93%);
}

/* Slim, unobtrusive scrollbars */
::-webkit-scrollbar       { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(60,50,35,0.18); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(60,50,35,0.32); }
