/* Global state variables and initialization moved to app.js */

/* Import Font Awesome */
@import url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css');

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  box-sizing: border-box;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #f5f5f5;
  color: #333;
  height: 100%;
  overflow: hidden;
}

html, body, .app-wrapper {
  height: 100%;
}

.app-wrapper {
  display: flex;
  flex-direction: column;
  width: 100%;
  background: white;
}

/* Header */
.header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 10px 16px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  z-index: 100;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.header h1 {
  font-size: 1.35em;
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.header-btn {
  padding: 7px 12px;
  background: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.3);
  color: white;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.header.collapsed {
  padding: 6px 12px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.08);
}

.header.collapsed h1 {
  font-size: 1.15em;
}

.header.collapsed .header-actions .header-btn {
  display: none;
}

.header.collapsed .header-actions #headerToggleBtn {
  display: inline-flex;
}

.header-btn:hover {
  background: rgba(255,255,255,0.3);
}

/* Main Layout */
.main-container {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: 250px;
  background: #f8f9fa;
  border-right: 1px solid #dee2e6;
  overflow-y: auto;
  transition: margin-left 0.3s;
}

.sidebar.collapsed {
  margin-left: -250px;
}

.sidebar-section {
  padding: 15px;
  border-bottom: 1px solid #dee2e6;
}

.sidebar-section h3 {
  font-size: 14px;
  color: #667eea;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.chapter-item {
  padding: 10px;
  background: white;
  margin-bottom: 8px;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid #e9ecef;
  transition: all 0.3s;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chapter-item:hover {
  background: #667eea;
  color: white;
  transform: translateX(3px);
}

.chapter-item.active {
  background: #667eea;
  color: white;
  border-color: #667eea;
}

.add-chapter-btn {
  width: 100%;
  padding: 10px;
  background: #667eea;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s;
}

.add-chapter-btn:hover {
  background: #764ba2;
}

/* Editor Container */
.editor-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Toolbar */
.toolbar-wrapper {
  background: #f8f9fa;
  border-bottom: 2px solid #dee2e6;
  max-height: 400px;
  overflow-y: auto;
}

.toolbar {
  padding: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}

.toolbar-group {
  display: flex;
  gap: 3px;
  padding: 5px;
  background: white;
  border-radius: 6px;
  border: 1px solid #dee2e6;
}

.toolbar-btn, .toolbar select, .toolbar input[type="color"], .toolbar input[type="number"] {
  padding: 8px 12px;
  border: 1px solid #dee2e6;
  background: white;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
  color: #333;
}

.toolbar-btn:hover {
  background: #667eea;
  color: white;
  border-color: #667eea;
}

.toolbar-btn.active {
  background: #667eea;
  color: white;
  border-color: #667eea;
}

.toolbar select {
  min-width: 120px;
}

.toolbar input[type="color"] {
  width: 40px;
  height: 36px;
  padding: 2px;
  cursor: pointer;
}

.toolbar input[type="number"] {
  width: 70px;
}

.highlight-color-btn {
  width: 28px;
  height: 28px;
  border: 2px solid #dee2e6;
  border-radius: 4px;
  cursor: pointer;
  padding: 0;
  transition: all 0.2s;
}

.highlight-color-btn:hover {
  border-color: #333;
  transform: scale(1.1);
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.highlight-color-btn.active {
  border-color: #333;
  box-shadow: 0 0 0 2px #667eea;
}

.toolbar-label {
  font-size: 12px;
  color: #666;
  margin-right: 5px;
}

/* Stats Bar */
.stats-bar {
  background: #f8f9fa;
  padding: 12px 20px;
  border-bottom: 1px solid #dee2e6;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 15px;
  font-size: 13px;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 5px;
  color: #666;
}

.stat-item strong {
  color: #667eea;
  font-weight: 600;
}

/* Sidebar Tabs */
.sidebar-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 15px;
  border-bottom: 2px solid #dee2e6;
  padding: 0 15px;
}

.sidebar-tab {
  flex: 1;
  padding: 8px;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: #6c757d;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
}

.sidebar-tab.active {
  color: #667eea;
  border-bottom-color: #667eea;
}

.sidebar-content {
  display: block;
}

.sidebar-content.hidden {
  display: none;
}

/* Storyboard styles */
.story-board {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.plot-list {
  list-style: none;
  padding-left: 0;
  margin: 8px 0 0 0;
  color: #333;
  font-size: 13px;
  line-height: 1.5;
}

.plot-list.numbered {
  list-style: decimal inside;
  padding-left: 0;
}

.beat-chip {
  display: inline-block;
  margin: 4px 6px 4px 0;
  padding: 6px 10px;
  border-radius: 16px;
  background: #eef2ff;
  color: #333;
  border: 1px solid #d6ddff;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.beat-chip:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

.plot-hint {
  font-size: 12px;
  color: #6c757d;
  margin-top: 6px;
}

.beat-marker {
  margin: 10px 0;
  padding: 8px 10px;
  border-left: 3px solid #7f5af0;
  background: #f4f2ff;
  font-weight: 600;
  color: #2d214f;
}

.pacing-graph {
  background: #f8f9fa;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 10px;
}

.story-card {
  background: #ffffff;
  border: 2px solid #e9ecef;
  border-radius: 6px;
  padding: 10px;
  cursor: move;
  transition: all 0.2s;
  min-height: 80px;
  display: flex;
  flex-direction: column;
}

.story-card:hover {
  border-color: #667eea;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

.story-card.dragging {
  opacity: 0.6;
}

.story-card-title {
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 4px;
  color: #333;
}

.story-card-words {
  font-size: 11px;
  color: #6c757d;
  margin-top: auto;
}

/* Editor Area */
.editor-area {
  flex: 1;
  overflow-y: auto;
  padding: 40px;
  background: white;
}

/* Page wrapper for page-size/margin simulation */
.page-wrapper {
  max-width: 8.5in;
  margin: 0 auto;
  background: white;
  box-shadow: 0 0 15px rgba(0,0,0,0.08);
  min-height: 11in;
  position: relative;
}

/* Page numbering */
.page-wrapper.page-numbers-enabled::after {
  content: attr(data-page-number);
  position: absolute;
  font-family: 'Times New Roman', serif;
  color: #666;
  font-size: 11pt;
  z-index: 1;
}

/* Position classes */
.page-wrapper.page-number-bottom-center::after {
  bottom: 0.5in;
  left: 50%;
  transform: translateX(-50%);
}

.page-wrapper.page-number-bottom-right::after {
  bottom: 0.5in;
  right: 0.75in;
}

.page-wrapper.page-number-bottom-left::after {
  bottom: 0.5in;
  left: 0.75in;
}

.page-wrapper.page-number-top-center::after {
  top: 0.5in;
  left: 50%;
  transform: translateX(-50%);
}

.page-wrapper.page-number-top-right::after {
  top: 0.5in;
  right: 0.75in;
}

.page-wrapper.page-number-top-left::after {
  top: 0.5in;
  left: 0.75in;
}

.editor-area.focus-mode {
  max-width: 800px;
  margin: 0 auto;
}

/* Hide sidebar and toolbar in focus mode */
.focus-mode ~ .sidebar,
.focus-mode .toolbar-wrapper,
.focus-mode .stats-bar {
  display: none !important;
}

.app-wrapper:has(.focus-mode) .sidebar {
  display: none !important;
}

.app-wrapper:has(.focus-mode) .header {
  opacity: 0.3;
  transition: opacity 0.3s;
}

.app-wrapper:has(.focus-mode) .header:hover {
  opacity: 1;
}

.editor-area.focus-mode {
  max-width: 900px;
  margin: 40px auto;
  padding: 40px 60px;
  background: #fafafa;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.editor-area.focus-mode #editor {
  font-size: 18px;
  line-height: 2.0;
  color: #222;
}

.editor-area.distraction-free {
  padding: 60px;
  background: #fafafa;
}

#editor {
  width: 100%;
  min-height: 600px;
  border: none;
  outline: none;
  font-size: 16px;
  line-height: 1.8;
  font-family: 'Georgia', 'Times New Roman', serif;
  color: #333;
}

#editor:focus {
  outline: none;
}

/* Editor Heading Styles */
#editor h1 {
  font-size: 2.5em;
  margin: 20px 0;
  font-weight: bold;
  line-height: 1.2;
}

#editor h2 {
  font-size: 2em;
  margin: 18px 0;
  font-weight: bold;
  line-height: 1.3;
}

#editor h3 {
  font-size: 1.75em;
  margin: 16px 0;
  font-weight: bold;
  line-height: 1.4;
}

/* Dialogue line styling */
#editor p.dialogue-line {
  margin-top: 8px;
  margin-bottom: 8px;
  margin-left: 40px;
  font-style: italic;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.6);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.modal.active {
  display: flex;
}

.modal-overlay {
  display: flex;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.6);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

/* Loading spinner */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255,255,255,.3);
  border-radius: 50%;
  border-top-color: #667eea;
  animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.spinner-large {
  width: 40px;
  height: 40px;
  border-width: 4px;
}

.modal-content {
  background: white;
  border-radius: 12px;
  max-width: 600px;
  width: 100%;
  max-height: 90%;
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

.modal-header {
  padding: 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 12px 12px 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  font-size: 1.3em;
}

.modal-close {
  background: none;
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
}

.modal-body {
  padding: 25px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #333;
}

.form-group input, .form-group textarea, .form-group select {
  width: 100%;
  padding: 10px;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
}

.form-group textarea {
  resize: vertical;
  min-height: 100px;
}

.checkbox-group {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.checkbox-group input[type="checkbox"] {
  width: auto;
}

.btn-group {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.btn {
  padding: 12px 24px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.3s;
  flex: 1;
}

.btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
  background: white;
  color: #667eea;
  border: 2px solid #667eea;
}

.btn-secondary:hover {
  background: #667eea;
  color: white;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 30px;
  right: 30px;
  background: #28a745;
  color: white;
  padding: 15px 25px;
  border-radius: 8px;
  box-shadow: 0 5px 20px rgba(0,0,0,0.3);
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s;
  z-index: 2000;
  display: flex;
  align-items: center;
  gap: 10px;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.error {
  background: #dc3545;
}

/* Dark Mode */
body.dark-mode {
  background: #1a1a2e;
  color: #e0e0e0;
}

body.dark-mode .app-wrapper {
  background: #16213e;
}

body.dark-mode .sidebar {
  background: #0f3460;
  border-right-color: #1a1a2e;
}

body.dark-mode .sidebar-section {
  border-bottom-color: #1a1a2e;
}

body.dark-mode .chapter-item {
  background: #1a1a2e;
  border-color: #0f3460;
  color: #e0e0e0;
}

body.dark-mode .toolbar-wrapper {
  background: #0f3460;
  border-bottom-color: #1a1a2e;
}

body.dark-mode .toolbar-group {
  background: #1a1a2e;
  border-color: #0f3460;
}

body.dark-mode .toolbar-btn, body.dark-mode .toolbar select {
  background: #1a1a2e;
  border-color: #0f3460;
  color: #e0e0e0;
}

body.dark-mode .editor-area {
  background: #16213e;
}

body.dark-mode #editor {
  color: #e0e0e0;
}

body.dark-mode .page-wrapper {
  background: #16213e;
  box-shadow: 0 0 15px rgba(0,0,0,0.4);
}

body.dark-mode .stats-bar {
  background: #0f3460;
  border-bottom-color: #1a1a2e;
}

body.dark-mode .stat-item {
  color: #b0b0b0;
}

/* Responsive */
@media (max-width: 768px) {
  .sidebar {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    z-index: 50;
    margin-left: -250px;
  }

  .sidebar.active {
    margin-left: 0;
  }

  .editor-area {
    padding: 20px;
  }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .header h1 {
    font-size: 1.2em;
  }
}

/* Table Styles */
#editor table {
  border-collapse: collapse;
  width: 100%;
  margin: 20px 0;
}

#editor table td, #editor table th {
  border: 1px solid #dee2e6;
  padding: 10px;
  text-align: left;
}

#editor table th {
  background: #f8f9fa;
  font-weight: 600;
}

/* Blockquote */
#editor blockquote {
  border-left: 4px solid #667eea;
  padding-left: 20px;
  margin: 20px 0;
  font-style: italic;
  color: #666;
}

/* Context menu */
.context-menu {
  display: none;
  position: fixed;
  background: white;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 3000;
  min-width: 180px;
}

.context-menu.active {
  display: block;
}

.context-menu-item {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
  color: #495057;
  border-bottom: 1px solid #f1f3f5;
  display: flex;
  align-items: center;
  gap: 8px;
}

.context-menu-item:last-child {
  border-bottom: none;
}

.context-menu-item:hover {
  background: #f8f9fa;
  color: #667eea;
}

/* Fullscreen / typewriter mode */
body.fullscreen-mode .header,
body.fullscreen-mode .toolbar-wrapper,
body.fullscreen-mode .sidebar,
body.fullscreen-mode .stats-bar {
  display: none !important;
}

body.fullscreen-mode .editor-area {
  padding: 40px 0;
  background: #f5f5f5;
}

body.fullscreen-mode .page-wrapper {
  box-shadow: none;
  background: white;
}

body.fullscreen-mode #editor {
  max-width: 800px;
  margin: 0 auto;
  background: white;
  color: #333;
}

.fullscreen-exit-btn {
  position: fixed;
  top: 16px;
  right: 16px;
  padding: 8px 14px;
  border: none;
  border-radius: 4px;
  background: #667eea;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
  z-index: 9999;
  display: none;
}

body.fullscreen-mode .fullscreen-exit-btn {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Outline view */
.outline-item {
  font-size: 13px;
  padding: 4px 0;
  cursor: pointer;
  color: #555;
}

.outline-item small {
  color: #999;
  margin-left: 4px;
}

/* Export list */
.export-list {
  list-style: none;
  padding: 0;
}

.export-list li {
  padding: 10px;
  background: #f8f9fa;
  margin-bottom: 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  gap: 10px;
}

.export-list li:hover {
  background: #667eea;
  color: white;
}

/* Page Break marker inside editor */
.page-break {
  page-break-after: always;
  margin: 30px 0;
  border-top: 2px dashed #999;
  text-align: center;
  color: #6c757d;
  padding-top: 10px;
  position: relative;
  background: #f8f9fa;
}

.page-break::after {
  content: '--- Page Break ---';
  background: #f8f9fa;
  padding: 0 10px;
  position: relative;
  top: -14px;
  font-size: 12px;
  font-weight: 600;
}

/* Highlight */
.highlight {
  background-color: yellow;
  padding: 2px 4px;
}

.highlight-dropdown-container {
  position: relative;
  display: inline-block;
}

.color-dropdown {
  position: absolute;
  top: 110%;
  left: 0;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.15);
  padding: 8px;
  min-width: 220px;
  z-index: 900;
  display: none;
}

.color-dropdown .swatch-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.highlight-color-btn {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 1px solid #ccc;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.highlight-color-btn:hover {
  transform: translateY(-1px) scale(1.02);
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
  border-color: #888;
}

.highlight-color-btn.active {
  outline: 2px solid #667eea;
  outline-offset: 1px;
  border-color: #667eea;
}

/* Drop caps */
.drop-cap-span {
  float: left;
  font-size: var(--drop-cap-size, 3em);
  line-height: 0.9;
  margin: 0.1em 0.1em 0 0;
  font-weight: 700;
  display: inline-block;
}

/* Simple Drop Cap - MS Word Style */
.drop-cap-letter {
  float: left;
  font-size: 3.5em;
  line-height: 0.85;
  font-weight: bold;
  margin: 0.05em 0.1em 0 0;
  color: #667eea;
  font-family: Georgia, 'Times New Roman', serif;
}

.drop-cap-span.drop-cap-classic {
  color: #333;
  font-weight: bold;
}

.drop-cap-span.drop-cap-colored {
  color: #667eea;
  font-weight: bold;
}

.drop-cap-span.drop-cap-bordered {
  color: #667eea;
  padding: 4px 8px;
  border: 3px solid #667eea;
  border-radius: 6px;
  font-weight: bold;
}

.drop-cap-span.drop-cap-background {
  color: white;
  background: #667eea;
  padding: 4px 8px;
  border-radius: 4px;
  font-weight: bold;
}

.drop-cap-span.drop-cap-gradient {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: bold;
}

.drop-cap-span.drop-cap-shadow {
  color: #333;
  text-shadow: 3px 3px 6px rgba(102, 126, 234, 0.5);
  font-weight: bold;
}

.drop-cap-span.drop-cap-outlined {
  color: transparent;
  -webkit-text-stroke: 2px #667eea;
  font-weight: bold;
}

.drop-cap-span.drop-cap-serif {
  font-family: 'Georgia', 'Times New Roman', serif;
  font-weight: normal;
  color: #333;
  line-height: 0.8;
}

.drop-cap-span.drop-cap-rounded {
  color: white;
  background: #667eea;
  padding: 8px 10px;
  border-radius: 50%;
  font-weight: bold;
  text-align: center;
  line-height: 1;
  width: 1.2em;
  height: 1.2em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.drop-cap-span.drop-cap-double-border {
  color: #667eea;
  padding: 4px 8px;
  border: 3px double #667eea;
  border-radius: 4px;
  font-weight: bold;
}

.drop-cap-span.drop-cap-glow {
  color: #667eea;
  text-shadow: 0 0 10px rgba(102, 126, 234, 0.8), 0 0 20px rgba(102, 126, 234, 0.5);
  font-weight: bold;
}

.drop-cap-span.drop-cap-vintage {
  color: #8b4513;
  font-family: 'Georgia', 'Times New Roman', serif;
  font-weight: bold;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

/* Inline comment / beta-note highlight */
.comment-highlight {
  background-color: #fff3cd;
  border-bottom: 2px solid #ff9800;
  cursor: pointer;
  position: relative;
  padding: 2px 4px;
  border-radius: 3px;
}

.comment-highlight:hover {
  background-color: #ffe082;
}

.comment-highlight::after {
  content: '💬';
  position: absolute;
  right: -2px;
  top: -8px;
  font-size: 10px;
  opacity: 0.7;
}

/* Loading Spinner */
.spinner {
  border: 3px solid #f3f3f3;
  border-top: 3px solid #667eea;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  animation: spin 1s linear infinite;
  display: inline-block;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Misspelled word highlighting */
.misspelled {
  background: rgba(255, 0, 0, 0.15);
  border-bottom: 2px wavy #ff0000;
  padding: 1px 2px;
  border-radius: 2px;
  cursor: pointer;
  transition: background 0.2s;
}

.misspelled:hover {
  background: rgba(255, 0, 0, 0.25);
}

/* Print styles */
@media print {
  .header,
  .toolbar-wrapper,
  .sidebar,
  .toast {
    display: none !important;
  }

  .editor-area {
    padding: 0;
    background: white;
  }

  .page-wrapper {
    box-shadow: none;
    max-width: 100%;
    margin: 0;
  }

  #editor {
    padding: 0.5in;
  }

  .page-break {
    page-break-after: always;
    border: none;
    background: transparent;
  }

  .page-break::after {
    content: '';
  }
}
