/* ═══════════════════════════════════════════════════════════════════════
 * DocStreamEditor.css — Styles for collaborative document editor
 * ═══════════════════════════════════════════════════════════════════════ */

/* ── Overlay ── */
.ds-editor-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 12000;
}

.ds-editor-container {
  background: #fff; border-radius: 12px;
  width: 95vw; max-width: 1100px; height: 90vh;
  display: flex; flex-direction: column;
  box-shadow: 0 25px 80px rgba(0,0,0,.4);
}

/* ── Header ── */
.ds-editor-header {
  display: flex; align-items: center; gap: 1rem;
  padding: .75rem 1rem; border-bottom: 1px solid #e5e7eb;
}

.ds-editor-title {
  font-size: 1rem; font-weight: 600; color: #111;
  display: flex; align-items: center; gap: .5rem;
}

.ds-editor-users {
  margin-left: auto; display: flex; align-items: center; gap: .25rem;
}

.ds-user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .7rem; font-weight: 700; color: #fff;
  border: 2px solid #fff;
  margin-left: -8px;
  box-shadow: 0 1px 3px rgba(0,0,0,.15);
}

.ds-user-avatar:first-child { margin-left: 0; }

.ds-connection-status {
  display: flex; align-items: center; gap: .25rem;
  font-size: .7rem; color: #6b7280; margin-left: .5rem;
}

.ds-status-dot {
  width: 8px; height: 8px; border-radius: 50%;
}

.ds-status-dot.connected { background: #10b981; }
.ds-status-dot.disconnected { background: #ef4444; }

.ds-close-btn {
  background: none; border: none; font-size: 1.25rem; cursor: pointer;
  color: #6b7280; padding: .25rem .5rem;
}

.ds-close-btn:hover { color: #111; }

/* ── Toolbar ── */
.ds-toolbar {
  display: flex; align-items: center; gap: .25rem;
  padding: .5rem 1rem; border-bottom: 1px solid #e5e7eb;
  flex-wrap: wrap;
}

.ds-toolbar-btn {
  display: inline-flex; align-items: center; gap: .25rem;
  padding: .375rem .75rem; border-radius: 6px; font-size: .8rem;
  font-weight: 500; cursor: pointer; border: 1px solid transparent;
  background: transparent; color: #374151;
  transition: all .15s;
}

.ds-toolbar-btn:hover { background: #f3f4f6; }
.ds-toolbar-btn.active { background: #dbeafe; color: #1e40af; border-color: #bfdbfe; }
.ds-toolbar-btn.disabled { opacity: .4; cursor: not-allowed; }

.ds-toolbar-sep {
  width: 1px; height: 24px; background: #e5e7eb;
  margin: 0 .25rem;
}

/* ── Editor body ── */
.ds-editor-body {
  flex: 1; overflow: auto; padding: 2rem;
  background: #f9fafb;
}

.ds-editable {
  max-width: 800px; min-height: 600px;
  margin: 0 auto; padding: 3rem;
  background: #fff; border: 1px solid #d1d5db;
  border-radius: 8px; outline: none;
  font-size: 1rem; line-height: 1.75;
  color: #111; box-shadow: 0 1px 3px rgba(0,0,0,.05);
}

.ds-editable:focus { border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59,130,246,.1); }

.ds-editable img { max-width: 100%; height: auto; border-radius: 4px; }

.ds-editable table {
  border-collapse: collapse; width: 100%; margin: 1rem 0;
}

.ds-editable td, .ds-editable th {
  border: 1px solid #d1d5db; padding: 8px 12px;
}

/* ── Remote cursors ── */
.ds-remote-cursor {
  position: absolute; width: 2px; height: 20px;
  pointer-events: none; z-index: 10;
}

.ds-cursor-label {
  position: absolute; top: -22px; left: 0;
  padding: 2px 6px; border-radius: 3px;
  font-size: .65rem; font-weight: 600; color: #fff;
  white-space: nowrap;
}

/* ── Dialogs ── */
.ds-dialog-overlay {
  position: absolute; inset: 0; background: rgba(0,0,0,.4);
  display: flex; align-items: center; justify-content: center;
  z-index: 13000;
}

.ds-dialog {
  background: #fff; border-radius: 12px; padding: 1.5rem;
  min-width: 400px; box-shadow: 0 20px 60px rgba(0,0,0,.3);
}

.ds-dialog h4 { margin: 0 0 1rem; font-size: 1rem; font-weight: 600; }

.ds-dialog-field { margin-bottom: 1rem; }
.ds-dialog-field label { display: block; font-size: .75rem; font-weight: 500; margin-bottom: .25rem; }
.ds-dialog-field input {
  width: 100%; padding: .5rem .75rem; border: 1px solid #d1d5db;
  border-radius: 6px; font-size: .875rem;
}

.ds-dialog-actions { display: flex; gap: .5rem; justify-content: flex-end; }

.ds-dialog-info { font-size: .75rem; color: #6b7280; margin: .5rem 0; }

/* ── Table grid ── */
.ds-table-grid {
  display: flex; flex-direction: column; gap: 2px;
  margin: 1rem 0;
}

.ds-table-row { display: flex; gap: 2px; }

.ds-table-cell {
  width: 24px; height: 24px; border: 2px solid #d1d5db;
  border-radius: 3px; cursor: pointer; transition: all .1s;
}

.ds-table-cell.selected { background: #3b82f6; border-color: #1e40af; }

.ds-table-cell:hover { background: #dbeafe; }

/* ── Footer ── */
.ds-editor-footer {
  display: flex; justify-content: space-between; align-items: center;
  padding: .5rem 1rem; border-top: 1px solid #e5e7eb;
  font-size: .7rem; color: #6b7280;
}

.ds-footer-info { display: inline-flex; align-items: center; gap: .25rem; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .ds-editor-container { width: 100vw; height: 100vh; border-radius: 0; }
  .ds-editor-body { padding: 1rem; }
  .ds-editable { padding: 1.5rem; }
}