/* ============ Moodboard ============ */
.mb-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

/* ============ Viewport & Board ============ */
.mb-viewport {
  flex: 1;
  overflow: hidden;
  position: relative;
  background: var(--bg-dark);
  cursor: grab;
}

.mb-viewport:active {
  cursor: grabbing;
}

.mb-viewport.mb-panning {
  cursor: grabbing;
}

.mb-board {
  position: absolute;
  top: 0;
  left: 0;
  width: 10000px;
  height: 10000px;
  transform-origin: 0 0;
  background-image: radial-gradient(circle, rgba(255,255,255,0.08) 1px, transparent 1px);
  background-size: 40px 40px;
}

/* ============ Card Base ============ */
.mb-card {
  position: absolute;
  border-radius: 8px;
  cursor: pointer;
  user-select: none;
  min-width: 100px;
  min-height: 60px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  transition: box-shadow 0.1s;
}

.mb-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}

.mb-card.mb-dragging {
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  z-index: 9999 !important;
  transition: none;
}

.mb-card iframe {
  pointer-events: auto;
}

.mb-card-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  z-index: 5;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  background: rgba(0,0,0,0.5);
  border: none;
  color: #fff;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.12s;
}

.mb-card:hover .mb-card-remove {
  opacity: 1;
}

.mb-card-remove:hover {
  background: var(--danger);
}

/* ============ Note Card ============ */
.mb-card.mb-type-note {
  background: var(--card-color, #fff3cd);
  border: 1px solid rgba(0,0,0,0.1);
  padding: 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.mb-note-content {
  flex: 1;
  font-size: 13px;
  line-height: 1.5;
  color: #222;
  word-wrap: break-word;
  overflow-wrap: break-word;
  overflow: hidden;
  cursor: text;
  padding-right: 16px;
}

.mb-note-content strong {
  font-weight: 700;
}

.mb-note-content em {
  font-style: italic;
}

.mb-note-content a {
  color: #1a6dd4;
  text-decoration: underline;
}

.mb-note-content ul {
  margin: 4px 0;
  padding-left: 18px;
  list-style: disc;
}

.mb-note-content li {
  display: list-item;
}

.mb-note-edit {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  border-radius: 8px;
  resize: none;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.5;
  padding: 12px;
  background: rgba(255,255,255,0.95);
  color: #222;
  z-index: 5;
}

/* ============ Link Card ============ */
.mb-card.mb-type-link {
  background: var(--bg-light);
  border: 1px solid var(--border);
  overflow: hidden;
  cursor: pointer;
}

.mb-link-thumb {
  width: 100%;
  height: 120px;
  object-fit: cover;
  display: block;
  background: var(--bg-mid);
}

.mb-link-thumb-placeholder {
  width: 100%;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-mid);
  color: var(--text-muted);
  font-size: 11px;
}

.mb-link-info {
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mb-link-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mb-link-domain {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: var(--text-muted);
}

.mb-link-favicon {
  width: 14px;
  height: 14px;
  border-radius: 2px;
}

/* YouTube play button overlay */
.mb-yt-play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 48px;
  height: 48px;
  background: rgba(0,0,0,0.7);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.mb-yt-play::after {
  content: '';
  display: block;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 10px 0 10px 18px;
  border-color: transparent transparent transparent #fff;
  margin-left: 4px;
}

.mb-link-thumb-wrap {
  position: relative;
}

.mb-link-thumb-wrap:hover .mb-yt-play {
  background: rgba(255,0,0,0.8);
}

.mb-youtube-embed {
  width: 100%;
  height: 120px;
  border: none;
  display: block;
}

/* ============ Image Card ============ */
.mb-card.mb-type-image {
  background: var(--bg-light);
  border: 1px solid var(--border);
  overflow: hidden;
}

.mb-card.mb-type-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ============ Ref Card (dragged DAW items) ============ */
.mb-card.mb-type-ref {
  cursor: pointer;
  width: 240px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.mb-card.mb-type-ref .cp-card,
.mb-card.mb-type-ref .preset-card {
  background: var(--bg-light);
  border: 1px solid var(--border);
  margin: 0;
}

.mb-waveform-wrap {
  position: relative;
  border-top: 1px solid var(--border);
  background: var(--bg-dark);
  height: 40px;
}

.mb-waveform-canvas {
  width: 100%;
  height: 40px;
  display: block;
}

.mb-waveform-wrap .smp-waveform-play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  color: #fff;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 0 0 2px;
  line-height: 1;
  transition: background 0.1s;
  opacity: 0;
}

.mb-waveform-wrap:hover .smp-waveform-play {
  opacity: 1;
}

.mb-waveform-wrap .smp-waveform-play:hover {
  background: rgba(74, 144, 217, 0.8);
}

.mb-waveform-wrap .smp-waveform-play.playing {
  background: rgba(74, 144, 217, 0.9);
  opacity: 1;
}

/* ============ Resize Handle ============ */
.mb-resize-handle {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 16px;
  height: 16px;
  cursor: nwse-resize;
  opacity: 0;
  transition: opacity 0.1s;
}

.mb-card:hover .mb-resize-handle {
  opacity: 1;
}

.mb-resize-handle::after {
  content: '';
  position: absolute;
  bottom: 3px;
  right: 3px;
  width: 8px;
  height: 8px;
  border-right: 2px solid rgba(0,0,0,0.3);
  border-bottom: 2px solid rgba(0,0,0,0.3);
}

.mb-resize-handle:hover::after {
  border-color: var(--accent);
}

/* ============ FAB (Add button) ============ */
.mb-fab {
  position: absolute;
  bottom: 16px;
  right: 16px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(74, 144, 217, 0.4);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.1s, transform 0.1s;
}

.mb-fab:hover {
  background: var(--accent-hover);
  transform: scale(1.05);
}

.mb-fab:active {
  transform: scale(0.95);
}

/* ============ Add Menu ============ */
.mb-add-menu {
  display: none;
  position: absolute;
  bottom: 68px;
  right: 16px;
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  z-index: 100;
  min-width: 160px;
  padding: 4px 0;
}

.mb-add-menu.open {
  display: block;
}

.mb-add-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  font-size: 12px;
  color: var(--text-primary);
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.mb-add-option:hover {
  background: var(--bg-hover);
}

.mb-add-option .material-symbols-outlined {
  font-size: 18px;
  color: var(--text-secondary);
}

/* ============ Context Menu ============ */
.mb-context-menu {
  display: none;
  position: fixed;
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  z-index: 10001;
  min-width: 150px;
  padding: 4px 0;
}

.mb-context-menu.open {
  display: block;
}

.mb-context-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  font-size: 12px;
  color: var(--text-primary);
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.mb-context-item:hover {
  background: var(--bg-hover);
}

.mb-context-item.mb-context-danger {
  color: var(--danger);
}

.mb-context-separator {
  height: 1px;
  background: var(--border);
  margin: 4px 8px;
}

.mb-color-picker {
  display: flex;
  gap: 4px;
  padding: 6px 14px;
  flex-wrap: wrap;
}

.mb-color-swatch {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: 2px solid transparent;
  cursor: pointer;
}

.mb-color-swatch:hover {
  border-color: var(--accent);
}

.mb-color-swatch.active {
  border-color: var(--text-primary);
}

/* ============ Zoom Indicator ============ */
.mb-zoom-level {
  position: absolute;
  bottom: 16px;
  left: 16px;
  font-size: 11px;
  color: var(--text-muted);
  background: rgba(0,0,0,0.5);
  padding: 3px 8px;
  border-radius: 4px;
  pointer-events: none;
  z-index: 50;
  font-variant-numeric: tabular-nums;
}

/* ============ Drop Overlay ============ */
.mb-drop-overlay {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(74, 144, 217, 0.08);
  border: 2px dashed var(--accent);
  z-index: 200;
  pointer-events: none;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: var(--accent);
}

.mb-drop-overlay.mb-drop-active {
  display: flex;
}
