/**
 * Behavior Editor CSS
 * Styles for the Minecraft behavior editor UI
 */

/* Main layout */
.behavior-editor-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  position: relative;
  z-index: 1;
}

.behavior-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 15px;
}

.behavior-actions {
  display: flex;
  gap: 10px;
}

.behavior-content {
  display: flex;
  height: auto;
  min-height: 300px;
  padding: 0 0 15px 0;
  border-bottom: 1px solid var(--border-color);
}

/* Components panel */
.components-panel {
  width: 40%;
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
}

.components-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 15px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 0;
}

.components-actions {
  display: flex;
  gap: 8px;
}

.components-list {
  flex: 1;
  overflow: visible;
  padding: 10px 15px;
  max-height: 75vh;
  margin-top: 0;
  margin-bottom: 0;
}

.empty-message {
  color: var(--text-muted);
  font-style: italic;
  text-align: center;
  padding: 20px 0;
}

/* Updated component item design */
.component-item {
  padding: 10px 14px;
  margin-bottom: 8px;
  background-color: var(--bg-secondary, #2d2d2d);
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color, #444);
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  transition: background-color 0.2s ease;
}

.component-item:hover {
  background-color: var(--bg-hover, #383838);
}

.component-name-container {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 150px;
  flex: 0 0 auto;
}

.component-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary, #e0e0e0);
}

.component-help {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.1);
  color: var(--text-secondary, #aaa);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  cursor: help;
  transition: background-color 0.2s;
  position: relative;
}

.component-help:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

.component-help-tooltip {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translate(-50%, -100%);
  width: 220px;
  background-color: #333;
  color: #fff;
  text-align: center;
  padding: 8px 10px;
  border-radius: 6px;
  z-index: 100;
  font-size: 12px;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
  line-height: 1.4;
}

.component-help:hover .component-help-tooltip {
  opacity: 1;
  visibility: visible;
}

/* Arrow for tooltip */
.component-help-tooltip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -5px;
  border-width: 5px;
  border-style: solid;
  border-color: #333 transparent transparent transparent;
}

.component-value {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 5px;
}

.remove-component {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background-color: rgba(255, 0, 0, 0.1);
  color: rgba(255, 255, 255, 0.7);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: all 0.2s;
  margin-left: 8px;
}

.remove-component:hover {
  background-color: rgba(255, 0, 0, 0.3);
  color: white;
}

/* JSON preview */
.json-preview-panel {
  width: 60%;
  display: flex;
  flex-direction: column;
  padding: 10px;
}

.json-display {
  flex: 1;
  overflow: auto;
  background-color: var(--bg-tertiary);
  border-radius: 4px;
  padding: 10px;
  margin: 0;
  font-family: monospace;
  font-size: 0.9em;
  white-space: pre-wrap;
  scroll-behavior: auto;
  overscroll-behavior: contain;
}

/* Add the json-components style for consistent display */
.json-components {
  white-space: nowrap;
  overflow-x: auto;
  display: block;
}

/* JSON syntax highlighting */
.json-key {
  color: var(--color-accent);
}

.json-string {
  color: var(--color-green);
}

.json-number {
  color: var(--color-orange);
}

.json-boolean {
  color: var(--color-purple);
}

.json-null {
  color: var(--color-red);
}

/* Editor panel */
.editor-container {
  padding: 15px;
  overflow-y: auto;
}

.editor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.editor-content {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

/* Field container and editor styles */
.field-container {
  margin-bottom: 20px;
  padding: 10px;
  border-radius: 4px;
  background-color: var(--bg-secondary);
}

.field-label {
  display: block;
  font-weight: bold;
  margin-bottom: 5px;
}

.field-description {
  font-size: 0.9em;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.field-input {
  width: 100%;
  padding: 8px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
}

.field-input:focus {
  border-color: var(--accent-color, #2196F3);
  outline: none;
}

/* Editor buttons */
.editor-buttons {
  display: flex;
  justify-content: flex-end;
  margin-top: 20px;
  padding-top: 15px;
  border-top: 1px solid var(--border-color);
}

.save-btn {
  padding: 8px 16px;
  background-color: var(--accent-color, #2196F3);
  color: white;
  border: none;
  border-radius: 4px;
  font-weight: bold;
  cursor: pointer;
  transition: background-color 0.2s;
}

.save-btn:hover {
  background-color: var(--accent-hover, #0b7dda);
}

/* Component add dialog */
.modal.component-dialog-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0);
  z-index: 10000;
  overflow: auto;
  transition: background-color 0.3s ease-in-out;
}

.modal.component-dialog-modal.show {
  display: block;
  background-color: rgba(0, 0, 0, 0.85);
}

.modal-content {
  position: relative;
  background-color: #121212;
  margin: 50px auto;
  padding: 20px;
  width: 80%;
  max-width: 800px;
  border-radius: 8px;
  max-height: 80vh;
  overflow-y: auto;
  z-index: 10001;
  opacity: 0;
  transform: translateY(-20px);
  transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out;
}

.modal.component-dialog-modal.show .modal-content {
  opacity: 1;
  transform: translateY(0);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  border-bottom: 1px solid #333;
  padding-bottom: 10px;
}

.modal-header h3 {
  margin: 0;
  color: #e0e0e0;
}

.close-modal-btn {
  background: none;
  border: none;
  font-size: 24px;
  color: #e0e0e0;
  cursor: pointer;
  padding: 0;
  margin: 0;
  transition: color 0.2s;
}

.close-modal-btn:hover {
  color: #fff;
}

.component-category {
  margin-bottom: 20px;
}

.component-category h4 {
  color: #e0e0e0;
  margin: 0 0 10px 0;
  border-bottom: 1px solid #333;
  padding-bottom: 5px;
}

.category-components {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 10px;
}

.component-option {
  background-color: #1e1e1e;
  border-radius: 4px;
  padding: 10px;
  cursor: pointer;
  transition: background-color 0.2s;
  border: 1px solid #444;
  opacity: 1;
}

.component-option:hover {
  background-color: #2a2a2a;
}

.component-option.disabled {
  background-color: #191919;
  cursor: not-allowed;
  opacity: 0.6;
}

.component-option-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 5px;
}

.component-option-name {
  font-weight: bold;
  color: #e0e0e0;
}

.component-status {
  font-size: 12px;
  color: #888;
  background-color: #222;
  padding: 2px 5px;
  border-radius: 3px;
}

.component-option-desc {
  font-size: 12px;
  color: #aaa;
}

/* Components Panel Styling */
.components-panel {
  background-color: #2c2c2c;
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 15px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.components-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  border-bottom: 1px solid #444;
  padding-bottom: 10px;
}

.components-header h4 {
  margin: 0;
  color: #e0e0e0;
}

.small-btn {
  background-color: #6200ee;
  color: white;
  border: none;
  border-radius: 4px;
  padding: 5px 10px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background-color 0.3s;
}

.small-btn:hover {
  background-color: #3700b3;
}

.small-btn:disabled {
  background-color: #444;
  cursor: not-allowed;
  opacity: 0.7;
}

.components-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 400px;
  overflow-y: auto;
}

.empty-message {
  color: #888;
  text-align: center;
  font-style: italic;
  padding: 10px;
}

.component-item {
  background-color: #383838;
  border-radius: 4px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border: 1px solid #444;
  animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.component-name-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.component-name {
  font-weight: bold;
  color: #e0e0e0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.remove-component {
  background-color: #d32f2f;
  color: white;
  border: none;
  border-radius: 4px;
  width: 24px;
  height: 24px;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.component-value {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Properties styling */
.object-properties-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.property-item {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.property-label {
  font-size: 0.8rem;
  color: #aaa;
}

.property-text,
.property-number,
.property-select {
  background-color: #222;
  border: 1px solid #444;
  border-radius: 4px;
  padding: 5px 8px;
  color: #e0e0e0;
  font-size: 0.9rem;
}

.property-text:focus,
.property-number:focus,
.property-select:focus {
  border-color: #6200ee;
  outline: none;
}

/* Toggle switch for boolean properties */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 24px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #444;
  transition: .4s;
  border-radius: 24px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}

input:checked + .toggle-slider {
  background-color: #6200ee;
}

input:checked + .toggle-slider:before {
  transform: translateX(26px);
}

.toggle-state {
  margin-left: 10px;
  color: #aaa;
  font-size: 0.8rem;
}

/* Number input container with +/- buttons */
.number-input-container {
  display: flex;
  align-items: center;
}

.number-btn {
  width: 24px;
  height: 24px;
  background-color: #444;
  border: none;
  color: #e0e0e0;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.number-input {
  background-color: #222;
  border: 1px solid #444;
  color: #e0e0e0;
  width: 60px;
  text-align: center;
  padding: 3px 0;
  /* Hide default spinner arrows */
  -moz-appearance: textfield;
}

/* Hide spinner for Chrome, Safari, Edge, Opera */
.number-input::-webkit-outer-spin-button,
.number-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Also hide spinner arrows in property number inputs */
.property-number {
  width: 80px;
  /* Hide default spinner arrows */
  -moz-appearance: textfield;
}

/* Hide spinner for Chrome, Safari, Edge, Opera in property inputs */
.property-number::-webkit-outer-spin-button,
.property-number::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Help icon */
.help-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background-color: #555;
  color: white;
  font-size: 12px;
  margin-left: 6px;
  cursor: help;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .behavior-content {
    flex-direction: column;
    height: auto;
  }
  
  .components-panel,
  .json-preview-panel {
    width: 100%;
    height: 250px;
  }
  
  .components-panel {
    border-right: none;
    border-bottom: 1px solid var(--border-color);
  }
  
  .category-components {
    grid-template-columns: 1fr;
  }
}

/* Add these new styles for the interactive components */

/* Full width panel */
.components-panel.full-width {
  width: 100%;
  border-right: none;
}

/* Text input */
.text-input {
  width: 100%;
  max-width: 180px;
  padding: 4px 6px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
}

.text-input:focus {
  border-color: var(--accent-color, #2196F3);
  outline: none;
}

/* Object properties */
.object-summary {
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.edit-object-btn {
  padding: 6px 12px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  color: var(--text-primary);
  cursor: pointer;
}

.edit-object-btn:hover {
  background-color: var(--bg-hover);
}

/* Help icon styling */
.help-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background-color: var(--bg-tertiary);
  color: var(--text-secondary);
  font-size: 12px;
  cursor: help;
  transition: background-color 0.2s;
  flex-shrink: 0;
}

.help-icon:hover {
  background-color: var(--accent-color, #2196F3);
  color: white;
}

/* Inline property editing */
.object-properties-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 8px;
}

.property-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.property-checkbox {
  width: 20px;
  height: 20px;
}

.property-number,
.property-text,
.property-select {
  padding: 6px 8px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background-color: var(--bg-secondary);
  color: var(--text-primary);
}

.property-number {
  width: 80px;
}

.property-text {
  width: 100%;
}

.property-select {
  width: 100%;
} 