﻿/* dawid_style.css – Styling for DAWID Web Interface */

:root {
    font-family: var(--ff-body);
}

body {
    font-family: var(--ff-body);
    text-align: center;
    margin-top: 10px;
    background-color: var(--c-background);
}

html, body{
  font-family: var(--ff-body);
}

think,
.main-heading {
    color: var(--c-primary);
    text-align: center;
    font-size: 2.5em;
    margin: 20px auto;
    line-height: 1.2;
    font-family: var(--ff-title);
}

.upload-status-block {
  padding: 8px 10px;
  border-left: 3px solid var(--c-toolbl-border);
  background: var(--c-toolbl-backgr);
  margin: 0 0 10px 0;
  font-size: 0.97em;
  word-break: break-word;
}
.upload-status-block b {
  color: var(--c-toolbl-color);
}

.container {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    position: relative;
    width: 95%;
    margin: auto;
    background: var(--c-white);
    padding: 20px;
    border-radius: 10px;
    box-shadow: var(--shadow-1);
}

.renew-session{
  display: inline-flex;
  align-items: center;
  gap: 6px;

  font-size: 12px;
  padding: 6px 10px;
  border: 1px solid var(--c-primary);
  background: var(--c-primary);
  color: var(--c-white);
  cursor: pointer;
  border-radius: 6px;
}

.renew-session:hover{ background: var(--c-accent); border-color: var(--c-accent); }

.renew-session i{ font-size: 14px; }

.renew-session-label{
  font-weight: 700;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.prefix-wrap{
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.prefix-caption{
  font-size: 12px;
  color: var(--c-primary);
  font-weight: 700;
  white-space: nowrap;
}

.prefix-switch{
  display: inline-flex;
  align-items: stretch;      /* IMPORTANT: make children fill full height */
  margin-bottom: 12px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--c-primary);
  box-shadow: var(--shadow-2);
}

.prefix-btn{
  display: inline-flex;      /* IMPORTANT: avoid inline baseline gaps */
  align-items: center;       /* vertically center text */
  justify-content: center;

  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;

  line-height: 1;            /* IMPORTANT: kills extra vertical line-box space */
  border: 0;
  margin: 0;                 /* safety */
  background: var(--c-background); /* #f0f0f0; */
  color: var(--c-primary);

  border-right: 1px solid var(--c-primary);
  cursor: pointer;

  appearance: none;          /* helps on Safari/Chrome */
  -webkit-appearance: none;
}

.prefix-btn:last-child{ border-right: none; }
.prefix-btn:hover{ background: var(--c-accent-light); }

.prefix-btn.active{
  background: var(--c-primary);
  color: var(--c-white);
}

.prefix-btn.active:hover{ background: var(--c-accent); }

.session-top-row .prefix-switch{
  margin-bottom: 0;
}

textarea {
    width: 95%;
    max-width: 95%;
    height: 100px;
    font-size: 16px;
    padding: 15px;
    margin: 5px auto;
    border-radius: 5px;
    border: 1px solid var(--c-primary-gray);
    resize: none;
    display: block;
    box-shadow: var(--shadow-1); /*0px 0px 5px rgba(0, 0, 0, 0.1);*/
    background: var(--c-white);
}

/* Make response container: text area on top, footer always below */
#response-container{
    box-sizing: border-box;
    max-width: 800px;
    width: 95%;
    max-width: 95%;
    min-height: 80px;
    padding: 15px;
    margin: 15px auto;
    background: var(--c-white);
    border-radius: 5px;
    border: 1px solid var(--c-primary-gray);
    box-shadow: var(--shadow-1);
    text-align: left;
    overflow-x: auto;
    transition: min-height 0.3s ease-in-out;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#history-container {
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    margin: 15px auto;
    padding: 15px;
    background: var(--c-white);
    border-radius: 5px;
    border: 1px solid var(--c-primary-gray);
    box-shadow: var(--shadow-1);
    text-align: left;
    display: block;
}

/* If you want scrolling in the text region (recommended): */
#history{
  overflow-y: auto;
  max-height: 60vh;      /* keep your existing behavior */
}

/* Chat should scroll as one unit */
#response-container{
  /* choose one height behavior */
  max-height: 70vh;          /* tweak 65–80vh */
  overflow-y: auto;
  overflow-x: hidden;        /* avoid sideways scroll from bubbles */
  -webkit-overflow-scrolling: touch;

  /* a little padding inside the scroll area feels nicer */
  padding: 6px 0;
}

/* History itself should NOT scroll anymore */
#history{
  max-height: none;
  overflow: visible;
}

/* Hide empty message blocks so no bubble appears initially */
#request:empty,
#response:empty,
#history:empty{
  display: none;
}

/* ===========================
   Chat-style response container
   =========================== */

#response-container{
  border: none;
  box-shadow: none;
  background: transparent;

  /* keep spacing but feel like a chat area */
  padding: 0 15px;
  gap: 12px;
}

/* Make history/request/response feel like part of the page, not inside a card */
#history, #request, #response{
  padding: 0;
  margin: 0;
}

/* Make the three blocks feel like one continuous stream */
#history, #request, #response{
  display: block;
}

/* small spacing between history and current exchange */
#history:not(:empty){ margin-bottom: 12px; }
#request:not(:empty){ margin-bottom: 12px; }

/* Spacing between messages in history */
#history > div{
  margin-bottom: 14px;
}

/* Make <hr> separators in history subtle (or hide them) */
#history hr{
  display: none;
  border: none;
  border-top: 1px solid rgba(0,0,0,0.08);
  margin: 12px 0 0;
}

/* Rows are full-width and decide alignment */
.chat-row{
  width: 100%;
  display: flex;
  margin: 6px 0;
}

.chat-row--right{ justify-content: flex-end; }
.chat-row--left { justify-content: flex-start; }

/* Generic bubble: shrink to content but cap width */
.chat-bubble{
  width: fit-content;
  max-width: var(--chat-bubble-max);
  min-width: var(--chat-bubble-min);

  padding: 10px 12px;
  border-radius: 14px;

  text-align: left;
  line-height: 1.4;

  overflow-wrap: anywhere;
  word-break: break-word;
}

/* User bubble (right) */
.chat-bubble--user{
  background: var(--c-secondary);
  border: 1px solid var(--c-third);
}

/* Upload bubble (right, blue-ish) */
.chat-bubble--upload{
  background: var(--c-toolbl-backgr);
  border: 1px solid var(--c-toolbl-border);
  color: var(--c-primary);
}

/* Assistant message: no bubble, plain background (left) */
.chat-bubble--assistant{
  background: transparent;
  border: none;
  padding: 0;
  border-radius: 0;
  max-width: 100%;
  min-width: 0;
}

/* Session timestamp meta line inside assistant bubble */
.chat-bubble .chat-ts {
  margin: 2px 0 8px 0;
  font-size: 12px;
  line-height: 1.2;
  color: var(--c-gray-dark);
  opacity: 0.8;
}

/* Tighten Markdown paragraph spacing inside bubbles */
.chat-bubble p {
  margin: 0.35em 0;
}
.chat-bubble p:first-child { margin-top: 0; }
.chat-bubble p:last-child  { margin-bottom: 0; }

/* Also tighten lists a bit */
.chat-bubble ul,
.chat-bubble ol {
  margin: 0.35em 0;
}
.chat-bubble ul:first-child,
.chat-bubble ol:first-child { margin-top: 0; }
.chat-bubble ul:last-child,
.chat-bubble ol:last-child { margin-bottom: 0; }

.upload-follow-anchor{
  height: 1px;
  width: 100%;
}

/* Make the structural containers act like rows */
#request, #response, #history{
  width: 100%;
  display: block;
  margin: 0;
  padding: 0;
}

/* History entries layout: each entry contains .chat-row children */
#history > .chat-turn{
  width: 100%;
  margin: 0 0 12px 0;
}

/* no separators */
#history hr{ display:none; }

button {
    padding: 4px 5px;
    font-size: 12px;
    border: none;
    background: var(--c-primary);
    color: var(--c-white);
    cursor: pointer;
    border-radius: 2px;
    margin: 1px 0;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

/* Keep the "send link" button same size as before (full width) */
button.fullwidth{
  width: 100%;
  box-sizing: border-box;
  padding: 10px;
  font-size: 16px;
  margin: 6px 0;
}

button:hover {
    background: var(--c-accent);
}

/* ===========================
   Query input "fake inner footer"
   Footer looks inside textarea, but textarea scroll is above it
   =========================== */

.query-input-wrap{
  width: 95%;
  max-width: 95%;
  margin: 10px auto;
  box-sizing: border-box;
}

/* Box provides the visible textarea frame */
.query-input-box{
  position: relative;
  box-sizing: border-box;

  border: 1px solid var(--c-primary-gray);
  border-radius: 5px;
  background: var(--c-white);
  box-shadow: var(--shadow-1);

  /* matches your old textarea padding */
  padding: 15px;

  /* room for the footer area (48px footer + 10px bottom offset like before) */
  padding-bottom: calc(15px + 42px + 10px);
}

/* The textarea itself becomes "content only" */
#queryInput{
  height: auto; 
  padding: 0; 
  width: 100%;
  max-width: 100%;
  margin: 0;
  display: block;
  box-sizing: border-box;

  border: none;
  outline: none;
  background: transparent;
  box-shadow: none;
  line-height: 1.35;

  font-size: 16px;
  font-family: var(--ff-body);

  resize: vertical;
  overflow-y: hidden; /* JS switches to auto when capped */
}

/* =========================================================
   Waiting state: animate the VISIBLE input frame (.query-input-box)
   ========================================================= */

.query-input-box.is-waiting{
  /* keep existing shape */
  border-radius: 5px;

  /* stronger frame so it’s obvious */
  border: 2px solid var(--wait-border-strong, var(--c-active-blue));
  box-shadow: 0 0 0 3px rgba(55,130,228,0.12), var(--shadow-1);

  /* subtle dim inside */
  background-color: var(--wait-fill, rgba(55,130,228,0.04));

  /* shimmer overlay using background, not border */
  background-image:
    linear-gradient(0deg, var(--wait-fill, rgba(55,130,228,0.04)), var(--wait-fill, rgba(55,130,228,0.04))),
    linear-gradient(120deg,
      rgba(55,130,228,0.00) 0%,
      rgba(55,130,228,0.16) 45%,
      rgba(55,130,228,0.00) 90%
    );
  background-size: 100% 100%, 220% 220%;
  background-repeat: no-repeat;
  animation:
    dawidWaitPulse 1.4s ease-in-out infinite,
    dawidWaitShimmer 1.0s linear infinite;
}

/* Optional: make the text look “disabled” */
.query-input-box.is-waiting #queryInput{
  opacity: 0.75;
}

/* Optional: visually disable the footer tools (still controlled by JS for clicks) */
.query-input-box.is-waiting .query-input-footer{
  opacity: 0.85;
}

/* Make shimmer actually move across the box */
@keyframes dawidWaitShimmer{
  0%   { background-position: 0 0, 200% 0; }
  100% { background-position: 0 0, -200% 0; }
}

/* Pulse the outline (not just color) -> accessible beyond color alone */
@keyframes dawidWaitPulse{
  0%, 100% { box-shadow: 0 0 0 2px rgba(55,130,228,0.10), var(--shadow-1); }
  50%      { box-shadow: 0 0 0 6px rgba(55,130,228,0.18), var(--shadow-1); }
}

/* Reduced motion: keep strong frame but no animations */
@media (prefers-reduced-motion: reduce){
  .query-input-box.is-waiting{
    animation: none;
    background-image: linear-gradient(0deg, var(--wait-fill, rgba(55,130,228,0.04)), var(--wait-fill, rgba(55,130,228,0.04)));
  }
}

/* Stop button look (can be tuned later) */
.stop-btn{
  background: var(--c-danger);
  color: var(--c-white);
  border-radius: 6px;
  padding: 0 12px;
  height: 42px;
  font-weight: 800;
}

/* Disabled tools while busy */
.query-input-box.is-busy .tool-btn,
.query-input-box.is-busy .mic-btn,
.query-input-box.is-busy .ask-btn:not(.stop-btn){
  opacity: 0.45;
  pointer-events: none;
}

/* Keep Stop clickable */
.query-input-box.is-busy .stop-btn{
  pointer-events: auto;
  opacity: 1;
}

/* Also disable selects and other controls (visual only; JS will disable the real elements) */
body.is-busy .selector-bar,
body.is-busy .session-top-row,
body.is-busy .session-bottom-row{
  opacity: 0.9;
}

.send-slot{
  position: relative;
  display: inline-flex;
  width: 42px;
  height: 42px;
}

/* both buttons fill the same slot */
.send-slot > .ask-btn{
  position: absolute;
  inset: 0;
  width: 42px;
  height: 42px;
  margin: 0;
}
.stop-btn:hover{ background: var(--c-danger); }

/* ensure icon in stop is white */
.stop-btn .inline-icon,
.stop-btn i,
.stop-btn span{
  color: var(--c-white) !important;
}

/* Footer is positioned inside the box, but not inside textarea */
.query-input-footer{
  position: absolute;
  left: 15px;
  right: 15px;
  bottom: 15px;
  height: 42px;

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;

  box-sizing: border-box;
}

/* Left group: watermark + tools */
.query-input-footer .footer-left{
  align-self: flex-end;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

/* watermark in footer row (no push-down here) */
.query-input-footer .session-security-watermark{
  align-self: center;
  margin-top: 0;
}

/* Tools */
.query-input-footer .three-buttons{
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.query-input-footer .tool-btn{
  background: none;
  border: none;
  padding: 2px 4px;
  margin: 0;
  cursor: pointer;

  color: var(--c-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.query-input-footer .tool-btn .icon,
.query-input-footer .tool-btn i,
.query-input-footer .tool-btn span{
  font-size: 18px;
  line-height: 1;
}

/* Ask/mic stays clickable and aligned */
.query-input-footer .ask-wrap{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.query-input-footer button{
  display: inline-flex;
  margin: 0;
}

/* watermark itself */
.session-security-watermark{
  align-self: flex-end;    /* anchor towards bottom of the footer row */
  margin-top: 10px;        /* pushes it down a bit */
  pointer-events: auto;   /* ✅ allow hover to show title */
  cursor: help;           /* optional: indicates tooltip */
  font-size: 12px;
  font-weight: 700;
  color: var(--c-primary);
  background: var(--c-secondary);
  border: 1px solid var(--c-third);
  border-radius: 999px;
  padding: 4px 8px;
  white-space: nowrap;
}

/* Enable clicking on actual controls */
.query-input-footer .ask-wrap{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.query-input-footer button{
    pointer-events: auto;
    display: inline-flex;      /* override global display:block */
    margin: 0;  
}

.record-status{
  color: var(--c-danger);
  font-weight: bold;
  visibility: hidden; /* keep your existing logic */
}

.ask-wrap{
  display: inline-block;   /* width = ask button only */
  position: static;      /* mic is positioned relative to this */
  padding-right: 0px;
}

.ask-btn{
  width: 42px;          /* optional */
  height: 42px;         /* optional */
  padding: 0;           /* optional */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;      /* controls icon size */
}

/* mic does NOT affect centering */
.mic-btn{
  position: static;         /* important: stop absolute positioning */
  transform: none;
  background: var(--c-white);
  color: var(--c-primary);
  border: none;
  font-size: 18px;
  width: 42px;          /* optional */
  height: 42px;         /* optional */
  padding: 0;           /* optional */
  cursor: pointer;
  display: inline-flex;     /* keep it aligned nicely */
  align-items: center;
  justify-content: center;
}

pre {
    position: relative;
    background-color: var(--c-pre-backgr);
    color: var(--c-pre-color);
    padding: 15px;
    border-radius: 5px;
    overflow-x: auto;
    font-family: "Courier New", monospace;
    font-size: 14px;
    white-space: pre;
    word-wrap: normal;
    border-left: 5px solid var(--c-pre-backgr);
}

.copy-button{
  position: absolute;
  top: 8px;
  right: 8px;

  border: 1px solid var(--overlay-backdrop);
  background: var(--c-pre-backgr);
  color: var(--c-primary);

  border-radius: 8px;
  padding: 4px 8px;
  font-size: 12px;
  cursor: pointer;
  line-height: 1;
  opacity: 0.85;
  transition: opacity 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.copy-button:hover{
  opacity: 1;
  background: var(--c-accent-light);
}

.copy-button:active{
  opacity: 1;
  background: var(--c-accent-light);
}

.copy-button:focus-visible{
  outline: var(--focus-ring-width) solid var(--focus-ring-color);
  outline-offset: 2px;
}

/* One rule to size both FA <i> and text glyph <span> the same */
.copy-button .copy-icon{
  font-size: 18px;   /* your desired icon size */
  line-height: 1;
  display: inline-block;
}
.copy-button .copy-icon{ color: var(--c-primary); } /* default */

.copy-button.is-copied .copy-icon{ color: var(--c-active-blue); }
.copy-button.is-failed .copy-icon{ color: var(--c-danger); }

pre.has-copy-btn{
  padding-top: 38px;
}

.notif-row { display:flex; align-items:flex-start; gap:8px; white-space:pre-wrap; }
.notif-icon { width: 1.2em; flex: 0 0 1.2em; }

/* Notification icon colors (works for both <i> and <span>) */
.notif-row .notif-icon-glyph{
  color: var(--c-primary);
  line-height: 1;
}

/* status -> color */
.notif-row.notif-success .notif-icon-glyph{ color: var(--c-active-blue); }
.notif-row.notif-info    .notif-icon-glyph{ color: var(--c-primary); }
.notif-row.notif-warning .notif-icon-glyph{ color: var(--c-warning); } /* optionally add a separate --c-warning */
.notif-row.notif-error   .notif-icon-glyph{ color: var(--c-danger); }

pre code {
    background: inherit;
    color: inherit;
}

#user-info {
    float: left;
    width: 100%;
}

a.logout {
    text-decoration: none;
    font-size: 16px;
    padding: 0px 10px;
    background: var(--c-primary);
    color: var(--c-white);
    border: none;
    border-radius: 6px;
    cursor: pointer;
}
a.logout:hover {
  background: var(--c-accent);
  color: var(--c-white);
}

.navigator-container {
    position: relative;
}

.navigator {
    display: none;
    position: absolute;
    top: 100%;           /* 👈 opens directly below the toggle */
    left: 0;             /* 👈 aligned to left edge */
    width: 100%;
    max-height: 300px;
    background-color: var(--c-background);
    font-size: 12px;
    overflow-y: auto;
    z-index: 1000;
    border: 1px solid var(--c-primary-gray);
    padding: 1px;
    box-shadow: var(--shadow-1);
}


.navigator ul {
    list-style-type: none;
    margin: 0;
    padding: 0;
	width: 100%; 
}

.navigator li a {
    display: block;
    color: var(--c-primary);
    padding: 10px;
    text-decoration: none;
	  width: 100%; 
}

/* Make label position context for the arrow */
.navigator-toggle {
    position: relative;
    padding-right: 26px; /* space for arrow */
    font-size: 16px;            /* kontrollierte Schriftgröße */
    display: inline-block;
    width: 80px !important;
    padding: 6px 8px;
    background-color: var(--c-primary);
    color: var(--c-white);
    text-align: center;
    border-radius: 4px;
    border: none; /*1px solid var(--c-primary);*/
    cursor: pointer;
    box-sizing: border-box;    
}

.navigator-toggle i{
  margin-right: 8px;
}

.navigator-toggle:hover {
  background: var(--c-accent);
  color: var(--c-white);
}

/* Arrow down by default */
.navigator-toggle::after{
  content: "";
  position: absolute;
  right: 10px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-60%) rotate(45deg); /* down chevron */
  transition: transform 0.15s ease;
}

/* Rotate chevron when open */
#navigator:checked + .navigator-toggle::after{
  transform: translateY(-30%) rotate(-135deg); /* looks like "^" */
}

/* Show/hide navigator panel */
#navigator:checked ~ .navigator{
  display: block;
}

/* Open state: keep it in the hovered/active color while open */
#navigator:checked + .navigator-toggle {
  background: var(--c-accent);
  color: var(--c-white);
}

/* Language switch (button-like segmented control) */
.lang-switch{
  display: inline-flex;
  align-items: center;
  margin-bottom: 12px;
  border-radius: 6px;
  overflow: hidden;

  /* subtle frame like other UI elements */
  border: 1px solid var(--c-primary);
  box-shadow: var(--shadow-2);
}

.lang-btn{
  display: inline-block;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-decoration: none;

  /* default = “inactive” button style */
  background: var(--c-background);
  color: var(--c-primary);

  border-right: 1px solid var(--c-primary);
}

.lang-btn:last-child{
  border-right: none;
}

.lang-btn:hover{
  background: var(--c-accent-light);
}

/* active = same as your main submit button */
.lang-btn.active{
  background: var(--c-primary);
  color: var(--c-white);
}

.lang-btn.active:hover{
  background: var(--c-accent); /* match button:hover */
}

/* shared focus style for segmented controls */
.selector-item select:focus-visible,
.session-action-btn:focus-visible,
.navigator-toggle:focus-visible{
  outline: var(--focus-ring-width) solid var(--focus-ring-color);
  outline-offset: 2px;
}
.lang-btn:focus-visible,
.prefix-btn:focus-visible{
  outline: var(--focus-ring-width) solid var(--focus-ring-color);
  outline-offset: calc(var(--focus-ring-offset) * -1); /* inside pill */
  position: relative; /* helps in some layouts */
  z-index: 1;         /* ensure ring isn't hidden by neighbors */
}

/* 3-column layout: left button | centered language | right spacer */
.page-topbar{
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  margin-top: 48px;
  margin-bottom: 16px;
}

.page-topbar .logout{
  justify-self: start;
}

.page-topbar .lang-switch{
  justify-self: center;
}

.page-topbar .topbar-spacer{
  justify-self: end;
}

/* Primary button look */
.btn-primary{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  font-size: 14px;
  border-radius: 6px;
  border: none;
  background: var(--c-primary);
  color: var(--c-white);
  cursor: pointer;
  text-decoration: none; /* important for <a> */
}

a.btn-primary,
a.btn-primary:visited{
  color: var(--c-white);
}

a.btn-primary:hover,
a.btn-primary:active,
a.btn-primary:focus-visible{
  background: var(--c-accent);
  color: var(--c-white);
}

.login-row{
  display: flex;
  gap: 8px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap; /* allows wrap on small screens */
}

/* Make login-like inputs (incl. set-password) match in height */
.login-row input{
  width: 200px;          /* keep your existing width */
  box-sizing: border-box;
  padding: 10px;
  font-size: 16px;
  line-height: 1.2;
}

.login-submit{
  display: inline-block;     /* overrides global button {display:block} */
  margin: 0;                 /* overrides auto-centering */
  width: auto;               /* prevents 100% width if you add that later */
  padding: 10px 14px;        /* keep your nice button feel */
  white-space: nowrap;
  font-size: 16px; 
}

.session-actions {
    position: absolute;
    top: 6px;
    right: 10px;
    display: flex;
    gap: 6px;
}

.session-action-btn {
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    transition: background 0.2s;
}

.session-action-btn.edit {
    background: linear-gradient(135deg, var(--c-primary) 60%, var(--c-primary) 100%); /* background: linear-gradient(135deg, #dfc97c 60%, #caae4f 100%); */
    color: var(--c-white); /* color: #644200; */
}

.session-action-btn.delete {
    background: linear-gradient(135deg, var(--c-delete-1) 70%, var(--c-delete-2) 100%);
    color: var(--c-white);
}

.custom-popup {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--overlay-backdrop);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
.custom-popup .popup-content {
  background: white;
  padding: 24px;
  border-radius: 8px;
  min-width: 280px;
  box-shadow: var(--shadow-1);
  position: relative;
  text-align: center;
}
.popup-content.popup-notification {
  min-width: 240px;
  max-width: 440px;
  text-align: left;
}
#notification-message {
  margin-bottom: 16px;
  white-space: pre-line;
  font-size: 16px;
}
#edit-session-title {
  font-size: 16px;
}
.popup-close {
  position: absolute;
  right: 13px; top: 10px;
  font-size: 20px;
  cursor: pointer;
}
.hidden { display: none; }

.popup-btn-row {
  display: flex;
  flex-direction: row;
  justify-content: center;
  gap: 12px;
  margin-top: 18px;
}

.popup-btn {
  min-width: 100px;
  padding: 8px 18px;
  border: none;
  border-radius: 4px;
  font-size: 16px;
  cursor: pointer;
  transition: background 0.2s;
}

.popup-btn.save {
  background: var(--c-primary);
  color: var(--c-white);
}

.popup-btn.cancel {
  background: var(--c-primary-gray);
  color: var(--c-dark-gray);
}

.session-item {
    position: relative;
    padding-right: 56px; /* space for the action buttons */
}

#queryForm .three-buttons {
	display: inline-flex;
	gap: 8px;
	align-items: center;
}

#queryForm .selector-group {
	display: flex;
	justify-content: flex-start;
	gap: 12px;
	margin-top: 0;
}

#queryForm .selector-group .model-select,
#queryForm .selector-group .dataspace-select {
	min-width: 160px;
}

.model-green      { background-color: var(--c-prefix-1) !important; color: var(--c-black); } /* medium balanced green */
.model-midgreen   { background-color: var(--c-prefix-2) !important; color: var(--c-black); } /* pastel but still green */
.model-lightgreen { background-color: var(--c-prefix-3) !important; color: var(--c-black); } /* lightest minty green */

input[type="checkbox"] {
    display: none;
}

@media only screen and (max-width: 900px) {
    body {
        margin: 0;
        padding: 0;
        margin-top: 5px;
    }

    .container {
        width: 95%;
        padding: 10px;
        margin: 0 auto;
        box-shadow: none;
        border-radius: 0;
    }

    #response-container,
    #history-container,
    textarea {
        width: 100% !important;
        max-width: 100% !important;
        margin: 10px 0;
    }
    .query-input-wrap{
        width: 100% !important;
        max-width: 100% !important;
        margin: 10px 0 !important;
        box-sizing: border-box;
    }
    .selector-bar{
        justify-content: flex-start !important;  /* left align the row */
    }

    #queryForm .selector-group{
        width: 100%;
        justify-content: flex-start !important;
    }

    /* Optional: make each item occupy the full row (prevents “centered blocks” on wrap) */
    .selector-item{
        flex: 1 1 100%;
        justify-content: flex-start;
    }

    /* Optional: keep selects reasonably wide when items are full-row */
    .selector-item select{
        width: 100%;
    }

    .navigator-toggle {
        display: block;          /* key: block makes auto-margins work reliably */
        width: 80px !important;  /* keep your intended size */
        margin-left: auto;   
        margin-top: 0px;
        box-sizing: border-box;
        text-align: left;
    }
    .navigator-toggle {
      text-align: left;
    }

    .navigator {
        margin-top: -20px;
        position: relative;
        width: 100% !important;
        max-width: 100%;
        left: 0;
    }

    .session-item {
        padding-right: 110px; /* extra space for larger buttons on mobile */
    }
    .session-actions {
        position: absolute;
        top: 0px;
        right: 0px;
        gap: 0px;
    }
    .session-action-btn {
        width: 50px;
        height: 36px;
        font-size: 24px;
        border-radius: 4px;
    }

    .renew-session {
        margin-left: auto;
    }

    #user-info {
        width: 100%;
    }

    h1.main-heading {
        margin-top: 75px;
        font-size: 24px;
    }

    button,
    .renew-session,
    .logout {
        font-size: 14px;
    }
}

/* Main container with 600px height and horizontal layout */
/* #forumArea {
  width: 95%;
  margin: 0 auto;
  margin-bottom: 30px;
} */

/* Hide forum until ready */
#forum-toggle-ui,
#forumArea,
#toggle-forum,
label[for="toggle-forum"]{
  display: none !important;
}

#forum-container {
  display: flex;
  flex-direction: column;
  width: 100%;
  padding: 0;
  box-sizing: border-box;
  border: 1px solid var(--c-primary-gray);
  border-radius: 5px 5px 0 0;
  margin: 0 auto;
}

.forum-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.3em 0.5em;
  border-radius: 5px 5px 0 0;
  background-color: var(--c-gray-light);
  border-bottom: 1px solid var(--c-primary-gray);
}

.forum-header h3 {
  margin: 0;
  font-size: 1.2em;
  color: var(--c-primary);  
  flex: 1;   
  text-align: left;  /* ✅ force left alignment */
}

#new-thread-button {
  display: inline-block; 
  margin-left: auto;
  padding: 0.3em 0.9em;
  font-size: 0.8em;
  background-color: var(--c-gray-light);
  color: var(--c-gray-dark);
  border: 1px solid var(--c-primary-gray);
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
  text-align: right;
}

#new-thread-button:hover {
  background-color: var(--c-accent-light);
  color: var(--c-black);
  border-color: var(--focus-ring-color);
}

#forum-content, #forum-threads {
  width: 100%;
  max-width: 100%; 
  box-sizing: border-box;
}
.thread {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px;
  margin-bottom: 0px;
  border: 1px solid var(--c-gray-light);
  border-radius: 0px;
  background: var(--c-white);
  width: 100%;
  box-sizing: border-box;
}
.thread-title {
  font-weight: bold;
  font-size: 0.8em;
  color: var(--c-gray-dark);              /* dark gray text */
  text-decoration: none;    /* no underline */
  transition: color 0.2s ease;
}
.thread-title:hover {
  color: var(--focus-ring-color);           /* blue on hover */
}
.thread-meta {
  font-size: 0.8em;
  color: var(--c-gray-dark);
}

/* Main container with 600px height and horizontal layout */
#editor-container {
    display: flex;
    width: 95%;
    min-height: 400px;
    height: 400%;
    overflow: auto;
    border: 1px solid var(--c-primary-gray);
    margin: 0 auto;
    box-sizing: border-box;
}
#editorArea {
    display: none;
}

/* File list: left pane */
#file-list {
    width: 20%;
    min-width: 120px;
    max-width: 300px;
    border-right: 1px solid var(--c-primary-gray);
    overflow-y: auto;
    padding: 10px;
    box-sizing: border-box;
    height: 400px;
}

/* Style list items */
#file-list-items {
    list-style: none;
    text-align: left;
    padding: 0;
    margin: 0;
}

#file-list-items li {
    padding: 3px 6px;
    margin-bottom: 1px;
    cursor: pointer;
    border-radius: 4px;
    text-align: left;
    font-size: 10px;
}

#file-list-items li:hover {
    background-color: var(--c-gray-light);
}

/* Code editor wrapper: right pane */
#code-editor-wrapper {
    flex: 1;
    overflow: hidden;
    padding: 0;
    box-sizing: border-box;
    height: 100%;
}

#code-editor {
    width: 100%;
    height: 100%;
    text-align: left;

}

#current-file-display {
    margin: 0 auto;
    width: 95%; /* genau wie #editor-container */
    padding: 8px 10px;
    font-size: 12px;
    background-color: var(--c-gray-light);
    border: 1px solid var(--c-primary-gray);
    border-bottom: none;
    border-radius: 5px 5px 0 0;
    box-sizing: border-box;
    display: flex;
	align-items: center;
}

.spacer {
    flex: 1;
}

.centered-content {
    display: flex;
    align-items: center;
    justify-content: center;
}

#info-button {
    background-color: var(--c-background);
    color: var(--c-dark-gray);
    border: 1px solid var(--c-primary-gray);
    border-radius: 4px;
    padding: 3px 3px;
    font-size: 14px;
    cursor: pointer;
}

#info-button:hover {
    background-color: var(--c-primary-gray);
}

#info-modal .popup-content{
  max-width: 720px;   /* optional */
}

input:checked + .slider:before {
    transform: translateX(16px);
}

/* Container-Styling */
#editor-toggle-container {
    display: flex;
    align-items: center;
    padding: 10px;
    margin-left: 20px;  /* ⬅️ Passe den Wert nach Bedarf an */

}

/* Switch (Rahmen & Schiebefläche) */
.switch {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 18px;
}

/* Unsichtbare Checkbox */
.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

/* Slider */
.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--c-primary-gray);
    transition: 0.3s;
    border-radius: 18px;
}

/* Schiebeknopf */
.slider:before {
    position: absolute;
    content: "";
    height: 12px;
    width: 12px;
    left: 3px;
    bottom: 3px;
    background-color: var(--c-white);
    transition: 0.3s;
    border-radius: 50%;
}

/* Aktiv */
input:checked + .slider {
    background-color: var(--c-active-blue);
}

input:checked + .slider:before {
    transform: translateX(18px);
}

/* selectors below textarea, but NOT in a boxed panel */
.selector-bar{
  width: 95%;
  max-width: 95%;
  margin: 6px auto 0;
  box-sizing: border-box;

  display: flex;
  gap: 12px;
  justify-content: center; /* right aligned under textarea */
  align-items: center;
  flex-wrap: wrap;

  padding: 0;              /* no “panel” padding */
  border: none;            /* no box */
  background: transparent; /* no fill */
  box-shadow: none;        /* no shadow */
}

.selector-item{
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.selector-item label{
  font-size: 16px;
  color: var(--c-primary);
  white-space: nowrap;
}

/* keep selects clean but lightweight */
.selector-item select{
  height: 30px;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid var(--c-primary-gray);     /* control border is fine */
  background: var(--c-white);
  font-size: 14px;
  color: var(--c-primary);
}

/* .selector-item select:focus{
  outline: none;
  border-color: var(--focus-ring-color);
  box-shadow: var(--shadow-2);
} */

#read-aloud-btn { 
  color: var(--c-primary);        /* normal */
}

#read-aloud-btn.is-speaking {
  color: var(--c-active-blue);        /* active red (pick what you like) */
}

/* optional: a subtle glow to make state obvious */
#read-aloud-btn.is-speaking i {
  filter: drop-shadow(0 0 2px var(--c-active-blue-light));
}

/* Wrapper für Session-Steuerung */
.session-block {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    width: 100%;
}

/* Desktop header row: left | center (lang) | right */
.session-top-row{
  display: grid;
  grid-template-columns: 1fr auto 1fr; /* center stays natural width */
  align-items: center;
  column-gap: 20px;
  width: 100%;
}

/* Put each block explicitly into a grid cell */
.session-top-row .top-left{
  grid-column: 1;
  justify-self: start;
  min-width: 0;              /* helps prevent overflow issues */
}

.session-top-row .lang-switch{
  grid-column: 2;
  justify-self: center;
  position: static;          /* IMPORTANT: remove absolute positioning */
  transform: none;           /* IMPORTANT */
  margin-bottom: 0;
}

.session-top-row .top-right{
  grid-column: 3;
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
}

/* unified container around "New session" + prefix choices */
.new-session-box{
  display: inline-flex;
  align-items: center;
  gap: 10px;

  padding: 6px 8px;
  border: 1px solid var(--c-third);
  border-radius: 8px;
  background: var(--c-secondary);
}
/* If prefix switch exists: hide renew button (keep as "backup" by re-enabling if needed) */
.new-session-box.has-prefix-switch #renewSession {
  display: none;
}

.new-session-hint{
  font: inherit;
  color: inherit;
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
  white-space: nowrap;
  pointer-events: none;
  font-size: 7pt;
}

/* shrink the whole box a bit */
.session-top-row .new-session-box{
  padding: 3px 6px;
  gap: 6px;
  border-radius: 7px;
}

/* smaller "New session" button */
.session-top-row .renew-session{
  padding: 4px 8px;
  font-size: 11px;
  border-radius: 6px;
}
.session-top-row .renew-session i{
  font-size: 12px;
}

/* smaller segmented buttons */
.session-top-row .prefix-btn{
  padding: 4px 8px;
  font-size: 11px;
  line-height: 1;
}

/* IMPORTANT: remove bottom margin inside header row */
.session-top-row .prefix-switch{ margin-bottom: 0; }

/* Make renew button visually consistent inside the box */
.session-top-row .renew-session{
  margin: 0;              /* avoid odd offsets */
  border-radius: 6px;
}

/* ensure no extra vertical offset in header row */
.session-top-row .prefix-switch{ margin-bottom: 0; }

#user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
}

.top-right {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
}

.session-bottom-row {
    display: flex;
    width: 100%;
    gap: 10px;
}

.session-id-box {
    width: 75%;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#session-id-text {
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}


.session-list-box {
    width: 50%;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    position: relative;
    font-size: 14px;
    white-space: nowrap;
    flex-direction: column;
    align-items: flex-end; 
}

#session-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.session-item {
    padding: 0px 0px;
    border-bottom: 1px solid var(--c-primary-gray);
}
.session-item:hover{
  background: var(--c-accent-light);
}

.session-title { 
    font-size: 1.2em;
    font-weight: bold;
    color: var(--c-primary);
    text-decoration: none;
    width: 100%;
}

.session-item:hover .session-title{
  color: inherit;        /* or explicitly var(--c-primary) */
  background: transparent;
}


.session-last-access,
.session-id {
    font-size: 0.85em;
    color: var(--c-dark-gray);
    width: 100%;
    padding-left: 10px;   
}

.main-heading-center {
    text-align: center;
    width: 100%;
    margin-top: 0px;   /* ← Adjust value as needed */
    margin-bottom: 10px;
}

.main-heading-wrap {
    display: inline-block;
    position: relative;
}

.main-heading {
    margin: 0;
    font-size: 2.5em;
    text-align: center;
    line-height: 1;
    font-family: sans-serif;
    display: inline-block;
}

.beta-badge {
    font-size: 1em; /* Keep "badge" size */
    color: var(--c-primary);
    background: var(--c-secondary);
    border: 1px solid var(--c-primary);
    border-radius: 9px;
    padding: 1px 9px;
    font-weight: 600;
    letter-spacing: 1px;
    position: absolute;
    left: 100%;      /* Just to the right of the heading */
    top: 60%;        /* Nudge down by percent of h1 height; tweak 60–70% for best effect */
    margin-left: 5px;
    white-space: nowrap;
}

/* Media Only */
@media only screen and (max-width: 900px) {
    /* Top row becomes: lang (center), then user (left), then new-session (left) */
    .session-top-row{
        display: grid;
        grid-template-columns: 1fr;
        grid-template-areas:
        "lang"
        "left"
        "right";
        gap: 6px;
        align-items: start;
        justify-items: start;     /* default left ragged */
    }

    /* keep lang centered */
    .session-top-row .lang-switch{
        position: static;
        left: auto;
        top: auto;
        transform: none;

        grid-area: lang;
        justify-self: center;
        margin: 0 0 6px 0;
    }

    .session-top-row .top-left{
        grid-area: left;
        justify-self: start;
        width: 100%;
        text-align: left;
    }

    .session-top-row .top-right{
        grid-area: right;
        justify-self: start;
        width: 100%;
        text-align: left;
        margin-top: 4px;          /* tiny separation between user and new-session */
    }

        /* shrink the whole box a bit */
    .session-top-row .new-session-box{
      padding: 3px 6px;
      gap: 6px;
      border-radius: 7px;
    }

    /* smaller "New session" button */
    .session-top-row .renew-session{
      padding: 4px 8px;
      font-size: 11px;
      border-radius: 6px;
    }
    .session-top-row .renew-session i{
      font-size: 12px;
    }

    /* smaller segmented buttons */
    .session-top-row .prefix-btn{
      padding: 4px 8px;
      font-size: 11px;
      line-height: 1;
    }
    /* Ensure the segmented control stretches to the new height */
    .session-top-row .prefix-switch{
        align-items: stretch;
    }

    .main-heading-center {
    margin-top: 10px;   /* ← Adjust value as needed */
    }
	#user-info {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 4px;
        align-items: center;
    }
    .top-left *:not(style),
    .top-right *:not(style) {
        margin-top: 0 !important;
        margin-bottom: 0 !important;
        padding: 0;
    }
	.session-block {
		align-items: stretch;
		margin-bottom: 0;
		padding-bottom: 0;
	}

    /* Align session id with the user block */
    .session-bottom-row{
        padding-left: 0 !important;
        margin-left: 0 !important;
        justify-content: flex-start;
    }

    .session-bottom-row .session-id-box{
        padding-left: 0 !important;   /* <-- key */
        margin-left: 0 !important;    /* <-- key */
    }

    /* Also remove any left padding on the text itself if inherited */
    .session-bottom-row #session-id-text{
        margin-left: 0 !important;
        padding-left: 0 !important;
    }

    .session-bottom-row{
        flex-direction: column;   /* stack session id above session list (if desired) */
        align-items: start;  /* ✅ left ragged */
        gap: 6px;
    }

  .session-id-box{
    width: 100%;
    justify-content: flex-start;  /* ✅ left ragged inside the flex row */
    text-align: left;
    font-size: 12px;             /* smaller overall */
    padding: 4px 8px;
    margin: 0;
  }

  #session-id-text{
    font-size: 12px;             /* smaller id */
    opacity: 0.9;
    white-space: normal;         /* allow wrap */
    overflow: visible;
    text-overflow: initial;
  }
	/* .session-top-row,
	.session-bottom-row {
		flex-direction: row;
		flex-wrap: wrap;
		row-gap: 4px;
        gap: 0;
    } */
	.session-id-box,
    .session-list-box {
	    display: block !important;
        width: 100%;
    }
	.session-id-box {
		padding: 4px 8px;
        margin-bottom: 8px;
	}
	#session-id-text {
		flex: 1;
		display: inline-block;
		font-size: 14px;
		overflow: visible;
		text-overflow: initial;
		white-space: normal;
	}
	.navigator {
		position: absolute;
		top: 100%;
	    margin-top: 4px;
		left: 0;
		z-index: 1000;
		width: 100%;
		max-height: 300px;
		overflow-y: auto;
	}
	.session-dropdown-wrapper {
		display: flex;
		flex-direction: column;
		width: 100%;
	    position: relative;
	}
	h1.main-heading {
		margin-top: 10px;
	}
	#queryForm .query-form-top-row {
		display: flex;
		flex-wrap: wrap;
		justify-content: flex-start;
		align-items: center;
		gap: 8px;
	}
	#queryForm .query-form-top-row {
		flex-direction: column;
		align-items: center;
	}

  #queryForm .three-buttons {
    display: inline-flex;
    justify-content: flex-start;
    align-items: center;
    gap: 8px;
    margin: 0;                 /* important: no vertical margins in footer */
  }

	#queryForm .three-buttons > * {
		font-size: 18px;
		display: inline-flex;
		align-items: center;
		justify-content: center;
		padding: 0px;
	}
	#queryForm .selector-group {
		display: flex;
		justify-content: center;
		flex-wrap: wrap;
		gap: 1px;
		margin-top: 0px;
	}

	#queryForm .selector-group .model-select,
	#queryForm .selector-group .dataspace-select {
		flex: 1 1 45%;   /* Allow two to fit in one row */
		min-width: 120px;
	}

	/* Only apply width control to model and dataspace blocks */
	#queryForm #modelSelect,
	#queryForm #dataSpaceSelect {
		width: 100%;
		min-width: 120px;
	}

	#queryForm .query-form-top-row .model-select-wrapper,
	#queryForm .query-form-top-row .dataspace-select-wrapper {
		flex: 0 0 48%;
		box-sizing: border-box;
	}

  .inline-icon{ margin-right: 6px; }
  
  #notification-message .notif-icon{
    margin-right: 6px;
    display: inline-block;
    line-height: 1;
  }
  #notification-message .notif-icon-glyph{
    vertical-align: -0.1em;
  }

	/* Icon styling */
	#queryForm #info-icon,
	#queryForm #read-aloud-btn,
	#queryForm label[for="uploadFile"] {
		font-size: 18px;
		display: inline-flex;
		align-items: center;
		justify-content: center;
		padding: 4px;
		line-height: 1;
	}

}
#transcription-overlay {
  position: absolute;
  top: 8px;     /* keep if you want it slightly inset */
  left: 15px;   /* match box padding */
  right: 15px;  /* match box padding */
  color: var(--c-primary);                 
  font-style: italic;
  font-weight: 500;
  background: var(--overlay-backdrop); 
  padding: 2px 6px;
  border-radius: 4px;
  pointer-events: none;         
  display: none;
}

/* icon inside the transcription overlay (works for <i> and <span>) */
#transcription-overlay .overlay-icon{
  line-height: 1;
  display: inline-block;
  margin-right: 6px;   /* space before text */
  vertical-align: -0.1em; /* optional: nicer baseline alignment */
}

#transcription-overlay.is-success .overlay-icon{ color: var(--c-active-blue); }
#transcription-overlay.is-error   .overlay-icon{ color: var(--c-danger); }


/* =========================================================
   API Docs page styles (scoped)
   ========================================================= */

.docs-wrap{
  max-width: 980px;
  margin: 0 auto;
  text-align: left;
}

.docs-card{
  background: var(--c-white);
  border: 1px solid var(--c-primary-gray);
  border-radius: 10px;
  padding: 16px 18px;
  margin: 12px 0;
  box-shadow: var(--shadow-2);
}

.docs-h1{
  color: var(--c-primary);
  margin: 10px 0 6px;
  font-family: var(--ff-title);
}

.docs-sub{
  color: var(--c-gray-dark);
  margin: 0 0 10px;
}

.endpoint{
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 10px;
  align-items: start;
  margin-top: 10px;
}

.method{
  font-weight: 800;
  border-radius: 6px;
  padding: 4px 8px;
  display: inline-block;
  color: var(--c-white);
  background: var(--c-primary);
  font-size: 12px;
  letter-spacing: .3px;
}

.path{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.muted{
  color: var(--c-gray-dark);
  font-size: 13px;
}

.docs-topbar{
  display: grid;
  grid-template-columns: 1fr auto 1fr; /* left spacer | centered lang | right button */
  align-items: center;
  margin: 6px 0 12px;
  gap: 12px;
}
.docs-topbar .left-spacer{ justify-self: start; }
.docs-topbar .lang-switch{ justify-self: center; margin: 0; }
.docs-topbar .right-actions{ justify-self: end; text-align: right; }

.pill{
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--c-third);
  background: var(--c-secondary);
  color: var(--c-primary);
  font-weight: 700;
  font-size: 12px;
  margin-left: 6px;
}

.docs-wrap a{
  color: var(--c-primary);
}

/* Code block for docs */
pre.codeblock{
  position: relative;
  padding-top: 38px; /* room for copy button */
}

.codeblock{
  background: var(--c-pre-backgr);
  border-left: 5px solid var(--c-pre-backgr);
  border-radius: 6px;
  padding: 12px;
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono","Courier New", monospace;
  font-size: 13px;
  white-space: pre;         /* keep formatting */
  -webkit-overflow-scrolling: touch;
}

/* API key link button */
.api-key-link{
  display: inline-block;
  border: 1px solid var(--c-primary-gray);
  background: var(--c-white);
  color: var(--c-primary);
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}
.api-key-link:hover{
  background: var(--c-secondary);
}

/* Mobile */
@media (max-width: 600px){
  .endpoint { grid-template-columns: 1fr; }
  .codeblock { white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; }
}

/* =========================================================
   API v1 landing page (scoped)
   ========================================================= */

.docs-langbar{
  display: flex;
  justify-content: center;
  margin: 8px 0 12px;
}

/* generic paragraph spacing inside docs cards */
.docs-wrap .docs-p{
  margin: 0 0 14px;
}

.docs-wrap .docs-actions{
  margin: 0 0 14px;
}

.docs-wrap .docs-url{
  margin: 0;
  color: var(--c-gray-dark);
  font-size: 13px;
  word-break: break-word;
}

/* =========================================================
   Login page (scoped)
   ========================================================= */

.login-wrap{
  max-width: 720px;
  margin-top: 40px; /* instead of body margin-top:50px in inline CSS */
}

.login-title{
  margin: 16px 0 10px;
  color: var(--c-primary);
  font-family: var(--ff-title);
}

/* keep login inputs consistent + readable */
.login-form input[type="text"],
.login-form input[type="password"]{
  border: 1px solid var(--c-primary-gray);
  border-radius: 6px;
  background: var(--c-white);
  color: var(--c-black);
}

/* You already have .login-row input sizing and .login-submit rules above, keep those */

/* error message */
.error{
  color: var(--c-danger);
  font-weight: 700;
  margin: 8px 0 12px;
}

/* links row under the form */
.auth-links{
  margin-top: 12px;
}

/* secondary button */
.btn-secondary{
  display: inline-block;
  padding: 10px 12px;
  font-size: 12px;
  border-radius: 6px;

  border: 1px solid var(--c-primary-gray);
  background: var(--c-white);
  color: var(--c-gray-dark);

  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.btn-secondary:hover{
  background: var(--c-secondary);
  border-color: var(--c-third);
}

.btn-secondary:focus-visible{
  outline: var(--focus-ring-width) solid var(--focus-ring-color);
  outline-offset: 2px;
}

/* Auth-ish simple pages (request link, exchange, api key, etc.) */

.page-wrap{ text-align: center; }     /* center headings/buttons */
.page-auth form{ text-align: center; }  /* keep label + input alignment nice */

.page-wrap{
  max-width: 720px;
  margin: auto;
  padding: 0 16px;
}

.page-auth input[type="email"],
.page-auth input[type="text"],
.page-auth input[type="password"]{
  padding: 10px;
  margin: 6px 0;
  font-size: 16px;
  width: 100%;
  box-sizing: border-box;

  border: 1px solid var(--c-primary-gray);
  border-radius: 6px;
  background: var(--c-white);
  color: var(--c-black);
}

.page-auth .note{
  color: var(--c-gray-dark);
  font-size: 14px;
}

/* add token later if you want */
.page-auth .ok{
  color: var(--c-active-blue);
  font-weight: 700;
}

/* Auth card used on show-api-key etc. */
.page-auth .auth-card{
  background: var(--c-white);
  border: 1px solid var(--c-primary-gray);
  border-radius: 10px;
  padding: 16px 18px;
  box-shadow: var(--shadow-2);
}

/* API key display box (uses existing codeblock look) */
.page-auth .keybox{
  position: relative;
  border-radius: 10px;
}

/* Make the pre/code look like a highlighted box (optional tweak) */
.page-auth pre.keybox{
  background: var(--c-secondary);
  border-left: 5px solid var(--c-third);
}

/* Upload SSE progress bar */
.upload-progress-row{
  display: flex;
  align-items: center;
  margin: 10px 0 4px 0;
  gap: 12px;
}

.upload-progress-bg{
  flex: 1;
  min-width: 60px;
  height: 16px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--c-progress-track);
}

.upload-progress-fill{
  height: 100%;
  width: 0%;
  border-radius: 6px;
  background: var(--c-progress-fill);
  transition: width 0.3s, background 0.3s;
}

.upload-progress-row.is-done .upload-progress-fill{
  width: 100%;
  background: var(--c-progress-done);
}

.upload-progress-text{
  color: var(--c-progress-text);
  font-size: 12px;
  white-space: nowrap;
}

/* =========================================================
   CHAT (single source of truth)
   ========================================================= */


/* Scrollable chat area */
#response-container{
  border: none;
  box-shadow: none;
  background: transparent;

  max-height: 70vh;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;

  padding: 0 15px;
  gap: 12px;

  display: flex;
  flex-direction: column;
  text-align: left;
}

/* Hide empty blocks (prevents initial empty bubble space) */
#request:empty,
#response:empty,
#history:empty{
  display: none;
}

/* Structural blocks */
#history, #request, #response{
  padding: 0;
  margin: 0;
}

/* A "turn" in history */
#history > .chat-turn{
  margin: 0 0 12px 0;
}

/* Chat rows control alignment */
.chat-row{
  width: 100%;
  display: flex;
  margin: 6px 0;
}
.chat-row--right{ justify-content: flex-end; }
.chat-row--left { justify-content: flex-start; }

/* Bubble sizing */
.chat-bubble{
  width: fit-content;
  max-width: var(--chat-bubble-max);
  min-width: var(--chat-bubble-min);

  padding: 10px 12px;
  border-radius: 14px;

  text-align: left;
  line-height: 1.4;

  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Bubble variants */
.chat-bubble--user{
  background: var(--c-secondary);
  border: 1px solid var(--c-third);
}

.chat-bubble--upload{
  background: var(--c-toolbl-backgr);
  border: 1px solid var(--c-toolbl-border);
  color: var(--c-primary);
}

/* Assistant is "plain": no bubble */
.chat-bubble--assistant{
  background: transparent;
  border: none;
  padding: 0;
  border-radius: 0;
  max-width: 100%;
  min-width: 0;
}

/* Bubble action row (read/copy) */
.chat-bubble{
  position: relative; /* anchor for actions */
}

/* A footer area inside bubble */
.chat-bubble-actions{
  display: flex;
  gap: 8px;
  justify-content: flex-start;   /* <-- ragged left */
  margin-top: 6px;
  opacity: 0.95;
  width: 100%; 
}

/* Minimal icon-like buttons */
.chat-bubble-actions .bubble-btn{
  background: transparent;
  border: 1px solid var(--c-primary-gray);
  color: var(--c-primary);
  border-radius: 8px;
  padding: 3px 8px;
  font-size: 12px;
  line-height: 1.2;
  cursor: pointer;

  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* Override global button centering for bubble action buttons */
.chat-bubble-actions .bubble-btn{
  display: inline-flex;     /* already in your file, but keep it */
  margin: 0 !important;     /* IMPORTANT: kill margin-left/right:auto from global button rule */
  width: auto;              /* safety: prevent stretching */
  flex: 0 0 auto;           /* safety: don't grow */
}

.chat-bubble-actions .bubble-btn:hover{
  background: var(--c-accent-light);
}

.chat-bubble-actions .bubble-btn:focus-visible{
  outline: var(--focus-ring-width) solid var(--focus-ring-color);
  outline-offset: 2px;
}

/* Don’t show bubble actions on the assistant “plain” container if you don’t want them there.
   If you DO want them, remove this rule. */
.chat-bubble-actions .bubble-btn.is-speaking{
  color: var(--c-active-blue);
}
.chat-bubble-actions{
  padding-top: 2px;
}

/* User bubble: align action buttons to the right */
.chat-bubble--user .chat-bubble-actions,
.chat-bubble--upload .chat-bubble-actions{
  justify-content: flex-end;
}
/* Remove separators if any remain */
#history hr{ display: none; }

/* Search results inside dataspace <details> */
.ds-results{
  margin-top: 6px;
}

.ds-hit{
  padding: 10px 0;
  border-top: 1px solid var(--c-primary-gray);
}
.ds-hit:first-child{ border-top: none; }

/* Make "Result N" pop (bigger + strong + dark) */
.ds-hit-head{
  margin: 0 0 6px;
  font-size: 14px;
  font-weight: 800;
  color: var(--c-black);
  font-family: var(--ff-body);
}

/* score stays subtle (gray) */
.ds-score{
  font-size: 11px;
  font-weight: 400;
  color: var(--c-gray-dark);
  margin-left: 6px;
}

/* keep meta + snippet slightly gray but readable */
.ds-meta{
  display: grid;
  gap: 2px;
  font-size: 12px;
  color: var(--c-gray-dark);
}

.ds-snippet{
  margin-top: 6px;
  font-size: 12px;
  color: var(--c-gray-dark);
}

/* Optional: make code path slightly darker than surrounding meta */
.ds-meta code{
  color: var(--c-black);
  background: var(--c-secondary);
}

.ds-hit{
  padding: 10px 10px;
  border: 1px solid var(--c-primary-gray);
  border-radius: 8px;
  background: var(--c-white);
  box-shadow: var(--shadow-2);
  margin: 8px 0;
}
.ds-hit:first-child{ margin-top: 0; }

/* ===========================
   Code rendering (single source of truth)
   =========================== */

/* Inline code should stay inline and wrap nicely */
.chat-bubble code,
#history code, #request code, #response code {
  display: inline;
  white-space: pre-wrap;       /* keep spaces, allow wrap */
  word-break: normal;
  overflow-wrap: anywhere;

  background-color: var(--c-pre-backgr);
  color: var(--c-pre-color);
  padding: 2px 5px;
  border-radius: 3px;

  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.95em;
}

/* Code blocks should preserve formatting and not be affected by inline code styling */
.chat-bubble pre,
#history pre, #request pre, #response pre {
  display: block;
  background-color: var(--c-pre-backgr);
  color: var(--c-pre-color);

  padding: 15px;
  border-radius: 5px;
  overflow-x: auto;

  /* IMPORTANT: keep code formatting stable */
  white-space: pre;            /* not pre-wrap */
  word-wrap: normal;
  word-break: normal;

  border-left: 5px solid var(--c-pre-backgr);

  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 14px;
  line-height: 1.4;
}

/* The <code> inside <pre> must not look like inline code */
.chat-bubble pre > code,
#history pre > code, #request pre > code, #response pre > code {
  display: block;
  padding: 0;
  margin: 0;
  border-radius: 0;

  background: transparent;
  color: inherit;

  white-space: inherit; /* follow pre */
}

.dawid-streaming-plain {
  margin: 0.35em 0;
  white-space: pre-wrap;   /* for streaming it’s OK to wrap */
  overflow-x: auto;
  padding: 12px;
  border-radius: 6px;
  background: rgba(0,0,0,0.03);  /* or use var */
  border: 1px solid var(--c-primary-gray);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 13px;
}
.dawid-streaming-plain code {
  background: transparent;
  padding: 0;
}

/* ===== HOTFIX: inline code must stay inline ===== */
#history p code,
#request p code,
#response p code,
.chat-bubble p code,
#history li code,
#request li code,
#response li code,
.chat-bubble li code {
  display: inline !important;
  white-space: pre-wrap !important;
  vertical-align: baseline !important;
}

/* Ensure code blocks remain blocks */
#history pre > code,
#request pre > code,
#response pre > code,
.chat-bubble pre > code {
  display: block !important;
  white-space: inherit !important;
}

.assistant-label { margin: 0 0 6px 0; }

/* ===========================
   Footer
   =========================== */

.dawid-footer{
  margin-top: 0px;
  padding-top: 12px;
  border-top: 1px solid var(--c-primary-gray);
  color: var(--c-gray-dark);
  font-size: 12px;
  text-align: center;
}

.dawid-footer__inner{
  width: 95%;
  margin: 0 auto;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}

.dawid-footer__left,
.dawid-footer__right{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.dawid-footer__sep{
  opacity: 0.7;
}

.dawid-footer__link{
  color: var(--c-primary);
  text-decoration: none;
  border-bottom: 1px dotted transparent;
}

.dawid-footer__link:hover{
  border-bottom-color: currentColor;
}

.dawid-footer__muted{
  opacity: 0.7;
}

.auth-shell .dawid-footer{
  margin-bottom: 12px;
}

body.auth-body{
  margin-top: 0;
}

body.auth-body .auth-shell{
  min-height: 100vh;
  min-height: 100svh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

body.auth-body .auth-main{
  flex: 1 1 auto;
  min-height: 0;      /* key */
  overflow: auto;     
  padding: 10px 0;
  box-sizing: border-box;
}

/* ===========================
   AUTH: eliminate micro-scroll
   =========================== */

/* 1) Prevent document scroll on auth pages */
html, body.auth-body{
  height: 100%;
}

body.auth-body{
  overflow: hidden; /* key: the page itself must not scroll */
}

/* 2) Make shell exactly viewport height (avoid rounding from min-height) */
body.auth-body .auth-shell{
  height: 100dvh;   /* modern */
  height: 100svh;   /* fallback for some browsers */
  height: 100vh;    /* fallback */
}

/* 3) Only main may scroll (if content truly doesn't fit) */
body.auth-body .auth-main{
  overflow: auto;
  min-height: 0;
}

/* Optional: tighten bottom margin too (choose one) */
body.auth-body h2{ margin-bottom: 12px; }
