/* ═══════════════════════════════════════════════════════════════════════════
   whiteboard.css - Collaborative Notes/Whiteboard tab
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Layout ──────────────────────────────────────────────────────────────── */
#notes-view {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  position: relative;
}

.wb-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
  height: 100%;
}

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.wb-sidebar {
  width: 220px;
  min-width: 220px;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width .2s, min-width .2s;
}
.wb-sidebar.collapsed {
  width: 0;
  min-width: 0;
  border-right: none;
}

.wb-sidebar-hdr {
  padding: 12px 12px 10px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.wb-sidebar-hdr span {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--text4);
}
.wb-new-board-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 5px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 0 var(--accent2);
  transition: background .12s, box-shadow .1s, transform .08s;
}
.wb-new-board-btn:hover  { background: var(--accent2); }
.wb-new-board-btn:active { box-shadow: none; transform: translateY(1px); }

.wb-board-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0;
}
.wb-board-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: background .1s, border-color .1s;
  position: relative;
}
.wb-board-item:hover { background: var(--border2); }
.wb-board-item.active {
  background: rgba(14,165,233,.08);
  border-left-color: var(--accent);
}
.wb-board-icon { font-size: 12px; flex-shrink: 0; opacity: .6; }
.wb-board-name {
  flex: 1;
  font-size: 12px;
  font-weight: 500;
  color: var(--text2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wb-board-item.active .wb-board-name { color: var(--accent); }
.wb-board-del {
  opacity: 0;
  background: none;
  border: none;
  color: var(--text4);
  cursor: pointer;
  font-size: 14px;
  padding: 0 2px;
  line-height: 1;
  transition: opacity .1s, color .1s;
  flex-shrink: 0;
}
.wb-board-item:hover .wb-board-del { opacity: 1; }
.wb-board-del:hover { color: #ef4444; }
.wb-board-live-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--live);
  flex-shrink: 0;
}

/* ── Main area ───────────────────────────────────────────────────────────── */
.wb-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg3);
}

/* ── Toolbar ─────────────────────────────────────────────────────────────── */
.wb-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  flex-wrap: wrap;
  min-height: 46px;
}

.wb-toolbar-left  { display: flex; align-items: center; gap: 6px; }
.wb-toolbar-center {
  flex: 1;
  display: flex;
  justify-content: center;
  min-width: 120px;
}
.wb-toolbar-right { display: flex; align-items: center; gap: 6px; margin-left: auto; }

/* Sidebar toggle */
.wb-sidebar-toggle {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 5px;
  box-shadow: 0 2px 0 rgba(0,0,0,.4);
  color: var(--text3);
  cursor: pointer;
  font-size: 14px;
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  transition: color .12s, background .12s, border-color .12s;
  flex-shrink: 0;
}
.wb-sidebar-toggle:hover  { color: var(--text); background: var(--bg2); border-color: var(--text4); }
.wb-sidebar-toggle:active { box-shadow: none; transform: translateY(1px); }

/* Tool buttons */
.wb-tool-btn {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 5px;
  box-shadow: 0 2px 0 rgba(0,0,0,.4);
  color: var(--text3);
  cursor: pointer;
  font-size: 13px;
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  transition: color .12s, background .12s, border-color .12s, box-shadow .1s, transform .08s;
  flex-shrink: 0;
}
.wb-tool-btn:hover  { color: var(--text); background: var(--bg2); border-color: var(--text4); }
.wb-tool-btn:active { box-shadow: none; transform: translateY(1px); }
.wb-tool-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 2px 0 var(--accent2);
}

/* Color swatches */
.wb-palette {
  display: flex;
  align-items: center;
  gap: 4px;
}
.wb-swatch {
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform .1s, border-color .1s;
  flex-shrink: 0;
}
.wb-swatch:hover   { transform: scale(1.2); }
.wb-swatch.active  { border-color: var(--text); transform: scale(1.15); }

/* Width control */
.wb-width-wrap {
  display: flex;
  align-items: center;
  gap: 5px;
}
.wb-width-preview {
  width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.wb-width-dot {
  border-radius: 50%;
  background: var(--text3);
  transition: width .1s, height .1s;
}
.wb-width-slider {
  width: 70px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* Board title */
.wb-board-title-input {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 5px;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  padding: 3px 8px;
  text-align: center;
  min-width: 100px;
  max-width: 260px;
  width: auto;
  transition: border-color .15s, background .15s;
  outline: none;
}
.wb-board-title-input:hover  { border-color: var(--border); background: var(--bg3); }
.wb-board-title-input:focus  { border-color: var(--accent); background: var(--bg3); }
.wb-board-title-input::placeholder { color: var(--text4); }

/* Action buttons */
.wb-action-btn {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 5px;
  box-shadow: 0 2px 0 rgba(0,0,0,.4);
  color: var(--text3);
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  white-space: nowrap;
  transition: color .12s, background .12s, border-color .12s, box-shadow .1s, transform .08s;
}
.wb-action-btn:hover  { color: var(--text); background: var(--bg2); border-color: var(--text4); }
.wb-action-btn:active { box-shadow: none; transform: translateY(1px); }
.wb-action-btn.danger:hover { color: #f87171; border-color: #ef4444; }

/* User presence avatars */
.wb-users-bar {
  display: flex;
  align-items: center;
  gap: 3px;
}
.wb-user-avatar {
  width: 24px; height: 24px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 9px;
  font-weight: 700;
  color: #fff;
  border: 2px solid var(--bg2);
  position: relative;
  cursor: default;
  flex-shrink: 0;
  transition: transform .1s;
}
.wb-user-avatar:hover { transform: scale(1.15); z-index: 1; }
.wb-user-avatar[title] { cursor: help; }

/* ── Canvas area ─────────────────────────────────────────────────────────── */
.wb-canvas-wrap {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: #f8fafc; /* canvas background is always light */
}
body.theme-light .wb-canvas-wrap { background: #e8ecf0; }

.wb-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  background: #ffffff;
}
.wb-canvas.tool-eraser { cursor: cell; }

/* Cursor label overlays (DOM labels over canvas) */
.wb-cursor-labels {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.wb-cursor-label {
  position: absolute;
  font-size: 10px;
  font-weight: 600;
  color: #fff;
  background: var(--lc, #3b82f6);
  border-radius: 3px;
  padding: 1px 5px;
  white-space: nowrap;
  transform: translate(10px, -100%);
  pointer-events: none;
}

/* ── Empty state (no board selected) ────────────────────────────────────── */
.wb-empty-state {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  height: 100%;
  color: var(--text3);
  font-size: 14px;
}
.wb-empty-state svg { opacity: .3; }
.wb-empty-state p { margin: 0; text-align: center; }

/* ── Connection status banner ────────────────────────────────────────────── */
.wb-status-banner {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 5px 14px;
  font-size: 11px;
  color: var(--text3);
  pointer-events: none;
  opacity: 0;
  transition: opacity .3s;
  white-space: nowrap;
  z-index: 10;
}
.wb-status-banner.visible { opacity: 1; }

/* ── Board capacity warning ──────────────────────────────────────────────── */
.wb-full-warning {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(245,158,11,.12);
  border-bottom: 1px solid rgba(245,158,11,.3);
  color: #f59e0b;
  font-size: 11px;
  flex-shrink: 0;
}
.wb-full-warning.visible { display: flex; }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .wb-sidebar { display: none; }
  .wb-sidebar.mobile-open {
    display: flex;
    position: absolute;
    left: 0; top: 0; bottom: 0;
    z-index: 200;
    box-shadow: 4px 0 20px rgba(0,0,0,.5);
  }
  .wb-width-slider { width: 50px; }
  .wb-board-title-input { max-width: 120px; }
  .wb-toolbar-center { min-width: 80px; }
}
