/* App Styles — draftbook.ink (Modern UX) */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-base);
  background: var(--bg);
  color: var(--text);
  line-height: var(--line-height);
  transition: background 0.3s ease, color 0.3s ease;
}

.page {
  width: 100%;
  min-height: 100vh;
}

/* ===== LANDING PAGE (MODERN) ===== */

.landing-wrapper {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 20px;
}

.hero-section {
  text-align: center;
  padding: 60px 20px 80px;
}

.brand-mark {
  font-size: 64px;
  margin-bottom: 20px;
  animation: fadeIn 0.6s ease;
}

.hero-title {
  font-size: 56px;
  font-weight: 700;
  margin-bottom: 16px;
  letter-spacing: -0.02em;
}

.hero-subtitle {
  font-size: 20px;
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 auto;
}

.landing-footer {
  text-align: center;
  padding: 40px 20px 60px;
  margin-top: 40px;
}

.footer-links {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.footer-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: color 0.2s ease;
}

.footer-link:hover {
  color: var(--accent);
}

.footer-separator {
  color: var(--border);
  font-size: 14px;
  user-select: none;
}

.books-container {
  margin-top: 40px;
}

.books-modern-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
  margin-bottom: 40px;
}

.book-card {
  background: var(--bg-secondary);
  border: 2px solid var(--border);
  border-radius: 16px;
  padding: 32px 24px;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.book-card-delete {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transition: all 0.2s ease;
  color: var(--text-muted);
  z-index: 10;
}

.book-card-delete:hover {
  background: var(--danger);
  color: white;
  transform: scale(1.1);
}

.book-card-delete svg {
  stroke: currentColor;
}

.book-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 6px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s ease;
}

.book-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.08);
}

.book-card:hover::before {
  transform: scaleX(1);
}

.book-card-create {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  border-style: dashed;
  background: transparent;
}

.book-card-create::before {
  display: none;
}

.book-card-create .create-icon {
  font-size: 48px;
  color: var(--text-muted);
  margin-bottom: 16px;
  transition: all 0.3s ease;
}

.book-card-create:hover .create-icon {
  transform: scale(1.1);
  color: var(--accent);
}

.book-card-create h3 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
}

.book-card-create p {
  font-size: 14px;
  color: var(--text-muted);
}

.book-card h3 {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
}

.book-card p {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.book-card-meta {
  font-size: 13px;
  color: var(--text-subtle);
  display: flex;
  justify-content: space-between;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 64px;
  margin-bottom: 24px;
  opacity: 0.5;
}

.empty-state h2 {
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text);
}

.empty-state p {
  font-size: 16px;
  color: var(--text-muted);
}

/* ===== INFO MODAL ===== */

.info-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

.info-modal {
  background: var(--bg);
  border-radius: 16px;
  max-width: 600px;
  width: 100%;
  max-height: 80vh;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  animation: slideUp 0.3s ease;
}

.info-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px;
  border-bottom: 1px solid var(--border);
}

.info-modal-header h2 {
  font-size: 24px;
  font-weight: 600;
  margin: 0;
}

.btn-close-modal {
  background: transparent;
  border: none;
  width: 36px;
  height: 36px;
  font-size: 24px;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-close-modal:hover {
  background: var(--bg-secondary);
  color: var(--text);
}

.info-modal-body {
  padding: 24px;
  overflow-y: auto;
  max-height: calc(80vh - 80px);
}

.info-modal-body h3 {
  font-size: 20px;
  margin: 0 0 16px;
}

.info-modal-body h4 {
  font-size: 16px;
  margin: 24px 0 12px;
}

.info-modal-body p {
  margin: 12px 0;
  line-height: 1.6;
}

.info-modal-body ul,
.info-modal-body ol {
  margin: 12px 0;
  padding-left: 24px;
}

.info-modal-body li {
  margin: 8px 0;
  line-height: 1.6;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}



/* ===== FORM OVERLAY (SLIDE UP) ===== */

.form-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;
}

.form-panel {
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  background: var(--bg);
  border-radius: 24px;
  animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  max-height: 90vh;
  overflow-y: auto;
}

.form-panel-header {
  padding: 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
}

.form-panel-header h2 {
  font-size: 24px;
  font-weight: 600;
}

.btn-close-panel {
  background: none;
  border: none;
  font-size: 24px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  border-radius: 50%;
  transition: all 0.2s ease;
}

.btn-close-panel:hover {
  background: var(--bg-tertiary);
  color: var(--text);
}

.create-form {
  padding: 24px;
}

.form-group {
  margin-bottom: 20px;
}

.label-sm {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 12px;
  color: var(--text-muted);
}

.input-lg {
  width: 100%;
  padding: 16px;
  font-size: 16px;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-base);
  transition: all 0.2s ease;
}

.input-lg:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--bg-secondary);
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.color-swatches {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.color-swatches input[type="radio"] {
  display: none;
}

.color-swatch {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid transparent;
  transition: all 0.2s ease;
  position: relative;
}

.color-swatches input[type="radio"]:checked + .color-swatch {
  border-color: var(--text);
  transform: scale(1.1);
}

.color-swatch:hover {
  transform: scale(1.15);
}

.form-actions-sticky {
  padding: 20px 24px;
  background: var(--bg);
  border-top: 1px solid var(--border);
  position: sticky;
  bottom: 0;
}

/* ===== EDITOR PAGE ===== */

.editor-header {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 64px;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(8px);
}

.header-left,
.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.book-info-header {
  display: flex;
  flex-direction: column;
  gap: 0;
  cursor: text;
}

.book-title-header {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
  color: var(--text);
  padding: 2px 0;
  outline: none;
  border: none;
  background: transparent;
  cursor: text;
  transition: color 0.2s ease;
}

.book-title-header:hover {
  color: var(--accent);
}

.book-title-header:focus {
  color: var(--accent);
}

.book-title-header:empty:before {
  content: attr(data-placeholder);
  color: var(--text-subtle);
}

.book-author-header {
  font-size: 11px;
  font-weight: 400;
  margin: 0;
  color: var(--text-muted);
  padding: 2px 0;
  outline: none;
  border: none;
  background: transparent;
  cursor: text;
  transition: color 0.2s ease;
}

.book-author-header:hover {
  color: var(--text);
}

.book-author-header:focus {
  color: var(--text);
}

.book-author-header:empty:before {
  content: attr(data-placeholder);
  color: var(--text-subtle);
  font-style: italic;
  opacity: 0.6;
}

.book-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.book-title {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
}

.save-status {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  padding: 6px 12px;
  background: var(--bg-secondary);
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
}

.save-status::before {
  content: '•';
  color: var(--accent);
  font-size: 16px;
}

.save-status.saving {
  color: var(--accent);
  border-color: var(--accent);
}

.save-status.saving::before {
  animation: pulse 1.5s ease-in-out infinite;
}

.btn-icon {
  background: transparent;
  border: none;
  font-size: 24px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  border-radius: 10px;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.btn-icon:hover {
  background: var(--bg-secondary);
  color: var(--text);
  transform: translateY(-1px);
}

.btn-icon:active {
  transform: translateY(0);
}

.btn-icon-settings {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  font-size: 24px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text);
  border-radius: 10px;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.btn-icon-settings:hover {
  background: var(--bg-tertiary);
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.btn-icon-settings:active {
  transform: translateY(0);
}

/* Hide hamburger on desktop */
#btn-toggle-sidebar {
  display: none;
}

.btn-icon-lg {
  background: none;
  border: none;
  font-size: 24px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  border-radius: 12px;
  transition: all 0.2s ease;
}

.btn-icon-lg:hover {
  background: var(--bg-tertiary);
  color: var(--text);
}


.editor-layout {
  display: flex;
  height: calc(100vh - 64px);
}

/* ===== SIDEBAR ===== */

.sidebar {
  width: 320px;
  background: var(--bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-header {
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg);
}

.sidebar-header h2 {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

.btn-icon-sm {
  background: var(--accent);
  color: white;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-icon-sm:hover {
  transform: scale(1.1);
  background: var(--accent-hover);
}

.chapters-list {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: var(--bg);
}

.chapter-card {
  background: var(--bg-secondary);
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.chapter-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent);
  border-radius: 10px 0 0 10px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.chapter-card:hover {
  background: var(--bg-tertiary);
  border-color: var(--border);
  transform: translateY(-1px);
}

.chapter-card:hover::before {
  opacity: 0.3;
}

.chapter-card.active {
  background: var(--bg-tertiary);
  border-color: var(--accent);
}

.chapter-card.active::before {
  opacity: 1;
}

.chapter-card-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: -0.01em;
}

.chapter-card.active .chapter-card-title {
  color: var(--accent);
}

.chapter-card-excerpt {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  white-space: normal;
  line-height: 1.5;
}

.chapter-card-meta {
  font-size: 11px;
  color: var(--text-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.chapter-card-delete {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-subtle);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: all 0.2s ease;
  z-index: 5;
}

.chapter-card:hover .chapter-card-delete,
.chapter-card.active .chapter-card-delete {
  opacity: 1;
}

.chapter-card-delete:hover {
  background: var(--danger);
  color: white;
  transform: scale(1.1);
}

.chapter-card-delete:active {
  transform: scale(0.95);
}

.chapter-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

/* ===== EDITOR MAIN ===== */

.editor-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.empty-state-editor {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  font-size: 18px;
  color: var(--text-muted);
}

.chapter-editor {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.chapter-header {
  padding: 32px 32px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.chapter-title-input {
  width: 100%;
  font-size: 32px;
  font-weight: 700;
  border: none;
  background: transparent;
  color: var(--text);
  outline: none;
  padding: 0;
  font-family: var(--font-base);
}

.chapter-title-input::placeholder {
  color: var(--text-subtle);
}

/* ===== RICH TEXT TOOLBAR ===== */

.editor-toolbar {
  display: flex;
  gap: 4px;
  padding: 12px 32px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
  flex-wrap: wrap;
}

.toolbar-group {
  display: flex;
  gap: 2px;
}

.toolbar-divider {
  width: 1px;
  background: var(--border);
  margin: 0 8px;
}

.toolbar-btn {
  background: transparent;
  border: none;
  padding: 8px 12px;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s ease;
  font-family: var(--font-base);
}

.toolbar-btn:hover {
  background: var(--bg-tertiary);
}

.toolbar-btn.active {
  background: var(--accent);
  color: var(--bg);
}

/* ===== RICH TEXT EDITOR ===== */

.editor-container {
  flex: 1;
  overflow: hidden;
  padding: 32px;
  background: var(--bg);
  position: relative;
}

.btn-toggle-notes {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 10;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.btn-toggle-notes:hover {
  background: var(--bg-tertiary);
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.btn-toggle-notes:active {
  transform: translateY(0);
}

.btn-toggle-notes .notes-icon {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  color: var(--text-muted);
}

/* Mobile Notes FAB */
.btn-toggle-notes-mobile {
  display: none;
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--bg);
  border: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  z-index: 999;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  align-items: center;
  justify-content: center;
}

.btn-toggle-notes-mobile:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.btn-toggle-notes-mobile:active {
  transform: scale(0.95);
}

.btn-toggle-notes-mobile svg {
  stroke: var(--bg);
}

.btn-toggle-notes:hover .notes-icon {
  color: var(--text);
}

.notes-panel:not(.hidden) ~ .editor-main .btn-toggle-notes .notes-icon,
.btn-toggle-notes.active .notes-icon {
  transform: rotate(180deg);
  color: var(--accent);
}

.rich-text-editor {
  width: 100%;
  height: 100%;
  max-width: 800px;
  margin: 0 auto;
  font-size: var(--fz-md);
  line-height: 1.7;
  color: var(--text);
  outline: none;
  overflow-y: auto;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.rich-text-editor:empty::before {
  content: 'Start writing...';
  color: var(--text-subtle);
  font-style: italic;
}

.rich-text-editor h1 {
  font-size: 2em;
  font-weight: 700;
  margin: 1em 0 0.5em;
  line-height: 1.2;
}

.rich-text-editor h2 {
  font-size: 1.5em;
  font-weight: 600;
  margin: 1em 0 0.5em;
  line-height: 1.3;
}

.rich-text-editor h3 {
  font-size: 1.25em;
  font-weight: 600;
  margin: 1em 0 0.5em;
  line-height: 1.4;
}

.rich-text-editor p {
  margin: 1em 0;
}

.rich-text-editor ul,
.rich-text-editor ol {
  margin: 1em 0;
  padding-left: 2em;
}

.rich-text-editor li {
  margin: 0.5em 0;
}

.rich-text-editor a {
  color: var(--accent);
  text-decoration: underline;
}

/* ===== NOTES PANEL ===== */

.notes-backdrop {
  display: none;
}

.notes-panel {
  width: 320px;
  min-width: 200px;
  max-width: 600px;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: relative;
  transform: translateX(0);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.4s ease;
  opacity: 1;
  overflow: hidden;
}

.notes-panel.hidden {
  transform: translateX(100%);
  opacity: 0;
  pointer-events: none;
  position: absolute;
  right: 0;
}

.notes-resize-handle {
  position: absolute;
  left: 0;
  top: 0;
  width: 4px;
  height: 100%;
  cursor: ew-resize;
  background: transparent;
  z-index: 10;
  transition: background 0.2s ease;
}

.notes-resize-handle:hover {
  background: var(--accent);
}

.notes-resize-handle.resizing {
  background: var(--accent);
}

.notes-header {
  padding: 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.notes-header h3 {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
}

.btn-close-notes {
  display: none;
  background: transparent;
  border: none;
  width: 32px;
  height: 32px;
  font-size: 20px;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.2s ease;
  align-items: center;
  justify-content: center;
}

.btn-close-notes:hover {
  background: var(--bg-tertiary);
  color: var(--text);
}

.btn-close-notes:active {
  transform: scale(0.95);
}

.notes-textarea {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text);
  padding: 20px;
  font-family: var(--font-base);
  font-size: 14px;
  line-height: 1.6;
  resize: none;
  outline: none;
}

.notes-textarea::placeholder {
  color: var(--text-subtle);
}

/* ===== SETTINGS SLIDE PANEL ===== */

.settings-slide-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 400px;
  height: 100vh;
  background: var(--bg);
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.1);
  z-index: 2000;
  animation: slideInRight 0.3s ease;
  overflow-y: auto;
}

.panel-header {
  padding: 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
}

.panel-header h2 {
  font-size: 20px;
  font-weight: 600;
}

.panel-body {
  padding: 24px;
}

.settings-group {
  margin-bottom: 32px;
}

.settings-group h3 {
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.btn-group-pills {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}

.pill-btn {
  padding: 12px 16px;
  border: 2px solid var(--border);
  background: transparent;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.pill-btn:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.pill-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

/* Icon Toggle Group */
.icon-toggle-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.icon-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border: 2px solid var(--border);
  border-radius: 12px;
  font-family: var(--font-base);
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s ease;
}

.icon-toggle-btn svg {
  stroke: var(--text-muted);
  transition: stroke 0.2s ease;
}

.icon-toggle-btn:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.icon-toggle-btn:hover svg {
  stroke: var(--accent);
}

.icon-toggle-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
}

.icon-toggle-btn.active svg {
  stroke: var(--bg);
}

/* Icon Toggle Group - 3 buttons */
.icon-toggle-group-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}

.icon-toggle-group-3 .icon-toggle-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 4px;
}

.icon-toggle-group-3 .icon-toggle-btn svg {
  opacity: 0.6;
}

.icon-toggle-group-3 .icon-toggle-btn.active svg {
  opacity: 1;
}

.icon-toggle-group-3 .icon-toggle-btn span {
  font-size: 11px;
  font-weight: 500;
  opacity: 0.8;
}

.icon-toggle-group-3 .icon-toggle-btn.active span {
  opacity: 1;
  font-weight: 600;
}

/* Typography Grid */
.typography-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}

/* Font Family Grid */
.font-family-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
  align-items: stretch;
}

.font-option {
  cursor: pointer;
  position: relative;
  display: flex;
  height: 100%;
}

.font-option input[type="radio"] {
  display: none;
}

.font-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px 16px;
  width: 100%;
  height: 100%;
  min-height: 160px;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: var(--bg-secondary);
  transition: all 0.2s ease;
}

.font-option:hover .font-preview {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.font-option input[type="radio"]:checked + .font-preview {
  border-color: var(--accent);
  border-width: 3px;
  background: var(--bg-tertiary);
}

.font-demo {
  font-size: 48px;
  font-weight: 600;
  color: var(--text);
  line-height: 1;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.font-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  text-align: center;
}

.font-type {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
}

.slider-with-value {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.slider-value {
  font-size: 14px;
  color: var(--accent);
  font-weight: 600;
  text-align: center;
  padding: 8px;
  background: var(--bg-tertiary);
  border-radius: 8px;
}

/* Export Options */
.export-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.export-option {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  text-align: left;
  height: auto;
  justify-content: flex-start;
}

.export-option svg {
  flex-shrink: 0;
}

.btn-primary.export-option svg {
  stroke: var(--bg);
}

.btn-secondary.export-option svg {
  stroke: var(--text);
}

.export-option-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.btn-primary.export-option .export-option-text strong,
.btn-primary.export-option .export-option-text small {
  color: var(--bg);
}

.export-option-text strong {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.export-option-text small {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 400;
}

.export-option:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Backup Grid - Keep for import button if needed */
.backup-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.btn-icon-text {
  flex-direction: column;
  padding: 20px 12px;
  text-align: center;
  gap: 8px;
  height: auto;
  min-height: 100px;
}

.btn-icon-large {
  font-size: 32px;
}

.btn-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.btn-text strong {
  font-size: 13px;
  font-weight: 600;
}

.btn-text small {
  font-size: 11px;
  opacity: 0.7;
}

.btn-icon-text:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  cursor: pointer;
  font-size: 14px;
}

.checkbox-label input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
}

.settings-description {
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.4;
}

.slider-group {
  margin-top: 16px;
}

.slider-group label {
  display: block;
  font-size: 14px;
  margin-bottom: 8px;
  color: var(--text-muted);
}

.slider-modern {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--border);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.slider-modern::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  transition: all 0.2s ease;
}

.slider-modern::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.slider-modern::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: none;
}

/* ===== BUTTONS ===== */

.btn {
  padding: 12px 24px;
  border: none;
  border-radius: 12px;
  font-family: var(--font-base);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary {
  background: var(--accent);
  color: var(--bg);
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text);
}

.btn-secondary:hover {
  background: var(--border);
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover {
  background: var(--danger-hover);
}

.btn-small {
  padding: 8px 16px;
  font-size: 13px;
  height: 36px;
  border-radius: 8px;
  font-weight: 500;
}

.btn-large {
  padding: 16px 32px;
  font-size: 16px;
}

.btn-block {
  width: 100%;
}

/* ===== ANIMATIONS ===== */

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
  }
  to {
    transform: translateX(0);
  }
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* ===== RESPONSIVE ===== */

@media (max-width: 768px) {
  .editor-header {
    padding: 6px 8px;
    height: 52px;
  }
  
  .book-title-header {
    font-size: 14px;
    max-width: 120px;
  }
  
  .header-left,
  .header-right {
    gap: 4px;
  }
  
  .btn-icon {
    width: 36px;
    height: 36px;
    font-size: 20px;
  }
  
  .btn-icon-settings {
    width: 36px;
    height: 36px;
    font-size: 20px;
  }
  
  .btn-small {
    display: none;
  }
  
  /* Keep chapter add button visible on mobile */
  .sidebar-header .btn-small {
    display: inline-flex;
  }
  
  .save-status {
    display: none;
  }
  
  .editor-layout {
    height: calc(100vh - 52px);
  }
  
  .hero-title {
    font-size: 40px;
  }
  
  .hero-subtitle {
    font-size: 16px;
  }
  
  .landing-footer {
    padding: 30px 20px 40px;
  }
  
  .footer-links {
    flex-direction: column;
    gap: 8px;
  }
  
  .footer-separator {
    display: none;
  }

  .books-modern-grid {
    grid-template-columns: 1fr;
  }

  .form-row-2 {
    grid-template-columns: 1fr;
  }
  
  .typography-grid,
  .font-family-grid {
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    gap: 8px;
    padding-bottom: 8px;
    -webkit-overflow-scrolling: touch;
  }
  
  .font-option {
    flex: 0 0 auto;
    width: 95px;
    min-width: 95px;
    max-width: 95px;
  }
  
  .font-preview {
    height: 115px;
    min-height: 115px;
    max-height: 115px;
    padding: 12px 8px;
    gap: 4px;
  }
  
  .font-demo {
    font-size: 28px;
    line-height: 1;
  }
  
  .font-name {
    font-size: 11px;
    line-height: 1.2;
    text-align: center;
  }
  
  .font-type {
    font-size: 9px;
    line-height: 1.2;
    text-align: center;
  }
  
  .backup-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  
  .btn-group-pills {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: absolute;
    height: 100%;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .btn-toggle-notes {
    display: none;
  }
  
  .btn-toggle-notes-mobile {
    display: flex;
  }
  
  /* Show hamburger on mobile */
  #btn-toggle-sidebar {
    display: flex !important;
  }
  
  /* Mobile Notes Panel - Bottom Sheet */
  .notes-panel {
    position: fixed;
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    height: 60vh;
    max-height: 500px;
    border-left: none;
    border-top: 1px solid var(--border);
    border-radius: 20px 20px 0 0;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    opacity: 1;
    pointer-events: auto;
  }
  
  .notes-panel.hidden {
    transform: translateY(100%);
    pointer-events: none;
  }
  
  .notes-panel:not(.hidden) {
    transform: translateY(0);
  }
  
  /* Drag Handle for Mobile */
  .notes-panel::before {
    content: '';
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    opacity: 0.5;
  }
  
  .notes-header {
    padding-top: 32px;
  }
  
  .btn-close-notes {
    display: flex;
  }
  
  .notes-resize-handle {
    display: none;
  }
  
  /* Backdrop for mobile */
  .notes-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }
  
  .notes-backdrop.visible {
    opacity: 1;
    pointer-events: auto;
  }

  .settings-slide-panel {
    width: 100%;
  }

  .editor-toolbar {
    padding: 12px 16px;
  }

  .editor-container {
    padding: 20px 16px;
  }
}

/* ===== SCROLLBARS ===== */

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-subtle);
}

/* ===== HIDDEN UTILITY ===== */

.hidden {
  display: none !important;
}

/* ===== CONFIRM MODAL ===== */

.confirm-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

.confirm-modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--overlay);
  backdrop-filter: blur(4px);
}

.confirm-modal-content {
  position: relative;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  max-width: 420px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.3s ease;
}

.confirm-modal-content h3 {
  margin: 0 0 12px 0;
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
}

.confirm-modal-content p {
  margin: 0 0 24px 0;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-muted);
}

.confirm-modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.confirm-modal-actions .btn {
  min-width: 100px;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

