/* RapidRTL Editor & Inspector Stylesheet */

/* CodeMirror Customization */
#editor-container {
  flex: 1;
  position: relative;
  overflow: hidden;
  height: calc(100% - 38px);
}

.CodeMirror {
  height: 100% !important;
  font-family: var(--font-mono) !important;
  font-size: 13px !important;
  line-height: 1.5 !important;
  background: var(--bg-pane) !important;
  color: var(--text-main) !important;
}

.CodeMirror-gutters {
  background: var(--bg-pane) !important;
  border-right: 1px solid var(--border-color) !important;
  padding-right: 4px;
}

.CodeMirror-linenumber {
  color: var(--text-muted) !important;
  font-size: 12px;
}

/* Syntax Highlighting */
.cm-s-default .cm-keyword { color: #f0883e !important; font-weight: 600; }
.cm-s-default .cm-atom { color: #58a6ff !important; }
.cm-s-default .cm-number { color: #79c0ff !important; }
.cm-s-default .cm-def { color: #d2a8ff !important; }
.cm-s-default .cm-variable { color: var(--text-main) !important; }
.cm-s-default .cm-variable-2 { color: #7ee787 !important; }
.cm-s-default .cm-variable-3 { color: #ffa657 !important; }
.cm-s-default .cm-type { color: #79c0ff !important; font-weight: 600; }
.cm-s-default .cm-property { color: #79c0ff !important; }
.cm-s-default .cm-operator { color: #ff7b72 !important; }
.cm-s-default .cm-comment { color: #8b949e !important; font-style: italic; }
.cm-s-default .cm-string { color: #a5d6ff !important; }

/* Light theme editor tweaks */
body.theme-light .cm-s-default .cm-keyword { color: #cf222e !important; }
body.theme-light .cm-s-default .cm-atom { color: #0550ae !important; }
body.theme-light .cm-s-default .cm-number { color: #0969da !important; }
body.theme-light .cm-s-default .cm-def { color: #8250df !important; }
body.theme-light .cm-s-default .cm-variable-2 { color: #116329 !important; }
body.theme-light .cm-s-default .cm-comment { color: #6e7781 !important; }
body.theme-light .cm-s-default .cm-string { color: #0a3069 !important; }

/* Error Line Marker */
.error-gutter-mark {
  color: var(--danger-color);
  font-weight: bold;
  padding-left: 2px;
}

.error-line-highlight {
  background-color: rgba(248, 81, 73, 0.15) !important;
}

/* Active line & Text Selection Highlights (Dark & Light Themes) */
body:not(.theme-light) .CodeMirror-activeline-background {
  background: rgba(255, 255, 255, 0.07) !important;
}

body:not(.theme-light) .CodeMirror-selected,
body:not(.theme-light) .CodeMirror-focused .CodeMirror-selected,
body:not(.theme-light) div.CodeMirror-selected {
  background: #264f78 !important;
}

body:not(.theme-light) .CodeMirror-line::selection,
body:not(.theme-light) .CodeMirror-line > span::selection,
body:not(.theme-light) .CodeMirror-line > span > span::selection {
  background: #264f78 !important;
  color: #ffffff !important;
}

body:not(.theme-light) .CodeMirror-cursor {
  border-left: 2px solid #58a6ff !important;
}

body.theme-light .CodeMirror-activeline-background {
  background: #f0f4f8 !important;
}

body.theme-light .CodeMirror-selected,
body.theme-light .CodeMirror-focused .CodeMirror-selected,
body.theme-light div.CodeMirror-selected {
  background: #b4d5fe !important;
}

body.theme-light .CodeMirror-line::selection,
body.theme-light .CodeMirror-line > span::selection,
body.theme-light .CodeMirror-line > span > span::selection {
  background: #b4d5fe !important;
  color: #000000 !important;
}

/* File Tabs Bar */
.file-tabs-bar {
  display: flex;
  align-items: center;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  padding: 0 8px;
  overflow-x: auto;
  min-height: 32px;
  user-select: none;
}

.file-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  border-right: 1px solid var(--border-color);
}

.file-tab:hover {
  color: var(--text-main);
  background: var(--bg-hover);
}

.file-tab.active {
  color: var(--text-main);
  background: var(--bg-pane);
  border-bottom-color: var(--accent-primary);
  font-weight: 600;
}

.file-tab-close {
  font-size: 11px;
  color: var(--text-muted);
  padding: 1px 3px;
  border-radius: 3px;
}

.file-tab-close:hover {
  background: var(--bg-hover);
  color: var(--danger-color);
}

.tab-add-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
  font-size: 14px;
}

.tab-add-btn:hover {
  color: var(--text-main);
}

/* Right Pane: Inspector & Resources View */
.inspector-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
}

.inspector-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 2px;
}

.inspector-subtitle {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--accent-primary);
}

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

.section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--accent-primary);
  margin-bottom: 8px;
}

.inspector-explanation {
  font-size: 12px;
  color: var(--text-main);
  line-height: 1.5;
}

.educational-callout {
  margin-top: 10px;
  padding: 10px;
  border-radius: 6px;
  background: rgba(227, 179, 65, 0.1);
  border-left: 3px solid var(--accent-primary);
  font-size: 11.5px;
  color: var(--text-main);
}

.gate-svg-wrapper {
  margin-top: 10px;
  padding: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.gate-level-canvas {
  width: 100%;
  max-height: 160px;
}

/* Resources & Stats Table */
.resource-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.resource-table th {
  text-align: left;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  padding: 6px 0;
  border-bottom: 1px solid var(--border-color);
}

.resource-table td {
  padding: 6px 0;
  color: var(--text-main);
  border-bottom: 1px solid rgba(48, 54, 61, 0.4);
}

.resource-table td.val {
  text-align: right;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-main);
}

.resource-table tr.total-row td {
  font-weight: 700;
  border-top: 1px solid var(--border-color);
  padding-top: 8px;
}

/* Warnings and Console List */
.warning-item {
  padding: 8px 10px;
  background: rgba(248, 81, 73, 0.08);
  border-left: 3px solid var(--danger-color);
  border-radius: 4px;
  margin-bottom: 8px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  word-break: break-all;
}

.warning-item.type-warning {
  background: rgba(227, 179, 65, 0.08);
  border-left-color: var(--accent-primary);
}
