/* src/index.css */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  color: #e0e0e0;
  background-color: #1a1a2e;
  font-family: -apple-system, BlinkMacSystemFont, Segoe UI, sans-serif;
}

body {
  overflow: hidden;
  width: 100vw;
  height: 100vh;
}

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

.app {
  display: flex;
  width: 100%;
  height: 100%;
}

.page-list {
  display: flex;
  overflow-y: auto;
  background: #16213e;
  border-right: 1px solid #0f3460;
  flex-direction: column;
  width: 220px;
  min-width: 220px;
}

.page-list-header {
  display: flex;
  border-bottom: 1px solid #0f3460;
  justify-content: space-between;
  align-items:  center;
  padding: 16px;
}

.page-list-header h2 {
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #8892b0;
  font-size: 14px;
  font-weight: 600;
}

.page-list-header button {
  color: #e0e0e0;
  cursor: pointer;
  display: flex;
  background: #0f3460;
  border: none;
  border-radius: 4px;
  justify-content: center;
  align-items:  center;
  width: 28px;
  height: 28px;
  font-size: 18px;
}

.page-list-header button:hover {
  background: #1a4a8a;
}

.page-list ul {
  list-style: none;
  padding: 8px;
}

.page-list li {
  display: flex;
  border-radius: 4px;
  align-items:  center;
  margin-bottom: 2px;
}

.page-list li:hover {
  background: #1a3a5c;
}

.page-list li.active {
  background: #0f3460;
}

.page-list li .page-name {
  color: #e0e0e0;
  text-align: left;
  cursor: pointer;
  background: none;
  border: none;
  flex: 1;
  padding: 8px 12px;
  font-size: 13px;
}

.page-list li .delete-btn {
  color: #555;
  cursor: pointer;
  opacity: 0;
  background: none;
  border: none;
  padding: 4px 8px;
  transition: opacity .15s;
  font-size: 12px;
}

.page-list li:hover .delete-btn {
  opacity: 1;
}

.page-list li .delete-btn:hover {
  color: #e74c3c;
}

.empty-hint {
  color: #555;
  text-align: center;
  padding: 16px;
  font-size: 13px;
}

.canvas-area {
  position: relative;
  overflow: hidden;
  background: #1a1a2e;
  flex: 1;
}

.drawing-canvas {
  position: absolute;
  cursor: crosshair;
  width: 100%;
  height: 100%;
  inset: 0;
}

.empty-state {
  display: flex;
  color: #555;
  justify-content: center;
  align-items:  center;
  height: 100%;
  font-size: 16px;
}

.text-element {
  position: absolute;
  cursor: grab;
  z-index: 10;
  border: 1px solid #0000;
  border-radius: 3px;
  min-width: 40px;
  min-height: 24px;
  padding: 4px 8px;
  transition: border-color .15s;
}

.text-element:hover {
  border-color: #333;
}

.text-element.editing {
  cursor: text;
  border-color: #0f3460;
}

.text-element.dragging {
  cursor: grabbing;
  opacity: .8;
}

.text-element textarea {
  color: #e0e0e0;
  outline: none;
  resize: both;
  background: #16213e;
  border: none;
  min-width: 120px;
  min-height: 24px;
  padding: 0;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
}

.text-content {
  color: #e0e0e0;
  white-space: pre-wrap;
  user-select: none;
  font-size: 14px;
  line-height: 1.5;
}

.text-content .katex-display {
  margin: 4px 0;
}

.text-edit-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.text-preview {
  color: #a0a0b8;
  white-space: pre-wrap;
  border-top: 1px solid #0f3460;
  padding-top: 8px;
  font-size: 14px;
  line-height: 1.5;
}

.text-preview .katex-display {
  margin: 4px 0;
}

.katex-error {
  color: #e74c3c;
  font-family: monospace;
  font-size: 12px;
}

.canvas-transform {
  position: absolute;
  pointer-events: none;
  z-index: 5;
  transform-origin: 0 0;
  inset: 0;
}

.canvas-transform .text-element {
  pointer-events: auto;
}

.coords-overlay {
  position: absolute;
  color: #8892b0;
  z-index: 100;
  pointer-events: none;
  user-select: none;
  background: #16213ed9;
  border-radius: 4px;
  padding: 4px 10px;
  font-family: SF Mono, Fira Code, Fira Mono, monospace;
  font-size: 12px;
  bottom: 12px;
  right: 12px;
}
