/* Minecraft pack.mcmeta Generator Styles */
/* Based on Hytale Pack Manifest Generator patterns */

/* Main Section Styling */
.mcmeta-section {
  margin: 20px 0;
}

.mcmeta-section h1 {
  font-size: 32px;
  margin-bottom: 10px;
  color: #1f2937;
}

.mcmeta-section h2 {
  font-size: 24px;
  margin-bottom: 15px;
  color: #1f2937;
}

/* Two-column container */
.mcmeta-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 20px;
}

/* 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 {
  font-size: 22px;
  margin: 0 0 4px 0;
  color: #374151;
  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: 4px;
  font-weight: 600;
  color: #374151;
  font-size: 14px;
  text-align: center;
}

.input-group .required {
  color: #dc2626;
}

.input-group input[type="text"],
.input-group input[type="number"],
.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="number"]:focus,
.input-group input[type="url"]:focus,
.input-group textarea:focus,
.input-group select:focus {
  outline: none;
  border-color: #3984a7;
}

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

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

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

.pack-format-hint {
  color: #3984a7;
  font-weight: 600;
}

/* Pack Type Toggle */
.pack-type-toggle {
  display: flex;
  border: 2px solid #d1d5db;
  border-radius: 24px;
  overflow: hidden;
  background: #fff;
}

.pack-type-toggle .toggle-btn {
  flex: 1;
  padding: 10px 16px;
  border: none;
  background: transparent;
  font-size: 14px;
  font-weight: 500;
  color: #666;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.pack-type-toggle .toggle-btn.active {
  background: #3984a7;
  color: #fff;
}

.pack-type-toggle .toggle-btn:not(.active):hover {
  background: #f0f8ff;
}

/* Options Group - Section containers */
.options-group {
  background: rgba(0, 0, 0, 0.05);
  border-radius: 16px;
  padding: 10px;
  width: 100%;
  box-sizing: border-box;
}

.options-group.has-entries {
  gap: 8px;
  display: flex;
  flex-direction: column;
}

.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 {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Add/Remove Buttons */
.add-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid #d1d5db;
  background: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  padding: 0;
  flex-shrink: 0;
}

.add-btn svg {
  width: 20px;
  height: 20px;
  stroke-width: 2;
  color: #666;
}

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

.add-btn:hover svg {
  color: #3984a7;
}

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

.remove-btn svg {
  width: 16px;
  height: 16px;
  stroke-width: 2;
  color: #dc2626;
}

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

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

/* Entry Cards */
.entry-card {
  background: rgba(0, 0, 0, 0.08);
  border-radius: 14px;
  padding: 10px;
}

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

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

.entry-title {
  font-weight: 600;
  font-size: 13px;
  color: #374151;
}

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

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

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

.entry-field {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.entry-field label {
  font-size: 11px;
  color: #6b7280;
  margin-bottom: 2px;
  font-weight: 500;
}

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

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

/* Text Component Builder */
.text-component-builder {
  background: rgba(0, 0, 0, 0.05);
  border-radius: 16px;
  padding: 12px;
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tc-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tc-field > label {
  font-size: 11px;
  font-weight: 600;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tc-field input[type="text"] {
  width: 100%;
  padding: 8px 12px;
  border: 2px solid #d1d5db;
  border-radius: 12px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  color: #374151;
  box-sizing: border-box;
}

.tc-field input[type="text"]:focus {
  outline: none;
  border-color: #3984a7;
}

.tc-color-picker {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tc-color-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
}

.tc-color-btn {
  width: 100%;
  aspect-ratio: 1;
  border: 2px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  padding: 0;
  min-width: 24px;
  min-height: 24px;
}

.tc-color-btn:hover {
  transform: scale(1.1);
  z-index: 1;
}

.tc-color-btn.active {
  border-color: #3984a7;
  box-shadow: 0 0 0 2px rgba(57, 132, 167, 0.3);
}

.tc-color-btn-white {
  border: 2px solid #d1d5db;
}

.tc-color-btn-white.active {
  border-color: #3984a7;
}

.tc-color-custom {
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.tc-color-custom input[type="checkbox"] {
  accent-color: #3984a7;
}

.tc-color-custom input[type="color"] {
  width: 32px;
  height: 32px;
  border: 2px solid #d1d5db;
  border-radius: 8px;
  padding: 2px;
  cursor: pointer;
  background: #fff;
}

.tc-color-custom input[type="color"]:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.tc-color-name {
  font-size: 12px;
  color: #3984a7;
  font-weight: 500;
  text-align: center;
}

.tc-formatting {
  display: flex;
  gap: 6px;
  justify-content: center;
}

.tc-format-btn {
  cursor: pointer;
}

.tc-format-btn input {
  display: none;
}

.tc-format-label {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 2px solid #d1d5db;
  border-radius: 8px;
  background: #fff;
  font-size: 16px;
  font-family: Georgia, serif;
  color: #666;
  transition: all 0.15s ease;
}

.tc-format-btn input:checked + .tc-format-label {
  border-color: #3984a7;
  background: #3984a7;
  color: #fff;
}

.tc-format-btn:hover .tc-format-label {
  border-color: #3984a7;
}

.tc-preview {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tc-preview > label {
  font-size: 11px;
  font-weight: 600;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tc-preview-box {
  background: #2d2d2d;
  color: #fff;
  padding: 10px 14px;
  border-radius: 8px;
  font-family: 'Minecraft', 'Segoe UI', sans-serif;
  font-size: 14px;
  text-align: center;
  min-height: 20px;
  text-shadow: 2px 2px 0 #3f3f3f;
}

/* Obfuscated text animation */
@keyframes obfuscate {
  0% { opacity: 1; }
  50% { opacity: 0.5; }
  100% { opacity: 1; }
}

.tc-obfuscated {
  animation: obfuscate 0.1s infinite;
  font-family: monospace;
  letter-spacing: 2px;
}

/* Text component builder responsive */
@media (max-width: 480px) {
  .tc-color-grid {
    grid-template-columns: repeat(8, 1fr);
    gap: 3px;
  }

  .tc-color-btn {
    min-width: 20px;
    min-height: 20px;
  }

  .tc-format-label {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }

  .tc-formatting {
    gap: 4px;
  }
}

/* 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"] {
  accent-color: #3984a7;
  width: 16px;
  height: 16px;
}

/* JSON Editor Container - Light mode like Hytale generator */
.json-editor-container {
  position: sticky;
  top: 80px;
  display: flex;
  border: 2px solid #e9ecef;
  border-radius: 24px;
  overflow: hidden;
  min-height: 180px;
  max-height: calc(100vh - 100px);
  font-family: Consolas, 'Roboto Mono', 'SF Mono', Monaco, 'Cascadia Code', 'Liberation Mono', 'Courier New', monospace;
  background: #fff;
  min-width: 0;
  align-self: flex-start;
}

.line-numbers {
  padding: 16px 8px;
  background-color: #f8f9fa;
  border-right: 1px solid #e5e7eb;
  color: #6b7280;
  font-size: 14px;
  line-height: 1.5;
  text-align: right;
  user-select: none;
  min-width: 40px;
  white-space: pre;
  overflow: hidden;
}

.json-editor-wrapper {
  flex: 1;
  position: relative;
  min-width: 0;
  overflow: auto;
}

.json-highlight {
  margin: 0;
  padding: 16px;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
  color: #1f2937;
  pointer-events: none;
  overflow: visible;
  min-height: 100%;
}

.json-editor-textarea {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  padding: 16px;
  margin: 0;
  border: none;
  background: transparent;
  color: transparent;
  caret-color: #1f2937;
  font-size: 14px;
  line-height: 1.5;
  font-family: inherit;
  resize: none;
  outline: none;
  white-space: pre-wrap;
  word-wrap: break-word;
  box-sizing: border-box;
  overflow: hidden;
}

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

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

/* JSON Syntax Highlighting - Light mode colors */
.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;
}

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

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

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

  .json-editor-container {
    position: relative;
    top: auto;
    max-height: none;
    min-height: 180px;
  }

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

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

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

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

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

/* Smaller screens: Copy full width, Download and Clear half each */
@media (max-width: 610px) {
  .mcmeta-section .converter-buttons-container {
    flex-direction: row;
  }
  .mcmeta-section .converter-buttons-container .converter-button {
    flex: 1 1 100%;
  }
  .mcmeta-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) {
  .mcmeta-section .converter-buttons-container {
    flex-direction: column;
  }
  .mcmeta-section .converter-buttons-container .converter-button,
  .mcmeta-section .converter-buttons-container .converter-button-secondary {
    flex: 1 1 100%;
  }

  .pack-type-toggle {
    flex-direction: column;
  }

  .pack-type-toggle .toggle-btn {
    border-radius: 0;
  }

  .pack-type-toggle .toggle-btn:first-child {
    border-radius: 22px 22px 0 0;
  }

  .pack-type-toggle .toggle-btn:last-child {
    border-radius: 0 0 22px 22px;
  }
}

@media (max-width: 480px) {
  .line-numbers {
    font-size: 13px;
    padding: 16px 6px;
    min-width: 35px;
  }

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

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

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

@media (max-width: 360px) {
  .mcmeta-section h1 {
    font-size: 24px;
  }

  .tool-panel {
    padding: 12px;
    gap: 10px;
  }

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