/* ===== Reset & Base ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --surface-alt: #f5f5f5;
  --border: #e0e0e0;
  --text: #1a1a1a;
  --text-secondary: #666666;
  --text-muted: #999999;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-light: #eef2ff;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --success: #16a34a;
  --success-bg: #f0fdf4;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.1);
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SF Mono", "Cascadia Code", "Fira Code", "JetBrains Mono", Consolas, monospace;

  /* Code editor theme (One Dark inspired) */
  --code-bg: #282c34;
  --code-gutter: #3a3f4b;
  --code-gutter-text: #636d83;
  --code-text: #abb2bf;
  --code-line-highlight: #2c313c;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===== Header ===== */
.header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 2rem 1.5rem;
  text-align: center;
}

.header-content {
  max-width: 720px;
  margin: 0 auto;
}

.logo {
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 0.25rem;
}

.tagline {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.subtitle {
  font-size: 1rem;
  color: var(--text-secondary);
  max-width: 540px;
  margin: 0 auto;
}

.logo-link {
  color: inherit;
  text-decoration: none;
}

.logo-link:hover {
  opacity: 0.8;
}

.header-links {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.gh-link {
  color: var(--text-secondary);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  transition: color 0.15s;
}

.gh-link:hover {
  color: var(--accent);
}

.header-sep {
  color: var(--border);
}

/* ===== Main ===== */
.main {
  flex: 1;
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* ===== Drop Zone ===== */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 3rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s, box-shadow 0.2s;
  background: var(--surface);
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-light);
  box-shadow: var(--shadow);
}

.drop-zone.drag-over {
  border-style: solid;
  box-shadow: var(--shadow-lg);
}

.drop-icon {
  width: 48px;
  height: 48px;
  color: var(--text-muted);
  margin-bottom: 1rem;
  transition: color 0.2s;
}

.drop-zone:hover .drop-icon,
.drop-zone.drag-over .drop-icon {
  color: var(--accent);
}

.drop-text {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.25rem;
}

.drop-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.drop-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 500;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s, box-shadow 0.15s;
  padding: 0.5rem 1rem;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-secondary {
  background: var(--surface-alt);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--border);
}

.btn-small {
  font-size: 0.8rem;
  padding: 0.35rem 0.75rem;
  background: var(--surface-alt);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-small:hover {
  background: var(--border);
  color: var(--text);
}

/* ===== Paste Area ===== */
.paste-area {
  margin-top: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem;
}

.paste-area textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.5;
  resize: vertical;
  background: var(--surface-alt);
  color: var(--text);
}

.paste-area textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.paste-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 0.75rem;
}

/* ===== Error Display ===== */
.error-display {
  margin-top: 1rem;
  background: var(--danger-bg);
  border: 1px solid #fecaca;
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.error-icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--danger);
  color: #fff;
  font-weight: 700;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.error-display p {
  flex: 1;
  font-size: 0.875rem;
  color: var(--danger);
}

/* ===== Input Info ===== */
.input-info {
  margin-top: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  background: var(--success-bg);
  border: 1px solid #bbf7d0;
  border-radius: var(--radius);
}

.input-filename {
  flex: 1;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--success);
}

/* ===== Output Section ===== */
.output-section {
  margin-top: 2rem;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.output-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.output-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text);
}

.output-stats {
  display: flex;
  gap: 0.75rem;
  flex: 1;
}

.stat {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--surface-alt);
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--border);
}

.output-actions {
  display: flex;
  gap: 0.5rem;
}

/* ===== Code Container ===== */
.code-container {
  display: flex;
  background: var(--code-bg);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  max-height: 75vh;
  overflow-y: auto;
}

.line-numbers {
  flex-shrink: 0;
  padding: 1rem 0;
  background: var(--code-gutter);
  color: var(--code-gutter-text);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.6;
  text-align: right;
  user-select: none;
  -webkit-user-select: none;
}

.line-numbers span {
  display: block;
  padding: 0 0.75rem;
  min-width: 3.5rem;
}

.code-output {
  flex: 1;
  padding: 1rem 1.25rem;
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.6;
  color: var(--code-text);
  overflow-x: auto;
  white-space: pre;
  tab-size: 2;
}

/* ===== Syntax Highlighting Colors (One Dark inspired) ===== */
.lp-section {
  color: #e5c07b;
  font-weight: 700;
}

.lp-comment {
  color: #5c6370;
  font-style: italic;
}

.lp-method-get {
  color: #98c379;
  font-weight: 700;
}

.lp-method-post {
  color: #61afef;
  font-weight: 700;
}

.lp-method-put,
.lp-method-patch {
  color: #d19a66;
  font-weight: 700;
}

.lp-method-delete {
  color: #e06c75;
  font-weight: 700;
}

.lp-method {
  font-weight: 700;
  color: #61afef;
}

.lp-scalar {
  color: #c678dd;
}

.lp-type {
  color: #56b6c2;
}

.lp-field {
  color: #e06c75;
}

.lp-op-name {
  color: #61afef;
}

.lp-path {
  color: #98c379;
}

.lp-path-param {
  color: #d19a66;
  font-weight: 600;
}

.lp-annotation {
  color: #d19a66;
}

.lp-modifier {
  color: #c678dd;
  font-style: italic;
}

.lp-string {
  color: #98c379;
}

.lp-number {
  color: #d19a66;
}

.lp-operator {
  color: #c678dd;
  font-weight: 600;
}

.lp-punct {
  color: #abb2bf;
}

.lp-key {
  color: #e06c75;
  font-weight: 600;
}

.lp-value {
  color: #98c379;
}

.lp-trigger {
  color: #e5c07b;
  font-style: italic;
}

.lp-flow-arrow {
  color: #c678dd;
  font-weight: 700;
}

.lp-desc {
  color: #7f848e;
  font-style: italic;
}

.lp-http-code {
  color: #d19a66;
  font-weight: 700;
}

/* ===== Utility ===== */
.hidden {
  display: none !important;
}

/* ===== Footer ===== */
.footer {
  text-align: center;
  padding: 1.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  margin-top: auto;
}

.footer a {
  color: var(--accent);
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

/* ===== Copy feedback ===== */
.btn-copied {
  background: var(--success) !important;
  color: #fff !important;
  border-color: var(--success) !important;
}

/* ===== Responsive ===== */
@media (max-width: 640px) {
  .header {
    padding: 1.5rem 1rem;
  }

  .logo {
    font-size: 1.75rem;
  }

  .main {
    padding: 1rem;
  }

  .drop-zone {
    padding: 2rem 1rem;
  }

  .output-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .output-actions {
    width: 100%;
  }

  .output-actions .btn-small {
    flex: 1;
    justify-content: center;
  }

  .code-container {
    max-height: 60vh;
  }

  .line-numbers span {
    min-width: 2.5rem;
    padding: 0 0.5rem;
  }
}

/* ===== Scrollbar (code area) ===== */
.code-container::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.code-container::-webkit-scrollbar-track {
  background: var(--code-bg);
}

.code-container::-webkit-scrollbar-thumb {
  background: var(--code-gutter);
  border-radius: 4px;
}

.code-container::-webkit-scrollbar-thumb:hover {
  background: var(--code-gutter-text);
}

.code-output::-webkit-scrollbar {
  height: 6px;
}

.code-output::-webkit-scrollbar-track {
  background: transparent;
}

.code-output::-webkit-scrollbar-thumb {
  background: var(--code-gutter);
  border-radius: 3px;
}
