/* ==========================================================================
   ONENOTE NOTEBOOK & RICH CANVAS STYLES
   ========================================================================== */

/* Section Navigation Ribbon (Top of Notebook Stage) */
.onenote-section-bar {
  background-color: var(--bg-surface-secondary);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  padding: 4px 16px 0 16px;
  gap: 4px;
  overflow-x: auto;
  user-select: none;
}

.section-tab {
  height: 32px;
  padding: 0 14px;
  border-radius: 6px 6px 0 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  background-color: transparent;
  border: 1px solid transparent;
  border-bottom: none;
  cursor: pointer;
  position: relative;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.section-tab:hover {
  background-color: var(--bg-hover);
  color: var(--text-primary);
}

.section-tab.active {
  background-color: var(--bg-surface);
  color: var(--text-primary);
  font-weight: 600;
  border-color: var(--border-subtle);
  border-bottom: 2px solid var(--section-color, var(--primary));
  box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.03);
}

.section-color-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--section-color, var(--primary));
  flex-shrink: 0;
}

.section-tab-close {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  opacity: 0;
  font-size: 10px;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
}
.section-tab:hover .section-tab-close {
  opacity: 1;
}
.section-tab-close:hover {
  background-color: var(--bg-active);
  color: var(--text-primary);
}

.add-section-btn {
  height: 28px;
  padding: 0 8px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  gap: 4px;
  margin-left: 4px;
  margin-bottom: 2px;
}
.add-section-btn:hover {
  background-color: var(--bg-hover);
  color: var(--text-primary);
}

/* Notebook Page List Sidebar Elements */
.notebook-selector {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.notebook-dropdown-btn {
  width: 100%;
  height: 34px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}
.notebook-dropdown-btn:hover {
  border-color: var(--border-default);
  background-color: var(--bg-hover);
}

.page-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 8px;
}

.page-item {
  padding: 8px 10px;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background-color: transparent;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
  position: relative;
}

.page-item:hover {
  background-color: var(--bg-hover);
}

.page-item.active {
  background-color: var(--bg-surface);
  border-color: var(--border-subtle);
  box-shadow: var(--shadow-sm);
}
.page-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  background-color: var(--active-section-color, var(--primary));
  border-radius: 0 3px 3px 0;
}

.page-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.page-item-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.page-item.active .page-item-title {
  font-weight: 600;
}

.pin-icon {
  font-size: 11px;
  color: var(--primary);
}

.page-item-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-tertiary);
}

.page-tag-pill {
  font-size: 10px;
  padding: 1px 5px;
  background-color: var(--bg-surface-tertiary);
  border-radius: 4px;
  color: var(--text-secondary);
}

/* ==========================================================================
   RICH NOTE EDITOR & CANVAS
   ========================================================================== */

.editor-wrapper {
  display: flex;
  flex-direction: column;
  height: 100%;
  background-color: var(--bg-surface);
  overflow: hidden;
}

/* Formatting Ribbon Toolbar */
.editor-toolbar {
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  padding: 4px 16px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  user-select: none;
  z-index: 10;
}

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

.toolbar-divider {
  width: 1px;
  height: 20px;
  background-color: var(--border-subtle);
  margin: 0 4px;
}

.tool-btn {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tool-btn:hover {
  background-color: var(--bg-hover);
  color: var(--text-primary);
}
.tool-btn.active {
  background-color: var(--primary-alpha);
  color: var(--primary);
}

.tool-select {
  height: 28px;
  padding: 0 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background-color: var(--bg-surface);
  color: var(--text-primary);
  font-size: 12px;
  outline: none;
}
.tool-select:focus {
  border-color: var(--primary);
}

/* Page Document Viewport */
.editor-scroll-container {
  flex: 1;
  overflow-y: auto;
  padding: 40px 60px;
  display: flex;
  justify-content: center;
  position: relative;
}

.note-page-canvas {
  width: 100%;
  max-width: 860px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.page-header-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.page-title-input {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  border: none;
  outline: none;
  background: transparent;
  width: 100%;
  line-height: 1.2;
}
.page-title-input:focus {
  background-color: var(--bg-surface-secondary);
  border-radius: var(--radius-sm);
}

.page-details-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 12px;
  color: var(--text-tertiary);
}

.page-author-tag {
  display: flex;
  align-items: center;
  gap: 6px;
}

.page-author-avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.page-tags-list {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tag-badge {
  background-color: var(--bg-surface-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 2px 8px;
  font-size: 11px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Rich Content Editable Area */
.note-content-editable {
  min-height: 500px;
  outline: none;
  font-size: 15px;
  line-height: 1.7;
  color: var(--text-primary);
}

.note-content-editable:empty::before {
  content: 'Type something, paste code, or add checklists...';
  color: var(--text-tertiary);
  pointer-events: none;
}

/* Typography in Rich Notes */
.note-content-editable h1 {
  font-size: 24px;
  font-weight: 700;
  margin: 20px 0 10px 0;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 6px;
}

.note-content-editable h2 {
  font-size: 19px;
  font-weight: 600;
  margin: 18px 0 8px 0;
  color: var(--text-primary);
}

.note-content-editable h3 {
  font-size: 16px;
  font-weight: 600;
  margin: 14px 0 6px 0;
}

.note-content-editable p {
  margin-bottom: 12px;
}

.note-content-editable .lead-text {
  font-size: 16px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Callout Alert Boxes */
.callout {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  margin: 16px 0;
  border-left: 4px solid var(--primary);
  background-color: var(--bg-surface-secondary);
}

.callout-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.callout-content {
  flex: 1;
  font-size: 14px;
  line-height: 1.5;
}

.callout-info { border-left-color: #0078d4; background-color: var(--status-info-bg); }
.callout-warning { border-left-color: #d83b01; background-color: var(--status-warning-bg); }
.callout-important { border-left-color: #7719aa; background-color: rgba(119, 25, 170, 0.08); }
.callout-tip { border-left-color: #107c41; background-color: var(--status-success-bg); }

/* Code Blocks */
.code-block-wrapper {
  background-color: #1e1e24;
  border-radius: var(--radius-md);
  margin: 16px 0;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-subtle);
}

.code-header {
  background-color: #282830;
  padding: 6px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-family: var(--font-mono);
  color: #adadad;
}

.btn-copy {
  font-size: 11px;
  padding: 2px 8px;
  background-color: #3b3b45;
  color: #fff;
  border-radius: 4px;
}
.btn-copy:hover {
  background-color: var(--primary);
}

.code-block-wrapper pre {
  padding: 14px;
  overflow-x: auto;
  margin: 0;
}

.code-block-wrapper code {
  font-family: var(--font-mono);
  font-size: 13px;
  color: #e6e6e6;
  line-height: 1.5;
}

/* Interactive Checklists (To-Dos) */
.todo-list {
  list-style: none;
  margin: 12px 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.todo-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  padding: 2px 0;
}

.todo-box {
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--border-strong);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 2px;
  background-color: var(--bg-surface);
  transition: all var(--transition-fast);
}

.todo-item.checked .todo-box {
  background-color: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.todo-item.checked {
  text-decoration: line-through;
  color: var(--text-tertiary);
}

/* Rich Tables */
.rich-table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  background-color: var(--bg-surface);
}

.rich-table th {
  background-color: var(--bg-surface-secondary);
  padding: 10px 14px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-subtle);
}

.rich-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 13px;
}

.rich-table tr:last-child td {
  border-bottom: none;
}

.rich-table tr:hover td {
  background-color: var(--bg-hover);
}

.status-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
}
.status-healthy { background: var(--status-success-bg); color: var(--status-success); }
.status-warning { background: var(--status-warning-bg); color: var(--status-warning-alt); }
.status-danger { background: var(--status-danger-bg); color: var(--status-danger); }

/* Drawing Canvas Whiteboard Overlay */
.draw-canvas-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.94);
  z-index: 50;
  display: flex;
  flex-direction: column;
}
[data-theme="dark"] .draw-canvas-container {
  background: rgba(20, 20, 24, 0.95);
}

.draw-toolbar {
  height: 48px;
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  box-shadow: var(--shadow-sm);
}

.draw-canvas {
  flex: 1;
  cursor: crosshair;
  touch-action: none;
}
