/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Trebuchet MS", Helvetica, sans-serif;
  min-height: 100vh;
  padding: 0;
}

/* Navigation */
.navbar {
  backdrop-filter: blur(10px);
  padding: 15px 0;
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
}

.nav-brand h2 {
  font-size: 1.5rem;
}

.nav-links {
  display: flex;
  gap: 20px;
}

.nav-link {
  color: rgba(0, 0, 0, 0.8);
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 6px;
  transition: all 0.3s ease;
  font-weight: 600;
}

.nav-link:hover,
.nav-link.active {
  background: rgba(52, 152, 219, 0.2);
  color: #3498db;
}

/* Main Container */
.container {
  max-width: 1200px;
  margin: 20px auto;
  padding: 0 20px;
}

.tool-container {
  display: none;
  background: white;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  margin-bottom: 20px;
}

.tool-container.active {
  display: block;
}

/* Headers */
.header {
  background: rgba(39, 174, 96, 0.2);
  color: #229954;
  padding: 30px;
  text-align: center;
}

.header h1 {
  font-size: 2.5rem;
  margin-bottom: 10px;
}

.header p {
  font-size: 1.1rem;
  opacity: 0.9;
}

/* Content */
.content {
  padding: 40px;
}

/* Labels and Form Elements */
.label {
  display: block;
  font-weight: 600;
  color: #2c3e50;
  margin-bottom: 10px;
  font-size: 1.1rem;
}

.input-textarea,
.output-textarea {
  width: 100%;
  min-height: 200px;
  padding: 15px;
  border: 2px solid #e1e8ed;
  border-radius: 8px;
  font-family: "Courier New", monospace;
  font-size: 14px;
  line-height: 1.5;
  resize: vertical;
  transition: border-color 0.3s ease;
}

.input-textarea:focus,
.output-textarea:focus {
  outline: none;
  border-color: #3498db;
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.output-textarea {
  background: #f8f9fa;
  min-height: 150px;
}

.select-input {
  width: 100%;
  padding: 10px 15px;
  border: 2px solid #e1e8ed;
  border-radius: 6px;
  font-size: 14px;
  background: white;
  transition: border-color 0.3s ease;
}

.select-input:focus {
  outline: none;
  border-color: #3498db;
}

.custom-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font-size: 14px;
  margin-top: 5px;
}

/* Buttons */
.convert-btn {
  background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
  color: white;
  border: none;
  padding: 15px 30px;
  font-size: 1.1rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.2s ease;
  margin: 20px 0;
  display: block;
}

.convert-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(52, 152, 219, 0.3);
}

.convert-btn.secondary {
  background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
  margin: 0;
  display: inline-block;
  margin-right: 10px;
}

.convert-btn.secondary:hover {
  box-shadow: 0 5px 15px rgba(108, 117, 125, 0.3);
}

.copy-btn {
  background: linear-gradient(135deg, #27ae60 0%, #229954 100%);
  color: white;
  border: none;
  padding: 10px 20px;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  margin-top: 10px;
  transition: transform 0.2s ease;
}

.copy-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(39, 174, 96, 0.3);
}

.copy-btn.small {
  padding: 6px 12px;
  font-size: 12px;
  margin: 0;
}

/* Examples */
.example {
  background: #e8f4fd;
  border-left: 4px solid #3498db;
  padding: 15px;
  margin-bottom: 20px;
  border-radius: 0 8px 8px 0;
}

.example-title {
  font-weight: 600;
  color: #2c3e50;
  margin-bottom: 8px;
}

.example-text {
  font-family: "Courier New", monospace;
  font-size: 13px;
  color: #555;
}

/* Sections */
.input-section,
.output-section {
  margin-bottom: 20px;
}

.output-section {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 20px;
  border: 1px solid #e1e8ed;
}

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

.section-header .label {
  margin: 0;
}

/* Delimiter Converter Specific */
.tool-row {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 20px;
  margin-bottom: 20px;
}

.delimiter-controls {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.control-group {
  background: #f8f9fa;
  padding: 15px;
  border-radius: 8px;
  border: 1px solid #e1e8ed;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #4a5568;
  margin-bottom: 8px;
}

/* Text Compare Specific */
.compare-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

.compare-section {
  display: flex;
  flex-direction: column;
}

.compare-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 8px;
  flex-wrap: wrap;
  gap: 15px;
}

.options-group {
  display: flex;
  gap: 15px;
  align-items: center;
  flex-wrap: wrap;
}

.actions-group {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.compare-results {
  margin-top: 20px;
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
  padding: 20px;
  background: #f8f9fa;
  border-radius: 8px;
  border: 1px solid #e1e8ed;
}

.results-info h3 {
  color: #2c3e50;
  margin: 0 0 10px 0;
  font-size: 18px;
}

.results-actions {
  display: flex;
  gap: 10px;
}

.diff-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 400px;
  border: 1px solid #e1e8ed;
  border-radius: 8px;
  overflow: hidden;
}

.diff-section {
  border-right: 1px solid #e1e8ed;
}

.diff-section:last-child {
  border-right: none;
}

.diff-section h4 {
  padding: 12px 20px;
  background: #f8f9fa;
  border-bottom: 1px solid #e1e8ed;
  font-size: 14px;
  font-weight: 600;
  color: #4a5568;
  margin: 0;
}

.diff-output {
  font-family: "Monaco", "Menlo", "Ubuntu Mono", "Consolas", "Courier New",
    monospace;
  font-size: 13px;
  line-height: 1.4;
  max-height: 600px;
  overflow: auto;
  background: #fafbfc;
}

.diff-line {
  display: flex;
  min-height: 20px;
  position: relative;
}

.line-number {
  flex-shrink: 0;
  width: 50px;
  padding: 0 8px;
  text-align: right;
  color: #8e8e93;
  background: #f6f8fa;
  border-right: 1px solid #e1e8ed;
  font-size: 12px;
  line-height: 20px;
  user-select: none;
  font-weight: normal;
}

.line-content {
  flex: 1;
  padding: 0 12px;
  line-height: 20px;
  white-space: pre;
  word-break: break-all;
  overflow-wrap: break-word;
}

.diff-line.added {
  background: #e6ffed;
}

.diff-line.added .line-number {
  background: #cdffd8;
  color: #24292e;
}

.diff-line.added .line-content {
  background: #e6ffed;
}

.diff-line.removed {
  background: #ffeef0;
}

.diff-line.removed .line-number {
  background: #ffdce0;
  color: #24292e;
}

.diff-line.removed .line-content {
  background: #ffeef0;
}

.diff-line.modified {
  background: #fff8c5;
}

.diff-line.modified .line-number {
  background: #ffec99;
  color: #24292e;
}

.diff-line.modified .line-content {
  background: #fff8c5;
}

.diff-line.equal .line-number {
  color: #8e8e93;
}

.diff-line.equal .line-content {
  color: #24292e;
}

.diff-line.empty {
  background: #f6f8fa;
  color: #8e8e93;
}

.diff-line.empty .line-content {
  color: #8e8e93;
  font-style: italic;
}

/* Character-level highlighting */
.char-added {
  background: rgba(40, 167, 69, 0.4);
  padding: 1px 2px;
  border-radius: 2px;
}

.char-removed {
  background: rgba(220, 53, 69, 0.4);
  padding: 1px 2px;
  border-radius: 2px;
  text-decoration: line-through;
}

.char-modified {
  background: rgba(255, 193, 7, 0.4);
  padding: 1px 2px;
  border-radius: 2px;
  font-weight: bold;
}

/* Responsive Design */
@media (max-width: 768px) {
  .nav-container {
    flex-direction: column;
    gap: 15px;
  }

  .nav-links {
    flex-wrap: wrap;
    justify-content: center;
  }

  .header h1 {
    font-size: 2rem;
  }

  .content {
    padding: 20px;
  }

  .tool-row {
    grid-template-columns: 1fr;
    gap: 15px;
  }

  .compare-container,
  .diff-container {
    grid-template-columns: 1fr;
    gap: 15px;
  }

  .results-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .compare-options {
    flex-direction: column;
    gap: 10px;
  }

  .actions-group {
    justify-content: center;
    width: 100%;
  }

  .options-group {
    justify-content: center;
    width: 100%;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 10px;
  }

  .content {
    padding: 15px;
  }

  .header {
    padding: 20px 15px;
  }
}
