/* yegge-docs — app-layer styles on top of yegge-design.css */

/* ── App shell ─────────────────────────────────────────── */
.app-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}
.app-sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.app-sidebar .nav-brand { display: block; margin-bottom: 1.25rem; padding: 0 0.5rem; }
.side-link {
  display: block;
  padding: 0.45rem 0.6rem;
  border-radius: 2px;
  font-size: 0.82rem;
  color: var(--text);
  text-decoration: none;
  letter-spacing: 0.02em;
}
.side-link:hover { background: var(--surface2); color: var(--text-bright); }
.side-link.active { background: var(--surface2); color: var(--text-bright); }
.side-section { margin-top: 1.25rem; }
.app-main { padding: 2rem clamp(1.25rem, 3vw, 3rem); min-width: 0; }

/* ── Doc list ──────────────────────────────────────────── */
.doc-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--surface);
  margin-bottom: 0.5rem;
  cursor: pointer;
  transition: border-color 0.15s;
}
.doc-row:hover { border-color: var(--accent); }
.doc-row .doc-title { color: var(--text-bright); font-size: 0.95rem; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-row .doc-date { font-size: 0.7rem; color: var(--text-muted); white-space: nowrap; }

/* ── Editor ────────────────────────────────────────────── */
.editor-toolbar {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-wrap: wrap;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 30;
}
.editor-toolbar .tb-sep { width: 1px; height: 18px; background: var(--border2); margin: 0 0.3rem; }
.editor-surface {
  width: 100%;
  min-height: 55vh;
  background: var(--input-bg);
  border: 1px solid var(--border2);
  border-radius: 3px;
  color: var(--text-bright);
  font-family: 'SFMono-Regular', 'Fira Code', Consolas, monospace;
  font-size: 0.88rem;
  line-height: 1.7;
  padding: 1.25rem;
  outline: none;
  resize: vertical;
}
.editor-surface:focus { border-color: var(--accent); }
.editor-surface.richtext {
  font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
}
.editor-meta { display: flex; gap: 0.75rem; flex-wrap: wrap; align-items: center; margin: 0.75rem 0 1rem; }
.editor-meta input[type="text"] { width: auto; flex: 1; min-width: 140px; }
.dictating { border-color: var(--danger-hover) !important; color: #c07070 !important; }

/* preview pane */
.preview-pane {
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1.5rem 2rem;
  background: var(--surface);
  min-height: 55vh;
}

/* code render iframe */
.code-render-frame {
  width: 100%;
  min-height: 260px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fff;
  margin: 1.5rem 0;
}
.code-render-toggle { right: 4.2rem; }

/* ── AI drawer ─────────────────────────────────────────── */
.ai-drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(420px, 92vw);
  background: var(--surface);
  border-left: 1px solid var(--border2);
  z-index: 150;
  display: flex;
  flex-direction: column;
  transform: translateX(102%);
  transition: transform 0.2s ease;
}
.ai-drawer.open { transform: none; }
.ai-drawer-body { flex: 1; overflow-y: auto; padding: 1.25rem; }
.ai-output {
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1rem;
  font-size: 0.82rem;
  white-space: pre-wrap;
  max-height: 40vh;
  overflow-y: auto;
  margin-top: 1rem;
}

/* ── Databases ─────────────────────────────────────────── */
.db-grid-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 3px; }
.db-grid { margin: 0; min-width: 640px; }
.db-grid td input, .db-grid td select {
  background: transparent; border: none; padding: 0.2em 0.3em; width: 100%;
  color: var(--text-bright); font-size: 0.85rem;
}
.db-grid td input:focus { background: var(--input-bg); }
.db-grid .row-del { opacity: 0; }
.db-grid tr:hover .row-del { opacity: 1; }

/* ── Login ─────────────────────────────────────────────── */
.login-wrap[hidden], .app-shell[hidden] { display: none !important; }

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 1.25rem;
  padding: 2rem;
  text-align: center;
}

/* ── Public cards ──────────────────────────────────────── */
.pub-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 3px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 0.75rem;
  text-decoration: none;
  transition: border-color 0.15s;
}
.pub-card:hover { border-color: var(--accent); }
.pub-card h3 { margin-bottom: 0.3rem; }

/* locked public redactions — solid, not clickable */
.redacted--locked { cursor: default; }

/* attachments list */
.att-row { display: flex; align-items: center; gap: 0.6rem; padding: 0.4rem 0; font-size: 0.82rem; border-bottom: 1px solid var(--border); }

/* mobile */
@media (max-width: 800px) {
  .app-shell { grid-template-columns: 1fr; }
  .app-sidebar {
    position: static; height: auto; flex-direction: row; flex-wrap: wrap;
    border-right: none; border-bottom: 1px solid var(--border);
    align-items: center;
  }
  .app-sidebar .nav-brand { margin: 0 0.75rem 0 0; }
  .side-section { margin-top: 0; }
}
