/* BEM Methodology for Text File to JSON Converter */

/* Base */
.converter {
  font-family: 'Roboto', 'Open Sans', sans-serif;
  color: #333333;
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
  box-sizing: border-box;
}

/* Apply border-box to all elements */
.converter * {
  box-sizing: border-box;
}

/* Input Section */
.converter__input-section {
  margin-bottom: 24px;
}

.converter__input-container {
  margin-bottom: 12px;
}

.converter__label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 8px;
  color: #6b7280;
}

.converter__textarea {
  width: 100%;
  min-height: 150px;
  padding: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
  font-family: inherit;
  resize: vertical;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.converter__textarea:focus {
  outline: none;
  border-color: #007BFF;
  box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

/* Actions */
.converter__actions {
  display: flex;
  flex-direction: row;
  gap: 12px;
  margin-bottom: 16px;
}

.converter__file-upload {
  position: relative;
  flex: 1;
}

.converter__file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Buttons */
.converter__button {
  font-size: 14px;
  font-weight: 500;
  padding: 10px 16px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: opacity 0.2s, background-color 0.2s;
  white-space: nowrap;
  display: inline-block;
  text-align: center;
  line-height: 1.5;
}

.converter__button:hover {
  opacity: 0.9;
}

.converter__button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.converter__button--primary {
  background-color: #007BFF;
  color: white;
}

.converter__button--secondary {
  background-color: #6C757D;
  color: white;
}

.converter__button--success {
  background-color: #28a745;
  color: white;
}

.converter__button--small {
  font-size: 12px;
  padding: 6px 12px;
  min-width: 100px;
}

#convert-button {
  width: 100%;
  padding: 12px;
}

/* Ensure "Upload Text File" and "Clear All" buttons are the same size */
.converter__actions .converter__button {
  flex: 1;
  padding: 10px 16px;
}

/* Options */
.converter__options {
  display: flex;
  flex-direction: row;
  gap: 16px;
  margin-bottom: 16px;
  background-color: #F8F9FA;
  border-radius: 12px;
  padding: 16px;
}

.converter__option {
  flex: 1;
  min-width: 0;
}

.converter__select {
  width: 100%;
  padding: 10px 30px 10px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background-color: white;
  font-size: 14px;
  color: #333333;
  line-height: 1.5;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236b7280' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  height: 40px;
}

.converter__select:focus {
  outline: none;
  border-color: #007BFF;
  box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

/* Preview Toggle */
.converter__preview-toggle {
  margin-bottom: 16px;
}

.converter__preview-toggle label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #6b7280;
}

/* Preview Section */
.converter__preview-section {
  margin-bottom: 16px;
}

.converter__json-preview {
  width: 100%;
  min-height: 100px;
  max-height: 200px;
  padding: 16px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background-color: #f1f5f9; /* Lighter background to distinguish from output */
  color: #333333;
  font-size: 14px;
  font-family: monospace;
  overflow: auto;
  margin: 0;
  line-height: 1.5;
}

/* Error Message */
.converter__error-message {
  margin-top: 12px;
  padding: 12px;
  background-color: rgba(220, 53, 69, 0.1);
  color: #dc3545;
  border-radius: 8px;
  font-size: 14px;
}

.converter__error-message--hidden {
  display: none;
}

/* Output Section */
.converter__output-section {
  margin-bottom: 24px;
}

.converter__output-section--hidden {
  display: none;
}

.converter__output-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  flex-wrap: wrap;
  gap: 10px;
}

.converter__output-actions {
  display: flex;
  gap: 8px;
}

.converter__json-output {
  width: 100%;
  min-height: 200px;
  max-height: 400px;
  padding: 16px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background-color: #2d2d2d;
  color: #f8f8f2;
  font-size: 14px;
  font-family: monospace;
  overflow: auto;
  margin: 0;
  line-height: 1.5;
}

/* Examples */
.converter__examples {
  padding: 16px;
  background-color: #F8F9FA;
  border-radius: 12px;
}

.converter__examples-title {
  font-size: 16px;
  font-weight: 500;
  margin-top: 0;
  margin-bottom: 16px;
}

.converter__example {
  margin-bottom: 16px;
}

.converter__example:last-child {
  margin-bottom: 0;
}

.converter__example-title {
  font-size: 14px;
  font-weight: 500;
  margin-top: 0;
  margin-bottom: 4px;
}

.converter__example-code {
  padding: 8px;
  background-color: white;
  border-radius: 4px;
  font-size: 12px;
  font-family: monospace;
  overflow-x: auto;
  margin: 0;
  white-space: pre-wrap;
}

/* Responsive adjustments */
@media (max-width: 600px) {
  .converter {
    padding: 10px;
  }
  
  .converter__options {
    flex-direction: column;
    gap: 12px;
  }
  
  .converter__option {
    flex: none;
    width: 100%;
  }
  
  .converter__output-header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .converter__output-actions {
    width: 100%;
    justify-content: space-between;
  }
  
  .converter__button--small {
    flex: 1;
  }
  
  .converter__actions {
    flex-direction: column;
    gap: 8px;
  }
  
  .converter__actions .converter__button {
    width: 100%;
  }
}