/* Reset and Variables */
:root {
  --bg-color: transparent;
  --border-color: rgba(228, 228, 231, 0.8);
  --text-primary: #18181b;
  --text-secondary: #71717a;
  --accent-color: #6c5cff;
  --font-family-sans: "Outfit", -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  background: transparent;
}

body {
  font-family: var(--font-family-sans);
  background-color: var(--bg-color);
  color: var(--text-primary);
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  user-select: none;
}

/* Canvas & Grid */
.canvas-container {
  position: relative;
  width: 100%;
  height: 100%;
}

/* Workspace Elements */
.workspace {
  position: absolute;
  inset: 0;
  z-index: 5;
  --sticky-size: clamp(195px, 50.625vw, 375px);
}

.canvas-element {
  position: absolute;
  background: white;
  border-radius: 0;
  border: 1px solid var(--border-color);
  box-shadow: 0 4px 15px -3px rgba(0, 0, 0, 0.05);
  cursor: grab;
  transition:
    box-shadow 0.2s ease,
    transform 0.2s ease;
  overflow: visible; /* Needed to let handles show outside */
  touch-action: none;
}

.canvas-element:hover {
  box-shadow: 0 8px 25px -5px rgba(0, 0, 0, 0.08);
}

.canvas-element.dragging {
  cursor: grabbing;
  z-index: 1000;
  box-shadow: 0 12px 30px -8px rgba(0, 0, 0, 0.15);
  transform: scale(1.02);
  transition: none;
}

body.dragging-active,
body.dragging-active * {
  cursor: grabbing !important;
}

.inner-content {
  width: 100%;
  height: 100%;
  padding: clamp(10px, 3vw, 20px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 0;
  pointer-events: none; /* Prevent text selection & default dragging of children */
}

/* Styling Specific Elements */
.sticky {
  width: var(--sticky-size);
  height: var(--sticky-size);
  left: calc(50% - (var(--sticky-size) / 2));
  top: calc(50% - (var(--sticky-size) / 2));
  background-color: #fef08a; /* Yellow-200 sticky note */
  border-color: #fde047;
}

.sticky p {
  font-size: clamp(0.8rem, 2.8vw, 1.1rem);
  color: #a16207;
  line-height: 1.4;
  text-align: center;
}

/* Selection SVG overlay and outline path */
.selection-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 100;
}

.selection-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.selection-path {
  fill: none;
  stroke: var(--accent-color);
  stroke-width: 2px;
  stroke-linecap: round;
}

/* Resize handles styling */
.resize-handle {
  position: absolute;
  width: 10px;
  height: 10px;
  background: white;
  border: 2.5px solid var(--accent-color);
  border-radius: 50%;
  z-index: 150;
  opacity: 0;
  transform: scale(0);
  transition:
    transform 0.35s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.35s ease;
}

.resize-handle.active {
  animation: handle-pop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  animation-delay: var(--delay, 0s);
}

.resize-handle[data-resize-dir="tl"],
.resize-handle[data-resize-dir="br"] {
  cursor: nwse-resize;
}

.resize-handle[data-resize-dir="tr"],
.resize-handle[data-resize-dir="bl"] {
  cursor: nesw-resize;
}

.resize-handle[data-resize-dir="t"],
.resize-handle[data-resize-dir="b"] {
  cursor: ns-resize;
}

.resize-handle[data-resize-dir="l"],
.resize-handle[data-resize-dir="r"] {
  cursor: ew-resize;
}

@keyframes handle-pop {
  0% {
    transform: scale(0);
    opacity: 0;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}
