/* ==========================================================================
   Quarto Book Whiteboard Overlay Styles - Optimized High-Performance
   ========================================================================== */

/* Fixed Viewport Canvas Overlay (Hardware Accelerated, Zero-lag) */
#whiteboard-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 9990;
  touch-action: none;
  /* Force GPU composite layer */
  transform: translateZ(0);
  backface-visibility: hidden;
}

#whiteboard-canvas.drawing-active {
  pointer-events: auto;
  cursor: crosshair;
}

/* Floating Action Button (FAB) */
#btn-toggle-whiteboard-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #0969da;
  color: #ffffff;
  border: none;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  cursor: pointer;
  z-index: 10000;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.2s, box-shadow 0.2s;
  user-select: none;
}

#btn-toggle-whiteboard-fab:hover {
  transform: scale(1.1);
  background: #0858b8;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
}

#btn-toggle-whiteboard-fab.active {
  background: #cf222e;
  box-shadow: 0 0 0 3px rgba(207, 34, 46, 0.35), 0 4px 14px rgba(0, 0, 0, 0.25);
}

/* Floating Whiteboard Dock (Bottom Center) */
#whiteboard-palette {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(0);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 14px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.18), 0 2px 8px rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  z-index: 10010;
  user-select: none;
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1), transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.25s;
}

#whiteboard-palette.hidden {
  opacity: 0;
  visibility: hidden;
  transform: translateX(-50%) translateY(20px);
  pointer-events: none;
}

/* Dock Groups */
.wb-dock-group,
.wb-dock-colors,
.wb-dock-actions {
  display: flex;
  align-items: center;
  gap: 5px;
}

/* Tool Buttons */
.wb-btn-tool {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 500;
  color: #24292f;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s ease;
  line-height: 1.2;
}

.wb-btn-tool:hover {
  background: rgba(0, 0, 0, 0.06);
}

.wb-btn-tool.active {
  background: #0969da;
  color: #ffffff;
  border-color: #0969da;
}

.wb-tool-icon {
  font-size: 14px;
}

/* Divider */
.wb-dock-divider {
  width: 1px;
  height: 22px;
  background: rgba(0, 0, 0, 0.12);
  margin: 0 4px;
}

/* Color Picker Buttons */
.wb-btn-color {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid #ffffff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  padding: 0;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.wb-btn-color:hover {
  transform: scale(1.15);
}

.wb-btn-color.active {
  transform: scale(1.25);
  box-shadow: 0 0 0 2px #0969da, 0 2px 6px rgba(0, 0, 0, 0.25);
}

/* Action Buttons (Undo, Clear, Export, Done) */
.wb-dock-btn-icon {
  background: transparent;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 8px;
  padding: 6px 9px;
  font-size: 13px;
  cursor: pointer;
  color: #24292f;
  transition: all 0.15s ease;
}

.wb-dock-btn-icon:hover {
  background: rgba(0, 0, 0, 0.06);
  border-color: rgba(0, 0, 0, 0.18);
}

.wb-dock-btn-close {
  background: #24292f;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease;
}

.wb-dock-btn-close:hover {
  background: #000000;
}

/* Fixed Viewport Indicators (Zero Lag) */
#wb-eraser-cursor {
  position: fixed;
  width: 28px;
  height: 28px;
  border: 2px dashed rgba(207, 34, 46, 0.85);
  border-radius: 50%;
  background: rgba(207, 34, 46, 0.12);
  pointer-events: none;
  transform: translate(-50%, -50%);
  z-index: 10020;
  display: none;
  will-change: left, top;
}

#wb-laser-cursor {
  position: fixed;
  width: 14px;
  height: 14px;
  background: radial-gradient(circle, #ff0055 35%, rgba(255, 0, 85, 0) 75%);
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%);
  z-index: 10020;
  display: none;
  box-shadow: 0 0 12px #ff0055, 0 0 24px #ff3366;
  will-change: left, top;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  #whiteboard-palette {
    bottom: 12px;
    padding: 6px 10px;
    gap: 4px;
    max-width: 95vw;
    overflow-x: auto;
  }
  .wb-btn-tool span.tool-label {
    display: none;
  }
}

/* ==========================================================================
   Custom Confirmation Modal (Replaces native browser window.confirm)
   ========================================================================== */
.wb-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10050;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.2s;
  user-select: none;
}

.wb-modal-backdrop.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.wb-modal-box {
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.22), 0 2px 10px rgba(0, 0, 0, 0.08);
  width: 90%;
  max-width: 380px;
  padding: 22px 24px 20px;
  text-align: left;
  border: 1px solid rgba(0, 0, 0, 0.08);
  color: #24292f;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  transform: scale(1);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.wb-modal-backdrop.hidden .wb-modal-box {
  transform: scale(0.94);
}

.wb-modal-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.wb-modal-icon {
  font-size: 22px;
}

.wb-modal-title {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
  color: #24292f;
}

.wb-modal-body {
  font-size: 14px;
  line-height: 1.5;
  color: #57606a;
  margin: 0 0 20px 0;
}

.wb-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.wb-modal-btn {
  padding: 7px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  font-family: inherit;
}

.wb-btn-cancel {
  background: #f6f8fa;
  color: #24292f;
  border-color: rgba(0, 0, 0, 0.12);
}

.wb-btn-cancel:hover {
  background: #eaeef2;
}

.wb-btn-danger {
  background: #cf222e;
  color: #ffffff;
}

.wb-btn-danger:hover {
  background: #b61c27;
}

