/* =============================================
   V2 MÍDIA — Módulo: Documentos
   style.css
   ============================================= */

/* ─── LAYOUT ───────────────────────────────── */
html, body {
  height: 100%;
  overflow: hidden;
  font-family: 'IBM Plex Sans', sans-serif;
}

.dc-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
}

/* ─── SIDEBAR ───────────────────────────────── */
.dc-sidebar {
  width: 256px;
  flex-shrink: 0;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.dc-sidebar-header {
  padding: 16px 14px 10px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dc-sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dc-sidebar-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.dc-btn-new {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  color: var(--text-muted);
}

.dc-btn-new:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-dim);
}

/* Search */
.dc-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.dc-search-icon {
  position: absolute;
  left: 10px;
  color: var(--text-muted);
  pointer-events: none;
}

.dc-search-input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 10px 7px 30px;
  font-family: var(--font);
  font-size: 12.5px;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}

.dc-search-input:focus { border-color: var(--accent); }
.dc-search-input::placeholder { color: var(--text-muted); }

/* Tree */
.dc-tree-wrap {
  flex: 1;
  overflow-y: auto;
  padding: 8px 8px;
}

.dc-tree,
.dc-subtree {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.dc-subtree {
  margin-left: 12px;
  padding-left: 8px;
  border-left: 1px solid var(--border);
}

.dc-tree-item {
  position: relative;
}

.dc-tree-row {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 8px;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.12s;
  color: var(--text-dim);
}

.dc-tree-row:hover {
  background: var(--bg-card-hover);
  color: var(--text);
}

.dc-tree-row.active {
  background: var(--accent-dim);
  color: var(--accent);
}

.dc-tree-toggle {
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  flex-shrink: 0;
  border-radius: 3px;
  transition: transform 0.15s;
}

.dc-tree-toggle svg { display: block; }
.dc-tree-toggle.open { transform: rotate(90deg); }
.dc-tree-toggle.hidden { visibility: hidden; }

.dc-tree-label {
  flex: 1;
  font-size: 13px;
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
}

.dc-tree-row.active .dc-tree-label {
  font-weight: 500;
}

/* Row actions (hidden until hover) */
.dc-tree-actions {
  display: none;
  align-items: center;
  gap: 2px;
}

.dc-tree-row:hover .dc-tree-actions { display: flex; }

.dc-tree-act-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 4px;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
}

.dc-tree-act-btn:hover { background: rgba(128,128,128,.12); color: var(--text); }
.dc-tree-act-btn--del:hover { background: var(--red-dim); color: var(--red); }

/* Empty state */
.dc-sidebar-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 32px 16px;
  text-align: center;
  color: var(--text-muted);
}

.dc-sidebar-empty p {
  font-size: 13px;
}

.dc-sidebar-empty svg { color: var(--text-muted); }

/* ─── MAIN ──────────────────────────────────── */
.dc-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* ─── TOPBAR ────────────────────────────────── */
.dc-topbar {
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
  flex-shrink: 0;
  gap: 12px;
}

.dc-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
  min-width: 0;
}

.dc-bc-root {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.dc-bc-sep { flex-shrink: 0; }

.dc-bc-current {
  color: var(--text-dim);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dc-topbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.dc-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border-radius: 7px;
  border: 1px solid var(--border-md);
  background: none;
  color: var(--text-dim);
  font-family: var(--font);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.13s, color 0.13s, border-color 0.13s;
  white-space: nowrap;
}

.dc-action-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text);
  border-color: var(--border-md);
}

.dc-action-btn--danger:hover {
  background: var(--red-dim);
  color: var(--red);
  border-color: transparent;
}

/* ─── EDITOR WRAPPER ────────────────────────── */
.dc-editor-wrap {
  flex: 1;
  overflow-y: auto;
  padding: 0;
  position: relative;
}

/* ─── WELCOME STATE ─────────────────────────── */
.dc-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  height: 100%;
  padding: 40px;
  text-align: center;
}

.dc-welcome-icon {
  width: 80px;
  height: 80px;
  border-radius: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.dc-welcome h2 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

.dc-welcome p {
  font-size: 14px;
  color: var(--text-dim);
  max-width: 380px;
  line-height: 1.6;
}

/* ─── EDITOR ────────────────────────────────── */
.dc-editor {
  max-width: 760px;
  margin: 0 auto;
  padding: 48px 56px 80px;
}

/* Document breadcrumb (inside editor, for sub-pages) */
.dc-doc-breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 16px;
  font-size: 12px;
  color: var(--text-muted);
  min-height: 20px;
}

.dc-doc-bc-item {
  cursor: pointer;
  transition: color 0.12s;
}

.dc-doc-bc-item:hover { color: var(--accent); }
.dc-doc-bc-sep { opacity: 0.5; }

/* Title */
.dc-title-input {
  width: 100%;
  background: none;
  border: none;
  outline: none;
  font-family: var(--font);
  font-size: 38px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.15;
  letter-spacing: -0.5px;
  margin-bottom: 14px;
  caret-color: var(--accent);
}

.dc-title-input::placeholder { color: var(--text-muted); }

/* Meta */
.dc-doc-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 32px;
  font-size: 12.5px;
  color: var(--text-muted);
}

.dc-meta-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #fbbf24);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.dc-meta-author { color: var(--text-dim); font-weight: 500; }

kbd {
  background: var(--bg-card);
  border: 1px solid var(--border-md);
  border-radius: 4px;
  padding: 1px 5px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
}

/* Body (contenteditable) */
.dc-body {
  font-size: 15px;
  line-height: 1.75;
  color: var(--text);
  outline: none;
  min-height: 200px;
  caret-color: var(--accent);
}

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

/* Rich text content styles */
.dc-body h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  margin: 28px 0 8px;
  line-height: 1.25;
  letter-spacing: -0.3px;
}

.dc-body h2 {
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
  margin: 22px 0 6px;
  line-height: 1.3;
}

.dc-body h3 {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  margin: 18px 0 5px;
  line-height: 1.35;
}

.dc-body p {
  margin: 0 0 4px;
}

.dc-body ul,
.dc-body ol {
  padding-left: 22px;
  margin: 6px 0;
}

.dc-body li {
  margin: 2px 0;
}

.dc-body blockquote {
  border-left: 3px solid var(--accent);
  margin: 12px 0;
  padding: 8px 16px;
  background: var(--accent-dim);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-dim);
  font-style: italic;
}

.dc-body pre {
  background: var(--bg-card);
  border: 1px solid var(--border-md);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-family: var(--mono);
  font-size: 13px;
  overflow-x: auto;
  margin: 10px 0;
  color: var(--text);
}

.dc-body code {
  font-family: var(--mono);
  font-size: 13px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 1px 5px;
  border-radius: 4px;
  color: var(--accent);
}

.dc-body hr {
  border: none;
  border-top: 1px solid var(--border-md);
  margin: 20px 0;
}

.dc-body strong { color: var(--text); }
.dc-body a { color: var(--blue); text-decoration: underline; }

/* Sub-pages section */
.dc-subpages-section {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.dc-subpages-header {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.dc-subpages-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}

.dc-subpage-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.12s;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.dc-subpage-card:hover {
  border-color: var(--border-md);
  background: var(--bg-card-hover);
  transform: translateY(-1px);
}

.dc-subpage-card-icon {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--accent-dim);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.dc-subpage-card-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.35;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* ─── SLASH MENU ────────────────────────────── */
.dc-slash-menu {
  display: none;
  position: fixed;
  background: var(--bg-surface);
  border: 1px solid var(--border-md);
  box-shadow: 0 8px 32px rgba(0,0,0,.35), 0 2px 8px rgba(0,0,0,.2);
  border-radius: 10px;
  width: 264px;
  z-index: 9999;
  flex-direction: column;
  padding: 6px 0;
  animation: slashIn 0.12s ease;
}

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

.dc-slash-menu.open { display: flex; }

.dc-slash-section {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 4px 12px 2px;
}

.dc-slash-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  cursor: pointer;
  background: none;
  border: none;
  text-align: left;
  width: 100%;
  font-family: var(--font);
  color: var(--text);
  transition: background 0.1s;
  border-radius: 6px;
  margin: 0 4px;
  width: calc(100% - 8px);
}

.dc-slash-item:hover { background: var(--bg-card-hover); }
.dc-slash-item.selected { background: var(--accent-dim); }

.dc-slash-icon {
  width: 28px;
  height: 28px;
  background: var(--bg-card);
  border: 1px solid var(--border-md);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--text-dim);
}

.dc-slash-icon--text {
  font-family: var(--font);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dim);
}

.dc-slash-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.3;
}

.dc-slash-desc {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 1px;
}

/* ─── MODAL ─────────────────────────────────── */
.dc-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: rgba(0,0,0,.5);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(3px);
  animation: fadeIn 0.15s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.dc-modal {
  background: var(--bg-surface);
  border: 1px solid var(--border-md);
  border-radius: var(--radius);
  box-shadow: 0 24px 64px rgba(0,0,0,.45);
  width: 100%;
  max-width: 440px;
  animation: modalIn 0.18s ease;
  overflow: hidden;
}

.dc-modal--sm { max-width: 360px; }

@keyframes modalIn {
  from { opacity: 0; transform: translateY(12px) scale(.97); }
  to   { opacity: 1; transform: none; }
}

.dc-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
}

.dc-modal-header h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.dc-modal-body { padding: 20px; }

.dc-modal-hint {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.55;
  margin-bottom: 16px;
}

.dc-modal-hint strong { color: var(--text); }

.dc-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
}

/* Export options */
.dc-export-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.dc-export-opt {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.14s, background 0.14s, transform 0.12s;
  text-align: left;
  font-family: var(--font);
}

.dc-export-opt:hover {
  border-color: var(--border-md);
  background: var(--bg-card-hover);
  transform: translateY(-1px);
}

.dc-export-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.dc-export-icon--blue   { background: var(--blue-dim);   color: var(--blue); }
.dc-export-icon--purple { background: var(--purple-dim); color: var(--purple); }
.dc-export-icon--green  { background: var(--green-dim);  color: var(--green); }
.dc-export-icon--amber  { background: var(--yellow-dim); color: var(--yellow); }

.dc-export-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.dc-export-desc {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 1px;
}

/* .btn-sm e .btn-danger agora em shared.css */

/* ─── TOAST ─────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-card);
  border: 1px solid var(--border-md);
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 13px;
  color: var(--text);
  box-shadow: 0 8px 24px rgba(0,0,0,.3);
  z-index: 99999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  white-space: nowrap;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ─── CHECKLIST ─────────────────────────────── */
.dc-checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin: 3px 0;
  line-height: 1.7;
}

.dc-cl-box {
  width: 17px;
  height: 17px;
  border-radius: 4px;
  border: 1.5px solid var(--border-md);
  flex-shrink: 0;
  margin-top: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.13s, border-color 0.13s;
  user-select: none;
  -webkit-user-select: none;
}

.dc-cl-box:hover {
  border-color: var(--accent);
}

.dc-cl-check-icon {
  display: none;
  color: #fff;
  flex-shrink: 0;
}

.dc-checklist-item.checked .dc-cl-box {
  background: var(--accent);
  border-color: var(--accent);
}

.dc-checklist-item.checked .dc-cl-check-icon {
  display: block;
}

.dc-cl-text {
  flex: 1;
  min-width: 20px;
  outline: none;
  word-break: break-word;
  transition: color 0.15s, text-decoration 0.15s;
}

.dc-checklist-item.checked .dc-cl-text {
  text-decoration: line-through;
  color: var(--text-muted);
}

/* ─── PRINT ─────────────────────────────────── */
@media print {
  .dc-sidebar,
  .dc-topbar,
  .dc-meta-hint,
  .dc-doc-meta { display: none; }
  .dc-editor {
    max-width: none;
    padding: 0;
  }
  .dc-title-input {
    font-size: 28px;
  }
}
