/* Admin Blocks Management */

.blocks-section {
  margin-top: 4rem;
  padding: 3rem;
  background: white;
  border-radius: 1.2rem;
  box-shadow: 0 0.1rem 0.3rem rgba(0, 0, 0, 0.1);
}

.blocks-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 0.1rem solid #e5e7eb;
}

.blocks-header h2 {
  font-size: 2.4rem;
  font-weight: 600;
  margin: 0;
  color: #111827;
}

.blocks-add-buttons {
  display: flex;
  gap: 1.2rem;
}

.blocks-add-buttons .btn {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.blocks-add-buttons svg {
  flex-shrink: 0;
}

/* Empty state */
.blocks-empty {
  text-align: center;
  padding: 4rem 2rem;
  color: #6b7280;
  font-size: 1.6rem;
}

/* Blocks list */
.blocks-list {
  display: flex;
  flex-direction: column;
  gap: 1.6rem;
}

.block-item {
  border: 0.1rem solid #e5e7eb;
  border-radius: 0.8rem;
  padding: 2rem;
  background: #f9fafb;
  transition: all 0.2s;
  overflow: hidden;
}

.block-item:hover {
  border-color: #d1d5db;
  box-shadow: 0 0.2rem 0.4rem rgba(0, 0, 0, 0.05);
}

.block-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.2rem;
  gap: 1rem;
}

.block-drag-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.4rem;
  color: #9ca3af;
  cursor: grab;
  transition: color 0.2s;
  flex-shrink: 0;
}

.block-drag-handle:hover {
  color: #6b7280;
}

.block-drag-handle:active {
  cursor: grabbing;
}

.block-item.is-dragging .block-drag-handle {
  color: #3b82f6;
  cursor: grabbing;
}

.block-type {
  display: inline-block;
  padding: 0.4rem 1.2rem;
  background: #dbeafe;
  color: #1e40af;
  border-radius: 0.6rem;
  font-size: 1.3rem;
  font-weight: 600;
  text-transform: capitalize;
}

.block-actions {
  display: flex;
  gap: 0.8rem;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.2rem;
  height: 3.2rem;
  background: white;
  border: 0.1rem solid #d1d5db;
  border-radius: 0.6rem;
  color: #374151;
  text-decoration: none;
  transition: all 0.2s;
  cursor: pointer;
}

.btn-icon:hover {
  background: #f3f4f6;
  border-color: #9ca3af;
}

.btn-icon.btn-danger {
  color: #dc2626;
}

.btn-icon.btn-danger:hover {
  background: #fee2e2;
  border-color: #dc2626;
}

.block-content {
  display: block;
  text-decoration: none;
  color: inherit;
  overflow: hidden;
}

.block-preview {
  padding: 1.5rem;
  background: white;
  border-radius: 0.6rem;
  min-height: 8rem;
  overflow: hidden;
}

.text-block-preview {
  font-size: 1.4rem;
  color: #374151;
  line-height: 1.6;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.basic-block-preview {
  font-size: 1.4rem;
  color: #374151;
  line-height: 1.6;
  word-wrap: break-word;
  overflow-wrap: break-word;
  margin-right: 1.6rem;
}

.code-block-preview {
  font-size: 1.4rem;
  color: #374151;
  line-height: 1.6;
}

.code-block-preview code {
  display: block;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.html-block-preview {
  font-size: 1.4rem;
  color: #374151;
  line-height: 1.6;
}

.html-block-preview code {
  display: block;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.image-block-preview {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.image-block-preview img {
  max-width: 200px;
  height: auto;
  border-radius: 0.4rem;
}

.image-block-preview p {
  font-size: 1.4rem;
  color: #6b7280;
  margin: 0;
}

/* Form styling for block forms */
.block-item .block-form-inline {
  width: 100%;
  box-sizing: border-box;
}

.block-item .block-form-inline .form-group {
  max-width: 100%;
  box-sizing: border-box;
}

.block-item .block-form-inline .form-control {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.block-item .block-form-inline textarea.form-control {
  resize: vertical;
}

.current-image {
  margin-bottom: 1.5rem;
  padding: 1.5rem;
  background: #f9fafb;
  border-radius: 0.8rem;
  text-align: center;
}

.current-image img {
  max-width: 100%;
  height: auto;
  border-radius: 0.6rem;
  margin-bottom: 1rem;
}

.current-image p {
  font-size: 1.4rem;
  color: #6b7280;
  margin: 0;
}

/* Responsive */
@media (max-width: 768px) {
  .blocks-section {
    padding: 2rem;
  }

  .blocks-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1.5rem;
  }

  .blocks-add-buttons {
    flex-direction: column;
    width: 100%;
  }

  .blocks-add-buttons .btn {
    width: 100%;
    justify-content: center;
  }

  .block-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .image-block-preview {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* Element Type Toolbar */
.element-type-toolbar-wrapper {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-top: 0.8rem;
  margin-bottom: 0.5rem;
}

.element-type-toolbar-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-width: 5.5rem;
  padding: 0.8rem 1rem;
  background: white;
  border: 0.2rem solid #d1d5db;
  border-radius: 0.6rem;
  cursor: pointer;
  transition: all 0.2s;
}

.element-type-toolbar-btn img {
  display: block;
  opacity: 0.6;
  transition: opacity 0.2s, filter 0.2s;
}

.element-type-toolbar-btn span {
  font-size: 1.2rem;
  font-weight: 600;
  color: #6b7280;
  transition: color 0.2s;
}

.element-type-toolbar-btn:hover {
  border-color: #9ca3af;
  background: #f9fafb;
}

.element-type-toolbar-btn:hover img {
  opacity: 0.8;
}

.element-type-toolbar-btn:hover span {
  color: #374151;
}

.element-type-toolbar-btn.active {
  background: #eff6ff;
  border: 0.3rem solid #3b82f6;
  color: #3b82f6;
}

.element-type-toolbar-btn.active img {
  opacity: 1;
  filter: invert(42%) sepia(98%) saturate(1816%) hue-rotate(203deg) brightness(101%) contrast(92%);
}

.element-type-toolbar-btn.active span {
  color: #1e40af;
}

.element-type-toolbar-btn:focus {
  outline: 0.2rem solid #93c5fd;
  outline-offset: 0.2rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .element-type-toolbar-wrapper {
    gap: 0.8rem;
  }

  .element-type-toolbar-btn {
    min-width: 6rem;
    padding: 1rem 1.2rem;
  }

  .element-type-toolbar-btn span {
    font-size: 1.3rem;
  }
}
