/* ═══════════════════════════════════════════════
   NOTED PAD PRO v4.2 — features.css
   Kanban, AI, Sync, Share, PWA, LaTeX, Markdown
═══════════════════════════════════════════════ */

/* ══════════════════════════════════════
   KANBAN BOARD
══════════════════════════════════════ */
#modal-kanban .modal { max-width: 98vw; width: 1100px; }

#kanban-board {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
  min-height: 400px;
  align-items: flex-start;
}
#kanban-board::-webkit-scrollbar { height: 5px; }

.kb-col {
  flex-shrink: 0;
  width: 220px;
  background: var(--bg-input);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  max-height: 72vh;
  overflow: hidden;
}
.kb-col-header {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 12px 8px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.kb-col-icon  { font-size: 16px; }
.kb-col-title { font-size: 12px; font-weight: 700; color: var(--text-primary); flex: 1; }
.kb-col-count { font-size: 10px; background: var(--bg-hover); color: var(--text-muted); padding: 1px 6px; border-radius: 9px; }

/* Column accent borders */
.kb-work     { border-top: 3px solid var(--info);    }
.kb-personal { border-top: 3px solid var(--purple);  }
.kb-ideas    { border-top: 3px solid var(--teal);    }
.kb-urgent   { border-top: 3px solid var(--danger);  }
.kb-done     { border-top: 3px solid var(--success); }
.kb-untagged { border-top: 3px solid var(--border-light); }

.kb-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.kb-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 11px;
  cursor: pointer;
  transition: all var(--t-fast);
  position: relative;
}
.kb-card:hover   { border-color: var(--border-accent); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.kb-card.kb-pinned { border-left: 3px solid var(--info); }
.kb-card.kb-locked { opacity: .7; }

.kb-card-title   { font-size: 12.5px; font-weight: 600; color: var(--text-primary); margin-bottom: 5px; line-height: 1.4; }
.kb-card-preview { font-size: 11px; color: var(--text-muted); margin-bottom: 6px; line-height: 1.5; }
.kb-card-meta    { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.kb-card-date    { font-size: 9.5px; color: var(--text-muted); }
.kb-card-folder  { font-size: 11px; }
.kb-card-attach  { font-size: 9.5px; color: var(--text-muted); }

.kb-add-btn {
  margin: 0 8px 8px;
  padding: 7px;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 11.5px;
  font-family: var(--font-body);
  cursor: pointer;
  transition: all var(--t-fast);
  text-align: center;
  flex-shrink: 0;
}
.kb-add-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

.kb-empty {
  text-align: center;
  padding: 16px 8px;
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
}

/* ══════════════════════════════════════
   AI ASSISTANT
══════════════════════════════════════ */
.ai-action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin-bottom: 12px;
}
.ai-action-btn {
  font-size: 12px !important;
  padding: 8px 10px !important;
  text-align: center;
  justify-content: center;
}
.ai-action-btn:disabled { opacity: .4; cursor: not-allowed; }

.ai-custom-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 14px;
}
.ai-custom-row input { flex: 1; margin-bottom: 0 !important; }

.ai-result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  flex-wrap: wrap;
  gap: 6px;
}
.ai-result-header > span { font-size: 11px; font-weight: 700; color: var(--text-muted); letter-spacing: .5px; text-transform: uppercase; }
.ai-result-header > div { display: flex; gap: 5px; }

.ai-result-box {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.7;
  white-space: pre-wrap;
  max-height: 220px;
  overflow-y: auto;
  margin-bottom: 12px;
}

/* Spinner */
.ai-spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

.ai-config-wrap { padding: 4px 0; }

/* ══════════════════════════════════════
   SYNC
══════════════════════════════════════ */
.sync-status-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
}
.sync-status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}
.sync-status-dot.configured { background: var(--success); box-shadow: 0 0 6px rgba(72,187,120,.5); animation: pulse 2.5s infinite; }

.sync-config-section {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 13px;
  margin-bottom: 14px;
}
.sync-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
  transition: opacity var(--t-fast);
}
.sync-actions .btn { flex-direction: column; padding: 10px; text-align: center; justify-content: center; }
.sync-disabled { opacity: .5; pointer-events: none; }

/* ══════════════════════════════════════
   SHARE
══════════════════════════════════════ */
.share-note-preview {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 14px;
}
.share-note-title { font-size: 14px; font-weight: 700; color: var(--text-primary); margin-bottom: 4px; }
.share-note-meta  { font-size: 11px; color: var(--text-muted); }

.share-url-box { margin-bottom: 10px; }
.share-url-textarea {
  width: 100%;
  height: 72px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 8px 10px;
  resize: none;
  outline: none;
  cursor: pointer;
  transition: border-color var(--t-fast);
}
.share-url-textarea:focus { border-color: var(--border-accent); }
.share-actions { display: flex; gap: 8px; margin-bottom: 4px; }
.share-actions .btn { flex: 1; justify-content: center; }

/* Shared note viewer */
#shared-note-viewer h1 { font-family: var(--font-display); }
#shared-note-viewer table { width: 100%; border-collapse: collapse; }
#shared-note-viewer th, #shared-note-viewer td { padding: 7px 11px; border: 1px solid var(--border); }
#shared-note-viewer pre { background: var(--bg-input); padding: 14px; border-radius: var(--radius); overflow-x: auto; }
#shared-note-viewer code { font-family: var(--font-mono); font-size: .85em; }
#shared-note-viewer blockquote { border-left: 3px solid var(--accent); padding-left: 14px; color: var(--text-secondary); }

/* ══════════════════════════════════════
   PWA INSTALL
══════════════════════════════════════ */
.pwa-install-highlight {
  background: var(--accent-soft);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius);
  padding: 18px;
  text-align: center;
  margin-bottom: 14px;
}
.pwa-guide-section { padding: 14px; background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius); }
.pwa-guide-title   { font-size: 12px; font-weight: 700; color: var(--text-muted); letter-spacing: .5px; text-transform: uppercase; margin-bottom: 12px; }
.pwa-guide-step    { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 10px; font-size: 13px; color: var(--text-secondary); }
.pwa-guide-num     { width: 22px; height: 22px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }

/* ══════════════════════════════════════
   LATEX
══════════════════════════════════════ */
#editor-content .latex-inline {
  display: inline-block;
  vertical-align: middle;
  margin: 0 2px;
  cursor: default;
  user-select: none;
}
#editor-content .latex-block {
  display: block;
  text-align: center;
  margin: 1em 0;
  padding: 8px;
  background: rgba(255,255,255,.02);
  border-radius: var(--radius-sm);
  overflow-x: auto;
  cursor: default;
  user-select: none;
}
.latex-preview-wrap {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  min-height: 48px;
  margin-top: 6px;
  margin-bottom: 12px;
  text-align: center;
  font-size: 1.2em;
}

/* KaTeX overrides */
.katex { color: var(--text-primary); }
.katex-display { color: var(--text-primary); }

/* ══════════════════════════════════════
   MARKDOWN IMPORT MODAL
══════════════════════════════════════ */
#md-import-input {
  width: 100%;
  height: 180px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 12.5px;
  padding: 10px 12px;
  outline: none;
  resize: vertical;
  line-height: 1.6;
  transition: border-color var(--t-fast);
  margin-bottom: 12px;
}
#md-import-input:focus { border-color: var(--border-accent); }

/* ══════════════════════════════════════
   DRAG & DROP NOTE ITEMS
══════════════════════════════════════ */
.ni-dragging {
  opacity: .4;
  background: var(--bg-active) !important;
}
.ni-chosen {
  box-shadow: 0 8px 20px rgba(0,0,0,.4);
  transform: scale(1.02);
  z-index: 100;
}
.ni-drag { opacity: .5; }

/* ══════════════════════════════════════
   RESPONSIVE — mobile overrides
══════════════════════════════════════ */
@media (max-width: 768px) {
  #modal-kanban .modal { max-width: 100%; }
  #kanban-board { gap: 8px; }
  .kb-col { width: 180px; }
  .ai-action-grid { grid-template-columns: 1fr; }
  .sync-actions { grid-template-columns: 1fr; }
}
