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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: #1e1e1e;
  color: #d4d4d4;
  overflow: hidden;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
}

/* Toolbar */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: #252526;
  border-bottom: 1px solid #3e3e42;
  flex-shrink: 0;
}

.toolbar-left, .toolbar-center, .toolbar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.logo-text {
  font-size: 1.25rem;
  font-weight: 700;
  color: #569cd6;
  letter-spacing: -0.5px;
}

.logo-subtitle {
  font-size: 0.875rem;
  color: #858585;
}

.example-selector {
  padding: 0.5rem 0.75rem;
  background: #3c3c3c;
  color: #d4d4d4;
  border: 1px solid #454545;
  border-radius: 4px;
  font-size: 0.875rem;
  cursor: pointer;
  outline: none;
  min-width: 200px;
}

.example-selector:hover {
  background: #464646;
}

.example-selector:focus {
  border-color: #569cd6;
}

.auto-compile-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: #d4d4d4;
  cursor: pointer;
  user-select: none;
}

.auto-compile-toggle input[type="checkbox"] {
  cursor: pointer;
  width: 16px;
  height: 16px;
  accent-color: #569cd6;
}

.btn-compile {
  padding: 0.5rem 1rem;
  background: #569cd6;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-compile:hover {
  background: #4a8dc4;
}

.btn-compile:active {
  background: #3d7ab3;
}

.compile-time {
  font-size: 0.75rem;
  color: #858585;
  min-width: 50px;
  text-align: right;
}

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

/* Panes */
.panes {
  flex: 1;
  display: flex;
  overflow: hidden;
}

.pane {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #1e1e1e;
}

.pane-left {
  width: 50%;
}

.pane-right {
  width: 50%;
}

.pane-header {
  display: flex;
  align-items: center;
  padding: 0.5rem 1rem;
  background: #252526;
  border-bottom: 1px solid #3e3e42;
  flex-shrink: 0;
}

.pane-title {
  font-size: 0.875rem;
  color: #d4d4d4;
  font-weight: 500;
}

.editor-container {
  flex: 1;
  overflow: auto;
}

/* Resizer */
.resizer {
  width: 4px;
  background: #2d2d30;
  cursor: col-resize;
  flex-shrink: 0;
  transition: background 0.2s;
}

.resizer:hover {
  background: #569cd6;
}

/* Error Panel */
.error-panel {
  background: #1e1e1e;
  border-top: 1px solid #f48771;
  max-height: 250px;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.error-panel.hidden {
  display: none;
}

.error-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1rem;
  background: #3c2626;
  border-bottom: 1px solid #4e2a2a;
}

.error-title {
  font-size: 0.875rem;
  color: #f48771;
  font-weight: 500;
}

.close-errors {
  background: none;
  border: none;
  color: #f48771;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}

.close-errors:hover {
  background: #4e2a2a;
}

.error-content {
  flex: 1;
  overflow: auto;
  padding: 0.75rem 1rem;
}

.error-item {
  padding: 0.5rem;
  margin-bottom: 0.5rem;
  background: #2d2d30;
  border-left: 3px solid #f48771;
  font-size: 0.875rem;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  color: #f48771;
  border-radius: 2px;
}

.error-item:last-child {
  margin-bottom: 0;
}

/* Loading Overlay */
.loading {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #1e1e1e;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  z-index: 1000;
}

.loading.hidden {
  display: none;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid #3e3e42;
  border-top-color: #569cd6;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-text {
  font-size: 1rem;
  color: #858585;
}

/* CodeMirror overrides */
.cm-editor {
  height: 100%;
}

.cm-scroller {
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 14px;
  line-height: 1.5;
}

/* Responsive */
@media (max-width: 768px) {
  .panes {
    flex-direction: column;
  }

  .pane-left, .pane-right {
    width: 100% !important;
    height: 50%;
  }

  .resizer {
    width: 100%;
    height: 4px;
    cursor: row-resize;
  }

  .toolbar {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .toolbar-left, .toolbar-center, .toolbar-right {
    flex: 1 1 auto;
  }
}
