/* assets/style.css
   ------------------------------------------------------
   Jednoduchý, přívětivý UI. Vše centrované.
   Light/Dark theme přes třídu na <html>.
   ------------------------------------------------------ */

:root {
  --bg: #f6f7fb;
  --panel: #ffffff;
  --text: #12131a;
  --muted: #6b6f7a;
  --border: #e6e7ee;
  --primary: #2b6cff;
  --secondary: #eef1ff;

  --ok: #1fbf4a;
  --bad: #ff3b3b;
}

html.theme-dark {
  --bg: #0f1117;
  --panel: #161a22;
  --text: #eef2ff;
  --muted: #aab2c5;
  --border: #2a3140;
  --primary: #7aa2ff;
  --secondary: #20263a;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.app {
  max-width: 980px;
  margin: 0 auto;
  padding: 16px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid var(--border);
}
.title { font-weight: 700; }
.subtitle { font-size: 12px; color: var(--muted); }

.actions { display: flex; align-items: center; gap: 10px; }

.led-wrap { display: flex; align-items: center; gap: 8px; }
.led {
  width: 12px; height: 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  display: inline-block;
}
.led-unknown { background: #999; }
.led-ok { background: var(--ok); }
.led-bad { background: var(--bad); }
.led-text { font-size: 12px; color: var(--muted); }

.content { margin-top: 14px; }
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
}

.tabs {
  display: flex;
  gap: 6px;
  padding: 10px;
  border-bottom: 1px solid var(--border);
}
.tab {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  border-radius: 999px;
  padding: 8px 12px;
  cursor: pointer;
}
.tab.active {
  background: var(--secondary);
  border-color: transparent;
}

.tab-body { padding: 12px; }
.hidden { display: none !important; }

.chat {
  height: 52vh;
  min-height: 320px;
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(0,0,0,0.02);
}

.bubble {
  margin: 10px 0;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
}
.bubble.user {
  background: var(--secondary);
  margin-left: 10%;
}
.bubble.assistant {
  background: var(--panel);
  margin-right: 10%;
}
.bubble-head {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}
.bubble-body {
  white-space: pre-wrap;
  line-height: 1.4;
}

.sources {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
}
.sources summary {
  cursor: pointer;
  color: var(--muted);
}
.sources-list {
  margin-top: 8px;
  font-size: 13px;
  color: var(--text);
}
.source-item { padding: 4px 0; }

.thinking {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0;
  color: var(--muted);
}
.spinner {
  width: 16px; height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 999px;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.composer {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}
.prompt {
  flex: 1;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  resize: vertical;
}
.btn {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px 12px;
  cursor: pointer;
  color: var(--text);
  background: transparent;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: transparent;
}
.btn-secondary {
  background: var(--secondary);
  border-color: transparent;
}

.footer {
  margin-top: 12px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}
.footer a { color: var(--muted); text-decoration: none; }

.rating { margin-top: 12px; display: flex; align-items: center; gap: 12px; }
.stars { display: flex; gap: 6px; }
.star {
  font-size: 22px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 6px 10px;
  cursor: pointer;
}
.rating-msg { font-size: 13px; color: var(--muted); }

.knowledge-item {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  margin: 8px 0;
}


/* ------------------------------------------------------
   Vylepšení UI: čitelnější typografie, focus stavy, jemné stíny
   ------------------------------------------------------ */

:root {
  --shadow: 0 10px 30px rgba(18,19,26,0.06);
  --shadow2: 0 6px 18px rgba(18,19,26,0.08);
  --ring: 0 0 0 4px rgba(43,108,255,0.15);
}

html.theme-dark {
  --shadow: 0 10px 30px rgba(0,0,0,0.35);
  --shadow2: 0 6px 18px rgba(0,0,0,0.45);
  --ring: 0 0 0 4px rgba(122,162,255,0.18);
}

a { color: var(--primary); }
a:hover { opacity: 0.9; }

.topbar, .panel { box-shadow: var(--shadow); }

.btn:focus, .prompt:focus, .tab:focus, .star:focus {
  outline: none;
  box-shadow: var(--ring);
}

.btn { transition: transform .05s ease, opacity .2s ease; }
.btn:active { transform: translateY(1px); }

.tab { transition: background .2s ease, transform .05s ease; }
.tab:active { transform: translateY(1px); }

.prompt { transition: box-shadow .2s ease, border-color .2s ease; }
.prompt:focus { border-color: var(--primary); }

.chat {
  background: linear-gradient(180deg, rgba(0,0,0,0.02), rgba(0,0,0,0.00));
}

.bubble {
  box-shadow: var(--shadow2);
}

.bubble.user { border-color: transparent; }
.bubble.assistant { border-color: rgba(0,0,0,0.04); }

html.theme-dark .bubble.assistant { border-color: rgba(255,255,255,0.06); }

.sources summary {
  user-select: none;
}

.footer { padding: 6px 0 0; }

@media (max-width: 720px) {
  .app { padding: 12px; }
  .topbar { flex-direction: column; align-items: flex-start; }
  .actions { width: 100%; justify-content: space-between; }
  .composer { flex-direction: column; }
  .btn { width: 100%; }
  .bubble.user { margin-left: 0; }
  .bubble.assistant { margin-right: 0; }
}


/* ------------------------------------------------------
   Chat HTML content styling (assistant output)
   - Zmenší mezery, opraví odrážky a čitelnost.
   ------------------------------------------------------ */
.bubble .body { line-height: 1.5; }
.bubble .body p { margin: 0 0 0.6em; }
.bubble .body p:last-child { margin-bottom: 0; }

.bubble .body h1, .bubble .body h2, .bubble .body h3 {
  margin: 0.2em 0 0.5em;
  line-height: 1.2;
}
.bubble .body h1 { font-size: 1.25em; }
.bubble .body h2 { font-size: 1.15em; }
.bubble .body h3 { font-size: 1.05em; }

.bubble .body ul, .bubble .body ol {
  margin: 0.2em 0 0.6em;
  padding-left: 1.2em;  /* aby byly odrážky hezky odsazené */
}
.bubble .body li { margin: 0.15em 0; }

.bubble .body blockquote {
  margin: 0.4em 0 0.6em;
  padding: 0.35em 0.75em;
  border-left: 3px solid rgba(0,0,0,0.12);
  background: rgba(0,0,0,0.03);
  border-radius: 12px;
}
html.theme-dark .bubble .body blockquote{
  border-left-color: rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.05);
}

.bubble .body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.95em;
  background: rgba(0,0,0,0.05);
  padding: 0.08em 0.35em;
  border-radius: 8px;
}
html.theme-dark .bubble .body code { background: rgba(255,255,255,0.08); }

.bubble .body pre {
  margin: 0.35em 0 0.6em;
  padding: 10px 12px;
  overflow: auto;
  border-radius: 14px;
  background: rgba(0,0,0,0.06);
}
html.theme-dark .bubble .body pre { background: rgba(255,255,255,0.08); }

/* Když model vrátí hodně <br>, omezíme „prázdné řádky“ */
.bubble .body br + br { display: none; }


/* Globální box-sizing kvůli stabilnímu layoutu */
*,
*::before,
*::after {
  box-sizing: border-box;
}
