/* Drawing Sidebar Styles */

/* Canvas background swatch icons */
.canvas-swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  outline: 1.5px solid #888;
  border-radius: 2px;
  vertical-align: middle;
}

.canvas-swatch-black { background: #000; }
.canvas-swatch-white { background: #fff; }

.drawing-sidebar {
  position: fixed;
  top: 4.5rem;
  right: 1.5rem;
  width: 21rem;
  max-height: calc(100vh - 6rem);
  background: rgba(17, 24, 39, 0.92); /* Tailwind gray-900 */
  backdrop-filter: blur(0.5rem);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 0.75rem;
  transform: translateX(calc(100% + 2rem));
  transition: transform 0.3s ease;
  z-index: 1000;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0.5rem 2rem rgba(0, 0, 0, 0.4);
}

.drawing-sidebar.open {
  transform: translateX(0);
}

#sidebar-content {
  flex-grow: 1;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

/* Sidebar section structure */
.drawing-sidebar .sidebar-section {
  padding: 0.3rem 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* Remove "hole" above sections without a label */
.drawing-sidebar .sidebar-section:not(:has(label)) {
  padding-top: 0;
}

/* Tool buttons - wrap to grid */
.drawing-sidebar .btn-group.flex-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.1rem;
}

.drawing-sidebar .btn-group.flex-wrap > .btn,
.drawing-sidebar .btn-group.flex-wrap > .btn-check + .btn {
  flex: 0 0 auto;
  border-radius: 0.25rem !important;
}

/* Custom color swatch styling */
#custom-color-picker {
  cursor: pointer;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  min-width: 30px;
  max-width: 30px;
  min-height: 30px;
  max-height: 30px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.4);
  margin: 0 0.6rem 0 0;
  appearance: none;
  -webkit-appearance: none;
  background: none;
  box-sizing: border-box;
  overflow: hidden;
  display: block;
  align-self: center;
}

#custom-color-picker::-webkit-color-swatch-wrapper {
  padding: 0;
  border-radius: 50%;
}

#custom-color-picker::-webkit-color-swatch {
  border: none;
  border-radius: 50%;
}

#custom-color-picker::-moz-color-swatch {
  border: none;
  border-radius: 50%;
}

/* Drawings list - no scrollbars, allow natural overflow */
.drawing-sidebar .drawings-list {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.drawing-sidebar .sidebar-section:last-child {
  min-height: 180px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.drawing-sidebar .drawings-list {
  flex-grow: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

.drawing-sidebar .list-group-item {
  padding: 0.5rem;
  border-radius: 0.375rem !important;
  flex-shrink: 0;
  overflow: hidden;
}

/* Keep rename/delete buttons visible even when the drawing name is very long */
.drawing-sidebar .list-group-item .rename,
.drawing-sidebar .list-group-item .delete {
  flex-shrink: 0;
}

.drawing-sidebar .list-group-item.active {
  background-color: rgba(255, 255, 255, 0.1) !important;
  border-color: rgba(255, 255, 255, 0.3) !important;
}

/* Text Editing UI fixes */
.doodle-text-layer {
  pointer-events: none;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2000;
}

.doodle-text-label {
  pointer-events: auto;
}

/* When editing, only the current element should respond to mouse */
.doodle-text-editing .doodle-text-label:not([contenteditable="true"]) {
  pointer-events: none;
  opacity: 0.7;
}

/* Stroke width & fill alpha button SVGs - match Bootstrap icon sizing */
#stroke-buttons svg,
#fill-alpha-buttons svg {
  display: block;
  width: 1em;
  height: 1em;
}

/* Text tool button - wider than icon-only buttons, with gap to font sizes */
label[data-tool="text"] {
  min-width: calc(3 * 2rem);
  margin-right: 0.6rem;
}

/* Example drawings placeholder - height of ~2 saved drawing items */
.example-drawings-list {
  min-height: calc(2 * 3.5rem);
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .drawing-sidebar {
    width: calc(100% - 2rem);
    max-width: 21rem;
    right: 1rem;
  }
}

/* Drag and drop overlay for importing/vectorizing files */
.drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: stretch;
  gap: 1.5rem;
  padding: 1.5rem;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.2s ease,
    visibility 0.2s ease;
  pointer-events: none;
}

.drop-overlay.visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.drop-overlay.hint {
  animation: dropOverlayHint 5s ease-in-out forwards;
}

@keyframes dropOverlayHint {
  0% {
    opacity: 0;
    visibility: visible;
  }
  10% {
    opacity: 1;
    visibility: visible;
  }
  90% {
    opacity: 1;
    visibility: visible;
  }
  100% {
    opacity: 0;
    visibility: hidden;
  }
}

/* Drop zones */
.drop-zone {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px dashed rgba(255, 255, 255, 0.3);
  border-radius: 1rem;
  transition:
    border-color 0.2s ease,
    background 0.2s ease;
  position: relative;
}

.drop-zone-import {
  flex: 7;
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(59, 130, 246, 0.35);
}

.drop-zone-vectorize {
  flex: 3;
  background: rgba(168, 85, 247, 0.12);
  border-color: rgba(168, 85, 247, 0.35);
}

.drop-zone-import.active {
  background: rgba(59, 130, 246, 0.3);
  border-color: rgba(59, 130, 246, 0.8);
}

.drop-zone-vectorize.active {
  background: rgba(168, 85, 247, 0.3);
  border-color: rgba(168, 85, 247, 0.8);
}

.drop-zone-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  color: white;
  text-align: center;
  pointer-events: none;
}

.drop-zone-title {
  font-size: 1.25rem;
  font-weight: 500;
}

.drop-zone-types {
  font-size: 0.85rem;
  opacity: 0.7;
}

.drop-zone-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  color: white;
  pointer-events: none;
}

.drop-zone-progress {
  font-size: 0.9rem;
  opacity: 0.9;
}
