/* ============================================================
   CallBrazi — Drawing / Whiteboard Overlay
   ============================================================ */

/* ── Drawing Canvas Overlay ──────────────────────────────── */
#draw-canvas-overlay {
  position: absolute;
  inset: 0;
  z-index: 30;
  pointer-events: none;  /* always non-interactive for video */
  opacity: 0;
  transition: opacity 0.25s ease;
}

/* Local user opened drawing mode — canvas is interactive + toolbar shown */
#draw-canvas-overlay.draw-active {
  opacity: 1;
  pointer-events: none; /* canvas handles its own events */
}

/* Remote partner is drawing — canvas shows, NO toolbar, NO interaction */
#draw-canvas-overlay.draw-remote-visible {
  opacity: 1;
  pointer-events: none;
}

/* The canvas itself captures pointer events only in draw-active state */
#draw-canvas-overlay.draw-active #draw-canvas {
  pointer-events: auto;
  cursor: crosshair;
}

#draw-canvas {
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
  touch-action: none;
}


/* ── Toolbar ─────────────────────────────────────────────── */
#draw-toolbar {
  position: absolute;
  top: 50%;
  right: 14px;
  transform: translateY(-50%);
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 5px;
  align-items: center;
  padding: 10px 7px;
  /* More transparent, smaller, glassy */
  background: rgba(8, 10, 28, 0.48);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border: 1px solid rgba(108, 99, 255, 0.18);
  border-radius: 18px;
  box-shadow:
    0 12px 36px rgba(0, 0, 0, 0.38),
    0 0 0 1px rgba(255, 255, 255, 0.04) inset;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.25, 1, 0.5, 1),
              transform 0.3s cubic-bezier(0.25, 1, 0.5, 1);
  transform: translateY(-50%) translateX(12px);
}

#draw-toolbar.toolbar-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(-50%) translateX(0);
}

/* ── Section labels ───────────────────────────────────────── */
.draw-separator {
  width: 26px;
  height: 1px;
  background: rgba(108, 99, 255, 0.2);
  margin: 2px 0;
}

.draw-section-label {
  font-size: 0.52rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(140, 146, 197, 0.55);
  text-align: center;
}

/* ── Tool Buttons ─────────────────────────────────────────── */
.draw-tool-btn {
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(240, 242, 255, 0.65);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  position: relative;
  flex-shrink: 0;
}

.draw-tool-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.draw-tool-btn:hover {
  background: rgba(108, 99, 255, 0.22);
  color: #fff;
  transform: scale(1.06);
}

.draw-tool-btn.tool-active {
  background: linear-gradient(135deg, rgba(108, 99, 255, 0.8), rgba(0, 212, 170, 0.65));
  color: #ffffff;
  box-shadow: 0 6px 18px rgba(108, 99, 255, 0.35);
}

/* Tooltip */
.draw-tool-btn::after {
  content: attr(data-tip);
  position: absolute;
  right: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  background: rgba(8, 12, 28, 0.94);
  border: 1px solid rgba(108, 99, 255, 0.3);
  color: #f0f2ff;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  padding: 5px 10px;
  border-radius: 8px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
  box-shadow: 0 8px 20px rgba(0,0,0,0.4);
}

.draw-tool-btn:hover::after {
  opacity: 1;
}

/* ── Color Swatches ───────────────────────────────────────── */
.draw-color-swatch {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.15);
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.draw-color-swatch:hover {
  transform: scale(1.15);
  border-color: rgba(255, 255, 255, 0.5);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35);
}

.draw-color-swatch.color-selected {
  border-color: #ffffff;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.28), 0 3px 10px rgba(0, 0, 0, 0.35);
  transform: scale(1.1);
}

/* Custom color input (hidden native, styled overlay) */
#draw-color-custom {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px dashed rgba(255, 255, 255, 0.35);
  background: conic-gradient(red, yellow, lime, cyan, blue, magenta, red);
  cursor: pointer;
  opacity: 0.8;
  transition: all 0.15s ease;
  padding: 0;
  outline: none;
  flex-shrink: 0;
  overflow: hidden;
  -webkit-appearance: none;
  appearance: none;
}

#draw-color-custom::-webkit-color-swatch-wrapper { padding: 0; }
#draw-color-custom::-webkit-color-swatch { border: none; border-radius: 50%; }
#draw-color-custom::-moz-color-swatch { border: none; border-radius: 50%; }

#draw-color-custom:hover {
  transform: scale(1.18);
  opacity: 1;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}

/* ── Brush Size ───────────────────────────────────────────── */
#draw-size-slider {
  width: 30px;
  height: 80px;
  -webkit-appearance: slider-vertical;
  appearance: slider-vertical;
  writing-mode: vertical-lr;
  direction: rtl;
  cursor: pointer;
  accent-color: #6c63ff;
  background: transparent;
}

/* Vertical fallback using rotate */
.draw-size-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.draw-size-preview {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.draw-size-dot {
  border-radius: 50%;
  transition: width 0.15s ease, height 0.15s ease;
}

/* Size range input — rotated */
#draw-size-range {
  -webkit-appearance: none;
  appearance: none;
  width: 64px;
  height: 3px;
  border-radius: 4px;
  background: linear-gradient(90deg, rgba(108,99,255,0.5), rgba(0,212,170,0.5));
  outline: none;
  cursor: pointer;
  transform: rotate(-90deg);
  margin: 16px 0;
}

#draw-size-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6c63ff, #00d4aa);
  cursor: pointer;
  box-shadow: 0 3px 8px rgba(108, 99, 255, 0.45);
  border: 2px solid rgba(255,255,255,0.3);
}

#draw-size-range::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6c63ff, #00d4aa);
  cursor: pointer;
  border: 2px solid rgba(255,255,255,0.3);
}

/* ── Undo / Clear Action Buttons ─────────────────────────── */
.draw-action-btn {
  width: 34px;
  height: 32px;
  border: none;
  border-radius: 8px;
  font-size: 0.54rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-family: inherit;
}

.draw-action-btn svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.draw-action-btn.btn-undo {
  background: rgba(59, 130, 246, 0.15);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.22);
}

.draw-action-btn.btn-undo:hover {
  background: rgba(59, 130, 246, 0.28);
  color: #bfdbfe;
  transform: translateY(-1px);
}

.draw-action-btn.btn-clear {
  background: rgba(239, 68, 68, 0.13);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.22);
}

.draw-action-btn.btn-clear:hover {
  background: rgba(239, 68, 68, 0.26);
  color: #fecaca;
  transform: translateY(-1px);
}

/* ── Opacity indicator ───────────────────────────────────── */
.draw-opacity-label {
  font-size: 0.58rem;
  color: rgba(140, 146, 197, 0.65);
  font-weight: 600;
  text-align: center;
}

/* ── Control bar "Desenhar" button active state ───────────── */
.control-btn#btn-draw.active {
  background: linear-gradient(180deg, rgba(108, 99, 255, 0.92), rgba(0, 212, 170, 0.8));
  color: #ffffff;
  box-shadow: 0 12px 30px rgba(108, 99, 255, 0.42), 0 0 0 1px rgba(255,255,255,0.18) inset;
}

/* ── Canvas cursor style when eraser active ──────────────── */
#draw-canvas.eraser-cursor {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28' viewBox='0 0 28 28'%3E%3Ccircle cx='14' cy='14' r='12' fill='rgba(255,255,255,0.18)' stroke='white' stroke-width='2'/%3E%3C/svg%3E") 14 14, cell;
}
