/* ===========================
   CSS Variables & Reset
   =========================== */
:root {
  --bg: #0d1117;
  --bg-card: #161b22;
  --bg-card-hover: #1c2333;
  --bg-elevated: #21262d;
  --border: #30363d;
  --border-subtle: #21262d;
  --accent: #3b82f6;
  --accent-dark: #2563eb;
  --accent-glow: rgba(59, 130, 246, 0.25);
  --accent2: #8b5cf6;
  --text-primary: #e6edf3;
  --text-secondary: #8b949e;
  --text-muted: #484f58;
  --success: #3fb950;
  --warning: #d29922;
  --error: #f85149;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Noto Sans KR', 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
}

/* ===========================
   Background Glow
   =========================== */
.bg-glow {
  position: fixed;
  top: -30%;
  left: 50%;
  transform: translateX(-50%);
  width: 900px;
  height: 500px;
  background: radial-gradient(ellipse at center,
    rgba(59,130,246,0.08) 0%,
    rgba(139,92,246,0.05) 40%,
    transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* ===========================
   Header
   =========================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(13, 17, 23, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 20px;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
  box-shadow: 0 0 12px var(--accent-glow);
}

.logo-text {
  font-size: 17px;
  font-weight: 700;
  background: linear-gradient(135deg, #60a5fa, #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.3px;
}

.logo-badge {
  font-size: 11px;
  color: var(--accent);
  background: rgba(59,130,246,0.12);
  border: 1px solid rgba(59,130,246,0.3);
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 500;
}

.header-nav .nav-hint {
  font-size: 13px;
  color: var(--text-muted);
}

/* ===========================
   Main Layout
   =========================== */
.main-container {
  max-width: 860px;
  margin: 0 auto;
  padding: 32px 20px 60px;
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ===========================
   Hero Section
   =========================== */
.hero-section {
  text-align: center;
  padding: 28px 0 12px;
}

.hero-title {
  font-size: 28px;
  font-weight: 700;
  background: linear-gradient(135deg, #e6edf3 30%, #60a5fa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 10px;
  letter-spacing: -0.5px;
}

.hero-desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.8;
}

/* ===========================
   Cards
   =========================== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.card:hover {
  border-color: #3a4150;
}

/* ===========================
   Upload Card
   =========================== */
.upload-card {
  padding: 8px;
}

.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 36px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
}

.upload-zone:hover,
.upload-zone.drag-over {
  border-color: var(--accent);
  background: rgba(59,130,246,0.05);
}

.upload-zone.drag-over {
  background: rgba(59,130,246,0.1);
  box-shadow: inset 0 0 30px rgba(59,130,246,0.05);
}

.upload-icon {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, rgba(59,130,246,0.15), rgba(139,92,246,0.15));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  border: 1px solid rgba(59,130,246,0.2);
  margin-bottom: 4px;
}

.upload-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
}

.upload-hint {
  font-size: 12px;
  color: var(--text-muted);
}

/* ===========================
   Buttons
   =========================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  font-family: inherit;
  white-space: nowrap;
}

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

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #2563eb);
  color: white;
  box-shadow: 0 2px 8px rgba(59,130,246,0.3);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #60a5fa, var(--accent));
  box-shadow: 0 4px 16px rgba(59,130,246,0.4);
  transform: translateY(-1px);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

.btn-ghost {
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: #3a4150;
}

.btn-sm {
  padding: 5px 12px;
  font-size: 12px;
}

.btn-icon {
  padding: 6px;
  background: transparent;
  color: var(--text-muted);
  border-radius: 6px;
}

.btn-icon:hover {
  background: var(--bg-elevated);
  color: var(--text-secondary);
}

.btn-success {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: white;
  box-shadow: 0 2px 8px rgba(34,197,94,0.25);
}

.btn-success:hover {
  box-shadow: 0 4px 14px rgba(34,197,94,0.35);
  transform: translateY(-1px);
}

/* ===========================
   Options Card
   =========================== */
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  cursor: pointer;
  user-select: none;
}

.card-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-secondary);
}

.card-header-left h2 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.toggle-btn {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  background: rgba(59,130,246,0.1);
  border: 1px solid rgba(59,130,246,0.25);
  padding: 4px 12px;
  border-radius: 20px;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}

.toggle-btn:hover {
  background: rgba(59,130,246,0.18);
}

.options-body {
  border-top: 1px solid var(--border-subtle);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  transition: all var(--transition);
}

.options-body.collapsed {
  display: none;
}

/* ===========================
   Option Groups
   =========================== */
.option-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.option-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.option-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  cursor: default;
}

.option-value-badge {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  background: rgba(59,130,246,0.12);
  border: 1px solid rgba(59,130,246,0.25);
  padding: 2px 10px;
  border-radius: 20px;
  min-width: 48px;
  text-align: center;
  transition: all var(--transition);
}

.option-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.7;
}

.option-desc strong {
  color: var(--text-secondary);
}

/* ===========================
   Slider
   =========================== */
.slider-track-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 5px;
  border-radius: 3px;
  background: linear-gradient(to right, var(--accent) 0%, var(--accent) var(--fill, 0%), var(--bg-elevated) var(--fill, 0%));
  outline: none;
  cursor: pointer;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: white;
  border: 3px solid var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
}

.slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 0 14px rgba(59,130,246,0.5);
}

.slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: white;
  border: 3px solid var(--accent);
  cursor: pointer;
}

.slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
}

/* ===========================
   Format Options
   =========================== */
.format-options {
  display: flex;
  gap: 8px;
}

.format-option {
  padding: 6px 18px;
  border-radius: 6px;
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  user-select: none;
}

.format-option:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.format-option.active {
  background: rgba(59,130,246,0.12);
  border-color: var(--accent);
  color: var(--accent);
}

/* ===========================
   Progress Card
   =========================== */
.progress-card {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.progress-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.progress-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.progress-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.progress-sub {
  font-size: 12px;
  color: var(--text-muted);
}

.progress-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

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

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: 3px;
  transition: width 0.4s ease;
  box-shadow: 0 0 8px rgba(59,130,246,0.4);
}

.progress-pct {
  font-size: 12px;
  color: var(--text-muted);
  text-align: right;
}

/* ===========================
   Files Card
   =========================== */
.files-card {
  min-height: 120px;
}

.files-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 48px 24px;
  color: var(--text-muted);
  font-size: 14px;
}

.files-list {
  display: flex;
  flex-direction: column;
}

/* ===========================
   File Item
   =========================== */
.file-item {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
  transition: background var(--transition);
  position: relative;
}

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

.file-item:hover {
  background: rgba(255,255,255,0.02);
}

.file-thumb {
  width: 64px;
  height: 48px;
  border-radius: 6px;
  object-fit: cover;
  background: var(--bg-elevated);
  display: block;
  border: 1px solid var(--border);
}

.file-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.file-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.file-size {
  font-size: 11px;
  color: var(--text-muted);
}

.file-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
}

.file-status.waiting {
  color: var(--text-muted);
  background: var(--bg-elevated);
}

.file-status.processing {
  color: var(--warning);
  background: rgba(210,153,34,0.12);
}

.file-status.done {
  color: var(--success);
  background: rgba(63,185,80,0.12);
}

.file-status.error {
  color: var(--error);
  background: rgba(248,81,73,0.1);
}

.file-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
}

/* Processing shimmer */
@keyframes shimmer {
  0% { opacity: 0.4; }
  50% { opacity: 1; }
  100% { opacity: 0.4; }
}

.file-item.processing .file-thumb {
  animation: shimmer 1.2s ease-in-out infinite;
}

/* Spinner */
.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(210,153,34,0.3);
  border-top-color: var(--warning);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===========================
   Modal
   =========================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.8);
  backdrop-filter: blur(6px);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay[hidden] {
  display: none;
}

.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 900px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 80px rgba(0,0,0,0.7);
  animation: modalIn 0.2s ease;
}

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

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all var(--transition);
  font-family: inherit;
}

.modal-close:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.modal-body {
  flex: 1;
  overflow: auto;
  padding: 20px;
}

.preview-compare {
  display: grid;
  grid-template-columns: 1fr 4px 1fr;
  gap: 0;
  min-height: 300px;
  max-height: 65vh;
}

.preview-pane {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.preview-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-align: center;
}

.preview-pane canvas {
  width: 100%;
  height: auto;
  max-height: 60vh;
  object-fit: contain;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #111;
}

.preview-divider {
  background: var(--border);
  border-radius: 2px;
  margin: 0 10px;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
}

/* ===========================
   Footer
   =========================== */
.site-footer {
  text-align: center;
  padding: 24px;
  color: var(--text-muted);
  font-size: 12px;
  border-top: 1px solid var(--border-subtle);
  position: relative;
  z-index: 1;
}

/* ===========================
   Scrollbar
   =========================== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #3a4150; }

/* ===========================
   Responsive
   =========================== */
@media (max-width: 600px) {
  .logo-badge { display: none; }
  .preview-compare { grid-template-columns: 1fr; }
  .preview-divider { height: 4px; margin: 10px 0; }
  .progress-actions { flex-wrap: wrap; }
  .file-item { grid-template-columns: 48px 1fr auto; }
  .file-thumb { width: 48px; height: 36px; }
}

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

.file-item {
  animation: fadeIn 0.25s ease;
}
