/* Minecraft Bedrock Manifest Generator Styles */
/* Based on Hytale Pack Manifest Generator styling */

.manifest-section {
  margin: 20px 0;
}

.manifest-section h2 {
  margin-bottom: 20px;
  font-size: 24px;
  color: #2c3e50;
}

/* Main Container - 50/50 Split Layout */
.manifest-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}

/* Tool Panel Style - Island containers */
.tool-panel {
  background: #f8f9fa;
  border: 2px solid #e9ecef;
  border-radius: 24px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  min-width: 0;
  overflow: hidden;
}

.tool-panel h3 {
  margin: 0;
  font-size: 20px;
  color: #333;
  font-weight: bold;
  text-align: center;
}

/* Form Elements */
.input-group {
  margin-bottom: 0;
  min-width: 0;
  overflow: hidden;
  width: 100%;
  max-width: none;
  margin-left: 0;
  margin-right: 0;
}

.input-group label {
  display: block;
  margin-bottom: 5px;
  font-weight: 500;
  color: #666;
  font-size: 14px;
  text-align: center;
}

.input-group input[type="text"],
.input-group input[type="url"],
.input-group textarea,
.input-group select {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid #d1d5db;
  border-radius: 24px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  color: #374151;
  transition: border-color 0.2s ease;
  box-sizing: border-box;
}

.input-group input[type="text"]:focus,
.input-group input[type="url"]:focus,
.input-group textarea:focus,
.input-group select:focus {
  outline: none;
  border-color: #3984a7;
}

.input-group input::placeholder,
.input-group textarea::placeholder {
  color: #9ca3af;
}

.input-group textarea {
  resize: vertical;
  min-height: 60px;
}

/* Required field indicator */
.input-group label .required,
.entry-field label .required,
.options-group-label .required {
  color: #dc2626;
}

/* Options Group */
.options-group {
  background: rgba(0, 0, 0, 0.05);
  border-radius: 16px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  width: 100%;
  box-sizing: border-box;
}

.options-group.has-entries {
  gap: 8px;
}

.options-group-label {
  font-size: 11px;
  font-weight: 600;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0;
  text-align: center;
}

/* Label row with Add button */
.label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.options-group.has-entries .label-row {
  margin-bottom: 6px;
}

/* Add Button */
.add-btn {
  padding: 0;
  border: 2px solid #d1d5db;
  border-radius: 50%;
  background: #fff;
  color: #666;
  font-size: 18px;
  font-weight: bold;
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.add-btn:hover {
  border-color: #3984a7;
  background: #f0f8ff;
  color: #3984a7;
}

.add-btn svg {
  width: 18px;
  height: 18px;
  display: block;
  pointer-events: none;
  flex-shrink: 0;
  stroke: currentColor;
  stroke-width: 2;
}

/* Entry Card */
.entry-card {
  background: rgba(0, 0, 0, 0.08);
  padding: 10px;
  border-radius: 14px;
  min-width: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.entry-card + .entry-card {
  margin-top: 8px;
}

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

.entry-title {
  font-size: 12px;
  color: #333;
  font-weight: 600;
}

.remove-btn {
  padding: 0;
  border: 2px solid #dc2626;
  border-radius: 50%;
  background: #fff;
  color: #dc2626;
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.remove-btn:hover {
  background: #dc2626;
  color: #fff;
}

.remove-btn svg {
  width: 14px;
  height: 14px;
  display: block;
  pointer-events: none;
  stroke: currentColor;
  stroke-width: 2;
}

.entry-fields {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  min-width: 0;
}

.entry-fields.two-col {
  grid-template-columns: 1fr 1fr;
}

.entry-fields.three-col {
  grid-template-columns: repeat(3, 1fr);
}

.entry-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  overflow: hidden;
}

.entry-field label {
  font-size: 11px;
  color: #666;
  font-weight: 500;
  text-align: center;
  margin-bottom: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.entry-field input,
.entry-field select {
  width: 100%;
  padding: 8px 10px;
  border: 2px solid #d1d5db;
  border-radius: 12px;
  font-size: 13px;
  background-color: #fff;
  color: #374151;
  transition: border-color 0.2s ease;
  box-sizing: border-box;
  min-width: 0;
  text-align: center;
}

.entry-field input:focus,
.entry-field select:focus {
  outline: none;
  border-color: #3984a7;
}

.entry-field input::placeholder {
  color: #9ca3af;
}

.entry-field .hint {
  font-size: 10px;
  color: #888;
  text-align: center;
  margin-top: 2px;
}

/* UUID Field with regenerate button */
.uuid-field .uuid-input-wrapper {
  display: flex;
  gap: 6px;
  align-items: center;
}

.uuid-field .uuid-input-wrapper input {
  flex: 1;
  min-width: 0;
  font-family: Consolas, 'Roboto Mono', monospace;
  font-size: 11px;
  text-align: left;
  padding: 8px;
}

.uuid-btn {
  padding: 0;
  border: 2px solid #d1d5db;
  border-radius: 50%;
  background: #fff;
  color: #666;
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.uuid-btn:hover {
  border-color: #3984a7;
  background: #f0f8ff;
  color: #3984a7;
}

.uuid-btn svg {
  width: 16px;
  height: 16px;
  display: block;
  pointer-events: none;
  stroke: currentColor;
}

/* Capabilities Grid */
.capabilities-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 8px;
}

.capability-checkbox {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
  font-size: 13px;
  color: #666;
  padding: 6px 10px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 10px;
  transition: background-color 0.2s ease;
}

.capability-checkbox:hover {
  background: rgba(0, 0, 0, 0.08);
}

.capability-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: #3984a7;
}

/* JSON Editor Container */
.json-editor-container {
  position: sticky;
  top: 80px; /* Account for navbar */
  display: flex;
  border: 2px solid #e9ecef;
  border-radius: 24px;
  background: #ffffff;
  overflow: hidden;
  transition: border-color 0.2s ease;
  min-height: 300px;
  max-height: calc(100vh - 100px); /* Leave space for navbar and padding */
  min-width: 0;
  align-self: flex-start; /* Required for sticky to work in grid */
}

/* Line Numbers */
.line-numbers {
  padding: 16px 8px;
  background-color: #f8f9fa;
  border-right: 1px solid #e5e7eb;
  color: #6b7280;
  font-family: Consolas, 'Roboto Mono', 'SF Mono', Monaco, 'Cascadia Code', 'Liberation Mono', 'Courier New', monospace;
  font-size: 14px;
  line-height: 1.5;
  text-align: right;
  user-select: none;
  white-space: pre;
  min-width: 40px;
  box-sizing: border-box;
  overflow-y: auto;
  overflow-x: hidden;
}

/* JSON Editor Wrapper */
.json-editor-wrapper {
  flex: 1;
  position: relative;
  min-width: 0;
  overflow: auto;
}

/* Syntax highlighted background layer */
.json-highlight {
  margin: 0;
  padding: 16px;
  font-family: Consolas, 'Roboto Mono', 'SF Mono', Monaco, 'Cascadia Code', 'Liberation Mono', 'Courier New', monospace;
  font-size: 14px;
  line-height: 1.5;
  color: #2c3e50;
  background: transparent;
  white-space: pre;
  tab-size: 2;
  -moz-tab-size: 2;
  pointer-events: none;
  min-height: 100%;
}

/* JSON Syntax Highlighting */
.json-highlight .json-key {
  color: #0550ae;
}

.json-highlight .json-string {
  color: #0a3069;
}

.json-highlight .json-number {
  color: #0550ae;
}

.json-highlight .json-boolean {
  color: #cf222e;
}

.json-highlight .json-null {
  color: #cf222e;
}

/* Editable textarea layer */
.json-editor-textarea {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 16px;
  font-family: Consolas, 'Roboto Mono', 'SF Mono', Monaco, 'Cascadia Code', 'Liberation Mono', 'Courier New', monospace;
  font-size: 14px;
  line-height: 1.5;
  color: transparent;
  caret-color: #2c3e50;
  background: transparent;
  white-space: pre;
  overflow: hidden;
  tab-size: 2;
  -moz-tab-size: 2;
  border: none;
  outline: none;
  resize: none;
  min-width: 0;
  box-sizing: border-box;
}

.json-editor-textarea.json-error {
  background: rgba(220, 38, 38, 0.05);
}

.json-editor-container:has(.json-error) {
  border-color: #dc2626;
}

/* Button container positioning */
.manifest-section .converter-buttons-container {
  margin-top: 20px;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.manifest-section .converter-buttons-container .converter-button,
.manifest-section .converter-buttons-container .converter-button-secondary {
  flex: 1;
  margin-right: 0;
  margin-bottom: 0;
  justify-content: center;
}

/* Dependency type select styling */
.dep-type-wrapper {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.dep-type-wrapper label {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  font-size: 12px;
  color: #666;
}

.dep-type-wrapper input[type="radio"] {
  accent-color: #3984a7;
}

/* UUID dependency fields grid */
.uuid-dep-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

/* Module dependency fields */
.module-dep-fields {
  margin-bottom: 8px;
}

/* Checkbox row for inline checkboxes */
.checkbox-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
}

.inline-checkbox {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 13px;
  color: #666;
  user-select: none;
}

.inline-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: #3984a7;
}

.inline-checkbox.compact {
  font-size: 12px;
}

.inline-checkbox.compact input[type="checkbox"] {
  width: 14px;
  height: 14px;
}

/* Add button group for settings */
.add-btn-group {
  display: flex;
  gap: 4px;
}

.add-btn.small {
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
  font-size: 12px;
  font-weight: 600;
}

.add-btn.small span {
  font-size: 12px;
}

/* Setting type badge */
.setting-type-badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  margin-left: 8px;
}

.setting-type-badge.label {
  background: #e0e7ff;
  color: #4338ca;
}

.setting-type-badge.toggle {
  background: #d1fae5;
  color: #047857;
}

.setting-type-badge.slider {
  background: #fef3c7;
  color: #b45309;
}

/* Version badge for format-version-specific features */
.version-badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 600;
  text-transform: lowercase;
  margin-left: 8px;
  background: #e0e7ff;
  color: #4338ca;
  vertical-align: 1px;
  white-space: nowrap;
  letter-spacing: 0;
}

/* Smaller screens: Copy full width, Download and Clear half each */
@media (max-width: 610px) {
  .manifest-section .converter-buttons-container {
    flex-direction: row;
  }

  .manifest-section .converter-buttons-container .converter-button {
    flex: 1 1 100%;
  }

  .manifest-section .converter-buttons-container .converter-button-secondary {
    flex: 1 1 calc(50% - 6px);
    min-width: 0;
  }
}

/* Very small screens: all buttons stacked */
@media (max-width: 420px) {
  .manifest-section .converter-buttons-container {
    flex-direction: column;
  }

  .manifest-section .converter-buttons-container .converter-button,
  .manifest-section .converter-buttons-container .converter-button-secondary {
    flex: 1 1 100%;
  }
}

/* Responsive Design */
@media (max-width: 768px) {
  .manifest-container {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .tool-panel {
    padding: 15px;
    gap: 15px;
  }

  .tool-panel h3 {
    font-size: 20px;
  }

  .input-group,
  .input-group input,
  .input-group textarea,
  .options-group {
    width: 100%;
  }

  .json-editor-container {
    position: relative; /* Disable sticky on mobile */
    top: auto;
    max-height: none;
    min-height: 250px;
  }

  .entry-fields {
    grid-template-columns: 1fr;
  }

  .entry-fields.two-col,
  .entry-fields.three-col {
    grid-template-columns: 1fr;
  }

  .capabilities-grid {
    grid-template-columns: 1fr;
  }

  .uuid-dep-fields {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .tool-panel {
    padding: 12px;
    gap: 12px;
  }

  .tool-panel h3 {
    font-size: 18px;
  }

  .input-group label {
    font-size: 13px;
  }

  .input-group input[type="text"],
  .input-group input[type="url"],
  .input-group textarea,
  .input-group select {
    padding: 10px;
    font-size: 14px;
  }

  .add-btn {
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
  }

  .add-btn svg {
    width: 16px;
    height: 16px;
  }

  .entry-field input {
    padding: 6px 8px;
    font-size: 12px;
  }

  .line-numbers {
    font-size: 13px;
    padding: 16px 6px;
    min-width: 35px;
  }

  .json-highlight,
  .json-editor-textarea {
    font-size: 13px;
  }

  .uuid-field .uuid-input-wrapper input {
    font-size: 10px;
  }
}

@media (max-width: 360px) {
  .tool-panel {
    padding: 10px;
    gap: 10px;
  }

  .tool-panel h3 {
    font-size: 17px;
  }

  .input-group input[type="text"],
  .input-group input[type="url"],
  .input-group textarea,
  .input-group select {
    padding: 8px;
    font-size: 13px;
  }

  .add-btn {
    width: 28px;
    height: 28px;
    min-width: 28px;
    min-height: 28px;
  }

  .add-btn svg {
    width: 14px;
    height: 14px;
  }

  .uuid-btn {
    width: 28px;
    height: 28px;
    min-width: 28px;
    min-height: 28px;
  }
}
