/* --------------------------------------------------------------------------
   TM Forum ODA Architecture Console — Enterprise Developer Theme
   Clean, practical, distraction-free UI with high readability and focus.
--------------------------------------------------------------------------- */

:root {
  --bg-app: #0d1117;
  --bg-sidebar: #161b22;
  --bg-panel: #161b22;
  --bg-subtle: #21262d;
  --bg-terminal: #090d13;
  --border-color: #30363d;
  --border-focus: #58a6ff;
  
  --text-main: #c9d1d9;
  --text-muted: #8b949e;
  --text-heading: #f0f6fc;
  --text-dim: #484f58;

  --accent-blue: #1f6feb;
  --accent-blue-hover: #388bfd;
  --accent-green: #238636;
  --accent-amber: #d29922;
  --accent-red: #da3633;
  --accent-purple: #8957e5;
  --accent-cyan: #39c5bb;

  --font-sans: -apple-system, BlinkMacSystemFont, "Pretendard", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "JetBrains Mono", SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  background-color: var(--bg-app);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* --------------------------------------------------------------------------
   Global Header
--------------------------------------------------------------------------- */
.app-header {
  height: 48px;
  background-color: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-heading);
  letter-spacing: -0.2px;
}

.version-tag {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  background-color: var(--bg-subtle);
  padding: 2px 6px;
  border-radius: 3px;
  border: 1px solid var(--border-color);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: #3fb950;
  box-shadow: 0 0 4px #3fb95080;
}

.nav-link {
  font-size: 12px;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

.nav-link:hover {
  color: var(--text-heading);
}

.nav-link-highlight {
  color: #58a6ff;
}

/* --------------------------------------------------------------------------
   App Container & Sidebar
--------------------------------------------------------------------------- */
.app-container {
  display: flex;
  min-height: calc(100vh - 48px);
}

.sidebar {
  width: 290px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.sidebar-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-heading);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sidebar-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.chapter-group-header {
  padding: 10px 16px 4px 16px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.chapter-item {
  display: flex;
  flex-direction: column;
  padding: 8px 16px;
  cursor: pointer;
  border-left: 2px solid transparent;
  transition: background-color 0.15s ease, border-color 0.15s ease;
  user-select: none;
}

.chapter-item:hover {
  background-color: var(--bg-subtle);
}

.chapter-item.active {
  background-color: #1f242c;
  border-left-color: var(--accent-blue);
}

.chapter-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chapter-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: #58a6ff;
}

.chapter-item.active .chapter-badge {
  color: #79c0ff;
}

.chapter-item-title {
  font-size: 12px;
  color: var(--text-main);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chapter-item.active .chapter-item-title {
  color: var(--text-heading);
  font-weight: 500;
}

/* --------------------------------------------------------------------------
   Main Content Workspace
--------------------------------------------------------------------------- */
.main-workspace {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 20px 24px;
  gap: 16px;
  overflow-y: auto;
}

/* Hero summary */
.chapter-hero {
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 14px;
}

.hero-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.category-badge {
  font-size: 11px;
  color: var(--text-muted);
  background-color: var(--bg-subtle);
  padding: 2px 6px;
  border-radius: 3px;
  border: 1px solid var(--border-color);
}

.doc-link {
  font-size: 12px;
  color: #58a6ff;
  text-decoration: none;
}

.doc-link:hover {
  text-decoration: underline;
}

.chapter-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-heading);
  letter-spacing: -0.3px;
}

.chapter-summary {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.4;
}

/* --------------------------------------------------------------------------
   Control Panel
--------------------------------------------------------------------------- */
.test-control-panel {
  background-color: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 14px 16px;
}

.panel-section-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-heading);
  letter-spacing: 0.2px;
  margin-bottom: 10px;
}

.control-grid {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.control-group {
  flex: 1;
  min-width: 260px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.control-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
}

.form-select {
  height: 32px;
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: 3px;
  color: var(--text-heading);
  font-family: var(--font-sans);
  font-size: 12px;
  padding: 0 8px;
  outline: none;
  cursor: pointer;
}

.form-select:focus {
  border-color: var(--border-focus);
}

.control-actions {
  display: flex;
  gap: 8px;
}

.btn {
  height: 32px;
  padding: 0 14px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 3px;
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

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

.btn-primary {
  background-color: var(--accent-blue);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.1);
}

.btn-primary:hover:not(:disabled) {
  background-color: var(--accent-blue-hover);
}

.btn-secondary {
  background-color: var(--bg-subtle);
  color: var(--text-main);
  border-color: var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
  background-color: #2b313a;
  color: var(--text-heading);
}

.btn-outline {
  background-color: transparent;
  color: var(--text-muted);
  border-color: var(--border-color);
}

.btn-outline:hover:not(:disabled) {
  color: var(--text-heading);
  border-color: #58a6ff;
}

.payload-accordion {
  margin-top: 12px;
  border-top: 1px solid var(--border-color);
  padding-top: 8px;
}

.accordion-summary {
  font-size: 11px;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
  padding: 4px 0;
}

.accordion-summary:hover {
  color: var(--text-heading);
}

.summary-hint {
  font-family: var(--font-mono);
  font-size: 10px;
  color: #58a6ff;
}

.accordion-body {
  margin-top: 8px;
}

.form-textarea {
  width: 100%;
  height: 90px;
  background-color: var(--bg-terminal);
  border: 1px solid var(--border-color);
  border-radius: 3px;
  color: #7ee787;
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.4;
  padding: 8px 10px;
  resize: vertical;
  outline: none;
}

.form-textarea:focus {
  border-color: var(--border-focus);
}

/* --------------------------------------------------------------------------
   Pipeline Flow Section
--------------------------------------------------------------------------- */
.pipeline-section {
  background-color: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pipeline-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.pipeline-stats {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

.pipeline-flow {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding: 6px 2px 10px 2px;
}

.flow-node {
  min-width: 125px;
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: 3px;
  padding: 8px 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  flex-shrink: 0;
}

.flow-node:hover {
  border-color: var(--text-muted);
}

.flow-node.active {
  border-color: var(--accent-blue);
  background-color: #1a2332;
  box-shadow: 0 0 0 1px var(--accent-blue);
}

.flow-node.success {
  border-color: #238636;
  background-color: #102619;
}

.flow-node.failed {
  border-color: var(--accent-red);
  background-color: #2d1416;
}

.flow-node.compensating {
  border-color: var(--accent-amber);
  background-color: #2c2010;
}

.node-layer-tag {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  text-transform: uppercase;
}

.node-name {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-heading);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.node-state {
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.flow-connector {
  color: var(--border-color);
  font-family: var(--font-mono);
  font-size: 12px;
  flex-shrink: 0;
}

/* Inspector */
.node-inspector {
  background-color: var(--bg-terminal);
  border: 1px solid var(--border-color);
  border-radius: 3px;
  padding: 8px 12px;
  font-family: var(--font-mono);
  font-size: 11px;
}

.inspector-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
  border-bottom: 1px solid #1c2128;
  padding-bottom: 4px;
}

.inspector-title {
  color: var(--text-muted);
  font-weight: 500;
}

.inspector-badge {
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 2px;
  background-color: var(--bg-subtle);
  color: #79c0ff;
}

.inspector-content {
  color: #8b949e;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 100px;
  overflow-y: auto;
}

/* --------------------------------------------------------------------------
   Live Terminal Section
--------------------------------------------------------------------------- */
.terminal-section {
  background-color: var(--bg-terminal);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 280px;
}

.terminal-header {
  height: 34px;
  background-color: #12171f;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
}

.terminal-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.terminal-title {
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-heading);
}

.terminal-counter {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  background-color: var(--bg-subtle);
  padding: 1px 5px;
  border-radius: 2px;
}

.terminal-tools {
  display: flex;
  align-items: center;
  gap: 12px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}

.terminal-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 11px;
  cursor: pointer;
  padding: 2px 4px;
}

.terminal-btn:hover {
  color: var(--text-heading);
}

.terminal-window {
  flex: 1;
  padding: 10px 12px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.5;
  overflow-y: auto;
  max-height: 360px;
}

.terminal-line {
  display: flex;
  gap: 8px;
  margin-bottom: 2px;
  word-break: break-all;
}

.log-time {
  color: var(--text-dim);
  flex-shrink: 0;
}

.log-tag {
  font-size: 10px;
  font-weight: 600;
  padding: 0 4px;
  border-radius: 2px;
  flex-shrink: 0;
}

.tag-system { background-color: #21262d; color: #8b949e; }
.tag-info   { background-color: #1f6feb22; color: #58a6ff; }
.tag-sql    { background-color: #8957e522; color: #bc8cff; }
.tag-warn   { background-color: #d2992222; color: #e3b341; }
.tag-error  { background-color: #da363322; color: #f85149; }

.log-comp {
  color: #79c0ff;
  flex-shrink: 0;
}

.log-msg {
  color: var(--text-main);
}

.log-sql .log-msg {
  color: #e2c08d;
}

.log-error .log-msg {
  color: #ff7b72;
}

.log-warn .log-msg {
  color: #d29922;
}

/* --------------------------------------------------------------------------
   Desktop-First Layout Enforcement (Mobile requests stay on Desktop UI)
--------------------------------------------------------------------------- */
html, body {
  min-width: 1280px;
}

.app-container {
  min-width: 1280px;
}

/* --------------------------------------------------------------------------
   Visualizer Tabs & Diagram Extensions
--------------------------------------------------------------------------- */
.visualizer-section {
  background-color: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.visualizer-tabs-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 8px;
}

.tabs-group {
  display: flex;
  gap: 6px;
}

.tab-btn {
  background-color: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  padding: 4px 12px;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tab-btn:hover {
  color: var(--text-heading);
  background-color: var(--bg-subtle);
}

.tab-btn.active {
  color: var(--text-heading);
  background-color: var(--bg-subtle);
  border-color: var(--border-color);
  border-bottom-color: #58a6ff;
  border-bottom-width: 2px;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
}

.diagram-info-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 8px;
  padding: 4px 8px;
  background-color: rgba(88, 166, 255, 0.08);
  border-left: 2px solid #58a6ff;
  border-radius: 2px;
}

/* --------------------------------------------------------------------------
   Sequence Diagram Container & Styles
--------------------------------------------------------------------------- */
.sequence-container {
  min-height: 200px;
  background-color: var(--bg-terminal);
  border: 1px solid var(--border-color);
  border-radius: 3px;
  padding: 12px;
  overflow-x: auto;
}

.seq-svg {
  width: 100%;
  min-width: 700px;
  font-family: var(--font-mono);
}

.seq-actor-box {
  fill: #161b22;
  stroke: #30363d;
  stroke-width: 1.5;
  cursor: pointer;
  transition: fill 0.2s, stroke 0.2s;
}

.seq-actor-box:hover {
  stroke: #58a6ff;
  fill: #1c2128;
}

.seq-actor-text {
  fill: #f0f6fc;
  font-size: 11.5px;
  font-weight: 600;
  text-anchor: middle;
  pointer-events: none;
}

.seq-actor-subtext {
  fill: #8b949e;
  font-size: 9.5px;
  text-anchor: middle;
  pointer-events: none;
}

.seq-lifeline {
  stroke: #30363d;
  stroke-width: 1;
  stroke-dasharray: 4, 4;
}

.seq-activation {
  fill: #21262d;
  stroke: #30363d;
  stroke-width: 1;
  transition: all 0.25s ease;
}

.seq-activation.active {
  fill: #1f6feb;
  stroke: #58a6ff;
  box-shadow: 0 0 8px #58a6ff;
}

.seq-message-line {
  stroke: #58a6ff;
  stroke-width: 1.5;
  cursor: pointer;
  transition: stroke 0.2s;
}

.seq-message-line.compensate {
  stroke: #d29922;
  stroke-dasharray: 4, 3;
}

.seq-message-line.return {
  stroke: #8b949e;
  stroke-dasharray: 3, 3;
}

.seq-message-line.highlight {
  stroke: #3fb950;
  stroke-width: 2.5;
}

.seq-message-text {
  fill: #c9d1d9;
  font-size: 10.5px;
  cursor: pointer;
  transition: fill 0.15s;
}

.seq-message-text:hover {
  fill: #58a6ff;
  text-decoration: underline;
}

.seq-message-text.highlight {
  fill: #3fb950;
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   Class Diagram Grid & Styles
--------------------------------------------------------------------------- */
.class-diagram-container {
  min-height: 220px;
  background-color: var(--bg-terminal);
  border: 1px solid var(--border-color);
  border-radius: 3px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-x: auto;
}

.class-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.class-card {
  background-color: #161b22;
  border: 1px solid var(--border-color);
  border-radius: 3px;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.15s;
  display: flex;
  flex-direction: column;
}

.class-card:hover {
  border-color: #58a6ff;
  transform: translateY(-1px);
}

.class-card.active {
  border-color: #3fb950;
  box-shadow: 0 0 0 1px #3fb950;
}

.class-card-header {
  padding: 6px 10px;
  background-color: #21262d;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.class-stereotype {
  font-family: var(--font-mono);
  font-size: 9px;
  color: #8b949e;
  text-transform: uppercase;
}

.class-layer-pill {
  font-family: var(--font-mono);
  font-size: 9px;
  padding: 1px 4px;
  border-radius: 2px;
  background-color: #30363d;
  color: #c9d1d9;
}

.class-card-title {
  padding: 6px 10px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  color: #f0f6fc;
}

.class-card-methods {
  padding: 6px 10px 8px 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: #8b949e;
  border-top: 1px solid #21262d;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.class-relations-list {
  padding: 8px 12px;
  background-color: #12171f;
  border: 1px solid var(--border-color);
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

.relation-item {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 3px;
}

.rel-tag {
  font-size: 9.5px;
  padding: 1px 4px;
  border-radius: 2px;
  background-color: #21262d;
  color: #58a6ff;
}

/* --------------------------------------------------------------------------
   Source Code Viewer Drawer (Slide-in)
--------------------------------------------------------------------------- */
.code-drawer {
  position: fixed;
  top: 0;
  right: -620px;
  width: 600px;
  max-width: 90vw;
  height: 100vh;
  background-color: #0d1117;
  border-left: 1px solid var(--border-color);
  box-shadow: -4px 0 16px rgba(0, 0, 0, 0.5);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transition: right 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.code-drawer.open {
  right: 0;
}

.code-drawer-header {
  height: 52px;
  padding: 0 16px;
  background-color: #161b22;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.drawer-title-group {
  display: flex;
  flex-direction: column;
}

.drawer-class-name {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-heading);
}

.drawer-pkg {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
}

.drawer-actions {
  display: flex;
  gap: 8px;
}

.btn-sm {
  height: 26px;
  padding: 0 10px;
  font-size: 11px;
}

.code-drawer-meta {
  padding: 6px 16px;
  background-color: #12171f;
  border-bottom: 1px solid var(--border-color);
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-muted);
}

.code-drawer-body {
  flex: 1;
  padding: 12px 16px;
  overflow-y: auto;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.5;
  background-color: #090d13;
}

.java-code {
  color: #c9d1d9;
  white-space: pre;
  display: block;
}

.drawer-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.4);
  z-index: 999;
  display: none;
}

.drawer-backdrop.open {
  display: block;
}
