/* ================================================================
   THOMZY.com — Whiteboard (Paint-style)
   ================================================================ */

/* ---- Body container ------------------------------------------------ */
.wm-body-whiteboard {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #c0c0c0;
  padding: 0;
  gap: 0;
}

/* #whiteboard-app must be a flex column so the stage can flex: 1 */
#whiteboard-app {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* ---- Toolbar ------------------------------------------------------- */
.wb-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 5px;
  background: linear-gradient(to bottom, #d8d8d8 0%, #c0c0c0 100%);
  border-bottom: 2px solid #808080;
  box-shadow: inset 0 1px 0 #ffffff;
  flex-shrink: 0;
  flex-wrap: wrap;
  min-height: 36px;
  user-select: none;
}

.wb-vsep {
  width: 2px;
  align-self: stretch;
  background: #808080;
  box-shadow: 1px 0 0 #ffffff;
  margin: 2px 3px;
  flex-shrink: 0;
}

/* ---- Tool buttons -------------------------------------------------- */
.wb-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
}

.wb-tool-btn {
  width: 28px;
  height: 28px;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(to bottom, #e8e8e8 0%, #c8c8c8 100%);
  border: 2px solid;
  border-color: #ffffff #808080 #808080 #ffffff;
  cursor: pointer;
  line-height: 1;
  color: #000000;
  padding: 0;
}

.wb-tool-btn:hover {
  background: linear-gradient(to bottom, #f0f0f0 0%, #d8d8d8 100%);
}

.wb-tool-btn.active {
  background: linear-gradient(to bottom, #a8a8a8 0%, #c0c0c0 100%);
  border-color: #808080 #ffffff #ffffff #808080;
  box-shadow: inset 1px 1px 2px rgba(0, 0, 0, 0.25);
  color: #000080;
}

/* Diagonal line icon */
.wb-icon-line {
  display: inline-block;
  transform: rotate(-45deg);
}

/* ---- Color section ------------------------------------------------- */
.wb-color-section {
  display: flex;
  align-items: center;
  gap: 4px;
}

.wb-cur-color {
  width: 24px;
  height: 24px;
  border: 2px solid;
  border-color: #808080 #ffffff #ffffff #808080;
  flex-shrink: 0;
  cursor: pointer;
}

.wb-palette {
  display: grid;
  grid-template-columns: repeat(16, 13px);
  gap: 1px;
}

.wb-swatch {
  width: 13px;
  height: 13px;
  border: 1px solid #404040;
  cursor: pointer;
  flex-shrink: 0;
}

.wb-swatch:hover {
  outline: 1px solid #000000;
  outline-offset: 1px;
  z-index: 1;
  position: relative;
}

.wb-color-picker {
  width: 24px;
  height: 24px;
  border: 1px solid #808080;
  padding: 0;
  cursor: pointer;
  background: none;
  flex-shrink: 0;
}

/* ---- Size section -------------------------------------------------- */
.wb-size-section {
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: Tahoma, Verdana, sans-serif;
  font-size: 11px;
  color: #000000;
  white-space: nowrap;
}

.wb-size-lbl {
  min-width: 20px;
  text-align: right;
  font-weight: bold;
}

.wb-size-range {
  width: 70px;
  accent-color: #000080;
}

/* ---- Actions ------------------------------------------------------- */
.wb-actions {
  display: flex;
  gap: 4px;
}

/* ---- Canvas stage -------------------------------------------------- */
.wb-stage {
  /* Always square: width fills 100%, height = width */
  width: 100%;
  aspect-ratio: 1 / 1;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
  background: #ffffff;
  border: 2px solid;
  border-color: #808080 #ffffff #ffffff #808080;
  box-shadow: inset 1px 1px 0 #404040;
}

.wb-canvas,
.wb-live,
.wb-preview {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
}

.wb-live {
  pointer-events: none; /* transparent pass-through layer */
}

.wb-preview {
  cursor: crosshair;
}

/* ---- Text options bar (appears below toolbar when text tool active) */
.wb-text-options {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  background: linear-gradient(to bottom, #ccd8ec 0%, #b4c4dc 100%);
  border-bottom: 2px solid #808080;
  box-shadow: inset 0 1px 0 #ddeeff;
  flex-shrink: 0;
  flex-wrap: nowrap;
  white-space: nowrap;
  user-select: none;
  min-height: 28px;
}
.wb-text-options[hidden] { display: none; }

.wb-text-opt-icon {
  font-size: 12px;
  color: #404060;
  opacity: .8;
  margin-right: 2px;
}

.wb-text-font-sel {
  height: 22px;
  font-size: 11px;
  border: 1px solid #808080;
  background: #ffffff;
  max-width: 130px;
  padding: 0 2px;
  cursor: pointer;
}

.wb-text-size-inp {
  width: 46px;
  height: 22px;
  font-size: 11px;
  border: 1px solid #808080;
  background: #ffffff;
  text-align: center;
  padding: 0 2px;
}

.wb-text-fmt-btn {
  width: 22px;
  height: 22px;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid;
  border-color: #ffffff #808080 #808080 #ffffff;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  background: linear-gradient(to bottom, #e8e8e8 0%, #c8c8c8 100%);
  color: #000000;
}
.wb-text-fmt-btn:hover {
  background: linear-gradient(to bottom, #f0f0f0 0%, #d8d8d8 100%);
}
.wb-text-fmt-btn.active {
  background: linear-gradient(to bottom, #a8a8a8 0%, #c0c0c0 100%);
  border-color: #808080 #ffffff #ffffff #808080;
  box-shadow: inset 1px 1px 2px rgba(0,0,0,.25);
  color: #000080;
}

.wb-text-hint {
  font-size: 10px;
  color: #303060;
  font-family: Tahoma, Verdana, sans-serif;
  opacity: .85;
  margin-left: 4px;
  white-space: nowrap;
}

/* ---- Drag handle (XP-style title bar above the text cursor) ------- */
.wb-text-drag-handle {
  position: absolute;
  z-index: 31;
  height: 18px;
  min-width: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  gap: 4px;
  background: linear-gradient(to bottom, #0a246a 0%, #3c6ea8 100%);
  color: #ffffff;
  font-size: 10px;
  cursor: move;
  border: 1px solid #000050;
  user-select: none;
  white-space: nowrap;
  font-family: Tahoma, Verdana, sans-serif;
  box-shadow: 1px 1px 3px rgba(0,0,0,.5);
}
.wb-text-drag-handle:hover {
  background: linear-gradient(to bottom, #1530a0 0%, #5090d0 100%);
}

/* ---- Text cursor (contenteditable div placed at click point) ------- */
.wb-text-cursor {
  position: absolute;
  z-index: 30;
  outline: none;
  background: rgba(255, 255, 255, 0.15);
  border: 1px dashed rgba(0, 0, 128, 0.7);
  min-width: 4px;
  white-space: pre;
  word-break: keep-all;
  padding: 0;
  margin: 0;
  cursor: text;
  box-sizing: border-box;
}
