/* Core block styling */
.wp-block-icon-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1em 0; /* Match default Gutenberg block margin */
}

.wp-block-icon-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0; /* Reduced padding to match default block spacing */
  margin: 0; /* No extra margin, handled by ul */
}

/* Background padding, similar to Heading block */
.wp-block-icon-list.has-background {
  padding: 1.25em 2.375em;
}

/* Vertical writing mode, similar to Heading block */
.wp-block-icon-list li:has(.has-text-align-left[style*=writing-mode]:where([style*=vertical-lr])),
.wp-block-icon-list li:has(.has-text-align-right[style*=writing-mode]:where([style*=vertical-rl])) {
  rotate: 180deg;
}

/* Selected state in editor */
.wp-block-icon-list li.selected {
  border: 2px solid #007cba; /* Default Gutenberg selection border color */
}

/* Modal styles */
.worldchefs-icon-modal {
  max-width: 600px;
  margin: auto;
  padding: 20px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.worldchefs-icon-modal .category-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.worldchefs-icon-modal .category-tabs button {
  padding: 8px 16px;
  background: #f0f0f0;
  border: 1px solid #ddd;
  border-radius: 4px;
  cursor: pointer;
}

.worldchefs-icon-modal .category-tabs button.active {
  background: #007cba; /* Match Gutenberg blue */
  color: #fff;
  border-color: #007cba;
}

.worldchefs-icon-modal .icon-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  max-height: 400px;
  overflow-y: auto;
}

.worldchefs-icon-modal .icon-grid button {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 8px 4px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 80px;
}

.worldchefs-icon-modal .icon-grid button:hover,
.worldchefs-icon-modal .icon-grid button.selected {
  background: #f0f0f0;
  border-color: #007cba; /* Match Gutenberg blue */
}

.worldchefs-icon-modal .icon-grid i {
  font-size: 24px;
  margin-bottom: 8px;
}

.worldchefs-icon-modal .icon-grid small {
  font-size: 10px;
  line-height: 1.2;
  text-align: center;
  word-break: break-word;
  display: block;
}

/* Button styles for Move Up, Move Down, and Remove (editor only) */
.worldchefs-icon-list .action-button {
  flex-shrink: 0;
  background: transparent; /* Match Gutenberg toolbar buttons */
  border: none;
  border-radius: 2px; /* Match Gutenberg button rounding */
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.worldchefs-icon-list .action-button.move-up,
.worldchefs-icon-list .action-button.move-down {
  color: #1e1e1e; /* Match Gutenberg toolbar icon color */
}

.worldchefs-icon-list .action-button.remove {
  color: #d94f4f;
}

.worldchefs-icon-list .action-button:hover {
  background: #f0f0f0; /* Match Gutenberg toolbar button hover */
}

.worldchefs-icon-list .action-button:disabled {
  color: #a0a0a0; /* Match Gutenberg disabled state */
  background: transparent;
  cursor: not-allowed;
}

.worldchefs-icon-list .action-button i {
  font-size: 14px;
}

/* Align buttons to the right (editor only) */
.worldchefs-icon-list .button-group {
  display: flex;
  gap: 4px; /* Reduced gap to match Gutenberg toolbar spacing */
  margin-left: auto;
}