:root {
  --bg-app: #1e1e1e;
  --bg-panel: #252526;
  --bg-header: #333333;
  --bg-sidebar: #252526;
  --border: #444444;
  --accent: #007acc;
  --accent-hover: #0062a3;
  --text-primary: #cccccc;
  --text-secondary: #888888;
  --font-ui: "Segoe UI", "Inter", system-ui, sans-serif;
  --font-mono: "Consolas", "Monaco", monospace;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-ui);
  background: var(--bg-app);
  color: var(--text-primary);
  height: 100vh;
  overflow: hidden;
}

.app-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* --- Header --- */
.app-header {
  height: 50px;
  background: var(--bg-header);
  display: flex;
  align-items: center;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
  user-select: none;
}

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

.app-icon {
  width: 24px;
  height: 24px;
  color: var(--accent);
}

.header-title {
  font-weight: 700;
  font-size: 18px;
  background: linear-gradient(135deg, #3A8DFF 0%, #00E5FF 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: 0.5px;
}

/* --- Main --- */
.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* --- Footer --- */
.app-footer {
  height: 22px;
  background: var(--accent);
  display: flex;
  align-items: center;
  padding: 0 10px;
  font-size: 12px;
  color: white;
  justify-content: space-between;
}

.footer-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

/* --- Tabs --- */
#tab-bar {
  display: flex;
  align-items: center;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  height: 35px;
  padding-left: 0;
}

.tab {
  padding: 8px 15px;
  cursor: pointer;
  border-right: 1px solid var(--border);
  background: var(--bg-panel);
  color: var(--text-secondary);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 100%;
}

.tab:hover {
  background: #2d2d2d;
}

.tab.active {
  background: var(--bg-app);
  color: #fff;
  border-top: 2px solid var(--accent);
}

.tab .close {
  font-size: 12px;
  border-radius: 3px;
  padding: 1px 4px;
}

.tab .close:hover {
  background: #444;
  color: #fff;
}

.new-tab {
  background: transparent;
  color: var(--text-secondary);
  border: none;
  padding: 0 10px;
  cursor: pointer;
  font-size: 18px;
  height: 100%;
  transition: color 0.2s;
}

.new-tab:hover {
  color: #fff;
}

/* --- Workspace --- */
#workspace {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.workspace-tab {
  display: none;
  height: 100%;
  flex-direction: column;
  padding: 10px;
}

.workspace-tab.active {
  display: flex;
}

.container {
  display: flex;
  gap: 10px;
  flex: 1;
  min-height: 0;
  /* Important for nested flex scrolling */
}

.editor-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  background: var(--bg-app);
}

.panel-header {
  padding: 5px 10px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  text-transform: uppercase;
  color: var(--text-secondary);
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.editor-body {
  flex: 1;
  display: flex;
  position: relative;
  overflow: hidden;
}

.line-numbers {
  width: 45px;
  background: var(--bg-app);
  color: #6e7681;
  text-align: right;
  padding: 10px 10px 10px 0;
  border-right: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.5;
  user-select: none;
  overflow: hidden;
}

.line-numbers div {
  height: 1.5em;
}

.editor-content {
  flex: 1;
  border: none;
  outline: none;
  resize: none;
  background: transparent;
  color: #d4d4d4;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.5;
  padding: 10px;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow: auto;
}

textarea.editor-content {
  display: block;
}

.highlight-view {
  display: none;
}

.hidden {
  display: none !important;
}

/* --- Controls --- */
.controls {
  padding: 15px 0;
  display: flex;
  justify-content: center;
}

.searchBtn {
  background: var(--accent);
  color: white;
  border: none;
  padding: 10px 0;
  width: 200px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(0, 122, 204, 0.3);
}

.searchBtn:hover {
  background: var(--accent-hover);
  box-shadow: 0 6px 16px rgba(0, 122, 204, 0.4);
  transform: translateY(-1px);
}

/* --- Results --- */
.results {
  height: 40px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 10px;
  gap: 10px;
  background: var(--bg-panel);
}

.result-item {
  padding: 2px 8px;
  border-radius: 2px;
  cursor: pointer;
  color: #111;
  font-weight: 600;
  font-size: 12px;
  font-family: var(--font-mono);
}

mark {
  border-radius: 2px;
  padding: 0 1px;
}