/* ── Design Tokens ───────────────────────────── */
:root {
  --brand:        #16a34a;
  --brand-dark:   #15803d;
  --brand-light:  #f0fdf4;
  --brand-border: #bbf7d0;
  --bg:           #f1f5f9;
  --surface:      #ffffff;
  --surface-2:    #f8fafc;
  --border:       #e2e8f0;
  --text:         #1e293b;
  --text-heading: #0f172a;
  --text-muted:   #64748b;
  --text-faint:   #94a3b8;
  --red:          #dc2626;
  --red-dark:     #b91c1c;
  --red-bg:       #fef2f2;
  --red-border:   #fca5a5;
  --radius-sm:    6px;
  --radius-md:    12px;
  --radius-lg:    20px;
  --shadow-sm:    0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:    0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg:    0 8px 32px rgba(0,0,0,0.10);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ── Reset ──────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; outline: none; }
input, select, textarea { font-family: inherit; }

/* ── Header ─────────────────────────────────── */
.app-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 200;
  box-shadow: 0 1px 0 var(--border);
}
.logo-group {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
}
.logo-group svg { flex-shrink: 0; }
.logo-text { display: flex; flex-direction: column; line-height: 1.2; }
.logo-text .brand { font-size: 17px; font-weight: 800; color: #231F20; letter-spacing: -0.4px; }
.logo-text .domain { font-size: 11px; color: var(--text-faint); font-weight: 500; }
.header-nav { display: flex; align-items: center; gap: 8px; }
.header-nav a {
  font-size: 13px; color: var(--text-muted); font-weight: 600;
  display: flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: var(--radius-sm);
  transition: color 150ms, background 150ms;
}
.header-nav a:hover { color: var(--brand); background: var(--brand-light); }

/* ── Footer ─────────────────────────────────── */
.app-footer {
  text-align: center; padding: 28px 24px; border-top: 1px solid var(--border);
  background: var(--surface); margin-top: 56px;
}
.app-footer p { font-size: 12px; color: var(--text-faint); }
.app-footer a { color: var(--text-muted); font-weight: 600; }
.app-footer a:hover { color: var(--brand); }

/* ── Hero ───────────────────────────────────── */
.hero {
  background: linear-gradient(170deg, #f0fdf4 0%, #dcfce7 50%, #d1fae5 100%);
  border-bottom: 1px solid var(--brand-border);
  padding: 52px 24px 48px;
  text-align: center;
}
.hero-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface); color: var(--brand);
  font-size: 12px; font-weight: 700; padding: 5px 14px;
  border-radius: 100px; border: 1.5px solid var(--brand-border);
  margin-bottom: 20px; letter-spacing: 0.3px; text-transform: uppercase;
}
.hero h1 { font-size: 44px; font-weight: 900; color: var(--text-heading); margin-bottom: 14px; letter-spacing: -1px; line-height: 1.1; }
.hero h1 span { color: var(--brand); }
.hero-sub { font-size: 16px; color: var(--text-muted); max-width: 480px; margin: 0 auto 36px; line-height: 1.65; }

/* ── Drop Zone ──────────────────────────────── */
.drop-zone {
  max-width: 600px; margin: 0 auto;
  background: rgba(255,255,255,0.8); backdrop-filter: blur(8px);
  border: 2px dashed #86efac; border-radius: 28px;
  padding: 44px 32px 36px;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  cursor: pointer;
  transition: border-color 200ms, background 200ms, transform 200ms, box-shadow 200ms;
  position: relative;
}
.drop-zone::before {
  content: ''; position: absolute; inset: -1px; border-radius: 29px;
  background: linear-gradient(135deg, rgba(22,163,74,0.06), rgba(22,163,74,0));
  pointer-events: none;
}
.drop-zone:hover { border-color: var(--brand); background: rgba(240,253,244,0.9); transform: translateY(-2px); box-shadow: 0 12px 40px rgba(22,163,74,0.15); }
.drop-zone.drag-over { border-color: var(--brand); background: rgba(220,252,231,0.95); transform: scale(1.015); box-shadow: 0 16px 48px rgba(22,163,74,0.2); }
.drop-icon-wrap {
  width: 72px; height: 72px;
  background: linear-gradient(135deg, #16a34a, #15803d);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 24px rgba(22,163,74,0.3);
  animation: float 3s ease-in-out infinite;
}
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
.drop-icon-wrap svg { width: 32px; height: 32px; color: #fff; }
.drop-zone h2 { font-size: 20px; font-weight: 800; color: var(--text-heading); letter-spacing: -0.3px; }
.drop-sub { font-size: 14px; color: var(--text-muted); margin-top: -4px; }
.btn-choose {
  background: var(--brand); color: #fff; font-size: 15px; font-weight: 700;
  padding: 12px 32px; border-radius: 100px;
  transition: background 200ms, transform 100ms, box-shadow 200ms;
  box-shadow: 0 4px 16px rgba(22,163,74,0.35); margin-top: 4px; letter-spacing: -0.2px;
}
.btn-choose:hover { background: var(--brand-dark); box-shadow: 0 6px 20px rgba(22,163,74,0.4); }
.btn-choose:active { transform: scale(0.97); }
.drop-formats { font-size: 12px; color: var(--text-faint); margin-top: 2px; }

/* ── Converter Main Area ────────────────────── */
.converter-main {
  max-width: 860px;
  margin: 0 auto;
  padding: 32px 20px 0;
}

/* ── File List ──────────────────────────────── */
#file-list { display: flex; flex-direction: column; gap: 8px; }

/* ── File Item — Convertio style ────────────── */
.file-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0 16px;
  height: 68px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  overflow: hidden;
  transition: border-color 200ms, box-shadow 200ms;
}
.file-item:hover { border-color: #cbd5e1; box-shadow: var(--shadow-md); }

/* Left accent */
.file-item::before {
  content: ''; position: absolute; left: 0; top: 8px; bottom: 8px;
  width: 3px; border-radius: 0 3px 3px 0; transition: background 200ms;
}
.file-item.status-idle::before        { background: #e2e8f0; }
.file-item.status-converting::before  { background: #3b82f6; }
.file-item.status-done::before        { background: var(--brand); }
.file-item.status-error::before       { background: var(--red); }
.file-item.status-unsupported::before { background: #9ca3af; }

/* Status tints */
.file-item.status-converting { background: #fffbeb; border-color: #fde68a; }
.file-item.status-done       { background: #f0fdf4; border-color: #bbf7d0; }
.file-item.status-error      { background: var(--red-bg); border-color: var(--red-border); }

/* Progress bar (inside item, bottom edge) */
.fi-progress {
  position: absolute; bottom: 0; left: 0; right: 0;
  height: 2px; background: #e2e8f0;
}
.fi-bar {
  height: 100%; background: #3b82f6;
  transition: width 250ms ease; border-radius: 2px;
}

/* Format badge */
.fi-badge {
  flex-shrink: 0; min-width: 46px; padding: 4px 8px;
  border-radius: var(--radius-sm); border: 1.5px solid;
  font-size: 11px; font-weight: 800; letter-spacing: 0.4px;
  text-align: center; white-space: nowrap;
}

/* Filename */
.fi-name-col { flex: 1; min-width: 0; }
.fi-name {
  font-size: 13px; font-weight: 600; color: var(--text-heading);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.fi-errmsg { font-size: 11px; color: var(--red); margin-top: 2px; font-weight: 500; }
.fi-multilinks { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }

/* Right controls */
.fi-right {
  display: flex; align-items: center; gap: 8px; flex-shrink: 0;
}
.fi-to { font-size: 12px; color: var(--text-faint); font-weight: 500; flex-shrink: 0; }

/* Format selector button */
.fi-fmtbtn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; background: var(--surface);
  border: 1.5px solid var(--border); border-radius: 8px;
  font-size: 12px; font-weight: 700; color: var(--text-heading);
  cursor: pointer; transition: border-color 150ms, background 150ms, box-shadow 150ms;
  min-width: 80px; justify-content: space-between; white-space: nowrap;
}
.fi-fmtbtn:hover:not([disabled]) { border-color: #94a3b8; background: var(--surface-2); }
.fi-fmtbtn.fi-locked { opacity: 0.55; cursor: default; pointer-events: none; }

/* Status badges */
.fi-status {
  padding: 3px 8px; border-radius: 6px; font-size: 10px;
  font-weight: 800; letter-spacing: 0.8px; white-space: nowrap; flex-shrink: 0;
}
.fi-ready      { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.fi-converting { background: #dbeafe; color: #1d4ed8; border: 1px solid #93c5fd; }
.fi-done       { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.fi-error      { background: var(--red-bg); color: var(--red); border: 1px solid var(--red-border); }
.fi-unsup      { background: #f1f5f9; color: #94a3b8; border: 1px solid #e2e8f0; }

/* File size */
.fi-size { font-size: 12px; color: var(--text-faint); white-space: nowrap; min-width: 50px; text-align: right; }

/* Download button (inline) */
.btn-dl {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--brand); color: #fff;
  font-size: 12px; font-weight: 700; padding: 5px 12px;
  border-radius: 100px; cursor: pointer; text-decoration: none;
  transition: background 150ms; white-space: nowrap; flex-shrink: 0;
}
.btn-dl:hover { background: var(--brand-dark); }
.btn-dl-sm { font-size: 11px; padding: 4px 9px; }

/* Remove button */
.btn-remove {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  background: transparent; color: var(--text-faint);
  display: flex; align-items: center; justify-content: center;
  transition: background 150ms, color 150ms;
}
.btn-remove:hover { background: var(--red-bg); color: var(--red); }

/* ── Format Dropdown ────────────────────────── */
.fmtd-overlay {
  position: fixed; inset: 0; z-index: 999; background: transparent;
}

.fmtd-panel {
  position: fixed; /* set by JS */
  background: #1a1a2e;
  border-radius: 14px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.45), 0 0 0 1px rgba(255,255,255,0.06);
  overflow: hidden;
  z-index: 1000;
  user-select: none;
  animation: dropIn 0.15s ease;
}

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

.fmtd-search-row {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-bottom: 1px solid rgba(255,255,255,0.07);
}
.fmtd-search-row svg { color: #475569; flex-shrink: 0; }
.fmtd-search {
  flex: 1; background: none; border: none; outline: none;
  font-size: 13px; color: #e2e8f0; caret-color: #60a5fa;
}
.fmtd-search::placeholder { color: #475569; }

.fmtd-body { display: flex; max-height: 320px; }

.fmtd-cats {
  width: 110px; flex-shrink: 0;
  border-right: 1px solid rgba(255,255,255,0.07);
  padding: 6px 0; overflow-y: auto;
}
.fmtd-cats::-webkit-scrollbar { width: 3px; }
.fmtd-cats::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

.fmtd-cat {
  padding: 9px 14px; font-size: 12px; color: #64748b;
  cursor: pointer; transition: color 120ms, background 120ms;
  white-space: nowrap;
}
.fmtd-cat:hover { color: #cbd5e1; background: rgba(255,255,255,0.04); }
.fmtd-cat.active { color: #f1f5f9; background: rgba(255,255,255,0.09); font-weight: 700; border-right: 2px solid #3b82f6; }

.fmtd-chips {
  flex: 1; padding: 10px 12px;
  display: flex; flex-wrap: wrap; gap: 6px; align-content: flex-start;
  overflow-y: auto;
}
.fmtd-chips::-webkit-scrollbar { width: 3px; }
.fmtd-chips::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

.fmtd-chip {
  padding: 5px 11px; border-radius: 100px; border: 1.5px solid;
  font-size: 11px; font-weight: 700; letter-spacing: 0.3px;
  cursor: pointer; transition: filter 120ms, transform 120ms, box-shadow 120ms;
  white-space: nowrap;
}
.fmtd-chip:hover { filter: brightness(1.1); transform: scale(1.04); }
.fmtd-sel { box-shadow: 0 0 0 2px #fff, 0 0 0 4px #3b82f6; }

.fmtd-empty {
  width: 100%; text-align: center; color: #475569;
  font-size: 12px; padding: 32px 16px;
}

/* ── Action Bar ─────────────────────────────── */
.action-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 16px 0; margin-top: 12px;
  border-top: 1px solid var(--border);
}
.action-left { display: flex; align-items: center; gap: 12px; flex: 1; flex-wrap: wrap; }
.action-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

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

.btn-add-more {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 13px; font-weight: 700; color: #475569;
  background: var(--surface); border: 1.5px dashed #cbd5e1;
  padding: 8px 16px; border-radius: 8px;
  transition: border-color 150ms, color 150ms;
  cursor: pointer; white-space: nowrap;
}
.btn-add-more:hover { border-color: var(--brand); color: var(--brand); }

/* Status chips */
.stat-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 100px;
  font-size: 11px; font-weight: 700; border: 1.5px solid;
}
.sc-ready  { color: #475569; background: #f8fafc; border-color: #e2e8f0; }
.sc-conv   { color: #d97706; background: #fffbeb; border-color: #fde68a; }
.sc-done   { color: var(--brand); background: var(--brand-light); border-color: var(--brand-border); }
.sc-err    { color: var(--red); background: var(--red-bg); border-color: var(--red-border); }
.sc-unsup  { color: #9ca3af; background: #f9fafb; border-color: #e5e7eb; }

/* Clear all */
.btn-clear-all {
  background: transparent; color: var(--text-faint);
  font-size: 13px; font-weight: 600; padding: 9px 14px; border-radius: 8px;
  transition: color 150ms, background 150ms;
}
.btn-clear-all:hover { color: var(--red); background: var(--red-bg); }

/* Download all */
.btn-download-all {
  background: var(--surface); color: var(--brand);
  border: 1.5px solid var(--brand-border); font-size: 13px; font-weight: 700;
  padding: 9px 20px; border-radius: 8px;
  display: inline-flex; align-items: center; gap: 7px;
  transition: background 150ms; cursor: pointer;
}
.btn-download-all:hover { background: var(--brand-light); }

/* Convert button — red, Convertio-style */
.btn-convert-all {
  background: var(--red); color: #fff;
  font-size: 15px; font-weight: 800;
  padding: 11px 28px; border-radius: 8px;
  display: inline-flex; align-items: center; gap: 8px;
  transition: background 150ms, transform 100ms, box-shadow 150ms;
  box-shadow: 0 4px 16px rgba(220,38,38,0.3);
  letter-spacing: -0.2px; white-space: nowrap;
}
.btn-convert-all:hover:not(:disabled) { background: var(--red-dark); box-shadow: 0 6px 24px rgba(220,38,38,0.4); transform: translateY(-1px); }
.btn-convert-all:active { transform: scale(0.97); }
.btn-convert-all:disabled { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: none; }

/* ── Spinner ────────────────────────────────── */
.spinner {
  width: 15px; height: 15px;
  border: 2px solid rgba(255,255,255,0.35); border-top-color: #fff;
  border-radius: 50%; animation: spin 0.7s linear infinite; flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

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

/* ── Responsive ─────────────────────────────── */
@media (max-width: 640px) {
  .app-header { padding: 0 16px; }
  .hero { padding: 36px 16px 32px; }
  .hero h1 { font-size: 32px; }
  .hero-sub { font-size: 14px; }
  .drop-zone { padding: 32px 18px 28px; border-radius: 16px; }
  .drop-zone h2 { font-size: 17px; }
  .drop-icon-wrap { width: 60px; height: 60px; }
  .drop-icon-wrap svg { width: 26px; height: 26px; }
  .converter-main { padding: 20px 12px 0; }
  .file-item { height: auto; min-height: 60px; padding: 12px 12px; flex-wrap: wrap; gap: 8px; }
  .fi-right { flex-wrap: wrap; gap: 6px; }
  .action-bar { flex-direction: column; align-items: stretch; }
  .action-left, .action-right { width: 100%; }
  .action-right { justify-content: flex-end; }
  .action-hint { display: none; }
  .btn-convert-all { font-size: 14px; padding: 11px 20px; }
  .fmtd-panel { width: calc(100vw - 16px) !important; left: 8px !important; }
}

@media (max-width: 440px) {
  .logo-text .domain { display: none; }
  .hero h1 { font-size: 28px; }
}
