/* =========================================================================
   Phase 12 — shared whiteboard
   ========================================================================= */

.wb-shell {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 0;
    height: calc(100vh - 64px);
    padding: 0 !important;
}

/* --- Board picker (left sidebar, same shape as the code-collab tree) --- */
.wb-tree {
    background: var(--color-bg-2, #f7f8fb);
    border-right: 1px solid var(--color-border, #e6e8ee);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}
.wb-tree__head { padding: 14px 16px 6px; border-bottom: 1px solid var(--color-border); }
.wb-tree__head h3 {
    margin: 6px 0 0; font-size: 14px;
    letter-spacing: 0.04em; text-transform: uppercase;
    color: var(--color-fg-subtle);
}
.wb-tree__new {
    display: flex; gap: 6px; padding: 12px 16px;
    border-bottom: 1px solid var(--color-border);
}
.wb-tree__input {
    flex: 1; border: 1px solid var(--color-border); border-radius: 6px;
    padding: 6px 10px; font-size: 13px;
}
.wb-tree__list { list-style: none; padding: 8px 0; margin: 0; flex: 1; overflow-y: auto; }
.wb-tree__item a {
    display: flex; flex-direction: column; gap: 2px;
    padding: 10px 16px;
    text-decoration: none; color: var(--color-fg); font-size: 13px;
    overflow: hidden;
}
.wb-tree__item a:hover { background: rgba(255, 198, 39, 0.12); }
.wb-tree__item--active a {
    background: rgba(255, 198, 39, 0.25); font-weight: 600;
}
.wb-tree__title {
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.wb-tree__sub { font-size: 11px; }
.wb-tree__empty { padding: 16px; color: var(--color-fg-subtle); font-size: 13px; text-align: center; }

/* --- Canvas pane --- */
.wb-pane {
    display: flex; flex-direction: column;
    background: #2b2b2b;
    overflow: hidden;
}
.wb-pane__head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 16px; background: #1e1e1e; color: #d4d4d4;
    border-bottom: 1px solid #1e1e1e; flex-shrink: 0;
}
.wb-pane__name { font-weight: 700; font-size: 15px; }
.wb-pane__actions { display: flex; gap: 10px; align-items: center; }
.wb-pane__actions form { margin: 0; }
.wb-pane__presence,
.wb-pane__save { font-size: 12px; color: #999; }

.wb-pane__empty {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    color: #888; background: #1e1e1e; padding: 48px; text-align: center;
}
.wb-pane__icon { font-size: 48px; margin-bottom: 12px; }
.wb-pane__empty h2 { color: #d4d4d4; margin: 8px 0; }

/* --- Toolbar --- */
.wb-toolbar {
    display: flex; gap: 6px; align-items: center;
    padding: 8px 14px; background: #1e1e1e;
    border-bottom: 1px solid #2b2b2b;
    flex-shrink: 0;
}
.wb-tool {
    background: #2b2b2b; color: #d4d4d4;
    border: 1px solid #444; border-radius: 6px;
    padding: 6px 10px; font-size: 14px;
    cursor: pointer;
    transition: background 0.1s;
}
.wb-tool:hover { background: #3a3a3a; }
.wb-tool--active {
    background: rgba(255, 198, 39, 0.25);
    border-color: #FFC627; color: #fff;
}
.wb-tool--danger { color: #ef9b9b; border-color: #5a2a2a; }
.wb-tool--danger:hover { background: #4a1f1f; }
.wb-toolbar__sep { width: 1px; height: 24px; background: #444; margin: 0 4px; }
.wb-toolbar__color input[type="color"] {
    width: 32px; height: 28px; padding: 0; border: 1px solid #444; border-radius: 4px;
    background: transparent;
}
.wb-toolbar__width input[type="range"] {
    width: 100px; vertical-align: middle;
}

/* --- Canvas + cursors overlay --- */
.wb-canvas-wrap {
    flex: 1; position: relative;
    background: #1a1a1a;
    display: flex; align-items: center; justify-content: center;
    padding: 16px;
    min-height: 0;
}
.wb-canvas {
    background: #fff;
    max-width: 100%; max-height: 100%;
    width: 100%; height: auto;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
    touch-action: none;
    cursor: crosshair;
}
.wb-cursors {
    position: absolute;
    /* Match the canvas wrap padding so cursor offsets land correctly. */
    top: 16px; left: 16px; right: 16px; bottom: 16px;
    pointer-events: none;
}
.wb-cursor {
    position: absolute;
    transform: translate(-2px, -2px);
}
.wb-cursor__arrow {
    display: block; width: 12px; height: 12px;
    border-left: 2px solid; border-top: 2px solid;
    border-color: inherit;
}
.wb-cursor__label {
    display: inline-block;
    color: #fff; font-size: 11px;
    padding: 1px 5px; border-radius: 3px;
    margin-top: 2px; white-space: nowrap;
}

/* --- Mobile fallback --- */
@media (max-width: 720px) {
    .wb-shell { grid-template-columns: 1fr; grid-template-rows: auto 1fr; height: auto; }
    .wb-tree { max-height: 200px; border-right: none; border-bottom: 1px solid var(--color-border); }
    .wb-toolbar { flex-wrap: wrap; }
    .wb-canvas { min-height: 50vh; }
}
