* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #e7ebf0;
  color: #1b2638;
}

.app-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.menu-bar {
  display: flex;
  justify-content: space-between;
  background: linear-gradient(180deg, #f4f6fb 0%, #dfe5ef 100%);
  border-bottom: 1px solid #c3cbd9;
  padding: 8px 12px;
  gap: 8px;
  align-items: center;
}

.menu-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.menu-dropdown {
  position: relative;
}

.menu-dropdown-content {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 10;
  min-width: 170px;
  padding: 4px;
  background: #f8fafc;
  border: 1px solid #8a9aaa;
  border-radius: 6px;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2);
}

.menu-bar button,
.menu-bar select {
  border: 1px solid #8a9aaa;
  border-radius: 8px;
  padding: 8px 14px;
  background: linear-gradient(180deg, #ffffff 0%, #e8eef5 100%);
  color: #1b2638;
  cursor: pointer;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2), 0 4px 8px rgba(0, 0, 0, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.8);
  transition: all 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  top: 0;
  font-weight: 500;
}

.menu-bar button:hover,
.menu-bar select:hover {
  background: linear-gradient(180deg, #ffffff 0%, #dfe6f0 100%);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.25), 0 6px 12px rgba(0, 0, 0, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.9);
  top: -3px;
  transform: scale(1.02);
}

.menu-bar button:active {
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.15), inset 0 3px 8px rgba(0, 0, 0, 0.1), inset 0 -1px 2px rgba(0, 0, 0, 0.05);
  top: 4px;
  background: linear-gradient(180deg, #e2e8f0 0%, #d5dce8 100%);
  transform: scale(0.98);
}

.menu-bar button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  top: 0;
  transform: scale(1);
}

.menu-dropdown-content button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 34px;
  padding: 7px 10px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  box-shadow: none;
  text-align: left;
  top: 0;
  transform: none;
}

.menu-dropdown-content button:hover {
  background: #dfe7fb;
  box-shadow: none;
  top: 0;
  transform: none;
}

.option-tick {
  width: 16px;
  color: #215c34;
  visibility: hidden;
}

.menu-dropdown-content button.enabled .option-tick {
  visibility: visible;
}

.status-text {
  margin-left: auto;
  font-size: 0.9em;
  color: #555;
}

.main-content {
  display: flex;
  flex: 1;
  min-height: 0;
}

.file-list {
  flex: 0 0 240px;
  background: #eef3fb;
  border-right: 1px solid #c3cbd9;
  padding: 8px;
  overflow: auto;
}

.file-list-header {
  font-weight: 600;
  margin-bottom: 8px;
  display: flex;
  gap: 8px;
}

#fileItems {
  list-style: none;
  padding: 0;
}

.file-item {
  padding: 6px 8px;
  border-radius: 4px;
  cursor: pointer;
  margin-bottom: 4px;
}

.file-item:hover {
  background: #dfe7fb;
}

.file-item.active {
  background: #b8c9e8;
  font-weight: 600;
}

.editor-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.tab-strip {
  display: flex;
  background: linear-gradient(180deg, #eef3fa 0%, #d7dfeb 100%);
  border-bottom: 1px solid #c3cbd9;
  padding: 7px 8px 5px;
  gap: 7px;
  overflow-x: auto;
}

.tab {
  position: relative;
  top: 0;
  max-width: 220px;
  padding: 7px 12px;
  overflow: hidden;
  background: linear-gradient(180deg, #ffffff 0%, #e6edf6 100%);
  border: 1px solid #8a9aaa;
  border-radius: 8px 8px 4px 4px;
  box-shadow: 0 7px 13px rgba(0, 0, 0, 0.18), 0 3px 6px rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.85);
  color: #1b2638;
  cursor: pointer;
  font-weight: 500;
  text-overflow: ellipsis;
  transition: all 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
  white-space: nowrap;
}

.tab:hover {
  top: -2px;
  background: linear-gradient(180deg, #ffffff 0%, #dfe7f2 100%);
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.22), 0 5px 9px rgba(0, 0, 0, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.tab.active {
  top: 2px;
  background: linear-gradient(180deg, #e5ecf6 0%, #f8fafc 72%);
  border-color: #6f8298;
  border-bottom-color: #f8fafc;
  box-shadow: 0 3px 7px rgba(0, 0, 0, 0.14), inset 0 3px 8px rgba(69, 88, 110, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.tab.dirty::after {
  content: ' •';
  color: #d9534f;
}

.status-bar {
  background: #f0f4fb;
  border-top: 1px solid #c3cbd9;
  padding: 4px 12px;
  font-size: 0.85em;
  color: #555;
}

.drive-back {
  padding: 4px 8px;
  font-size: 0.9em;
}

#orionEditor,
.orion-editor {
  display: flex;
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
}

.editor-host {
  flex: 1 1 auto;
  min-height: 0;
}

.editor-frame {
  display: grid;
  flex: 1 1 auto;
  grid-template-columns: minmax(0, 1fr);
  width: 100%;
  height: 100%;
  min-height: 0;
  background: #ffffff;
}

.editor-frame.show-line-numbers {
  grid-template-columns: minmax(44px, max-content) minmax(0, 1fr);
}

.line-number-gutter {
  display: none;
  overflow: hidden;
  padding: 12px 8px;
  border-right: 1px solid #d7deea;
  background: #f4f7fb;
  color: #697586;
  font-family: Consolas, 'Courier New', monospace;
  font-size: 14px;
  line-height: 20px;
  text-align: right;
  user-select: none;
  pointer-events: none;
}

.editor-frame.show-line-numbers .line-number-gutter {
  display: block;
}

#editor-textarea {
  display: block;
  grid-column: 1;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  padding: 12px;
  border: none;
  outline: none;
  resize: none;
  font-family: Consolas, 'Courier New', monospace;
  font-size: 14px;
  line-height: 20px;
}

.editor-frame.show-line-numbers #editor-textarea {
  grid-column: 2;
}

.CodeMirror {
  grid-column: 1;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  font-family: Consolas, 'Courier New', monospace;
  font-size: 14px;
  line-height: 20px;
}

.CodeMirror-lines {
  padding: 12px 0;
}

.CodeMirror pre.CodeMirror-line,
.CodeMirror pre.CodeMirror-line-like {
  padding: 0 12px;
}

.CodeMirror-gutters {
  border-right: 1px solid #d7deea;
  background: #f4f7fb;
}
