/* Hytale Pack Manifest Generator Styles */
/* Follows Pixel Art Tag Generator styling patterns */

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

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

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

/* Tool Panel Style - Island containers (matches .tool-panel) */
.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 - matches pixel art tag generator */
.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;
}

.input-group .hint {
  display: block;
  font-size: 12px;
  color: #888;
  margin-top: 6px;
  text-align: center;
}

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

/* Options Group - Visual grouping for related controls (matches pixel art) */
.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;
}

.options-group-label .required {
  color: #dc2626;
}

.options-group .hint {
  display: block;
  font-size: 12px;
  color: #888;
  margin-top: 4px;
  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;
}

.label-row label {
  margin-bottom: 0;
}

/* Add Button - matches quantity-btn style */
.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;
}

/* Author & Dependency Entry - matches color-entry style */
.entry-card {
  background: rgba(0, 0, 0, 0.08);
  padding: 10px;
  border-radius: 14px;
  min-width: 0;
  overflow: hidden;
}

.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(3, 1fr);
  gap: 8px;
  min-width: 0;
}

.entry-fields.two-col {
  grid-template-columns: 2fr 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 {
  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 {
  outline: none;
  border-color: #3984a7;
}

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

/* Checkbox Group */
.checkbox-group {
  margin-top: 4px;
  margin-bottom: 4px;
}

.checkbox-group label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  font-weight: 500;
  color: #666;
  font-size: 14px;
}

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

/* JSON Editor Container - matches json-editor-container */
.json-editor-container {
  position: relative;
  display: flex;
  border: 2px solid #e9ecef;
  border-radius: 24px;
  background: #ffffff;
  overflow: hidden;
  transition: border-color 0.2s ease;
  min-height: 300px;
  min-width: 0;
}

/* Line Numbers - matches JSON formatter */
.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 - overlay container */
.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;
}

/* 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 - matches pixel art tag generator breakpoints */
@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 {
    min-height: 250px;
  }

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

  .entry-fields.two-col {
    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;
  }
}

@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;
  }
}
