/**
 * Dynamic Content Editor Styles
 *
 * Styles for the visual JSON editor used for offering content
 * Maintains refined, editorial aesthetic with clear information architecture
 * Collapsible design with advanced JSON editor toggle
 */

/* Dynamic Content Container */
.dynamic-content-container {
  border: none;
  border-radius: 0.5rem;
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.dynamic-content-container summary {
  list-style: none;
}

.dynamic-content-container summary::-webkit-details-marker {
  display: none;
}

/* Dynamic Content Button Grid */
.dynamic-content-button-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

/* Dynamic Content Section Button */
.dynamic-content-section-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem;
  background: white;
  border: 1.5px solid #e7e5e4;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all var(--transition-slow);
  font-size: 0.875rem;
  font-weight: 500;
  color: #1f2937;
  min-height: 120px;
}

.dynamic-content-section-btn:hover {
  border-color: var(--honey, #fff947);
  background-color: var(--primary-light, #fffbdf);
  box-shadow: 0 2px 8px rgba(255, 249, 71, 0.1);
  transform: translateY(-2px);
}

.dynamic-content-section-btn:active {
  transform: translateY(0);
}

.dynamic-content-section-btn i {
  font-size: 1.5rem;
  color: var(--charcoal, #0b0b0b);
}

.dynamic-content-section-btn span {
  text-align: center;
  line-height: 1.3;
}

/* Dynamic Content Preview Container */
.dynamic-content-preview {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1rem;
}

/* Individual Section Card */
.dynamic-content-section-card {
  background: white;
  border: 1.5px solid #e7e5e4;
  border-radius: 0.5rem;
  overflow: hidden;
  transition: all var(--transition-slow);
}

.dynamic-content-section-card:hover {
  border-color: var(--honey, #fff947);
  box-shadow: 0 2px 8px rgba(255, 249, 71, 0.1);
}

/* Section Card Header */
.dynamic-content-section-header-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
  background: #fafaf8;
  border-bottom: 1px solid #e7e5e4;
}

/* Section Card Content */
.dynamic-content-section-content {
  padding: 1rem;
}

/* Remove Button */
.dynamic-content-remove-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0.375rem;
  cursor: pointer;
  color: #dc2626;
  transition: all var(--transition-slow);
  flex-shrink: 0;
}

.dynamic-content-remove-btn:hover {
  background-color: rgba(220, 38, 38, 0.1);
}

.dynamic-content-remove-btn:active {
  background-color: rgba(220, 38, 38, 0.15);
}

/* Advanced Button */
.dynamic-content-advanced-btn {
  white-space: nowrap;
}

.dynamic-content-advanced-btn:hover {
  background-color: rgba(11, 11, 11, 0.05) !important;
  border-color: var(--charcoal, #0b0b0b) !important;
  color: var(--charcoal, #0b0b0b) !important;
}

.dynamic-content-advanced-btn:active {
  transform: scale(0.98);
}

/* Advanced JSON Editor Container */
.dynamic-content-advanced-editor {
  animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
  from {
    opacity: 0;
    max-height: 0;
    overflow: hidden;
  }
  to {
    opacity: 1;
    max-height: 500px;
  }
}

/* JSON Textarea */
.dynamic-content-textarea {
  width: 100%;
  min-height: 200px;
  padding: 1rem;
  font-family: 'Monaco', 'Courier New', 'Menlo', monospace;
  font-size: 0.8125rem;
  line-height: 1.6;
  background-color: #fafaf8;
  border: 1.5px solid #e7e5e4;
  border-radius: 0.5rem;
  color: #1f2937;
  resize: vertical;
  transition: all var(--transition-slow);
}

.dynamic-content-textarea:focus {
  outline: none;
  border-color: #fff947;
  background-color: white;
  box-shadow: 0 0 0 3px rgba(255, 169, 77, 0.1);
}

.dynamic-content-textarea::placeholder {
  color: #78716c;
  opacity: 0.7;
}

/* Editable Field Styles */
.dynamic-edit-field {
  width: 100%;
  padding: 0.625rem 0.75rem;
  font-family: inherit;
  font-size: 0.8125rem;
  line-height: 1.5;
  background-color: white;
  border: 1px solid #e7e5e4;
  border-radius: 0.375rem;
  color: #1f2937;
  transition: all var(--transition-slow);
}

.dynamic-edit-field:hover {
  border-color: #d0ccc8;
}

.dynamic-edit-field:focus {
  outline: none;
  border-color: var(--honey, #fff947);
  background-color: white;
  box-shadow: 0 0 0 2.5px rgba(255, 249, 71, 0.1);
}

.dynamic-edit-field::placeholder {
  color: #b3aba3;
}

/* Field Group Container */
.dynamic-field-group {
  margin: 0.75rem 0;
  display: flex;
  flex-direction: column;
}

.dynamic-field-group label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.375rem;
  color: #1f2937;
  font-size: 0.8125rem;
}

.dynamic-field-group input {
  width: 100%;
}

/* Object Field Container */
.dynamic-object-field {
  margin: 1rem 0;
  padding: 0.75rem;
  background: #fafaf8;
  border-radius: 0.375rem;
  border-left: 3px solid var(--honey, #fff947);
}

.dynamic-object-field > label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: #1f2937;
  font-size: 0.875rem;
}

.dynamic-object-field > div {
  margin-left: 1rem;
}

/* Array Container */
.dynamic-array-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Array Item */
.dynamic-array-item {
  margin: 0.75rem 0;
  padding: 0.875rem;
  background: white;
  border: 1px solid #e7e5e4;
  border-radius: 0.375rem;
  transition: all var(--transition-slow);
}

.dynamic-array-item:hover {
  border-color: #d0ccc8;
  background-color: #fafaf8;
}

.dynamic-array-item > div:first-child {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #f0ebe6;
}

.dynamic-array-item > div:first-child span {
  font-weight: 500;
  font-size: 0.8125rem;
  color: #78716c;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Remove Item Button */
.dynamic-remove-item-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.375rem;
  background: transparent;
  border: none;
  border-radius: 0.25rem;
  cursor: pointer;
  color: #dc2626;
  font-size: 0.75rem;
  transition: all var(--transition-slow);
  flex-shrink: 0;
}

.dynamic-remove-item-btn:hover {
  background-color: rgba(220, 38, 38, 0.1);
  color: #b91c1c;
}

.dynamic-remove-item-btn:active {
  background-color: rgba(220, 38, 38, 0.15);
}

/* Add Item Button */
.dynamic-add-item-btn {
  margin-top: 0.75rem;
  padding: 0.625rem 1rem;
  background: white;
  border: 1px dashed #e7e5e4;
  border-radius: 0.375rem;
  cursor: pointer;
  font-size: 0.8125rem;
  color: #78716c;
  font-weight: 500;
  transition: all var(--transition-slow);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.dynamic-add-item-btn:hover {
  border-color: #fff947;
  background-color: rgba(255, 169, 77, 0.02);
  color: #fff947;
}

.dynamic-add-item-btn:active {
  transform: scale(0.98);
}

.dynamic-add-item-btn i {
  font-size: 0.75rem;
}

/* Edit Container */
.dynamic-edit-container {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Responsive adjustments for smaller screens */
@media (max-width: 768px) {
  .dynamic-content-button-grid {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.5rem;
  }

  .dynamic-content-section-btn {
    padding: 0.75rem;
    min-height: 100px;
    font-size: 0.8125rem;
  }

  .dynamic-content-section-btn i {
    font-size: 1.25rem;
  }

  .dynamic-content-section-header-card {
    flex-direction: column;
    gap: 0.5rem;
  }

  .dynamic-content-remove-btn {
    margin-left: auto;
  }

  .dynamic-content-textarea {
    min-height: 150px;
    font-size: 0.75rem;
  }

  .dynamic-edit-field {
    font-size: 0.75rem;
    padding: 0.5rem 0.625rem;
  }

  .dynamic-array-item {
    padding: 0.75rem;
  }

  .dynamic-object-field {
    padding: 0.625rem;
    margin: 0.75rem 0;
  }

  .dynamic-object-field > div {
    margin-left: 0.75rem;
  }
}

/* Utility classes used in the component */
.form-label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: #1f2937;
  font-size: 0.875rem;
}

.text-xs {
  font-size: 0.75rem;
}

.text-neutral-500 {
  color: #78716c;
}

.mt-3 {
  margin-top: 0.75rem;
}

.space-y-2 > * + * {
  margin-top: 0.5rem;
}
