/* ========================
   Block layout + header
   ======================== */

.block {
  background: var(--block-bg, #f8f8f8);
  padding: 1rem;
  border-radius: 0.5rem;
  margin-bottom: 1rem;
  position: relative;
}

.block-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.block-label {
  font-weight: 600;
  font-size: 1rem;
}

/* ========================
   Block actions (move/delete)
   ======================== */

.block-actions {
  display: flex;
  align-items: center;
  margin-left: auto;
}

.block-actions button {
  margin-left: 0.5rem;
  font-size: 1rem;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
  line-height: 1;
  color: var(--main-text-color, #333);
}

.block-actions button:hover {
  color: var(--action-color, #007acc);
}

/* ========================
   Toolbar (text formatting)
   ======================== */

.block-toolbar {
  display: inline-flex;
  gap: 0.25rem;
}

.block-toolbar button {
  font-weight: bold;
  border: 1px solid var(--main-text-color);
  border-radius: 4px;
  background: white;
  padding: 0.25rem 0.4rem;
  cursor: pointer;
}

.block-toolbar button:hover {
  background: #f0f0f0;
}

.block-toolbar button.active {
  background: #ebffe4;
  border-color: #ebb1ff;
  color: #e498ff;
}

/* ========================
   Rich text editing block
   ======================== */

.richtext {
  min-height: 1rem;
  padding: 0.5rem;
  border: 1px solid var(--main-text-color);
  border-radius: 0.25rem;
  font: inherit;
  line-height: 1.4;
  white-space: pre-wrap;
  outline: none;
  width: 100%;
}

/* ========================
   Textarea auto-grow style
   ======================== */

textarea.autogrow {
  width: 100%;
  min-height: 3rem;
  overflow: hidden;
  resize: none;
  font: inherit;
  padding: 0.5rem;
  border-radius: 0.25rem;
  border: 1px solid #ccc;
}

/* ========================
   Media preview container
   ======================== */

.file-preview {
  margin-top: 0.5rem;
}

.file-preview img,
.file-preview video {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 0.25rem;
}

/* ========================
   Slider for image resize
   ======================== */

.image-size-slider {
  display: block;
  width: 100%;
  margin-top: 0.5rem;
  -webkit-appearance: none;
  background: transparent;
}

.image-size-slider:focus {
  outline: none;
}

/* Track */
.image-size-slider::-webkit-slider-runnable-track {
  height: 6px;
  background: #ccc;
  border-radius: 3px;
}

.image-size-slider::-moz-range-track {
  height: 6px;
  background: #ccc;
  border-radius: 3px;
}

/* Thumb */
.image-size-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  background: black;
  border: none;
  border-radius: 2px;
  margin-top: -4px; /* centers thumb on track */
}

.image-size-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  background: black;
  border: none;
  border-radius: 2px;
}

/* ========================
   Animations
   ======================== */

.block.fade-in {
  animation: fadeIn 0.25s ease-out;
}

.block.fade-out {
  animation: fadeOut 0.25s ease-in forwards;
}

.block.moving {
  transition: transform 0.25s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes fadeOut {
  from { opacity: 1; transform: scale(1); }
  to {
    opacity: 0;
    transform: scale(0.96);
    height: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
  }
}
