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

:root {
  --red:      #E63946;
  --red-dark: #C1121F;
  --blue:     #1D6FA4;
  --green:    #2D6A4F;
  --orange:   #D4831A;
  --bg:       #F8F9FA;
  --surface:  #FFFFFF;
  --border:   #E2E8F0;
  --text:     #1A202C;
  --muted:    #718096;
  --shadow:   0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
  --shadow-lg:0 8px 30px rgba(0,0,0,.12);
  --radius:   12px;
  --radius-sm:8px;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; }

/* ── Layout ───────────────────────────────────────────────────────────── */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

main { flex: 1; }

/* ── Header ───────────────────────────────────────────────────────────── */
.header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 0 var(--border);
}

.header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text);
}

.nav {
  display: flex;
  gap: 4px;
}

.nav a {
  padding: 6px 14px;
  border-radius: 8px;
  font-size: .875rem;
  font-weight: 500;
  color: var(--muted);
  transition: background .15s, color .15s;
}

.nav a:hover, .nav a.active {
  background: #FFF1F1;
  color: var(--red);
}

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  width: 40px;
  height: 40px;
}

.nav-toggle span {
  display: block;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform .2s;
}

/* ── Mobile Nav ───────────────────────────────────────────────────────── */
.mobile-nav {
  display: none;
  flex-direction: column;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 8px 0;
}

.mobile-nav.open { display: flex; }

.mobile-nav a {
  padding: 14px 24px;
  font-size: 1rem;
  font-weight: 500;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  transition: background .15s;
}

.mobile-nav a:last-child { border-bottom: none; }
.mobile-nav a:hover { background: var(--bg); }

/* ── Hero ─────────────────────────────────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, #fff 0%, #FFF5F5 100%);
  padding: 72px 0 64px;
  text-align: center;
  border-bottom: 1px solid var(--border);
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #FFF1F1;
  color: var(--red);
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 6px 16px;
  border-radius: 100px;
  margin-bottom: 24px;
}

.hero h1 {
  font-size: clamp(2.2rem, 5vw, 3.5rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -.02em;
  margin-bottom: 16px;
}

.accent { color: var(--red); }

.hero-sub {
  font-size: 1.15rem;
  color: var(--muted);
  max-width: 520px;
  margin: 0 auto 36px;
}

.hero-cta {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 48px;
}

.hero-stats {
  display: flex;
  gap: 40px;
  justify-content: center;
  flex-wrap: wrap;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat strong {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text);
}

.stat span {
  font-size: .8rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* ── Buttons ──────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 28px;
  border-radius: var(--radius-sm);
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all .15s;
  white-space: nowrap;
}

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

.btn-primary:hover {
  background: var(--red-dark);
  border-color: var(--red-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(230,57,70,.35);
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}

.btn-ghost:hover {
  background: var(--bg);
  border-color: #ccc;
}

.btn-lg { padding: 16px 36px; font-size: 1.05rem; }

.btn-full { width: 100%; }

/* ── Tools Section ────────────────────────────────────────────────────── */
.tools-section {
  padding: 80px 0;
}

.section-header {
  text-align: center;
  margin-bottom: 48px;
}

.section-header h2 {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 8px;
  letter-spacing: -.02em;
}

.section-header p {
  color: var(--muted);
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: transform .2s, box-shadow .2s, border-color .2s;
  cursor: pointer;
  position: relative;
}

.tool-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: #ddd;
}

.tool-icon {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.tool-info { flex: 1; }

.tool-info h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.tool-info p {
  font-size: .875rem;
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 12px;
}

.tool-tag {
  font-size: .75rem;
  font-weight: 600;
  color: var(--muted);
  background: var(--bg);
  padding: 3px 10px;
  border-radius: 100px;
  letter-spacing: .02em;
}

.tool-arrow {
  position: absolute;
  right: 24px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.25rem;
  color: #ccc;
  transition: color .15s, right .15s;
}

.tool-card:hover .tool-arrow {
  color: var(--red);
  right: 20px;
}

/* ── Why Section ──────────────────────────────────────────────────────── */
.why-section {
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 60px 0;
}

.why-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 32px;
  text-align: center;
}

.why-icon {
  font-size: 2rem;
  margin-bottom: 12px;
}

.why-item h4 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.why-item p {
  font-size: .875rem;
  color: var(--muted);
}

/* ── Tool Page ────────────────────────────────────────────────────────── */
.tool-page {
  padding: 48px 0 80px;
}

.tool-hero {
  text-align: center;
  margin-bottom: 40px;
}

.tool-icon-lg {
  width: 88px;
  height: 88px;
  border-radius: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}

.tool-hero h1 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 800;
  letter-spacing: -.02em;
  margin-bottom: 10px;
}

.tool-hero p {
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 480px;
  margin: 0 auto;
}

/* ── Upload Form ──────────────────────────────────────────────────────── */
.upload-form {
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.drop-zone {
  border: 2.5px dashed var(--border);
  border-radius: var(--radius);
  padding: 48px 24px;
  text-align: center;
  background: var(--surface);
  cursor: pointer;
  transition: border-color .2s, background .2s;
  position: relative;
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--red);
  background: #FFF5F5;
}

.drop-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.drop-icon { font-size: 2.5rem; margin-bottom: 12px; }

.drop-content h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.drop-content p { color: var(--muted); font-size: .9rem; }

.drop-note {
  font-size: .8rem !important;
  margin-top: 8px;
  color: #aaa !important;
}

.link {
  color: var(--red);
  cursor: pointer;
  text-decoration: underline;
}

.drop-selected h3 { font-size: 1rem; word-break: break-all; }
.drop-selected p  { font-size: .85rem; color: var(--muted); }

/* ── Options Row ──────────────────────────────────────────────────────── */
.options-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.option-group { display: flex; flex-direction: column; gap: 8px; }

.option-group label {
  font-size: .85rem;
  font-weight: 600;
  color: var(--text);
}

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

.radio-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: .9rem;
  font-weight: 500;
  transition: border-color .15s, background .15s;
}

.radio-btn:has(input:checked) {
  border-color: var(--red);
  background: #FFF1F1;
  color: var(--red);
}

.radio-btn input { display: none; }

.select-input {
  padding: 10px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  outline: none;
  transition: border-color .15s;
}

.select-input:focus { border-color: var(--red); }

/* ── File List (sortable) ─────────────────────────────────────────────── */
.file-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.file-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.file-list-header h4 { font-size: .95rem; font-weight: 700; }
.file-list-hint { font-size: .8rem; color: var(--muted); }

.sortable-list { list-style: none; }

.sortable-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  cursor: grab;
  transition: background .15s;
  user-select: none;
  background: var(--surface);
}

.sortable-list li:last-child { border-bottom: none; }
.sortable-list li:hover { background: var(--bg); }
.sortable-list li.dragging { opacity: .5; background: #FFF1F1; }
.sortable-list li.drag-over { border-top: 2px solid var(--red); }

.drag-handle {
  color: #ccc;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.file-item-thumb {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  overflow: hidden;
}

.file-item-thumb img { width: 100%; height: 100%; object-fit: cover; }

.file-item-name {
  flex: 1;
  min-width: 0;
  font-size: .9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-item-size { font-size: .8rem; color: var(--muted); flex-shrink: 0; }

.file-item-remove {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: .9rem;
  transition: background .15s, color .15s;
  flex-shrink: 0;
}

.file-item-remove:hover { background: #FFF1F1; color: var(--red); }

.add-more-btn {
  display: block;
  text-align: center;
  padding: 12px;
  color: var(--red);
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  border-top: 1px solid var(--border);
  transition: background .15s;
  background: var(--bg);
}

.add-more-btn:hover { background: #FFF1F1; }

/* ── Alerts ───────────────────────────────────────────────────────────── */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  max-width: 640px;
  margin: 0 auto;
  font-weight: 500;
}

.alert-error {
  background: #FFF1F1;
  color: var(--red-dark);
  border: 1px solid #FECACA;
}

.alert-success {
  background: #F0FFF4;
  color: var(--green);
  border: 1px solid #A7F3D0;
}

/* ── Result Box ───────────────────────────────────────────────────────── */
.result-box {
  max-width: 640px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px;
  text-align: center;
}

.result-icon { font-size: 3rem; margin-bottom: 16px; }

.result-box h3 {
  font-size: 1.4rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.result-box > p { color: var(--muted); margin-bottom: 24px; }

/* ── Preview Grid ─────────────────────────────────────────────────────── */
.preview-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 24px 0;
}

.preview-thumb {
  aspect-ratio: 3/4;
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg);
  border: 1px solid var(--border);
}

.preview-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.preview-more {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--muted);
  font-size: .9rem;
}

/* ── Info Box ─────────────────────────────────────────────────────────── */
.info-box {
  background: #F0F7FF;
  border: 1px solid #BEE3F8;
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  font-size: .875rem;
  color: #2C5282;
  line-height: 1.5;
}

/* ── How It Works ─────────────────────────────────────────────────────── */
.how-it-works {
  max-width: 640px;
  margin: 40px auto 0;
  text-align: center;
}

.how-it-works h4 {
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 16px;
}

.steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.step {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .875rem;
  font-weight: 500;
}

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

.step-arrow { color: #ccc; font-size: 1rem; }

/* ── Footer ───────────────────────────────────────────────────────────── */
.footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 40px 0;
  margin-top: auto;
}

.footer .container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
}

.footer-links {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  justify-content: center;
}

.footer-links a {
  font-size: .875rem;
  color: var(--muted);
  transition: color .15s;
}

.footer-links a:hover { color: var(--red); }

.footer-copy { font-size: .8rem; color: #aaa; }

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

/* ── Progress Bar ─────────────────────────────────────────────────────── */
.progress-bar-wrap {
  height: 4px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: var(--red);
  width: 0;
  border-radius: 4px;
  transition: width .3s;
  animation: indeterminate 1.5s infinite linear;
}

@keyframes indeterminate {
  0%   { transform: translateX(-100%); width: 60%; }
  100% { transform: translateX(200%); width: 60%; }
}

/* ── Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .nav { display: none; }
  .nav-toggle { display: flex; }

  .hero { padding: 48px 0 40px; }
  .hero-stats { gap: 24px; }

  .tools-grid { grid-template-columns: 1fr; }
  .tool-arrow { display: none; }

  .why-grid { grid-template-columns: 1fr 1fr; gap: 24px; }

  .tool-page { padding: 32px 0 60px; }

  .options-row { grid-template-columns: 1fr; }

  .preview-grid { grid-template-columns: repeat(2, 1fr); }

  .steps { flex-direction: column; gap: 12px; }
  .step-arrow { transform: rotate(90deg); }

  .result-box { padding: 28px 20px; }

  .footer-links { gap: 16px; }
}

@media (max-width: 480px) {
  .container { padding: 0 16px; }

  .hero h1 { font-size: 1.9rem; }

  .hero-cta { flex-direction: column; align-items: center; }

  .why-grid { grid-template-columns: 1fr; }

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