/* --------------------------------------------------------
   Open WebUI–style design system (dark theme)
   -------------------------------------------------------- */

*, *::before, *::after {
  box-sizing: border-box;
}

:root {
  --font: 'Inter', 'Segoe UI', system-ui, sans-serif;

  /* Neutrals (matching OW dark palette) */
  --bg:        #171717;
  --bg-2:      #1e1e1e;
  --bg-3:      #262626;
  --bg-hover:  #2e2e2e;
  --border:    #363636;
  --border-2:  #404040;

  /* Text */
  --text:      #efefef;
  --text-2:    #a3a3a3;
  --text-3:    #737373;

  /* Accent (OW uses white-on-dark primarily; blue accent for interactive) */
  --accent:    #3b82f6;
  --accent-2:  #2563eb;
  --danger:    #ef4444;
  --success:   #22c55e;
  --warning:   #f59e0b;

  /* Sizes */
  --radius:    10px;
  --radius-lg: 14px;
  --topnav-h:  52px;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ---- Top nav ---------------------------------------- */
.topnav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--topnav-h);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  z-index: 50;
}

.topnav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  padding: 0 1.25rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
}

.brand-icon {
  width: 20px;
  height: 20px;
  color: var(--accent);
}

.brand-name {
  letter-spacing: -0.01em;
}

/* Status badge in topnav */
.badge {
  font-size: 0.72rem;
  font-weight: 500;
  padding: 0.2rem 0.65rem;
  border-radius: 99px;
  background: var(--bg-3);
  color: var(--text-2);
  border: 1px solid var(--border);
  transition: background 0.2s, color 0.2s;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge.joining  { background: rgba(245,158,11,.12); color: var(--warning); border-color: rgba(245,158,11,.25); }
.badge.recording { background: rgba(239,68,68,.12);  color: var(--danger);  border-color: rgba(239,68,68,.25); animation: pulse 2s infinite; }
.badge.processing { background: rgba(59,130,246,.12); color: var(--accent); border-color: rgba(59,130,246,.25); }
.badge.completed { background: rgba(34,197,94,.12);  color: var(--success); border-color: rgba(34,197,94,.25); }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.6; }
}

/* ---- Workspace layout ------------------------------- */
.workspace {
  display: grid;
  grid-template-columns: 300px 1fr;
  height: calc(100vh - var(--topnav-h));
  margin-top: var(--topnav-h);
  overflow: hidden;
}

/* ---- Sidebar ---------------------------------------- */
.sidebar {
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  overflow-y: auto;
}

.sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.section-label {
  margin: 0;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
  padding: 0 0.1rem;
}

/* ---- Form fields ------------------------------------ */
form {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.field label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-2);
}

.field-icon {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}

.field input {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  padding: 0.48rem 0.65rem;
  width: 100%;
  transition: border-color 0.15s;
  outline: none;
}

.field input::placeholder { color: var(--text-3); }
.field input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(59,130,246,.18); }

/* ---- Buttons ---------------------------------------- */
button {
  cursor: pointer;
  font: inherit;
  border: none;
  outline: none;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius);
  font-size: 0.82rem;
  font-weight: 500;
  transition: background 0.15s, opacity 0.15s, transform 0.1s;
  white-space: nowrap;
}

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

.btn-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.btn-primary {
  background: var(--text);
  color: var(--bg);
  width: 100%;
}
.btn-primary:hover { background: #d4d4d4; }

.btn-accent {
  background: var(--accent);
  color: #fff;
  flex: 1;
}
.btn-accent:hover { background: var(--accent-2); }

.btn-ghost {
  background: var(--bg-3);
  color: var(--text-2);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text); }

.btn-danger {
  color: var(--danger) !important;
}
.btn-danger:hover { background: rgba(239,68,68,.1) !important; }

.btn-sm { padding: 0.35rem 0.65rem; font-size: 0.78rem; }

.btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.btn-group > .btn {
  flex: 1 1 auto;
  min-width: 0;
}

.mock-tools {
  padding-top: 0.15rem;
  border-top: 1px dashed var(--border);
}

.mock-tools-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.45rem;
}

.mock-tools-actions .btn {
  justify-content: flex-start;
  width: 100%;
}

/* ---- Status card ------------------------------------ */
.status-card {
  margin-top: auto;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius);
  background: var(--bg-3);
  border: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--text-2);
  line-height: 1.4;
}

/* ---- Content area ----------------------------------- */
.content-area {
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow: hidden;
}

.top-split {
  display: flex;
  min-height: 0;
  flex: 1;
  --transcript-split: 50%;
}

.content-area > .panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}

.content-area > .panel:last-child {
  border-bottom: none;
}

.panel-split {
  min-width: 0;
  border-bottom: 1px solid var(--border);
}

#transcriptPanel {
  flex: 0 0 var(--transcript-split);
  border-right: 1px solid var(--border);
}

#quickPanel {
  min-width: 0;
  flex: 1 1 auto;
}

.split-divider {
  width: 10px;
  flex: 0 0 10px;
  cursor: col-resize;
  background: transparent;
  position: relative;
}

.split-divider::before {
  content: '';
  position: absolute;
  top: 0.7rem;
  bottom: 0.7rem;
  left: 4px;
  width: 2px;
  border-radius: 99px;
  background: var(--border-2);
  opacity: 0.8;
  transition: background 0.15s;
}

.split-divider:hover::before,
.split-divider.is-dragging::before {
  background: #60a5fa;
}

.panel-details {
  min-height: 0;
  flex: 1;
}

/* ---- Panel ------------------------------------------ */
.panel {
  background: var(--bg);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 1rem;
  min-height: 2.75rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-2);
  flex-shrink: 0;
}

.panel-title {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.panel-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.panel-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

#transcriptPanel.panel--compact #manualTranscript,
#transcriptPanel.panel--compact #appendMockBtn {
  display: none;
}

#quickPanel.panel--compact #additionalContext {
  display: none;
}

.text-size-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  border: 1px solid var(--border);
  background: var(--bg-3);
  border-radius: 8px;
  padding: 0.18rem;
}

.size-btn {
  min-width: 1.55rem;
  padding: 0.2rem 0.3rem;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-3);
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 1;
}

.size-btn:hover {
  background: rgba(148, 163, 184, 0.15);
  color: var(--text-2);
}

.size-btn.active {
  background: rgba(59, 130, 246, 0.22);
  color: #bfdbfe;
}

.inline-input {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
  padding: 0.35rem 0.6rem;
  width: 240px;
  outline: none;
  transition: border-color 0.15s;
}
.inline-input::placeholder { color: var(--text-3); }
.inline-input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(59,130,246,.18); }

.content-pre {
  margin: 0;
  padding: 1rem;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--font);
  font-size: var(--panel-font-size, 0.84rem);
  line-height: 1.65;
  color: var(--text-2);
  overflow-y: auto;
  flex: 1;
}

.content-pre.text-size-small { --panel-font-size: 0.84rem; }
.content-pre.text-size-medium { --panel-font-size: 0.94rem; }
.content-pre.text-size-large { --panel-font-size: 1.06rem; }

.content-pre--insights {
  display: flex;
  flex-direction: column;
  color: var(--text);
}

.insights-render {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  flex: 1;
  min-height: 0;
}

.insight-quick {
  border: 1px solid rgba(59, 130, 246, 0.4);
  background: linear-gradient(180deg, rgba(37, 99, 235, 0.12), rgba(30, 41, 59, 0.2));
  border-radius: 14px;
  padding: 0.85rem;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.insight-quick-head {
  font-size: calc(var(--panel-font-size, 0.84rem) * 0.9);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #bfdbfe;
  margin-bottom: 0.65rem;
  font-weight: 600;
}

.insight-quick-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
  flex: 1;
  min-height: 0;
  align-items: stretch;
}

.insight-quick-card {
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: rgba(15, 23, 42, 0.38);
  border-radius: 10px;
  padding: 0.65rem 0.7rem;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.insight-quick-card h4 {
  margin: 0 0 0.45rem;
  font-size: calc(var(--panel-font-size, 0.84rem) * 0.9);
  font-weight: 600;
  color: #e2e8f0;
  letter-spacing: 0.02em;
}

.insight-quick-card ul {
  margin: 0;
  padding-left: 1rem;
  flex: 1;
  max-height: none;
  overflow-y: auto;
  padding-right: 0.2rem;
}

.insight-quick-card li {
  font-size: calc(var(--panel-font-size, 0.84rem) * 0.95);
  line-height: 1.45;
  margin: 0.22rem 0;
  color: #f8fafc;
}

.insight-quick-card li::marker {
  color: #93c5fd;
}

.insight-details {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.insight-section {
  border: 1px solid var(--border);
  background: var(--bg-2);
  border-radius: 12px;
  padding: 0.8rem 0.9rem;
}

.insight-section h3 {
  margin: 0 0 0.55rem;
  font-size: calc(var(--panel-font-size, 0.84rem) * 0.85);
  line-height: 1.3;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #93c5fd;
}

.insight-section p {
  margin: 0.45rem 0 0;
  font-size: var(--panel-font-size, 0.84rem);
  line-height: 1.6;
  color: var(--text-2);
}

.insight-section ul {
  margin: 0.35rem 0 0;
  padding-left: 1rem;
}

.insight-section li {
  margin: 0.25rem 0;
  font-size: var(--panel-font-size, 0.84rem);
  line-height: 1.55;
  color: var(--text);
}

.insight-section li::marker {
  color: #60a5fa;
}

.insight-muted {
  color: var(--text-3);
}

body.is-split-resizing,
body.is-split-resizing * {
  user-select: none !important;
  cursor: col-resize !important;
}

/* ---- Scrollbar -------------------------------------- */
::-webkit-scrollbar              { width: 5px; height: 5px; }
::-webkit-scrollbar-track        { background: transparent; }
::-webkit-scrollbar-thumb        { background: var(--border-2); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover  { background: var(--text-3); }

/* ---- Responsive ------------------------------------- */
@media (max-width: 840px) {
  .workspace {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    height: auto;
  }
  .sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .top-split {
    display: grid;
    grid-template-columns: 1fr;
  }
  .split-divider { display: none; }
  #transcriptPanel {
    flex: 1 1 auto;
    border-right: none;
  }
  .inline-input { width: 100%; }
  .insight-quick-grid { grid-template-columns: 1fr; }
}

/* ---- Chat link ----------------------------------------- */
.chat-link {
  margin-top: 0.4rem; font-size: 0.75rem;
}
.chat-link a { color: var(--accent); text-decoration: none; }
.chat-link a:hover { text-decoration: underline; }
