/* ============================================
   Multiuser Journal Demo — Design System
   Strict black & white. Inter + monospace.
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* --- Tokens --- */
:root {
  --bg:         #000000;
  --surface:    #111111;
  --border:     #333333;
  --text:       #ffffff;
  --text-muted: #888888;
  --text-dim:   #555555;
  --accent:     #ffffff;
  --danger:     #ffffff;
  --font-sans:  'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono:  'Courier New', monospace;
  --radius:     6px;
  --transition: 0.15s ease;
}

/* --- Reset --- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* --- Layout --- */
.app {
  display: grid;
  grid-template-columns: 280px 1fr 300px;
  height: 100vh;
  overflow: hidden;
}

.panel {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 24px 20px;
}

.panel:last-child {
  border-right: none;
}

/* --- Typography --- */
.app-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.3px;
  margin-bottom: 20px;
}

.section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

/* --- Controls --- */
.control-group {
  margin-bottom: 20px;
}

.control-group label {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

select {
  width: 100%;
  padding: 8px 12px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: 13px;
  cursor: pointer;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23888' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  transition: border-color var(--transition);
}

select:hover, select:focus {
  border-color: var(--text-muted);
}

/* --- Mode Badge --- */
.mode-badge {
  display: inline-block;
  padding: 4px 14px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--accent);
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  font-family: var(--font-mono);
}

/* --- Note List --- */
.note-list {
  flex: 1;
  overflow-y: auto;
  margin-top: 8px;
}

.note-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  margin-bottom: 2px;
}

.note-item:hover {
  background: var(--surface);
  border-color: var(--border);
}

.note-item.active {
  background: var(--surface);
  border-color: var(--text-muted);
}

.note-item-content {
  flex: 1;
  min-width: 0;
}

.note-item-title {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.note-item-date {
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  margin-top: 2px;
}

.note-item .delete-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px 6px;
  font-size: 14px;
  line-height: 1;
  opacity: 0;
  transition: opacity var(--transition), color var(--transition);
}

.note-item:hover .delete-btn {
  opacity: 1;
}

.note-item .delete-btn:hover {
  color: var(--text);
}

/* --- Editor --- */
.editor {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.editor input,
.editor textarea {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: 14px;
  outline: none;
  transition: border-color var(--transition);
}

.editor input:focus,
.editor textarea:focus {
  border-color: var(--text-muted);
}

.editor input::placeholder,
.editor textarea::placeholder {
  color: var(--text-dim);
}

.editor textarea {
  flex: 1;
  min-height: 200px;
  resize: vertical;
  line-height: 1.6;
}

/* --- Buttons --- */
.btn {
  padding: 10px 20px;
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  letter-spacing: 0.3px;
}

.btn-primary {
  background: var(--accent);
  color: var(--bg);
  border: 1px solid var(--accent);
}

.btn-primary:hover {
  background: transparent;
  color: var(--text);
}

.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-outline:hover {
  border-color: var(--text-muted);
}

.btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.btn:disabled:hover {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}

.editor-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

/* --- Latency Feedback --- */
.latency-feedback {
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  min-height: 18px;
}

/* --- Sync Section --- */
.sync-section {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.sync-info {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-dim);
  margin-top: 8px;
  min-height: 16px;
}

/* --- Dashboard --- */
.stat-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  transition: border-color var(--transition);
}

.stat-card:hover {
  border-color: var(--text-dim);
}

.stat-card-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.stat-card-value {
  font-size: 22px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text);
  letter-spacing: -0.5px;
}

.stat-card-unit {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
}

/* --- Operation Log --- */
.op-log {
  flex: 1;
  overflow-y: auto;
}

.op-log-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 6px 0;
  border-bottom: 1px solid rgba(51, 51, 51, 0.5);
  font-size: 12px;
  font-family: var(--font-mono);
}

.op-log-type {
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
  min-width: 50px;
}

.op-log-desc {
  flex: 1;
  color: var(--text-dim);
  margin: 0 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.op-log-latency {
  color: var(--text);
  white-space: nowrap;
  font-weight: 500;
}

.op-log-latency.high {
  color: var(--text-muted);
}

/* --- Empty States --- */
.empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  color: var(--text-dim);
  font-size: 13px;
  font-style: italic;
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
  width: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-dim);
}

/* --- Responsive --- */
@media (max-width: 900px) {
  .app {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr auto;
    height: auto;
    min-height: 100vh;
  }

  .panel {
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: none;
    overflow: visible;
  }

  .panel:last-child {
    border-bottom: none;
  }

  .note-list {
    max-height: 200px;
    overflow-y: auto;
  }
}
