* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: #f5f5f5;
  overflow: hidden;
}

.app-header {
  height: 56px;
  background: #fff;
  border-bottom: 1px solid #e0e0e0;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.app-header h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: #333;
}

.app-header .badge {
  background: #6e5cbe;
  color: #fff;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 500;
}

.app-header .subtitle {
  margin: 0;
  font-size: 13px;
  color: #666;
}

.header-nav {
  margin-left: auto;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  color: #333;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  border-radius: 6px;
  transition: all 0.15s ease;
}

.nav-link:hover {
  background: #f0f0f0;
  color: #6e5cbe;
}

.nav-link svg {
  flex-shrink: 0;
}

.container {
  display: flex;
  height: calc(100vh - 56px);
  gap: 1px;
  background: #e0e0e0;
}

.panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #fff;
  min-width: 360px;
  overflow: hidden;
}

.panel-toolbar {
  height: 48px;
  padding: 0 16px;
  border-bottom: 1px solid #e0e0e0;
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  background: #fafafa;
  flex-shrink: 0;
}

.toolbar-group {
  display: flex;
  gap: 8px;
  align-items: center;
}

.toolbar-label {
  font-size: 12px;
  font-weight: 500;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn {
  padding: 8px 16px;
  border: 1px solid #d0d0d0;
  border-radius: 6px;
  background: #fff;
  color: #333;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn:hover:not(:disabled) {
  background: #f0f0f0;
  border-color: #c0c0c0;
}

.btn-primary {
  background: #6e5cbe;
  color: #fff;
  border-color: #6e5cbe;
}

.btn-primary:hover:not(:disabled) {
  background: #5d4eb0;
  border-color: #5d4eb0;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ── Editor Surface ─────────────────────────────────────── */
.editor-surface {
  flex: 1;
  overflow: hidden;
  position: relative;
  background: #f9f9f9;
}

#monacoEditor {
  width: 100%;
  height: 100%;
}

/* ── Output Panel ───────────────────────────────────────── */
.panel.output {
  overflow: hidden;
}

.panel.output .panel-toolbar {
  border-bottom: 1px solid #e0e0e0;
}

.pdf-host {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
  padding: 16px;
  background: #f5f5f5;
  overflow: auto;
  min-width: 0;
}

.pdf-canvas {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  border-radius: 4px;
  background: #fff;
  max-width: 100%;
  height: auto;
}

.output-box {
  padding: 12px;
  background: #fff3f3;
  border: 1px solid #ffcdd2;
  border-radius: 6px;
  color: #c62828;
  font-size: 13px;
  white-space: pre-wrap;
  word-break: break-word;
}

.output-box.hidden {
  display: none;
}

.status {
  padding: 8px 12px;
  font-size: 12px;
  color: #666;
  background: #f5f5f5;
  border-radius: 4px;
  margin-top: 12px;
}

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

  .panel {
    min-height: 300px;
  }
}
