/* ── CSS VARIABLES & DESIGN SYSTEM ───────────────────────────── */
:root {
  --primary: #2563EB;
  --primary-hover: #1D4ED8;
  --primary-light: #DBEAFE;
  --accent: #7C3AED;
  --bg-main: #F8FAFC;
  --bg-card: #FFFFFF;
  --bg-secondary: #F1F5F9;
  --text: #0F172A;
  --text-muted: #64748B;
  --border: #E2E8F0;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 16px rgba(37,99,235,0.08);
  --shadow-lg: 0 12px 32px rgba(37,99,235,0.14);
}

[data-theme="dark"] {
  --primary: #3B82F6;
  --primary-hover: #60A5FA;
  --primary-light: rgba(59,130,246,0.15);
  --accent: #8B5CF6;
  --bg-main: #0F172A;
  --bg-card: #1E293B;
  --bg-secondary: #1E293B;
  --text: #F8FAFC;
  --text-muted: #94A3B8;
  --border: #334155;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.3);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.4);
}

/* ── BASE RESET & TYPOGRAPHY ───────────────────────────────── */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-main);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
  width: 100%;
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ── SITE HEADER ───────────────────────────────────────────── */
#site-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1000;
  backdrop-filter: blur(8px);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 70px;
}
.site-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text);
}
.logo-icon {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}
.site-logo span { color: var(--primary); }

.main-nav { display: flex; gap: 20px; }
.nav-link {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: color 0.2s;
}
.nav-link:hover, .nav-link.active { color: var(--primary); text-decoration: none; }

.header-actions { display: flex; align-items: center; gap: 12px; }
.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: all 0.2s;
}
.icon-btn:hover { background: var(--border); transform: scale(1.05); }

/* ── BREADCRUMB ────────────────────────────────────────────── */
.breadcrumb-list {
  display: flex;
  align-items: center;
  gap: 8px;
  list-style: none;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.breadcrumb-item a { color: var(--text-muted); }
.breadcrumb-item.active { color: var(--primary); font-weight: 600; }

/* ── HERO SECTION ──────────────────────────────────────────── */
#hero {
  text-align: center;
  padding: 48px 0 24px;
}
.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--primary-light);
  color: var(--primary);
  padding: 6px 16px;
  border-radius: 99px;
  font-size: 0.82rem;
  font-weight: 700;
  margin-bottom: 16px;
}
#hero h1 {
  font-size: 2.5rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  margin-bottom: 14px;
}
.gradient-text {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero-subtitle {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 680px;
  margin: 0 auto 24px;
}
.hero-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: 99px;
  font-size: 0.8rem;
  font-weight: 600;
}
.hero-badge i { color: #22C55E; }

/* ── UPLOAD ZONE & TOOL CARD ───────────────────────────────── */
.tool-card-wrap {
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px;
  box-shadow: var(--shadow-lg);
  margin-bottom: 40px;
}
.upload-zone {
  border: 2.5px dashed var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-secondary);
  padding: 52px 32px;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--primary);
  background: var(--primary-light);
  transform: scale(1.008);
}
.upload-icon-wrap {
  width: 76px;
  height: 76px;
  background: linear-gradient(135deg, var(--primary-light), #EDE9FE);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  color: var(--primary);
  margin: 0 auto 20px;
  transition: transform 0.35s ease;
}
.upload-zone:hover .upload-icon-wrap { transform: scale(1.15) rotate(-6deg); }
.upload-title { font-size: 1.25rem; font-weight: 700; margin-bottom: 8px; }
.upload-sub { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 22px; }
.btn-choose {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--primary);
  color: #fff;
  padding: 12px 28px;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-choose:hover { background: var(--primary-hover); transform: translateY(-2px); box-shadow: 0 8px 24px rgba(37,99,235,0.4); }
#file-input { display: none; }

/* ── FILE LIST ─────────────────────────────────────────────── */
.file-list { margin-top: 24px; display: flex; flex-direction: column; gap: 12px; }
.file-item {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s, transform 0.2s;
}
.file-item.success { border-color: #22C55E; }
.file-item.error { border-color: #EF4444; }

.file-item-icon {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-sm);
  background: #FEE2E2;
  color: #EF4444;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}
.file-item-info { flex: 1; min-width: 0; }
.file-item-name { font-size: 0.9rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-item-size { font-size: 0.76rem; color: var(--text-muted); margin-top: 2px; }
.file-item-status { font-size: 0.76rem; font-weight: 600; margin-top: 3px; }
.file-item-status.pending { color: var(--text-muted); }
.file-item-status.converting { color: var(--primary); }
.file-item-status.done { color: #22C55E; }
.file-item-status.error { color: #EF4444; }

.btn-dl {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #D1FAE5;
  color: #166534;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}
.btn-dl:hover { background: #22C55E; color: #fff; transform: translateY(-1px); }
.btn-remove {
  width: 32px;
  height: 32px;
  background: rgba(239,68,68,0.1);
  color: #EF4444;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-remove:hover { background: #EF4444; color: #fff; }

/* ── PROGRESS BAR & CONTROLS ───────────────────────────────── */
.overall-progress { margin-top: 24px; display: none; }
.overall-progress.visible { display: block; }
.prog-label { display: flex; justify-content: space-between; font-size: 0.83rem; font-weight: 600; color: var(--text-muted); margin-bottom: 8px; }
.prog-track { height: 10px; background: var(--border); border-radius: 99px; overflow: hidden; }
.prog-fill { height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, var(--primary), var(--accent)); transition: width 0.3s ease; }

.tool-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 24px; }
.btn-convert {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  padding: 13px 32px;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(37,99,235,0.35);
  transition: all 0.2s ease;
}
.btn-convert:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(37,99,235,0.5); }
.btn-convert:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-reset {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-secondary);
  color: var(--text-muted);
  padding: 13px 24px;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 600;
  border: 1.5px solid var(--border);
  cursor: pointer;
  transition: all 0.2s;
}
.btn-reset:hover { border-color: var(--primary); color: var(--primary); }

.btn-dl-all {
  display: none;
  align-items: center;
  gap: 8px;
  background: #D1FAE5;
  color: #166534;
  padding: 13px 26px;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
}
.btn-dl-all.visible { display: inline-flex; }
.btn-dl-all:hover { background: #22C55E; color: #fff; }

/* ── STATS & STEPS GRID ────────────────────────────────────── */
.stats-bar { display: flex; flex-wrap: wrap; gap: 32px; justify-content: center; margin-bottom: 36px; }
.stat-item { text-align: center; }
.stat-val { font-size: 1.8rem; font-weight: 900; color: var(--primary); }
.stat-lbl { font-size: 0.8rem; color: var(--text-muted); }

.section-title { font-size: 1.6rem; font-weight: 800; text-align: center; margin-bottom: 32px; }
.steps-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 24px; margin-bottom: 48px; }
.step-card {
  text-align: center;
  padding: 36px 20px;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  position: relative;
  transition: transform 0.3s;
}
.step-card:hover { transform: translateY(-6px); }
.step-num {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  font-size: 0.8rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}
.step-icon { font-size: 2.2rem; color: var(--primary); margin-bottom: 14px; }
.step-title { font-size: 1rem; font-weight: 700; margin-bottom: 6px; }
.step-desc { font-size: 0.83rem; color: var(--text-muted); }

/* ── FEATURES & RELATED TOOLS ──────────────────────────────── */
.features-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 20px; margin-bottom: 48px; }
.feat-card {
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  transition: transform 0.3s ease;
}
.feat-card:hover { transform: translateY(-4px); }
.feat-icon { font-size: 1.7rem; color: var(--primary); margin-bottom: 10px; }
.feat-title { font-size: 0.95rem; font-weight: 700; margin-bottom: 5px; }
.feat-desc { font-size: 0.82rem; color: var(--text-muted); }

.related-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-bottom: 48px; }
.related-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  color: var(--text);
  transition: all 0.25s ease;
}
.related-card:hover { transform: translateY(-4px); border-color: var(--primary); text-decoration: none; }
.related-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}
.related-name { font-size: 0.9rem; font-weight: 700; }
.related-desc { font-size: 0.76rem; color: var(--text-muted); }

/* ── FAQ ACCORDION ─────────────────────────────────────────── */
.faq-list { max-width: 800px; margin: 0 auto 48px; display: flex; flex-direction: column; gap: 14px; }
.faq-item { background: var(--bg-card); border: 1.5px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.faq-q {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
}
.faq-icon { transition: transform 0.25s; color: var(--primary); }
.faq-item.open .faq-icon { transform: rotate(45deg); }
.faq-a { max-height: 0; overflow: hidden; transition: max-height 0.35s ease; }
.faq-item.open .faq-a { max-height: 300px; }
.faq-a-inner { padding: 0 22px 18px; font-size: 0.88rem; color: var(--text-muted); }

/* ── ADS SLOTS & FOOTER ────────────────────────────────────── */
.ad-slot {
  background: var(--bg-secondary);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 18px;
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 20px 0;
}

#site-footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 40px 0 20px;
  margin-top: auto;
}
.footer-text { text-align: center; font-size: 0.85rem; color: var(--text-muted); }

/* ── TOAST NOTIFICATIONS ───────────────────────────────────── */
#toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: #1E293B;
  color: #fff;
  padding: 14px 26px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 9999;
  opacity: 0;
  transition: all 0.35s cubic-bezier(0.34,1.56,0.64,1);
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
}
#toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

.btn-preview {
  display: inline-flex; align-items: center; gap: 6px;
  background: #DBEAFE; color: var(--primary);
  padding: 7px 14px; border-radius: var(--radius-sm);
  font-size: .8rem; font-weight: 600; border: none; cursor: pointer;
  transition: background .2s, transform .2s; text-decoration: none;
}
.btn-preview:hover { background: var(--primary); color: #fff; transform: translateY(-1px); }

/* ── PREVIEW MODAL ─────────────────────────────────────────── */
.preview-modal-backdrop {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15,23,42,0.75); backdrop-filter: blur(5px);
  z-index: 10000; display: none; align-items: center; justify-content: center;
  padding: 20px;
}
.preview-modal-backdrop.open { display: flex; }
.preview-modal-card {
  background: var(--bg-card); border-radius: var(--radius-lg);
  width: 100%; max-width: 860px; max-height: 90vh;
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 20px 50px rgba(0,0,0,0.35); border: 1.5px solid var(--border);
}
.preview-modal-header {
  padding: 16px 24px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bg-secondary);
}
.preview-modal-title { font-size: 1.05rem; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 8px; }
.preview-modal-close {
  background: none; border: none; font-size: 1.6rem; color: var(--text-muted);
  cursor: pointer; transition: color 0.2s; line-height: 1;
}
.preview-modal-close:hover { color: #EF4444; }
.preview-modal-body {
  padding: 24px; overflow-y: auto; flex: 1; background: #334155;
  display: flex; flex-direction: column; align-items: center; gap: 20px;
}
.preview-canvas-page {
  box-shadow: 0 8px 30px rgba(0,0,0,0.4); border-radius: 4px; background: #fff;
  max-width: 100%; height: auto;
}
.preview-modal-footer {
  padding: 16px 24px; border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bg-card);
}
