/* JSON Formatter Tool - Enhanced Styling */

/* Container fixes */
.json-input-section,
.json-output-section {
  margin: 1.5rem 0;
  background: #fff;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  border: 1px solid #e9ecef;
}

/* Fix textarea and output styling */
.json-textarea {
  width: 100%;
  min-height: 250px;
  padding: 15px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-family: 'Monaco', 'Consolas', 'Courier New', monospace;
  font-size: 14px;
  line-height: 1.6;
  background-color: #fafbfc;
  resize: vertical;
  transition: all 0.3s ease;
  box-sizing: border-box;
}

.json-textarea:focus {
  border-color: #3498db;
  outline: none;
  background-color: #fff;
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

/* JSON Output styling */
.json-output {
  width: 100%;
  min-height: 250px;
  padding: 15px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  background-color: #ffffff;
  font-family: 'Monaco', 'Consolas', 'Courier New', monospace;
  font-size: 14px;
  line-height: 1.6;
  overflow-x: auto;
  white-space: pre-wrap;
  word-wrap: break-word;
  color: #2c3e50;
  box-sizing: border-box;
}

/* Input and Output containers */
.input-container,
.output-container {
  margin-bottom: 15px;
}

/* Input/Output headers */
.input-header,
.output-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 2px solid #eee;
}

.input-header h3,
.output-header h3 {
  margin: 0;
  color: #2c3e50;
  font-size: 18px;
  font-weight: 600;
}

/* Input/Output actions */
.input-actions,
.output-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Status indicator */
.input-status {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding: 10px 15px;
  background-color: #f8f9fa;
  border-radius: 8px;
  border-left: 4px solid #ddd;
  transition: all 0.3s ease;
}

.status-icon {
  font-size: 16px;
  min-width: 20px;
}

.status-text {
  font-size: 14px;
  color: #6c757d;
  font-weight: 500;
}

/* Format options */
.format-options {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  padding: 25px;
  border-radius: 12px;
  margin: 25px 0;
  border: 1px solid #dee2e6;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 25px;
}

.option-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: white;
  padding: 15px;
  border-radius: 8px;
  border: 1px solid #e9ecef;
  transition: all 0.3s ease;
}

.option-group:hover {
  border-color: #3498db;
  box-shadow: 0 2px 8px rgba(52, 152, 219, 0.1);
}

.option-group label {
  font-weight: 600;
  color: #495057;
  font-size: 14px;
  margin-bottom: 5px;
}

.option-group select {
  padding: 10px 12px;
  border: 2px solid #ced4da;
  border-radius: 6px;
  background-color: white;
  font-size: 14px;
  transition: border-color 0.3s ease;
  cursor: pointer;
}

.option-group select:focus {
  border-color: #3498db;
  outline: none;
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.option-group input[type="checkbox"] {
  width: 20px;
  height: 20px;
  transform: scale(1.3);
  cursor: pointer;
  accent-color: #3498db;
}

/* Action buttons */
.action-buttons {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
}

.action-buttons .btn {
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 8px;
  transition: all 0.3s ease;
  cursor: pointer;
  border: 2px solid transparent;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.action-buttons .btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.action-buttons .btn-primary {
  background: linear-gradient(45deg, #3498db, #2980b9);
  color: white;
  border-color: #2980b9;
}

.action-buttons .btn-primary:hover {
  background: linear-gradient(45deg, #2980b9, #3498db);
}

.action-buttons .btn-secondary {
  background: linear-gradient(45deg, #95a5a6, #7f8c8d);
  color: white;
  border-color: #7f8c8d;
}

.action-buttons .btn-secondary:hover {
  background: linear-gradient(45deg, #7f8c8d, #95a5a6);
}

.action-buttons .btn-outline {
  background: white;
  color: #3498db;
  border-color: #3498db;
}

.action-buttons .btn-outline:hover {
  background: #3498db;
  color: white;
}

/* Output info */
.output-info {
  display: flex;
  justify-content: space-around;
  margin-top: 15px;
  padding: 15px;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border-radius: 10px;
  border: 1px solid #dee2e6;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.info-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 10px;
  background: white;
  border-radius: 8px;
  min-width: 80px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.info-item span:first-child {
  font-size: 12px;
  color: #6c757d;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.info-item span:last-child {
  font-size: 16px;
  color: #2c3e50;
  font-weight: 700;
}

/* Button improvements */
.btn-small {
  padding: 8px 16px;
  font-size: 13px;
  border-radius: 6px;
  font-weight: 600;
  transition: all 0.3s ease;
}

.btn-small:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

/* Error display */
.error-display {
  background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
  border: 2px solid #f5c6cb;
  border-radius: 10px;
  padding: 20px;
  margin: 20px 0;
  box-shadow: 0 2px 8px rgba(220, 53, 69, 0.1);
}

.error-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.error-icon {
  font-size: 20px;
  color: #dc3545;
}

.error-header h4 {
  margin: 0;
  color: #721c24;
  font-size: 18px;
  font-weight: 600;
}

.error-content {
  color: #721c24;
  font-size: 14px;
  line-height: 1.5;
}

/* Success states */
.input-status.success {
  border-left-color: #28a745;
  background-color: #d4edda;
}

.input-status.success .status-icon {
  color: #28a745;
}

.input-status.success .status-text {
  color: #155724;
}

.input-status.error {
  border-left-color: #dc3545;
  background-color: #f8d7da;
}

.input-status.error .status-icon {
  color: #dc3545;
}

.input-status.error .status-text {
  color: #721c24;
}

/* Responsive design */
@media (max-width: 768px) {
  .json-input-section,
  .json-output-section {
    padding: 1rem;
    margin: 1rem 0;
  }
  
  .input-header,
  .output-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  
  .input-actions,
  .output-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }
  
  .options-grid {
    grid-template-columns: 1fr;
    gap: 15px;
  }
  
  .option-group {
    padding: 12px;
  }
  
  .action-buttons {
    justify-content: stretch;
    flex-direction: column;
  }
  
  .action-buttons .btn {
    width: 100%;
    margin-bottom: 8px;
  }
  
  .output-info {
    flex-direction: column;
    gap: 10px;
    padding: 12px;
  }
  
  .info-item {
    flex-direction: row;
    justify-content: space-between;
    min-width: auto;
    width: 100%;
  }
  
  .json-textarea,
  .json-output {
    min-height: 200px;
    font-size: 13px;
  }
}

@media (max-width: 480px) {
  .format-options {
    padding: 15px;
  }
  
  .action-buttons .btn {
    padding: 10px 20px;
    font-size: 13px;
  }
  
  .input-actions,
  .output-actions {
    gap: 5px;
  }
  
  .btn-small {
    padding: 6px 12px;
    font-size: 12px;
  }
}

/* JSON syntax highlighting - Enhanced */
.json-output .json-key {
  color: #e74c3c;
  font-weight: 600;
}

.json-output .json-string {
  color: #27ae60;
}

.json-output .json-number {
  color: #f39c12;
  font-weight: 500;
}

.json-output .json-boolean {
  color: #9b59b6;
  font-weight: 600;
}

.json-output .json-null {
  color: #95a5a6;
  font-style: italic;
}

/* Loading state */
.loading .json-output {
  background-color: #f8f9fa;
  position: relative;
  opacity: 0.7;
}

.loading .json-output::after {
  content: "⏳ Processing...";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #6c757d;
  font-style: italic;
  font-size: 16px;
  background: rgba(255,255,255,0.9);
  padding: 10px 20px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Copy feedback - Enhanced */
.copy-feedback {
  position: fixed;
  top: 20px;
  right: 20px;
  background: linear-gradient(45deg, #28a745, #20c997);
  color: white;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
  animation: slideInOut 3s ease-in-out;
}

@keyframes slideInOut {
  0% { transform: translateX(100%); opacity: 0; }
  10% { transform: translateX(0); opacity: 1; }
  90% { transform: translateX(0); opacity: 1; }
  100% { transform: translateX(100%); opacity: 0; }
}

/* Enhanced focus states */
.json-textarea:focus,
.json-output:focus {
  border-color: #3498db;
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.15);
}

/* Tool container specific styling */
[data-tool="json-formatter"] .tool-content {
  background: #fff;
  border-radius: 15px;
  padding: 2rem;
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
  border: 1px solid #e9ecef;
}

/* Smooth transitions for all interactive elements */
* {
  transition: all 0.3s ease;
}

button:active {
  transform: scale(0.98);
}
