/* === CSS Variables === */
:root {
  --ink: #000000;
  --canvas: #ffffff;
  --signal: #0052cc;
  --signal-light: #e8f0fe;
  --border: #e5e5e5;
  --text: #1a1a1a;
  --text-secondary: #666666;
  --success: #0a8a3e;
  --success-light: #e6f4ea;
  --warning: #b36b00;
  --warning-light: #fef7e0;
  --danger: #c41e1e;
  --danger-light: #fce8e6;
  --font: 'Pretendard', -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', 'Fira Code', monospace;
  --radius: 4px;
  --section-pad: 80px;
  --container: 1080px;
}

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

html { font-size: 16px; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  font-weight: 400;
  color: var(--text);
  background: var(--canvas);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.container { max-width: var(--container); margin: 0 auto; padding: 0 24px; }

/* === Hero === */
.hero {
  position: relative;
  min-height: 520px;
  display: flex;
  align-items: center;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.hero-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(0,0,0,0.82) 0%, rgba(0,20,60,0.75) 100%);
}

.hero-content {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 80px 24px;
  color: var(--canvas);
  max-width: 720px;
  margin: 0 auto;
}

.hero-badge {
  display: inline-block;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--canvas);
  border: 1px solid rgba(255,255,255,0.4);
  padding: 4px 16px;
  border-radius: var(--radius);
  margin-bottom: 24px;
  opacity: 0;
  animation: fadeUp 0.6s ease forwards 0.2s;
}

.hero-headline {
  font-size: 48px;
  font-weight: 700;
  line-height: 1.15;
  margin-bottom: 16px;
  opacity: 0;
  animation: fadeUp 0.6s ease forwards 0.35s;
}

.hero-sub {
  font-size: 18px;
  font-weight: 400;
  opacity: 0.85;
  margin-bottom: 32px;
  opacity: 0;
  animation: fadeUp 0.6s ease forwards 0.5s;
}

.hero-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  opacity: 0;
  animation: fadeUp 0.6s ease forwards 0.65s;
}

/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 700;
  padding: 12px 28px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s;
  min-height: 44px;
  min-width: 44px;
  text-decoration: none;
}

.btn:focus-visible {
  outline: 2px solid var(--signal);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--signal);
  color: var(--canvas);
  border-color: var(--signal);
}

.btn-primary:hover { background: #003d99; border-color: #003d99; }
.btn-primary:active { background: #002d73; }

.btn-secondary {
  background: transparent;
  color: var(--canvas);
  border-color: rgba(255,255,255,0.6);
}

.btn-secondary:hover { background: rgba(255,255,255,0.1); border-color: var(--canvas); }

.btn-outline {
  background: var(--canvas);
  color: var(--signal);
  border-color: var(--signal);
}

.btn-outline:hover { background: var(--signal-light); }

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* === Steps Bar === */
.steps-bar {
  background: var(--canvas);
  border-bottom: 1px solid var(--border);
  padding: 16px 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.steps {
  display: flex;
  list-style: none;
  gap: 32px;
  justify-content: center;
  counter-reset: step;
}

.step {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 400;
  color: var(--text-secondary);
  cursor: pointer;
  transition: color 0.15s;
  padding: 8px;
  min-height: 44px;
}

.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border);
  font-weight: 700;
  font-size: 13px;
  transition: all 0.15s;
}

.step.active { color: var(--signal); }
.step.active .step-num {
  background: var(--signal);
  color: var(--canvas);
  border-color: var(--signal);
}

.step.completed { color: var(--success); }
.step.completed .step-num {
  background: var(--success);
  color: var(--canvas);
  border-color: var(--success);
}

/* === Sections === */
.section {
  padding: var(--section-pad) 0;
}

.section-title {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 24px;
}

.section[hidden] { display: none; }

/* === Drop Zone === */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 64px 32px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  background: var(--canvas);
}

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

.drop-zone:focus-visible {
  outline: 2px solid var(--signal);
  outline-offset: 2px;
}

.drop-icon { color: var(--text-secondary); margin-bottom: 16px; }

.drop-text {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.drop-hint {
  font-size: 14px;
  color: var(--text-secondary);
}

/* === Input Toggle === */
.input-toggle {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.toggle-btn {
  font-family: var(--font);
  font-size: 14px;
  font-weight: 400;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--canvas);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
  min-height: 44px;
}

.toggle-btn.active {
  background: var(--signal);
  color: var(--canvas);
  border-color: var(--signal);
}

.toggle-btn:focus-visible {
  outline: 2px solid var(--signal);
  outline-offset: 2px;
}

/* === Clipboard Input === */
.clipboard-input {
  margin-top: 16px;
}

.clipboard-input textarea {
  width: 100%;
  font-family: var(--mono);
  font-size: 13px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  resize: vertical;
  background: #fafafa;
  color: var(--text);
  line-height: 1.5;
}

.clipboard-input textarea:focus {
  outline: none;
  border-color: var(--signal);
}

.clipboard-input .btn { margin-top: 12px; }

/* === Progress === */
.parse-progress {
  margin-top: 24px;
}

.progress-bar {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--signal);
  width: 0%;
  transition: width 0.3s ease;
  border-radius: 3px;
}

.progress-text {
  margin-top: 8px;
  font-size: 14px;
  color: var(--text-secondary);
  font-family: var(--mono);
}

/* === Terminal Feed === */
.terminal-feed {
  margin-top: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  max-height: 240px;
}

.terminal-header {
  background: #f5f5f5;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--border);
}

.terminal-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--success);
}

.terminal-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  font-family: var(--mono);
}

.terminal-body {
  background: #1a1a2e;
  color: #a0e9a0;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.7;
  padding: 16px;
  overflow-y: auto;
  max-height: 180px;
}

.terminal-body .log-entry { opacity: 0; animation: fadeIn 0.2s ease forwards; }
.terminal-body .log-entry.warn { color: #f5c542; }
.terminal-body .log-entry.error { color: #ff6b6b; }
.terminal-body .log-entry.info { color: #6ec6ff; }

/* === Sample Button === */
.sample-btn {
  margin-top: 16px;
}

/* === Results Layout === */
.results-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 32px;
  align-items: start;
}

.stats-sidebar {
  position: sticky;
  top: 80px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--canvas);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.stat-item {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

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

.stat-value {
  display: block;
  font-size: 28px;
  font-weight: 700;
  font-family: var(--mono);
  color: var(--text);
  line-height: 1.2;
}

.stat-label {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.stat-item.highlight .stat-value { color: var(--signal); }

/* === Table === */
.table-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.input-search,
.input-select {
  font-family: var(--font);
  font-size: 14px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--canvas);
  color: var(--text);
  min-height: 44px;
}

.input-search { width: 200px; }
.input-select { min-width: 120px; }

.input-search:focus,
.input-select:focus {
  outline: none;
  border-color: var(--signal);
}

.table-count {
  font-size: 14px;
  color: var(--text-secondary);
  font-family: var(--mono);
}

.table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.data-table th {
  background: #fafafa;
  font-weight: 700;
  font-size: 13px;
  text-align: left;
  padding: 12px 16px;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
  color: var(--text-secondary);
}

.data-table td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.data-table tbody tr:hover { background: var(--signal-light); }

.data-table .action-badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius);
  text-transform: uppercase;
}

.action-badge.create { background: var(--success-light); color: var(--success); }
.action-badge.update { background: var(--warning-light); color: var(--warning); }
.action-badge.delete { background: var(--danger-light); color: var(--danger); }
.action-badge.get { background: #f0f0f0; color: var(--text-secondary); }
.action-badge.list { background: #f0f0f0; color: var(--text-secondary); }
.action-badge.patch { background: var(--warning-light); color: var(--warning); }

.status-mapped { color: var(--success); font-weight: 700; }
.status-unmapped { color: var(--text-secondary); }

/* === Pagination === */
.pagination {
  display: flex;
  gap: 4px;
  justify-content: center;
  margin-top: 16px;
  flex-wrap: wrap;
}

.pagination button {
  font-family: var(--font);
  font-size: 14px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--canvas);
  color: var(--text);
  cursor: pointer;
  min-height: 44px;
  min-width: 44px;
  transition: all 0.15s;
}

.pagination button:hover { background: var(--signal-light); }
.pagination button.active { background: var(--signal); color: var(--canvas); border-color: var(--signal); }
.pagination button:disabled { opacity: 0.4; cursor: not-allowed; }

/* === Report === */
.report-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 32px;
  align-items: start;
}

.report-controls {
  position: sticky;
  top: 80px;
}

.label-text {
  display: block;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text);
}

.period-select { margin-bottom: 24px; }

.report-stats { margin-bottom: 24px; }

.report-subtitle {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 16px;
}

.compliance-bars { display: flex; flex-direction: column; gap: 12px; }

.compliance-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.compliance-label {
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  justify-content: space-between;
}

.compliance-bar {
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.compliance-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.6s ease;
}

.compliance-fill.high { background: var(--success); }
.compliance-fill.medium { background: var(--warning); }
.compliance-fill.low { background: var(--danger); }

.report-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* === A4 Preview === */
.a4-preview-wrapper {
  display: flex;
  justify-content: center;
  background: #f5f5f5;
  padding: 32px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: auto;
}

.a4-preview {
  width: 595px;
  min-height: 842px;
  background: var(--canvas);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.a4-page {
  padding: 48px 40px;
}

.a4-header {
  border-bottom: 2px solid var(--text);
  padding-bottom: 16px;
  margin-bottom: 24px;
}

.a4-header h1 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 4px;
}

.a4-header p {
  font-size: 14px;
  color: var(--text-secondary);
}

.a4-meta {
  display: flex;
  gap: 16px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-secondary);
  font-family: var(--mono);
}

.a4-body { font-size: 13px; line-height: 1.7; }
.a4-body table { width: 100%; border-collapse: collapse; margin: 16px 0; font-size: 12px; }
.a4-body th, .a4-body td { border: 1px solid var(--border); padding: 8px; text-align: left; }
.a4-body th { background: #fafafa; font-weight: 700; }

.a4-empty {
  color: var(--text-secondary);
  text-align: center;
  padding: 48px 0;
}

.a4-footer {
  margin-top: 48px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-secondary);
  text-align: center;
}

/* === How It Works === */
.how-timeline {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0;
  position: relative;
  padding-left: 48px;
}

.how-timeline::before {
  content: '';
  position: absolute;
  left: 18px;
  top: 28px;
  bottom: 28px;
  width: 2px;
  background: var(--border);
}

.how-step {
  position: relative;
  padding: 24px 0;
}

.how-num {
  position: absolute;
  left: -48px;
  top: 20px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--signal);
  color: var(--canvas);
  font-weight: 700;
  font-size: 15px;
  border-radius: 50%;
}

.how-content h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
}

.how-content p {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* === Guide Section === */
.guide-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: start;
}

.guide-image img {
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  display: block;
}

.faq-list { display: flex; flex-direction: column; gap: 2px; }

.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.faq-item + .faq-item { margin-top: -1px; }

.faq-item summary {
  padding: 16px 20px;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.faq-item summary::after {
  content: '+';
  font-size: 18px;
  color: var(--text-secondary);
  transition: transform 0.2s;
}

.faq-item[open] summary::after { content: '\2212'; }

.faq-item summary:focus-visible {
  outline: 2px solid var(--signal);
  outline-offset: -2px;
}

.faq-item p {
  padding: 0 20px 16px;
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* === Footer === */
.footer {
  background: #0a0a0a;
  color: var(--canvas);
  padding: 64px 0 32px;
  text-align: center;
}

.footer-headline {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 8px;
}

.footer-sub {
  font-size: 16px;
  opacity: 0.7;
  margin-bottom: 24px;
}

.footer-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 32px;
}

.footer-actions .btn-outline {
  color: var(--canvas);
  border-color: rgba(255,255,255,0.4);
  background: transparent;
}

.footer-actions .btn-outline:hover {
  background: rgba(255,255,255,0.1);
  border-color: var(--canvas);
}

.footer-copy {
  font-size: 13px;
  opacity: 0.5;
}

/* === Toast === */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--text);
  color: var(--canvas);
  padding: 12px 24px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s forwards;
  pointer-events: auto;
}

.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.warning { background: var(--warning); }

/* === Animations === */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

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

/* === Responsive === */
@media (max-width: 1023px) {
  .results-layout {
    grid-template-columns: 1fr;
  }

  .stats-sidebar {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0;
  }

  .stat-item {
    flex: 1 1 calc(33% - 2px);
    min-width: 140px;
    border-right: 1px solid var(--border);
  }

  .report-layout {
    grid-template-columns: 1fr;
  }

  .report-controls { position: static; }

  .guide-layout {
    grid-template-columns: 1fr;
    gap: 32px;
  }
}

@media (max-width: 767px) {
  :root { --section-pad: 48px; }

  .hero { min-height: 420px; }
  .hero-headline { font-size: 28px; }
  .hero-sub { font-size: 15px; }
  .hero-content { padding: 48px 16px; }

  .steps { gap: 16px; }
  .step-label { display: none; }

  .section-title { font-size: 22px; }

  .stats-sidebar {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .stat-item {
    flex: 1 1 calc(50% - 2px);
    min-width: 120px;
    text-align: center;
  }

  .stat-value { font-size: 22px; }

  .filter-group { width: 100%; }
  .input-search { width: 100%; }

  .a4-preview-wrapper { padding: 16px; }

  .a4-preview {
    width: 100%;
    min-width: 320px;
  }

  .drop-zone { padding: 48px 16px; }

  .how-timeline { padding-left: 40px; }
  .how-timeline::before { left: 14px; }
  .how-num { left: -40px; width: 30px; height: 30px; font-size: 13px; }
}

/* === Print === */
@media print {
  .hero, .steps-bar, .footer, .btn, .drop-zone, .terminal-feed,
  .table-controls, .pagination, .input-toggle, .sample-btn,
  .report-actions, .section-how { display: none !important; }

  .section { padding: 0; }
  .a4-preview-wrapper { background: none; padding: 0; border: none; }
  .a4-preview { box-shadow: none; width: 100%; }
}
