/* ========================================
   NOTES SPACE - Notion-style Redesign
   ======================================== */

/* Notes Header */
.notes-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.notes-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 12px;
}

.notes-title-icon {
  width: 28px;
  height: 28px;
  color: var(--accent);
}

/* View Toggles */
.notes-view-toggle {
  display: flex;
  gap: 4px;
  background: rgba(255,255,255,0.03);
  border-radius: 8px;
  padding: 4px;
}

.notes-view-btn {
  padding: 6px 12px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
}

.notes-view-btn.active {
  background: rgba(196, 149, 106, 0.1);
  color: var(--accent);
  border: 1px solid rgba(196, 149, 106, 0.4);
}

/* Sections */
.notes-section {
  margin-bottom: 32px;
}

.notes-section-title {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.notes-section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* Note Card - Block Style */
.note-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.note-block:hover {
  border-color: var(--accent);
  background: rgba(196, 149, 106, 0.03);
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.note-block.pinned {
  border-left: 3px solid var(--accent);
}

/* Note Block Header */
.note-block-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 8px;
}

.note-block-icon {
  font-size: 1.1rem;
  opacity: 0.7;
  flex-shrink: 0;
  margin-top: 2px;
}

.note-block-title {
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--text);
  flex: 1;
  line-height: 1.4;
}

/* Note Block Preview */
.note-block-preview {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 12px;
}

/* Note Block Meta */
.note-block-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.note-block-date {
  display: flex;
  align-items: center;
  gap: 4px;
}

.note-block-date svg {
  width: 12px;
  height: 12px;
  opacity: 0.6;
}

/* Tags */
.note-block-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.note-tag {
  padding: 2px 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  font-size: 0.68rem;
  color: var(--text-secondary);
}

.note-tag.tag-work { background: rgba(106, 149, 196, 0.15); color: #a0b4c4; }
.note-tag.tag-personal { background: rgba(196, 149, 106, 0.15); color: var(--accent); }
.note-tag.tag-ideas { background: rgba(180, 160, 196, 0.15); color: #b4a0c4; }

/* Hover Actions */
.note-block-actions {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.15s;
}

.note-block:hover .note-block-actions {
  opacity: 1;
}

.note-action-btn {
  width: 28px;
  height: 28px;
  border: none;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.note-action-btn:hover {
  background: var(--accent);
  color: var(--bg);
}

.note-action-btn svg {
  width: 14px;
  height: 14px;
}

/* Drag Handle */
.note-drag-handle {
  position: absolute;
  left: -8px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  cursor: grab;
  color: var(--text-muted);
  transition: opacity 0.15s;
}

.note-block:hover .note-drag-handle {
  opacity: 0.5;
}

.note-drag-handle:hover {
  opacity: 1 !important;
}

/* Empty State */
.notes-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.notes-empty-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.3;
}

.notes-empty-title {
  font-size: 1rem;
  margin-bottom: 8px;
  color: var(--text-secondary);
}

.notes-empty-text {
  font-size: 0.85rem;
  margin-bottom: 20px;
}

.notes-empty-hint {
  font-size: 0.75rem;
  opacity: 0.6;
}

/* Grid View */
.notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.notes-grid .note-block {
  margin-bottom: 0;
}

/* List View (compact) */
.notes-list-compact .note-block {
  padding: 12px 16px;
  margin-bottom: 6px;
}

.notes-list-compact .note-block-preview {
  -webkit-line-clamp: 1;
  margin-bottom: 8px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .notes-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
  
  .notes-view-toggle {
    width: 100%;
    justify-content: center;
  }
  
  .note-block-actions {
    opacity: 1;
  }
  
  .note-drag-handle {
    display: none;
  }
  
  .notes-grid {
    grid-template-columns: 1fr;
  }
}

/* ========================================
   NOTION-STYLE BLOCK EDITOR
   ======================================== */

/* Block Editor Container */
.block-editor {
  background: var(--surface);
  border-radius: 16px;
  border: 1px solid var(--border);
  min-height: 400px;
  display: flex;
  flex-direction: column;
}

.block-editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
}

.block-editor-title {
  flex: 1;
  font-size: 1.5rem;
  font-weight: 500;
  font-family: var(--font-display);
  color: var(--text);
  background: transparent;
  border: none;
  outline: none;
  padding: 0;
}

.block-editor-title::placeholder {
  color: var(--text-muted);
}

.block-editor-actions {
  display: flex;
  gap: 8px;
}

/* Block Editor Content Area */
.block-editor-content {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
}

/* Individual Block */
.editor-block {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 4px 0;
  margin-left: 28px;
  border-radius: 4px;
  transition: background 0.1s;
}

.editor-block:hover {
  background: rgba(255,255,255,0.02);
}

.editor-block.dragging {
  opacity: 0.5;
}

.editor-block.drag-over {
  border-top: 2px solid var(--accent);
}

/* Block Drag Handle */
.block-handle {
  position: absolute;
  left: -28px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  cursor: grab;
  color: var(--text-muted);
  border-radius: 4px;
  transition: all 0.15s;
  font-size: 12px;
}

.editor-block:hover .block-handle {
  opacity: 0.5;
}

.block-handle:hover {
  opacity: 1 !important;
  background: rgba(255,255,255,0.05);
}

.block-handle:active {
  cursor: grabbing;
}

/* Block Content */
.block-content {
  flex: 1;
  min-height: 24px;
  outline: none;
  padding: 2px 4px;
  border-radius: 3px;
  line-height: 1.5;
  word-break: break-word;
}

.block-content:focus {
  background: rgba(255,255,255,0.03);
}

.block-content:empty::before {
  content: attr(data-placeholder);
  color: var(--text-muted);
  pointer-events: none;
}

/* Block Types */
.editor-block[data-type="h1"] .block-content {
  font-size: 1.75rem;
  font-weight: 600;
  font-family: var(--font-display);
  margin: 16px 0 8px;
}

.editor-block[data-type="h2"] .block-content {
  font-size: 1.4rem;
  font-weight: 600;
  font-family: var(--font-display);
  margin: 12px 0 6px;
}

.editor-block[data-type="h3"] .block-content {
  font-size: 1.15rem;
  font-weight: 600;
  font-family: var(--font-display);
  margin: 8px 0 4px;
}

.editor-block[data-type="quote"] .block-content {
  border-left: 3px solid var(--accent);
  padding-left: 16px;
  color: var(--text-secondary);
  font-style: italic;
}

.editor-block[data-type="code"] .block-content {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  background: rgba(0,0,0,0.3);
  padding: 12px 16px;
  border-radius: 6px;
  white-space: pre-wrap;
}

.editor-block[data-type="divider"] {
  padding: 12px 0;
}

.editor-block[data-type="divider"] .block-content {
  height: 1px;
  background: var(--border);
  min-height: 1px;
}

/* Todo Block */
.editor-block[data-type="todo"] {
  display: flex;
  align-items: flex-start;
}

.block-checkbox {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(196,149,106,0.3);
  border-radius: 4px;
  margin-right: 8px;
  margin-top: 3px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
  background: rgba(20,18,14,0.8);
  color: transparent;
}

.block-checkbox:hover {
  border-color: var(--accent);
  background: rgba(196,149,106,0.1);
}

.block-checkbox.checked {
  background: #1a1510;
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 1px 8px rgba(196,149,106,0.2);
}

.block-checkbox.checked svg {
  color: var(--accent);
}

.editor-block[data-type="todo"].checked .block-content {
  text-decoration: line-through;
  color: var(--text-muted);
}

/* List Blocks */
.editor-block[data-type="bullet"] .block-content::before {
  content: '•';
  margin-right: 8px;
  color: var(--text-muted);
}

.editor-block[data-type="numbered"] {
  counter-increment: list-counter;
}

.editor-block[data-type="numbered"] .block-content::before {
  content: counter(list-counter) '.';
  margin-right: 8px;
  color: var(--text-muted);
}

.block-editor-content {
  counter-reset: list-counter;
}

/* Slash Command Menu */
.slash-menu {
  position: fixed;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.4);
  min-width: 220px;
  max-height: 300px;
  overflow-y: auto;
  z-index: 1000;
  padding: 6px;
}

.slash-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.1s;
}

.slash-menu-item:hover,
.slash-menu-item.selected {
  background: rgba(196, 149, 106, 0.15);
}

.slash-menu-item-icon {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.05);
  border-radius: 4px;
  font-size: 14px;
}

.slash-menu-item-text {
  flex: 1;
}

.slash-menu-item-name {
  font-size: 0.85rem;
  color: var(--text);
}

.slash-menu-item-desc {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* Inline Formatting Toolbar */
.inline-toolbar {
  position: fixed;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  padding: 4px;
  display: flex;
  gap: 2px;
  z-index: 1001;
}

.inline-toolbar-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.1s;
  font-size: 14px;
}

.inline-toolbar-btn:hover {
  background: rgba(255,255,255,0.1);
  color: var(--text);
}

.inline-toolbar-btn.active {
  background: var(--accent);
  color: var(--bg);
}

/* Add Block Button */
.add-block-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  margin-top: 8px;
  margin-left: 28px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.85rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
}

.add-block-btn:hover {
  background: rgba(255,255,255,0.05);
  color: var(--text);
}

.add-block-btn svg {
  width: 18px;
  height: 18px;
}

/* Block Editor Mobile */
@media (max-width: 768px) {
  .block-handle {
    display: none;
  }
  
  .editor-block {
    margin-left: 0;
  }
  
  .add-block-btn {
    margin-left: 0;
  }
  
  .slash-menu {
    left: 16px !important;
    right: 16px !important;
    width: auto !important;
  }
}

/* Smooth transitions for blocks */
.editor-block {
  animation: blockFadeIn 0.15s ease;
}

@keyframes blockFadeIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Block editor full-screen mode */
.block-editor.fullscreen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 100;
  border-radius: 0;
  border: none;
}
