/* css/styles.css */

/* Editor container fills viewport */
.editor-container {
  position: relative;
  width: 100%;
  height: 100vh;
  overflow: hidden;
}

/* Dropzone styling */
.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  border: 2px dashed #cbd5e1;
  border-radius: 0.5rem;
  background-color: #f8fafc;
  transition: border-color 0.2s, background-color 0.2s;
}

.dropzone:hover,
.dropzone.drag-over {
  border-color: #3b82f6;
  background-color: #eff6ff;
}

.dropzone-hidden {
  display: none;
}

/* Image container */
.image-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.image-container img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* Bubbles container - overlay on image */
.bubbles-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* Individual bubble */
.bubble {
  position: absolute;
  pointer-events: auto;
  user-select: none;
}

.bubble.selected {
  outline: 2px dashed #3b82f6;
  outline-offset: 2px;
}

/* Resize handles - only visible when bubble is selected */
.resize-handle {
  position: absolute;
  width: 12px;
  height: 12px;
  background-color: #3b82f6;
  border: 2px solid white;
  border-radius: 2px;
  box-sizing: border-box;
  display: none;
  z-index: 10;
}

.bubble.selected .resize-handle {
  display: block;
}

.resize-handle-nw {
  top: -6px;
  left: -6px;
  cursor: nw-resize;
}

.resize-handle-ne {
  top: -6px;
  right: -6px;
  cursor: ne-resize;
}

.resize-handle-sw {
  bottom: -6px;
  left: -6px;
  cursor: sw-resize;
}

.resize-handle-se {
  bottom: -6px;
  right: -6px;
  cursor: se-resize;
}

/* Bubble text */
.bubble-text {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 15%;
  box-sizing: border-box;
  font-family: 'Comic Sans MS', cursive;
  font-size: 16px;
  color: black;
  overflow: hidden;
  word-wrap: break-word;
}

/* Bubble SVG layer */
.bubble-svg {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
}

/* Tail handle - only visible when bubble is selected */
.tail-handle {
  position: absolute;
  width: 14px;
  height: 14px;
  background-color: #f97316;
  border: 2px solid white;
  border-radius: 50%;
  box-sizing: border-box;
  display: none;
  z-index: 10;
  cursor: move;
  transform: translate(-50%, -50%);
  pointer-events: auto;
}

.bubble.selected .tail-handle {
  display: block;
}

/* Bubble text editing input */
.bubble-edit-input {
  caret-color: black;
}

.bubble-edit-input:focus {
  outline: none;
}

/* Font classes for bubbles */
.font-comic { font-family: 'Comic Sans MS', 'Comic Sans', cursive; }
.font-marker { font-family: 'Marker Felt', 'Marker', fantasy; }
.font-helvetica { font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; }
.font-impact { font-family: Impact, Haettenschweiler, sans-serif; }
.font-noteworthy { font-family: Noteworthy, 'Comic Sans MS', cursive; }

/* Toolbar positioning */
.toolbar {
  position: fixed;
  left: 0;
  right: 0;
  z-index: 100;
}

.toolbar-button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

@media (max-width: 639px) {
  .toolbar {
    bottom: 0;
    padding-bottom: env(safe-area-inset-bottom, 8px);
  }
  .toolbar-button {
    min-height: 44px;
    min-width: 44px;
  }
  .resize-handle { width: 44px; height: 44px; }
  .resize-handle-nw { top: -22px; left: -22px; }
  .resize-handle-ne { top: -22px; right: -22px; }
  .resize-handle-sw { bottom: -22px; left: -22px; }
  .resize-handle-se { bottom: -22px; right: -22px; }
  .tail-handle { width: 44px; height: 44px; }
  /* Adjust image container to account for bottom toolbar */
  .image-container {
    padding-bottom: 80px;
  }
}

@media (min-width: 640px) {
  .toolbar { top: 0; }
  .resize-handle { width: 12px; height: 12px; }
  /* Adjust image container to account for top toolbar */
  .image-container {
    padding-top: 60px;
  }
}
