/* Aviveil Boards - Infinite Moodboard Styling */

/* Board Gallery */
.boards-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.boards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.board-card {
  padding: 0;
  overflow: hidden;
  transition: transform 0.15s ease, border-color 0.15s ease;
  background: var(--p);
  border: 1px solid var(--ln);
  border-radius: 12px;
}

.board-card:hover {
  transform: translateY(-2px);
  border-color: var(--a);
}

.board-thumbnail-wrap {
  width: 100%;
  height: 140px;
  background: #0b0b0c;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--ln);
  position: relative;
  overflow: hidden;
}

.board-thumb-img {
  width: 100%;
  height: 140px;
  object-fit: cover;
}

.board-thumb-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #4a4e5a;
}

.board-thumb-label {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #33363f;
  user-select: none;
}

/* Fullscreen Canvas */
.board-fullscreen-view {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  z-index: 1000;
  background-color: #0b0b0c;
  background-image: radial-gradient(#2a2a2e 1.5px, transparent 1.5px);
  background-size: 24px 24px;
  overflow: hidden;
  user-select: none;
}

.board-canvas-header {
  position: absolute;
  top: max(48px, calc(env(safe-area-inset-top, 0px) + 12px));
  left: max(14px, calc(env(safe-area-inset-left, 0px) + 14px));
  right: max(14px, calc(env(safe-area-inset-right, 0px) + 14px));
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 1010;
  pointer-events: none;
  gap: 8px;
}

.board-canvas-header > * {
  pointer-events: auto;
}

.board-name-editable {
  font-size: 15px;
  font-weight: 500;
  color: #e6e4ea;
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(30, 32, 37, 0.85);
  border: 1px solid var(--ln);
  outline: none;
  min-width: 100px;
}

.board-name-editable:focus {
  border-color: var(--a);
  background: #1e2025;
}

/* Floating Toolbar */
.board-floating-toolbar {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 4px;
  background: #1e2025;
  border: 1px solid #33363f;
  padding: 5px 8px;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
  z-index: 1010;
}

.board-tool-btn {
  background: transparent;
  border: none;
  color: #8f93a0;
  height: 32px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.15s ease;
  position: relative;
  white-space: nowrap;
}

.board-tool-btn:hover {
  background: #262930;
  color: #e6e4ea;
}

.board-tool-btn.active {
  background: var(--a);
  color: #16171b;
  font-weight: 600;
}

.board-tool-btn.board-tool-clear {
  color: var(--r);
}

.board-tool-btn.board-tool-clear:hover {
  background: rgba(234, 181, 192, 0.14);
  color: var(--r);
}

.tool-sep {
  width: 1px;
  height: 22px;
  background: #33363f;
  margin: 0 6px;
}

/* Utility Classes: Anti-Selection & Dynamic Cursors */
.select-none {
  -webkit-user-select: none !important;
  -moz-user-select: none !important;
  -ms-user-select: none !important;
  user-select: none !important;
}

.cursor-grab {
  cursor: grab !important;
}

.cursor-grabbing {
  cursor: grabbing !important;
}

/* Canvas Container & Tool Cursors */
.board-canvas-container {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  touch-action: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

.board-canvas-container.is-dragging,
.board-canvas-container.is-dragging * {
  cursor: grabbing !important;
  -webkit-user-select: none !important;
  user-select: none !important;
}

.board-canvas-container.tool-select {
  cursor: default;
}

.board-canvas-container.tool-hand {
  cursor: grab;
}

.board-canvas-container.tool-hand.is-panning,
.board-canvas-container.tool-hand:active {
  cursor: grabbing;
}

.board-canvas-container.tool-pen,
.board-canvas-container.tool-pen .canvas-obj,
.board-canvas-container.tool-pen .canvas-obj * {
  cursor: crosshair;
}

/* Custom Eraser Mouse Cursor */
.board-canvas-container.tool-eraser,
.board-canvas-container.tool-eraser .canvas-obj,
.board-canvas-container.tool-eraser .canvas-obj *,
.board-canvas-container.tool-eraser [contenteditable="true"] {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M16.5 3.5L20.5 7.5L9 19H5V15L16.5 3.5Z' fill='%23eab5c0' stroke='%23ffffff' stroke-width='1.5' stroke-linejoin='round'/%3E%3Cpath d='M12.5 7.5L16.5 11.5' stroke='%23ffffff' stroke-width='1.5'/%3E%3Cpath d='M8 12L12 16' stroke='%23ffffff' stroke-width='1.5'/%3E%3Cpath d='M5 15L9 19' stroke='%23ffffff' stroke-width='1.5'/%3E%3Cpath d='M3 21H12' stroke='%23ffffff' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") 5 19, cell !important;
}

.board-canvas-container.tool-eraser .board-vendor-card-inner,
.board-canvas-container.tool-eraser .board-vendor-card-inner *,
.board-canvas-container.tool-eraser [contenteditable="true"] {
  pointer-events: none !important;
}

.board-svg {
  width: 100%;
  height: 100%;
  display: block;
  -webkit-user-select: none;
  user-select: none;
}

.board-svg image,
.board-svg img {
  -webkit-user-drag: none;
  user-drag: none;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}

/* Canvas Objects */
.canvas-obj {
  cursor: grab;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

.canvas-obj:active,
.canvas-obj.is-dragging {
  cursor: grabbing !important;
}

.canvas-obj:hover {
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.4));
}

.board-vendor-card-inner {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
  cursor: grab;
}

.board-vendor-card-inner:active,
.board-vendor-card-inner.cursor-grabbing,
.canvas-obj.is-dragging .board-vendor-card-inner {
  cursor: grabbing !important;
}

.board-vendor-card-inner img,
.board-vendor-card-inner image {
  -webkit-user-drag: none;
  user-drag: none;
  pointer-events: none;
}

.sticky-text-content {
  color: #16171b;
  font-size: 13.5px;
  font-family: inherit;
  font-weight: 500;
  line-height: 1.4;
  word-break: break-word;
  outline: none;
  width: 100%;
  height: 100%;
  overflow-y: auto;
  box-sizing: border-box;
  cursor: text;
  padding: 2px;
}

.sticky-text-content:empty::before {
  content: attr(data-placeholder);
  color: rgba(22, 23, 27, 0.45);
  pointer-events: none;
}

.board-text-content {
  color: #e6e4ea;
  font-size: 16px;
  font-family: inherit;
  line-height: 1.4;
  word-break: break-word;
  outline: none;
  width: 100%;
  height: 100%;
  cursor: text;
  background: transparent;
}

.board-text-content:empty::before {
  content: attr(data-placeholder);
  color: rgba(230, 228, 234, 0.45);
  pointer-events: none;
}

.board-text-content:focus {
  outline: 1px dashed var(--a);
}

.resize-handle,
.resize-handle-hit {
  cursor: nwse-resize;
}

.resize-handle {
  stroke: #0b0b0c;
  stroke-width: 2px;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.65));
}

.resize-handle[data-handle="ne"],
.resize-handle[data-handle="sw"],
.resize-handle-hit[data-handle="ne"],
.resize-handle-hit[data-handle="sw"] {
  cursor: nesw-resize;
}

.resize-handle[data-handle="nw"],
.resize-handle[data-handle="se"],
.resize-handle-hit[data-handle="nw"],
.resize-handle-hit[data-handle="se"] {
  cursor: nwse-resize;
}

.resize-handle[data-handle="n"],
.resize-handle[data-handle="s"],
.resize-handle-hit[data-handle="n"],
.resize-handle-hit[data-handle="s"] {
  cursor: ns-resize;
}

.resize-handle[data-handle="e"],
.resize-handle[data-handle="w"],
.resize-handle-hit[data-handle="e"],
.resize-handle-hit[data-handle="w"] {
  cursor: ew-resize;
}

/* Shape Picker Popover on Boards */
.board-shape-menu-popover {
  position: absolute;
  bottom: 76px;
  left: 50%;
  transform: translateX(-50%);
  width: 240px;
  background: #141519;
  border: 1px solid #3a3d46;
  border-radius: 12px;
  padding: 6px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.8);
  z-index: 1030;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.board-shape-menu-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #8f93a0;
  padding: 4px 10px 2px;
}

.board-shape-opt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 9px 10px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: #ffffff;
  font-size: 12.5px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}

.board-shape-opt:hover,
.board-shape-opt:active {
  background: #23252c;
  border-color: #3a3d46;
}

/* Floating Contextual Actions for Selected Object */
.board-selected-actions {
  position: absolute;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  background: #141519;
  border: 1px solid #33363f;
  padding: 6px 8px;
  border-radius: 10px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.65);
  z-index: 1020;
  pointer-events: auto;
  max-width: calc(100vw - 24px);
}

.board-size-quick-controls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 4px;
}

.board-size-step-btn {
  min-width: 30px !important;
  min-height: 30px !important;
  padding: 0 8px !important;
  background: #23252c !important;
  color: #ffffff !important;
  border: 1px solid #3a3d46 !important;
  border-radius: 6px !important;
  font-size: 15px !important;
  font-weight: 700 !important;
  justify-content: center;
}

.board-size-slider {
  width: 84px;
  accent-color: #ffffff;
  cursor: pointer;
}

.board-selected-actions button {
  background: transparent;
  border: none;
  color: #d5d7de;
  padding: 6px 8px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
}

.board-selected-actions button:hover {
  background: #2a2d36;
  color: #ffffff;
}

.board-selected-actions button.btn-del {
  color: var(--r);
}

.board-selected-actions button.btn-del:hover {
  background: rgba(234, 181, 192, 0.15);
  color: var(--r);
}

/* Live Collaborator Cursors */
.board-cursor {
  position: absolute;
  pointer-events: none;
  z-index: 1005;
  transition: transform 0.08s linear;
}

.board-cursor-label {
  position: absolute;
  left: 12px;
  top: 12px;
  font-size: 10px;
  font-weight: 500;
  padding: 2px 6px;
  border-radius: 4px;
  color: #16171b;
  white-space: nowrap;
}

/* Zoom / Sizing Controls - Fixed to Bottom-Right Corner */
.board-zoom-controls,
.board-zoom-widget {
  position: absolute;
  bottom: 24px;
  right: 24px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #141519;
  border: 1px solid #3a3d46;
  padding: 6px 12px;
  border-radius: 22px;
  z-index: 1010;
  font-size: 13px;
  color: #d5d7de;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.55);
}

.board-zoom-controls button,
.board-zoom-widget button {
  background: #23252c;
  border: 1px solid #33363f;
  color: #ffffff;
  min-width: 32px;
  min-height: 32px;
  padding: 4px 10px;
  cursor: pointer;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}

.board-zoom-controls button:hover,
.board-zoom-widget button:hover {
  background: #ffffff;
  color: #0b0b0c;
}

.board-zoom-text {
  min-width: 46px;
  text-align: center;
  font-size: 12.5px;
  font-weight: 600;
  color: #ffffff;
}

/* Mobile & Touch Screen Adaptations (<= 768px) */
@media (max-width: 768px) {
  .board-canvas-header {
    top: max(48px, calc(env(safe-area-inset-top, 0px) + 10px));
    left: max(10px, calc(env(safe-area-inset-left, 0px) + 10px));
    right: max(10px, calc(env(safe-area-inset-right, 0px) + 10px));
    gap: 6px;
  }

  .board-name-editable {
    max-width: 130px;
    font-size: 13px;
    padding: 4px 8px;
    min-width: 70px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .board-canvas-header button {
    padding: 4px 8px;
    font-size: 12.5px;
  }

  .board-shape-menu-popover {
    bottom: max(70px, calc(env(safe-area-inset-bottom, 0px) + 64px));
    width: min(260px, calc(100vw - 28px));
  }

  /* Horizontally scrollable tool dock - no squishing */
  .board-floating-toolbar {
    bottom: max(12px, calc(env(safe-area-inset-bottom, 0px) + 8px));
    left: 50%;
    transform: translateX(-50%);
    width: calc(100vw - 20px);
    max-width: calc(100vw - 20px);
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 3px;
    padding: 5px 6px;
    border-radius: 12px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .board-floating-toolbar::-webkit-scrollbar {
    display: none;
  }

  .board-tool-btn {
    flex-shrink: 0;
    white-space: nowrap;
    min-width: 44px;
    min-height: 44px;
    height: 44px;
    padding: 0 12px;
    font-size: 13px;
    border-radius: 8px;
    touch-action: manipulation;
  }

  .board-selected-actions button {
    min-width: 44px;
    min-height: 44px;
    padding: 8px 10px;
    justify-content: center;
    touch-action: manipulation;
  }

  .tool-sep {
    flex-shrink: 0;
    margin: 0 4px;
    height: 18px;
  }

  /* Elevated & enlarged zoom widget above the tool dock for easy mobile thumb tapping */
  .board-zoom-controls,
  .board-zoom-widget {
    bottom: max(76px, calc(env(safe-area-inset-bottom, 0px) + 70px));
    right: max(10px, calc(env(safe-area-inset-right, 0px) + 10px));
    padding: 6px 10px;
    font-size: 13px;
    gap: 6px;
    border-radius: 18px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.65);
  }

  .board-zoom-controls button,
  .board-zoom-widget button {
    padding: 6px 12px;
    min-width: 44px;
    min-height: 44px;
    font-size: 15px;
    touch-action: manipulation;
  }

  .board-zoom-text {
    min-width: 42px;
    font-size: 12.5px;
  }
}

@media (max-width: 480px) {
  .board-name-editable {
    max-width: 100px;
    font-size: 12px;
  }

  .board-canvas-header button {
    padding: 6px 10px;
    font-size: 12px;
    min-width: 44px;
    min-height: 44px;
    touch-action: manipulation;
  }
}
