/* java-runner Widget Styles */

:root {
  --jr-bg: #ffffff;
  --jr-border: #d0d0d0;
  --jr-toolbar-bg: #f5f5f5;
  --jr-tab-text: #555555;
  --jr-tab-hover: #e8e8e8;
  --jr-tab-active-text: #000000;
  --jr-accent: #007acc;
  --jr-accent-hover: #005a9e;
  --jr-console-bg: #1e1e1e;
  --jr-console-text: #d4d4d4;
  --jr-console-input: #73d0ff;
  --jr-console-error: #ff6b6b;
  --jr-console-separator: #444444;
  --jr-btn-run: #1a7f37;
  --jr-btn-run-hover: #15692d;
  --jr-btn-stop: #dc3545;
  --jr-btn-stop-hover: #c82333;
  --jr-btn-reset: #6c757d;
  --jr-btn-reset-hover: #5a6268;
  --jr-btn-test: #6f42c1;
  --jr-btn-test-hover: #5a32a3;
  --jr-input-bg: #2d2d2d;
  --jr-input-border: #666666;
  --jr-radius: 6px;
  --jr-font-mono: "Fira Code", "Consolas", "Monaco", "Courier New", monospace;
}

/* ---- Widget shell ---- */

.jr-widget {
  border: 1px solid var(--jr-border);
  border-radius: var(--jr-radius);
  overflow: hidden;
  margin: 1em 0;
  background: var(--jr-bg);
  font-family: sans-serif;
}

/* ---- Toolbar ---- */

.jr-toolbar {
  display: flex;
  gap: 6px;
  padding: 6px 10px;
  background: var(--jr-toolbar-bg);
  border-top: 1px solid var(--jr-border);
  border-bottom: 1px solid var(--jr-border);
}

.jr-btn {
  border: none;
  border-radius: 4px;
  padding: 5px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: #fff;
  transition: background 0.15s;
}

.jr-btn-run { background: var(--jr-btn-run); }
.jr-btn-run:hover { background: var(--jr-btn-run-hover); }
.jr-btn-stop { background: var(--jr-btn-stop); }
.jr-btn-stop:hover { background: var(--jr-btn-stop-hover); }
.jr-btn-reset { background: var(--jr-btn-reset); }
.jr-btn-reset:hover { background: var(--jr-btn-reset-hover); }
.jr-btn-test { background: var(--jr-btn-test); }
.jr-btn-test:hover { background: var(--jr-btn-test-hover); }

/* ---- Tab bar ---- */

.jr-tab-bar {
  display: flex;
  background: var(--jr-toolbar-bg);
  border-bottom: 1px solid var(--jr-border);
  overflow-x: auto;
  font-size: 13px;
}

.jr-tab {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  cursor: pointer;
  border-right: 1px solid var(--jr-border);
  white-space: nowrap;
  user-select: none;
  color: var(--jr-tab-text);
  transition: background 0.15s;
}

.jr-tab:hover {
  background: var(--jr-tab-hover);
}

.jr-tab-active {
  background: var(--jr-bg);
  color: var(--jr-tab-active-text);
  font-weight: 600;
  border-bottom: 2px solid var(--jr-accent);
}

.jr-tab-close {
  font-size: 15px;
  line-height: 1;
  padding: 0 2px;
  border-radius: 3px;
  color: #999;
}

.jr-tab-close:hover {
  background: #ccc;
  color: #333;
}

.jr-tab-add {
  font-size: 16px;
  font-weight: 600;
  color: #888;
  padding: 6px 14px;
  border-right: none;
}

.jr-tab-add:hover {
  background: var(--jr-tab-hover);
  color: #333;
}

.jr-tab-dragging {
  opacity: 0.4;
}

.jr-tab-dragover {
  border-left: 2px solid var(--jr-accent);
}

/* ---- Editor ---- */

.jr-editor {
  border-bottom: 1px solid var(--jr-border);
}

.jr-editor .cm-editor {
  max-height: 600px;
  overflow: auto;
}

.jr-editor .cm-editor.cm-focused {
  outline: none;
}

/* ---- Shared console / REPL base ---- */

.jr-console,
.jr-repl {
  background: var(--jr-console-bg);
  color: var(--jr-console-text);
  font-family: var(--jr-font-mono);
  font-size: 13px;
  line-height: 1.4;
  overflow-x: auto;
}

.jr-console-output,
.jr-repl-output {
  margin: 0;
  padding: 10px 12px;
  white-space: pre;
  word-break: normal;
  overflow-wrap: normal;
}

.jr-error,
.jr-repl-error {
  color: var(--jr-console-error);
}

.jr-input-echo {
  color: var(--jr-console-input);
}

/* ---- Console ---- */

.jr-console {
  max-height: 300px;
  overflow-y: auto;
  position: relative;
}

.jr-console-output {
  min-height: 1.5em;
}

.jr-console-input {
  display: flex;
  gap: 6px;
  padding: 4px 12px 8px;
  align-items: center;
  border-top: 1px solid var(--jr-console-separator);
}

.jr-console-input-field {
  flex: 1;
  background: var(--jr-input-bg);
  border: 1px solid var(--jr-input-border);
  border-radius: 3px;
  padding: 4px 8px;
  color: var(--jr-console-input);
  font-family: var(--jr-font-mono);
  font-size: 13px;
  outline: none;
}

.jr-console-input-field:focus {
  border-color: var(--jr-accent);
}

.jr-console-submit {
  background: var(--jr-accent);
  color: #fff;
  border: none;
  border-radius: 3px;
  padding: 4px 12px;
  font-size: 12px;
  cursor: pointer;
}

.jr-console-submit:hover {
  background: var(--jr-accent-hover);
}

/* ---- REPL ---- */

.jr-repl {
  border: 1px solid var(--jr-border);
  border-radius: var(--jr-radius);
  margin: 1em 0;
  max-height: 400px;
  overflow-y: auto;
}

.jr-repl-output {
  padding-bottom: 0;
}

.jr-repl-input-line {
  display: flex;
  align-items: center;
  padding: 0px 12px 10px;
}

.jr-repl-prompt {
  color: var(--jr-console-input);
  font-weight: bold;
  white-space: pre;
  user-select: none;
}

.jr-repl-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--jr-console-text);
  font-family: inherit;
  font-size: inherit;
  outline: none;
  padding: 0;
}
