/* =========================================================
   WHITEBOARD - Floating panel + pop-out page
   ========================================================= */

/* ── FAB toggle button ──────────────────────────────────── */
.wb-fab {
  position: fixed;
  bottom: 1.75rem;
  right: 1.75rem;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-gradient-primary-start, #667eea), var(--color-gradient-primary-end, #764ba2));
  color: #fff;
  border: none;
  cursor: pointer;
  z-index: 8990;
  box-shadow: 0 4px 20px rgba(0,0,0,.28), 0 2px 8px rgba(0,0,0,.14);
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .2s ease, box-shadow .2s ease, opacity .2s ease;
}
.wb-fab:hover  { transform: scale(1.12); box-shadow: 0 8px 32px rgba(0,0,0,.32); }
.wb-fab:active { transform: scale(0.96); }
.wb-fab[hidden] { display: none; }

/* ── Floating panel ─────────────────────────────────────── */
.wb-panel {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 55vh;
  min-height: 320px;
  max-height: 92vh;
  background: var(--color-card-background, #fff);
  border-top: 2px solid var(--color-border, #e5e7eb);
  box-shadow: 0 -6px 40px rgba(0,0,0,.14);
  z-index: 8980;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform .3s cubic-bezier(.4,0,.2,1);
}
.wb-panel.wb-open { transform: translateY(0); }

/* Drag-to-resize handle */
.wb-handle {
  height: 11px;
  cursor: ns-resize;
  background: var(--color-background, #f9fafb);
  border-bottom: 1px solid var(--color-border, #e5e7eb);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  user-select: none;
}
.wb-handle::after {
  content: '';
  width: 38px;
  height: 3px;
  border-radius: 2px;
  background: var(--color-border, #d1d5db);
}

/* ── Toolbar ────────────────────────────────────────────── */
.wb-toolbar {
  display: flex;
  align-items: center;
  gap: .3rem;
  padding: .4rem .75rem;
  background: var(--color-background, #f9fafb);
  border-bottom: 1px solid var(--color-border, #e5e7eb);
  overflow-x: auto;
  flex-shrink: 0;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.wb-toolbar::-webkit-scrollbar { display: none; }

.wb-group {
  display: inline-flex;
  align-items: center;
  gap: .18rem;
  flex-shrink: 0;
}

.wb-sep {
  display: inline-block;
  width: 1px;
  height: 22px;
  background: var(--color-border, #e5e7eb);
  margin: 0 .25rem;
  flex-shrink: 0;
}

/* ── Toolbar buttons ────────────────────────────────────── */
.wb-btn {
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--color-text-medium, #4b5563);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .8rem;
  transition: background .12s, color .12s;
  flex-shrink: 0;
  position: relative;
}
.wb-btn:hover { background: var(--color-border, #e5e7eb); color: var(--color-text-dark, #111827); }
.wb-btn.wb-active {
  background: var(--color-primary, #5c6bc0);
  color: #fff;
}
.wb-btn.wb-danger:hover { background: rgba(239,68,68,.1); color: #ef4444; }

/* Size indicator dots */
.wb-dot {
  display: block;
  border-radius: 50%;
  background: currentColor;
  transition: transform .12s;
}
.wb-btn:hover .wb-dot { transform: scale(1.25); }

/* ── Colour swatches ────────────────────────────────────── */
.wb-swatch {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2.5px solid transparent;
  cursor: pointer;
  transition: transform .12s, border-color .12s;
  flex-shrink: 0;
  outline: none;
}
.wb-swatch:hover { transform: scale(1.15); }
.wb-swatch.wb-active {
  border-color: var(--color-text-dark, #111827);
  transform: scale(1.2);
}

.wb-color-input {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--color-border, #e5e7eb);
  cursor: pointer;
  padding: 0;
  background: none;
  overflow: hidden;
  flex-shrink: 0;
}

/* ── Canvas area ────────────────────────────────────────── */
.wb-canvas-wrap {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: #fff;
  min-height: 0;
}
.wb-canvas-wrap canvas { display: block; }
/* Fabric.js wraps the canvas - ensure container fills properly */
.wb-canvas-wrap .canvas-container {
  width: 100% !important;
  height: 100% !important;
}

/* ── Pop-out standalone page ────────────────────────────── */
.wb-popup-page {
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  background: #f3f4f6;
  font-family: 'Inter', system-ui, sans-serif;
}
.wb-popup-page .wb-toolbar {
  border-top: none;
  border-bottom: 2px solid #e5e7eb;
  background: #f9fafb;
  padding: .55rem 1rem;
}
.wb-popup-page .wb-canvas-wrap { flex: 1; }

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 640px) {
  .wb-panel { height: 68vh; }
  .wb-fab   { bottom: 1rem; right: 1rem; width: 44px; height: 44px; font-size: 1rem; }
}
