/**
 * Broken JSON Fixer - Stylesheet
 * Strict adherence to MAF Labs design system (maflabs.online).
 * Light theme only, Outfit + Inter typography, responsive side-by-side layout.
 */

:root {
  --bg: #ffffff;
  --bg-glow: #e8eeff;
  --heading: #0f172a;
  --body: #475569;
  --muted: #64748b;
  --brand-gradient: linear-gradient(90deg, #2563eb, #7c3aed);
  --badge-bg: #eff6ff;
  --badge-border: #bfdbfe;
  --badge-text: #1d4ed8;
  --card-border: #e2e8f0;
  --card-radius: 12px;
  --card-shadow: 0 4px 24px rgba(15, 23, 42, 0.06);
  --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --code-font: 'JetBrains Mono', 'Fira Code', 'SF Mono', Menlo, Consolas, Monaco, monospace;
  --focus-ring: 0 0 0 4px rgba(37, 99, 235, 0.15);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  min-height: 100%;
}

body {
  background-color: var(--bg);
  background-image: radial-gradient(circle at 12% 10%, var(--bg-glow) 0%, rgba(255, 255, 255, 0) 45%);
  background-repeat: no-repeat;
  color: var(--body);
  font-family: var(--font-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  display: flex;
  flex-direction: column;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Header */
header {
  width: 100%;
  max-width: 1380px;
  margin: 0 auto;
  padding: 18px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(226, 232, 240, 0.8);
}

.logo {
  font-family: var(--font-heading);
  font-size: 24px;
  font-weight: 800;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  letter-spacing: -0.5px;
}

.logo-maf {
  color: #0f172a;
}

.logo-labs {
  background: var(--brand-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

nav {
  display: flex;
  align-items: center;
  gap: 22px;
}

nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: color 0.15s ease;
}

nav a:hover {
  color: var(--heading);
}

nav a.nav-highlight {
  color: #2563eb;
  font-weight: 600;
}

/* Nav Dropdown */
.nav-dropdown {
  position: relative;
  display: inline-block;
}

.nav-dropdown-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border-radius: 6px;
  transition: all 0.15s ease;
}

.nav-dropdown-btn:hover,
.nav-dropdown:hover .nav-dropdown-btn {
  color: var(--heading);
  background: rgba(241, 245, 249, 0.8);
}

.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 1000;
  min-width: 310px;
  background: #ffffff;
  border: 1px solid var(--card-border);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.12);
  padding: 8px;
  margin-top: 4px;
}

.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu {
  display: block;
  animation: dropdownFade 0.18s ease-out;
}

@keyframes dropdownFade {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.dropdown-item {
  display: flex !important;
  flex-direction: column;
  padding: 9px 12px;
  border-radius: 8px;
  text-decoration: none !important;
  transition: background 0.15s ease;
}

.dropdown-item:hover {
  background: #f8fafc;
}

.dropdown-item-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--heading);
  line-height: 1.3;
}

.dropdown-item-desc {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 2px;
  line-height: 1.3;
}

/* Hero Section */
.hero {
  max-width: 1380px;
  margin: 28px auto 16px;
  padding: 0 24px;
  text-align: center;
}

.pill-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--badge-bg);
  border: 1px solid var(--badge-border);
  color: var(--badge-text);
  font-size: 13px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 9999px;
  margin-bottom: 14px;
}

.pill-badge svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

h1 {
  font-family: var(--font-heading);
  font-size: 38px;
  font-weight: 800;
  color: var(--heading);
  letter-spacing: -0.8px;
  line-height: 1.25;
  max-width: 840px;
  margin: 0 auto 12px;
}

@media (max-width: 640px) {
  h1 {
    font-size: 28px;
  }
}

.gradient-text {
  background: var(--brand-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero p {
  color: var(--muted);
  font-size: 16px;
  max-width: 720px;
  margin: 0 auto;
}

/* Privacy Notice Banner */
.privacy-notice {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  color: #059669;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  padding: 6px 14px;
  border-radius: 999px;
  margin: 14px auto 22px;
}

/* Main Workspace */
.main-workspace {
  width: 100%;
  max-width: 1380px;
  margin: 0 auto;
  padding: 0 24px 40px;
  flex: 1;
}

/* Options Bar Card */
.options-card {
  background: #ffffff;
  border: 1px solid var(--card-border);
  border-radius: var(--card-radius);
  box-shadow: var(--card-shadow);
  padding: 14px 20px;
  margin-bottom: 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.options-title {
  font-weight: 700;
  font-size: 13px;
  color: var(--heading);
  display: flex;
  align-items: center;
  gap: 7px;
}

.options-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  font-size: 13px;
  color: var(--body);
}

.options-grid label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
}

.options-grid input[type="checkbox"] {
  accent-color: #2563eb;
  width: 15px;
  height: 15px;
  cursor: pointer;
}

/* Toolbar Buttons */
.toolbar-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

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

.btn {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  padding: 9px 18px;
  border-radius: 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  text-decoration: none;
}

.btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.btn-primary {
  background: var(--brand-gradient);
  color: #ffffff;
  box-shadow: 0 6px 16px rgba(79, 70, 229, 0.28);
}

.btn-primary:hover {
  box-shadow: 0 8px 20px rgba(79, 70, 229, 0.35);
  transform: translateY(-1px);
}

.btn-secondary {
  background: #ffffff;
  color: var(--heading);
  border: 1px solid var(--card-border);
}

.btn-secondary:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
  padding: 9px 14px;
}

.btn-ghost:hover {
  color: var(--heading);
  background: #f1f5f9;
}

/* Inline Compare Container */
.compare-container {
  display: none;
  background: #ffffff;
  border: 2px dashed #93c5fd;
  border-radius: var(--card-radius);
  padding: 20px;
  margin-bottom: 24px;
}

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

.compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 900px) {
  .compare-grid {
    grid-template-columns: 1fr;
  }
}

/* Two Main Editor Panels (Side-by-Side on Desktop, Stacked on Mobile) */
.panels-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

@media (max-width: 900px) {
  .panels-container {
    grid-template-columns: 1fr;
  }
}

.panel-card {
  background: #ffffff;
  border: 1px solid var(--card-border);
  border-radius: var(--card-radius);
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel-header {
  padding: 12px 18px;
  border-bottom: 1px solid var(--card-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #fafbfc;
}

.panel-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--heading);
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-meta {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 14px;
}

.editor-wrapper {
  position: relative;
  display: flex;
  flex: 1;
  min-height: 460px;
  height: 60vh;
}

@media (max-width: 900px) {
  .editor-wrapper {
    min-height: 380px;
    height: 40vh;
  }
}

textarea.code-editor {
  width: 100%;
  height: 100%;
  border: none;
  padding: 16px;
  font-family: var(--code-font);
  font-size: 15px;
  line-height: 1.6;
  color: #0f172a;
  background: #ffffff;
  resize: vertical;
  outline: none;
  white-space: pre;
  tab-size: 2;
  box-sizing: border-box;
}

textarea.code-editor:focus {
  box-shadow: inset 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.code-preview {
  width: 100%;
  height: 100%;
  padding: 16px;
  font-family: var(--code-font);
  font-size: 15px;
  line-height: 1.6;
  overflow: auto;
  background: #ffffff;
  display: none;
  white-space: pre;
  box-sizing: border-box;
}

.code-preview.active {
  display: block;
}

/* Syntax Highlighting Colors */
.syn-key { color: #0284c7; font-weight: 600; }
.syn-str { color: #059669; }
.syn-num { color: #d97706; }
.syn-bool { color: #7c3aed; font-weight: 600; }
.syn-null { color: #dc2626; font-weight: 600; }
.syn-punc { color: #64748b; }

/* Status Banners */
.status-banner {
  padding: 10px 18px;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--card-border);
}

.status-valid {
  background: #f0fdf4;
  color: #166534;
  border-color: #bbf7d0;
}

.status-error {
  background: #fef2f2;
  color: #991b1b;
  border-color: #fecaca;
}

.status-info {
  background: #f8fafc;
  color: #475569;
}

/* What Was Fixed (Change Log) */
.changelog-card {
  background: #ffffff;
  border: 1px solid var(--card-border);
  border-radius: var(--card-radius);
  box-shadow: var(--card-shadow);
  padding: 20px;
  margin-bottom: 24px;
}

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

.changelog-title {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 700;
  color: var(--heading);
  display: flex;
  align-items: center;
  gap: 10px;
}

.fixes-summary-badge {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e40af;
  font-weight: 600;
  font-size: 13px;
  padding: 3px 10px;
  border-radius: 999px;
}

.fixes-list {
  display: grid;
  gap: 8px;
  max-height: 260px;
  overflow-y: auto;
  padding-right: 6px;
}

.fix-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px;
  gap: 10px;
}

.fix-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.conf-tag {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.conf-safe {
  background: #dcfce7;
  color: #15803d;
}

.conf-guessed {
  background: #fef3c7;
  color: #b45309;
}

/* Side-by-Side Line Diff */
.diff-section {
  background: #ffffff;
  border: 1px solid var(--card-border);
  border-radius: var(--card-radius);
  box-shadow: var(--card-shadow);
  padding: 20px;
  margin-bottom: 24px;
}

.diff-view {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px;
  font-family: var(--code-font);
  font-size: 13px;
  max-height: 380px;
  overflow-y: auto;
}

@media (max-width: 900px) {
  .diff-view {
    grid-template-columns: 1fr;
  }
}

.diff-line {
  white-space: pre-wrap;
  word-break: break-all;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--code-font);
}

.diff-del {
  background: #fee2e2;
  color: #991b1b;
}

.diff-add {
  background: #dcfce7;
  color: #166534;
}

.diff-same {
  color: #64748b;
}

/* FAQ Section */
.faq-section {
  background: #ffffff;
  border: 1px solid var(--card-border);
  border-radius: var(--card-radius);
  box-shadow: var(--card-shadow);
  padding: 32px 28px;
  margin-top: 24px;
}

.faq-section h2 {
  font-family: var(--font-heading);
  font-size: 24px;
  font-weight: 800;
  color: var(--heading);
  margin-bottom: 20px;
}

.faq-item {
  border-bottom: 1px solid #e2e8f0;
  padding: 16px 0;
}

.faq-item:last-child {
  border-bottom: none;
}

.faq-q {
  font-weight: 700;
  font-size: 16px;
  color: var(--heading);
  margin-bottom: 6px;
}

.faq-a {
  font-size: 14px;
  color: var(--body);
  line-height: 1.6;
}

/* Site Footer */
.site-footer {
  border-top: 1px solid #e2e8f0;
  background: #ffffff;
  padding: 48px 24px 24px;
  margin-top: 48px;
}

.footer-container {
  max-width: 1380px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 36px;
}

.footer-brand {
  max-width: 340px;
}

.footer-brand p {
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.6;
  margin-top: 12px;
}

.footer-links-grid {
  display: flex;
  gap: 48px;
  flex-wrap: wrap;
}

.footer-col h4 {
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 700;
  color: var(--heading);
  margin-bottom: 14px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.footer-col ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.footer-col ul li a {
  font-size: 13.5px;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

.footer-col ul li a:hover {
  color: #2563eb;
}

.footer-bottom {
  max-width: 1380px;
  margin: 36px auto 0;
  padding-top: 20px;
  border-top: 1px solid #f1f5f9;
  text-align: center;
  font-size: 12.5px;
  color: var(--muted);
}

.footer-bottom a {
  color: #2563eb;
  text-decoration: none;
}
