html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: #111827;
  color: #e5e7eb;
  overflow: hidden; /* page itself never scrolls */
}

.layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.pane {
  flex: 1;
  min-width: 0;
  min-height: 0; /* important so children can scroll */
  display: flex;
  flex-direction: column;
  overflow: hidden; /* each pane manages its own scroll */
}

.pane.left {
  border-right: 1px solid #374151;
  background: #000;
  width: 75vw;
  flex: none;
}

.pane.right {
  background: #111827;
  flex: 1 1 auto;
  min-width: 200px;
}

.header {
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 600;
  background: #030712;
  border-bottom: 1px solid #374151;
  display: flex;
  align-items: center;
  justify-content: space-between;

  position: sticky; /* stays visible */
  top: 0;
  z-index: 10;
}

.header span.sub {
  font-size: 12px;
  font-weight: normal;
  color: #9ca3af;
}

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

/* Small pill button in header */
.header-btn {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid #374151;
  background: #111827;
  color: #e5e7eb;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.header-btn:hover {
  background: #1f2937;
  border-color: #4b5563;
}

.header-btn:active {
  transform: translateY(1px);
}

/* LEFT PANE – iframe fills remaining height */
.pane.left iframe {
  border: none;
  width: 100%;
  flex: 1 1 auto;
  height: 100%;
}

/* REMOVE the global iframe rule, we now target only left pane iframe */
/* (your old global iframe rule is no longer needed) */

/* RIGHT PANE – chat */
.chat-container {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0; /* allows .messages to scroll */
  /* height: 100%;  <-- remove this */
}

.messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto; /* only this scrolls */
  padding: 12px 14px;
  background: #020617;
}

.msg {
  margin-bottom: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  max-width: 95%;
  line-height: 1.4;
  font-size: 14px;
  white-space: pre-wrap;
}

.msg.user {
  background: #1d4ed8;
  align-self: flex-end;
}

.msg.assistant {
  background: #111827;
  border: 1px solid #1f2937;
  align-self: flex-start;
}

.msg.system {
  background: #0f172a;
  color: #9ca3af;
  font-size: 12px;
  align-self: center;
}

/* --- Markdown znotraj assistant sporočil --- */
.msg.assistant p {
  margin: 0 0 6px 0;
}

.msg.assistant ul,
.msg.assistant ol {
  margin: 4px 0 6px 18px;
  padding-left: 18px;
}

.msg.assistant li {
  margin-bottom: 2px;
}

.msg.assistant code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", "Courier New", monospace;
  font-size: 13px;
  background: #020617;
  padding: 2px 4px;
  border-radius: 4px;
}

.msg.assistant pre {
  margin: 6px 0;
  padding: 8px;
  background: #020617;
  border-radius: 6px;
  overflow-x: auto;
}

.msg.assistant pre code {
  padding: 0;
  background: transparent;
}

.msg.assistant h1,
.msg.assistant h2,
.msg.assistant h3,
.msg.assistant h4,
.msg.assistant h5,
.msg.assistant h6 {
  margin: 4px 0 6px 0;
  font-weight: 600;
}

.chat-input {
  border-top: 1px solid #374151;
  padding: 10px;
  background: #030712;
  display: flex;
  gap: 8px;
  flex: 0 0 auto; /* fixed at bottom */
}

.chat-input input[type="text"] {
  flex: 1;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid #4b5563;
  background: #020617;
  color: #e5e7eb;
  font-size: 14px;
  outline: none;
}

.chat-input input[type="text"]:focus {
  border-color: #60a5fa;
}

.chat-input button {
  border: none;
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 14px;
  cursor: pointer;
  background: #22c55e;
  color: #022c22;
  font-weight: 600;
  transition: transform 0.05s ease-out, box-shadow 0.05s ease-out;
  white-space: nowrap;
}

.chat-input button:active {
  transform: translateY(1px);
  box-shadow: none;
}

.chat-input button:disabled {
  opacity: 0.5;
  cursor: default;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  display: inline-block;
  background: #16a34a;
}

.status-offline {
  background: #b91c1c;
}

.splitter {
  width: 6px;
  background: #1f2937;
  cursor: col-resize;
  flex: none;
}

.splitter:hover {
  background: #374151;
}

/* When dragging the splitter, disable pointer events on the iframe
   so it doesn't "eat" mousemove/mouseup events. */
.body-dragging iframe {
  pointer-events: none;
}

/* --- DICOM + MONAI toolbars ----------------------------------- */

.dicom-data-container,
.monai-container {
  flex: 0 0 auto;
  padding: 8px 14px;
  background: #020617;
  border-bottom: 1px solid #1f2937;

  display: flex;
  align-items: center;
  justify-content: flex-start;
  border-bottom: 1px solid #1f2937;
}

/* Put them visually closer together, like one combined tools area */
.monai-container {
  /*border-top: 1px solid #020617;      /* hide double line between them */
  /*margin-top: -1px; */
  flex-wrap: wrap; /* ADD THIS */
}

/* Wrap inner <div> so content hugs left and doesn’t stretch weirdly */
.dicom-data-container > div,
.monai-container > div {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Buttons in toolbars: small, pill-shaped, consistent with chat button */
.dicom-data-container button,
.monai-container button {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid #374151;
  background: #111827;
  color: #e5e7eb;
  cursor: pointer;

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

/* Run modelling button states */
#run-monai-seg-btn:disabled {
  background: #4b5563; /* grey */
  border-color: #4b5563;
  color: #9ca3af;
  cursor: not-allowed;
}

#run-monai-seg-btn:not(:disabled) {
  background: #22c55e; /* green, same as chat send */
  border-color: #22c55e;
  color: #022c22;
  cursor: pointer;
}

.dicom-data-container button:hover,
.monai-container button:hover {
  background: #1f2937;
  border-color: #4b5563;
}

.dicom-data-container button:active,
.monai-container button:active {
  transform: translateY(1px);
}

.dicom-data-container > div {
  font-size: 0.8rem; /* smaller font size */
  margin: 0; /* optional: to adjust spacing */
}

.monai-container > div > p {
  font-size: 0.8rem; /* smaller font size */
  margin: 0; /* optional: to adjust spacing */
}

.monai-container > div {
  width: 100%;
}

.monai-container > div button {
  margin-right: auto;
}

.monai-container select {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid #374151;
  background: #111827;
  color: #e5e7eb;
  cursor: pointer;

  /* match button flex behavior */
  display: inline-flex;
  align-items: center;

  /* prevent text from wrapping */
  white-space: nowrap;
}

.monai-container select:focus {
  outline: none;
  border-color: #60a5fa;
}

.monai-container select:hover {
  background: #1f2937;
  border-color: #4b5563;
}

.monai-model-name {
  font-size: 12px;
  color: #e5e7eb;
  gap: 6px;
}

.monai-model-pill {
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid #374151;
  background: #111827;
  color: #e5e7eb;
  white-space: nowrap;
}

/* === Condensed chat layout ==================================== */

/* Less padding around the whole message area */
.messages {
  padding: 6px 8px;
}

/* Smaller, tighter message bubbles */
.msg {
  margin-bottom: 4px;
  padding: 4px 6px;
  border-radius: 6px;
  max-width: 95%;
  line-height: 1.25;
  font-size: 13px;
}

/* Tighter Markdown formatting inside assistant messages */
.msg.assistant p {
  margin: 0 0 2px 0;
}

.msg hr {
  border: 0;
  border-top: 1px solid #1f2937;
  margin: 6px 0;
  opacity: 0.8;
}

.msg.assistant ul,
.msg.assistant ol {
  margin: 2px 0 2px 16px;
  padding-left: 16px;
}

.msg.assistant li {
  margin-bottom: 1px;
}

.msg.assistant pre {
  margin: 2px 0;
  padding: 4px 6px;
}

/* Condensed input area at the bottom */
.chat-input {
  padding: 6px;
  gap: 6px;
}

.chat-input input[type="text"] {
  padding: 6px 8px;
  font-size: 13px;
}

.chat-input button {
  padding: 6px 10px;
  font-size: 13px;
}

.divider {
  height: 1px;
  background-color: #374151;
  margin: 8px 0;
  width: 100%;
  flex-basis: 100%; /* force to take full line */
  flex-shrink: 0;
}

button.btn-disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.status-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #6b7280; /* default: gray */
  margin-right: 6px;
}

/* When models are loaded → green */
.status-dot.status-online {
  background: #22c55e; /* green-500-ish */
}

#run-monai-seg-btn {
  display: block; /* make it a block element */
  width: 100%; /* full width of its container */
  box-sizing: border-box; /* include padding in width */
  padding: 8px 12px; /* optional: nicer size */
  margin-top: 5px; /* optional: space from fields above */
}

.header {
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 600;

  display: flex; /* NEW: flex layout */
  justify-content: space-between; /* left + right */
  align-items: center; /* vertical centering */
}

/* Optional: style left/right parts if you want */
.header-title {
  /* e.g. keep default */
}

.header-brand {
  opacity: 0.9;
  font-weight: 700;
  /* optional: slightly smaller or lighter */
  /* font-size: 13px; */
}
