/* ═══════════════════════════════════════════════════════
   DOKÜMANLAR — full styling (.doc-* prefix)
═══════════════════════════════════════════════════════ */

.doc-shell {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  background: var(--bg);
  color: var(--text);
}

/* ── Header ─────────────────────────────────────── */
.doc-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
  flex-shrink: 0;
}
.doc-header-left { flex-shrink: 0; }
.doc-title { font-size: 16px; font-weight: 700; color: var(--text); }

.doc-header-search {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  background: var(--surface3);
  border: 1px solid var(--border);
  border-radius: 8px;
  max-width: 420px;
}
.doc-header-search svg { color: var(--muted); flex-shrink: 0; }
.doc-header-search input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
}

/* Search dropdown */
.doc-search-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  max-height: 360px;
  overflow-y: auto;
  z-index: 100;
  display: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}
.doc-search-dropdown.open { display: block; }
.doc-search-item {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .12s;
}
.doc-search-item:hover { background: var(--surface3); }
.doc-search-item:last-child { border-bottom: none; }
.doc-search-name { font-size: 13px; font-weight: 600; color: var(--text); }
.doc-search-snippet { font-size: 11px; color: var(--muted); margin-top: 2px; line-height: 1.4; }
.doc-search-empty { padding: 16px; text-align: center; font-size: 12px; color: var(--muted); }

.doc-header-right {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

/* ── Buttons ────────────────────────────────────── */
.doc-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface3);
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background .12s, border-color .12s, transform .08s;
}
.doc-btn:hover { background: var(--surface); border-color: var(--accent); }
.doc-btn:active { transform: translateY(1px); }
.doc-btn-primary {
  background: linear-gradient(135deg, #ec4899, #be185d);
  border-color: transparent;
  color: #fff;
}
.doc-btn-primary:hover {
  background: linear-gradient(135deg, #be185d, #9d174d);
}
.doc-btn-ghost { padding: 7px 10px; color: var(--muted2); }

/* ── Body (2-pane) ──────────────────────────────── */
.doc-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 260px 1fr;
  overflow: hidden;
}

/* Sidebar */
.doc-sidebar {
  border-right: 1px solid var(--border);
  background: var(--surface2);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.doc-sidebar-head {
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.8px;
  padding: 12px 16px 8px;
  border-bottom: 1px solid var(--border);
}
.doc-tree {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}
.doc-tree-placeholder {
  padding: 20px;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}
.doc-tree-empty { padding: 32px 16px; text-align: center; }
.doc-tree-empty-title { font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.doc-tree-empty-sub { font-size: 11px; color: var(--muted); line-height: 1.5; }

.doc-folder, .doc-file {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  cursor: pointer;
  user-select: none;
  font-size: 12px;
  color: var(--text);
  transition: background .1s;
}
.doc-folder:hover, .doc-file:hover { background: var(--surface3); }
.doc-file.open {
  background: rgba(236, 72, 153, 0.12);
  color: #ec4899;
  border-left: 2px solid #ec4899;
  padding-left: 10px;
}
.doc-caret {
  display: inline-block;
  width: 12px;
  font-size: 9px;
  color: var(--muted);
  transition: transform .15s;
  text-align: center;
}
.doc-caret.open { transform: rotate(90deg); }
.doc-caret-spacer { display: inline-block; width: 12px; }
.doc-icon { color: var(--muted2); flex-shrink: 0; }
.doc-folder:hover .doc-icon { color: var(--accent2); }
.doc-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.doc-count {
  font-size: 9px;
  color: var(--muted);
  background: var(--surface3);
  border: 1px solid var(--border);
  padding: 1px 5px;
  border-radius: 4px;
  min-width: 16px;
  text-align: center;
}
.doc-row-del {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  opacity: 0;
  padding: 2px 4px;
  border-radius: 4px;
  transition: opacity .12s, color .12s, background .12s;
}
.doc-folder:hover .doc-row-del,
.doc-file:hover .doc-row-del { opacity: 1; }
.doc-row-del:hover { background: rgba(239, 68, 68, 0.15); color: #ef4444; }
.doc-children {
  padding-left: 16px;
}

/* ── Editor pane ────────────────────────────────── */
.doc-editor {
  display: flex;
  flex-direction: column;
  background: var(--bg);
  min-height: 0;
}
.doc-editor-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
  min-height: 44px;
}
.doc-editor-path {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text);
  flex: 1;
  font-variant-numeric: tabular-nums;
}
.doc-editor-path svg { color: var(--muted); }
.doc-dirty-dot {
  color: var(--accent);
  font-size: 14px;
  margin-left: 4px;
}
.doc-editor-meta {
  font-size: 10px;
  color: var(--muted);
}
.doc-editor-mode {
  display: flex;
  gap: 2px;
  background: var(--surface3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2px;
}
.doc-mode-btn {
  background: transparent;
  border: none;
  color: var(--muted2);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: background .12s, color .12s;
}
.doc-mode-btn:hover { color: var(--text); }
.doc-mode-btn.active {
  background: linear-gradient(135deg, #ec4899, #be185d);
  color: #fff;
}
.doc-save-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface3);
  color: var(--muted2);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
}
.doc-save-btn:hover { color: var(--text); border-color: var(--accent); }
.doc-save-btn.dirty {
  background: linear-gradient(135deg, #ec4899, #be185d);
  color: #fff;
  border-color: transparent;
  animation: doc-save-pulse 2s ease-in-out infinite;
}
@keyframes doc-save-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(236, 72, 153, 0.4); }
  50%      { box-shadow: 0 0 0 4px rgba(236, 72, 153, 0); }
}

.doc-editor-content {
  flex: 1;
  overflow: auto;
  display: flex;
}
.doc-textarea {
  flex: 1;
  border: none;
  background: var(--bg);
  color: var(--text);
  font-family: 'SF Mono', 'Menlo', 'Monaco', 'Consolas', monospace;
  font-size: 13px;
  line-height: 1.7;
  padding: 24px 32px;
  outline: none;
  resize: none;
  width: 100%;
  -webkit-user-select: text;
  user-select: text;
}

.doc-preview {
  flex: 1;
  padding: 24px 32px;
  overflow-y: auto;
  -webkit-user-select: text;
  user-select: text;
  background: var(--bg);
  font-size: 14px;
  line-height: 1.7;
  color: var(--text);
}
.doc-preview h1 { font-size: 26px; margin: 0 0 16px; font-weight: 700; color: var(--text); border-bottom: 1px solid var(--border); padding-bottom: 8px; }
.doc-preview h2 { font-size: 20px; margin: 24px 0 12px; font-weight: 700; color: var(--text); }
.doc-preview h3 { font-size: 16px; margin: 20px 0 10px; font-weight: 600; color: var(--text); }
.doc-preview h4 { font-size: 14px; margin: 16px 0 8px; font-weight: 600; color: var(--muted2); }
.doc-preview p  { margin: 0 0 12px; }
.doc-preview ul, .doc-preview ol { margin: 0 0 12px; padding-left: 24px; }
.doc-preview li { margin-bottom: 4px; }
.doc-preview code {
  background: var(--surface3);
  border: 1px solid var(--border);
  padding: 1px 5px;
  border-radius: 4px;
  font-family: 'SF Mono', 'Menlo', monospace;
  font-size: 12px;
  color: var(--accent2);
}
.doc-preview pre {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  overflow-x: auto;
  margin: 12px 0;
}
.doc-preview pre code {
  background: transparent;
  border: none;
  padding: 0;
  color: var(--text);
  font-size: 12.5px;
  line-height: 1.6;
}
.doc-preview blockquote {
  margin: 12px 0;
  padding: 8px 16px;
  border-left: 3px solid var(--accent);
  background: rgba(232, 0, 125, 0.05);
  color: var(--muted2);
  font-style: italic;
}
.doc-preview a { color: var(--accent); text-decoration: none; }
.doc-preview a:hover { text-decoration: underline; }
.doc-preview hr { border: none; border-top: 1px solid var(--border); margin: 24px 0; }
.doc-preview img { max-width: 100%; border-radius: 8px; margin: 8px 0; }
.doc-preview strong { color: var(--text); font-weight: 700; }
.doc-preview em { color: var(--muted2); }
.doc-preview del { color: var(--muted); }

/* Split mode */
.doc-split {
  display: flex;
  flex: 1;
  min-height: 0;
}
.doc-split .doc-textarea {
  border-right: 1px solid var(--border);
}
.doc-split .doc-preview { background: var(--surface); }

/* Empty state */
.doc-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--muted);
}
.doc-empty-title { font-size: 16px; font-weight: 700; color: var(--text); }
.doc-empty-sub { font-size: 12px; color: var(--muted); max-width: 320px; text-align: center; line-height: 1.5; }

/* App switcher button rengi (pink) */
.app-sw-documents.app-sw-active {
  background: rgba(236, 72, 153, .1);
  border-color: rgba(236, 72, 153, .35);
  color: #f472b6;
}
