/* ===== CSS Variables & Reset ===== */
:root {
  --primary: #3B82F6;
  --primary-light: #93C5FD;
  --primary-dark: #2563EB;
  --secondary: #06B6D4;
  --secondary-dark: #0891B2;
  --tertiary: #8B5CF6;
  --accent-green: #22C55E;
  --accent-amber: #F59E0B;
  --surface: #1A1B21;
  --surface-light: #252731;
  --surface-lighter: #2D3040;
  --background: #0D0E12;
  --background-alt: #111218;
  --text: #FFFFFF;
  --text-secondary: rgba(255,255,255,0.6);
  --text-muted: rgba(255,255,255,0.4);
  --border: rgba(255,255,255,0.08);
  --border-light: rgba(255,255,255,0.12);
  --error: #EF4444;
  --error-bg: rgba(239,68,68,0.1);
  --warning: #F59E0B;
  --warning-bg: rgba(245,158,11,0.1);
  --success: #22C55E;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 24px;
  --shadow: 0 8px 32px rgba(0,0,0,0.3);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.2);
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--background);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
}

a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, select { font-family: inherit; }

.container { max-width: 1100px; margin: 0 auto; padding: 0 24px; }

/* ===== Background Animation ===== */
.bg-animation { position: fixed; inset: 0; z-index: -1; overflow: hidden; }
.bg-gradient {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(59,130,246,0.15), transparent),
    radial-gradient(ellipse 60% 40% at 80% 80%, rgba(6,182,212,0.08), transparent),
    radial-gradient(ellipse 50% 30% at 10% 60%, rgba(139,92,246,0.06), transparent);
}
.bg-particles { position: absolute; inset: 0; }
.particle {
  position: absolute; width: 2px; height: 2px;
  background: rgba(59,130,246,0.4); border-radius: 50%;
  animation: float linear infinite;
}
@keyframes float {
  0% { transform: translateY(100vh) scale(0); opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { transform: translateY(-10vh) scale(1); opacity: 0; }
}

/* ===== Logo ===== */
.logo-container { position: fixed; top: 18px; left: 24px; z-index: 101; }
.app-logo { height: 36px; width: auto; }

/* ===== Navbar ===== */
.navbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  padding: 16px 0;
  background: rgba(13,14,18,0.8);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  transition: var(--transition);
}
.nav-container {
  max-width: 1100px; margin: 0 auto; padding: 0 24px;
  display: flex; align-items: center; justify-content: space-between;
}
.nav-logo { display: flex; align-items: center; gap: 10px; font-size: 1.25rem; font-weight: 700; }
.logo-icon { font-size: 28px; color: var(--primary); }
.logo-accent { color: var(--primary); }
.nav-links { display: flex; gap: 8px; }
.nav-link {
  padding: 8px 16px; border-radius: var(--radius-sm);
  font-size: 0.9rem; font-weight: 500; color: var(--text-secondary);
  transition: var(--transition);
}
.nav-link:hover, .nav-link.active { color: var(--text); background: rgba(59,130,246,0.1); }
.nav-cta {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 20px; background: var(--primary); border-radius: var(--radius-sm);
  font-size: 0.85rem; font-weight: 600; color: white; transition: var(--transition);
}
.nav-cta:hover { background: var(--primary-dark); transform: translateY(-1px); }
.nav-cta .material-icons-round { font-size: 18px; }
.nav-toggle { display: none; color: var(--text); padding: 8px; }

/* Mobile Menu */
.mobile-menu {
  display: none; position: fixed; top: 65px; left: 0; right: 0;
  background: rgba(13,14,18,0.95); backdrop-filter: blur(20px);
  padding: 16px 24px; border-bottom: 1px solid var(--border); z-index: 99;
  flex-direction: column; gap: 4px;
}
.mobile-menu.open { display: flex; }
.mobile-link {
  padding: 12px 16px; border-radius: var(--radius-sm);
  font-weight: 500; color: var(--text-secondary); transition: var(--transition);
}
.mobile-link:hover { color: var(--text); background: rgba(59,130,246,0.1); }

/* ===== Hero ===== */
.hero { padding: 160px 0 80px; text-align: center; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 20px;
  background: rgba(59,130,246,0.12); border: 1px solid rgba(59,130,246,0.25);
  border-radius: 100px; font-size: 0.85rem; font-weight: 600;
  color: var(--primary-light); margin-bottom: 32px;
}
.hero-badge .material-icons-round { font-size: 18px; }
.hero-title {
  font-size: clamp(2.2rem, 5vw, 4rem); font-weight: 800;
  line-height: 1.1; letter-spacing: -0.02em; margin-bottom: 24px;
}
.gradient-text {
  background: linear-gradient(135deg, var(--primary), var(--secondary), var(--tertiary));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.hero-subtitle {
  font-size: 1.1rem; color: var(--text-secondary);
  max-width: 620px; margin: 0 auto 40px; line-height: 1.7;
}
.hero-actions { margin-bottom: 48px; }
.hero-stats {
  display: flex; justify-content: center; align-items: center; gap: 32px;
  flex-wrap: wrap;
}
.stat { text-align: center; }
.stat-value { display: block; font-size: 1.3rem; font-weight: 800; color: var(--primary-light); }
.stat-label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; }
.stat-divider { width: 1px; height: 40px; background: var(--border-light); }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 20px; border-radius: var(--radius-sm);
  font-size: 0.9rem; font-weight: 600; color: white;
  background: var(--primary); transition: var(--transition);
}
.btn:hover { background: var(--primary-dark); transform: translateY(-1px); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.btn .material-icons-round { font-size: 18px; }
.btn-primary { background: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-lg { padding: 14px 28px; font-size: 1rem; border-radius: var(--radius); }
.btn-sm { padding: 6px 14px; font-size: 0.8rem; }
.btn-ghost {
  background: rgba(255,255,255,0.06); color: var(--text-secondary);
}
.btn-ghost:hover { background: rgba(255,255,255,0.1); color: var(--text); }
.btn-outline {
  background: transparent; border: 1px solid var(--border-light); color: var(--text-secondary);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: rgba(59,130,246,0.08); }

/* ===== Sections ===== */
.tool-section { padding: 60px 0 80px; }
.features-section { padding: 80px 0; }
.how-section { padding: 80px 0; }
.section-header { text-align: center; margin-bottom: 48px; }
.section-icon {
  width: 56px; height: 56px; border-radius: 16px;
  background: rgba(59,130,246,0.15); display: inline-flex; align-items: center;
  justify-content: center; margin-bottom: 16px;
}
.section-icon .material-icons-round { font-size: 28px; color: var(--primary); }
.section-title {
  font-size: clamp(1.5rem, 3vw, 2.2rem); font-weight: 800;
  margin-bottom: 12px;
}
.section-subtitle { color: var(--text-secondary); font-size: 1rem; max-width: 520px; margin: 0 auto; }

/* ===== Tool Card ===== */
.tool-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 32px; box-shadow: var(--shadow);
}

/* ===== Options Row ===== */
.options-row {
  display: flex; flex-wrap: wrap; gap: 16px 24px;
  align-items: center; margin-bottom: 24px;
  padding-bottom: 20px; border-bottom: 1px solid var(--border);
}
.toggle-label {
  display: flex; align-items: center; gap: 10px;
  font-size: 0.85rem; color: var(--text-secondary); cursor: pointer; user-select: none;
}
.toggle-label input[type="checkbox"] { display: none; }
.toggle-slider {
  position: relative; width: 36px; height: 20px; border-radius: 10px;
  background: rgba(255,255,255,0.12); transition: var(--transition); flex-shrink: 0;
}
.toggle-slider::after {
  content: ''; position: absolute; left: 2px; top: 2px;
  width: 16px; height: 16px; border-radius: 50%;
  background: rgba(255,255,255,0.5); transition: var(--transition);
}
.toggle-label input:checked + .toggle-slider { background: var(--primary); }
.toggle-label input:checked + .toggle-slider::after {
  transform: translateX(16px); background: white;
}
.size-threshold {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.85rem; color: var(--text-secondary); margin-left: auto;
}
.size-threshold select {
  background: var(--surface-light); color: var(--text);
  border: 1px solid var(--border-light); border-radius: 6px;
  padding: 4px 8px; font-size: 0.8rem;
}

/* ===== Drop Zone ===== */
.drop-zone {
  position: relative; border: 2px dashed var(--border-light);
  border-radius: var(--radius); padding: 48px 24px; text-align: center;
  cursor: pointer; transition: var(--transition); margin-bottom: 0;
}
.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--primary); background: rgba(59,130,246,0.06);
}
.drop-zone-content { pointer-events: none; }
.drop-icon { font-size: 48px; color: var(--primary); margin-bottom: 16px; }
.drop-zone h3 { font-size: 1.15rem; font-weight: 600; margin-bottom: 4px; }
.drop-zone p { color: var(--text-secondary); font-size: 0.9rem; }
.drop-hint {
  display: inline-block; margin-top: 12px; padding: 4px 12px;
  background: rgba(255,255,255,0.04); border-radius: 100px;
  font-size: 0.75rem; color: var(--text-muted);
}
.file-input {
  position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: 0; cursor: pointer;
}

/* ===== Alerts ===== */
.alert {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 14px 20px; border-radius: var(--radius-sm); margin-top: 16px;
  font-size: 0.9rem;
}
.alert .material-icons-round { font-size: 22px; flex-shrink: 0; }
.alert-warning {
  background: var(--warning-bg); border: 1px solid rgba(245,158,11,0.3);
  color: var(--warning);
}
.alert-error {
  background: var(--error-bg); border: 1px solid rgba(239,68,68,0.3);
  color: var(--error);
}
.alert-actions { display: flex; gap: 8px; margin-left: auto; }

/* ===== Progress ===== */
.progress-section { margin-top: 24px; }
.progress-bar-track {
  height: 6px; border-radius: 3px; background: rgba(255,255,255,0.08);
  overflow: hidden; margin-bottom: 10px;
}
.progress-bar {
  height: 100%; width: 0%; border-radius: 3px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  transition: width 0.3s ease;
}
.progress-info {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 0.85rem; color: var(--text-secondary);
}
.progress-pct { font-weight: 600; color: var(--primary-light); font-variant-numeric: tabular-nums; }

/* ===== Results Header ===== */
.results-header {
  display: flex; flex-wrap: wrap; align-items: center;
  justify-content: space-between; gap: 16px;
  margin-top: 24px; padding: 16px 20px;
  background: var(--surface-light); border-radius: var(--radius);
  border: 1px solid var(--border);
}
.results-stats { display: flex; gap: 20px; flex-wrap: wrap; }
.results-stat {
  display: flex; align-items: center; gap: 6px;
  font-size: 0.85rem; color: var(--text-secondary);
}
.results-stat .material-icons-round { font-size: 18px; color: var(--primary); }
.results-stat strong { color: var(--text); font-weight: 700; }
.results-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ===== Image Grid ===== */
.image-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px; margin-top: 20px;
}
.image-card {
  position: relative; background: var(--surface-light);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  overflow: hidden; transition: var(--transition);
}
.image-card:hover { transform: translateY(-3px); border-color: var(--border-light); box-shadow: var(--shadow-sm); }
.image-card.selected { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.image-card-checkbox {
  position: absolute; top: 8px; left: 8px; z-index: 2;
  width: 18px; height: 18px; accent-color: var(--primary); cursor: pointer;
}
.image-thumb-wrapper {
  width: 100%; height: 140px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.2); overflow: hidden;
}
.image-thumb-wrapper img { max-width: 100%; max-height: 100%; object-fit: contain; }
.image-card-info {
  padding: 10px 12px; border-top: 1px solid var(--border);
  font-size: 0.75rem;
}
.image-card-name {
  font-weight: 600; color: var(--text-secondary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-bottom: 4px;
}
.image-card-meta {
  display: flex; justify-content: space-between;
  color: var(--text-muted); font-size: 0.7rem;
}
.image-card-format {
  display: inline-block; padding: 1px 6px; border-radius: 4px;
  font-size: 0.65rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.04em;
}
.format-jpg { background: rgba(245,158,11,0.15); color: var(--accent-amber); }
.format-png { background: rgba(34,197,94,0.15); color: var(--accent-green); }
.format-other { background: rgba(139,92,246,0.15); color: var(--tertiary); }

/* ===== Extraction Method Badges ===== */
.image-badge {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  padding: 2px 8px; border-radius: 4px;
  font-size: 0.6rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.04em; line-height: 1.6;
  pointer-events: none;
}
.badge-original {
  background: rgba(34,197,94,0.2); color: var(--accent-green);
  border: 1px solid rgba(34,197,94,0.3);
}
.badge-reconstructed {
  background: rgba(245,158,11,0.2); color: var(--accent-amber);
  border: 1px solid rgba(245,158,11,0.3);
}

/* ===== Error ===== */
/* (uses .alert-error above) */

/* ===== Reset ===== */
.reset-section { text-align: center; margin-top: 24px; }

/* ===== Features Grid ===== */
.features-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}
.feature-card {
  padding: 28px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  transition: var(--transition);
}
.feature-card:hover { border-color: var(--border-light); transform: translateY(-2px); }
.feature-icon {
  width: 48px; height: 48px; border-radius: 12px;
  background: rgba(59,130,246,0.12);
  display: flex; align-items: center; justify-content: center; margin-bottom: 16px;
}
.feature-icon .material-icons-round { font-size: 24px; color: var(--primary); }
.feature-card h3 { font-size: 1rem; font-weight: 700; margin-bottom: 8px; }
.feature-card p { font-size: 0.85rem; color: var(--text-secondary); line-height: 1.6; }

/* ===== Steps ===== */
.steps-grid {
  display: flex; align-items: center; justify-content: center; gap: 24px;
  flex-wrap: wrap;
}
.step-card {
  flex: 1; min-width: 200px; max-width: 280px; text-align: center;
  padding: 32px 24px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
}
.step-number {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--primary); color: white;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 1.1rem; margin-bottom: 16px;
}
.step-card h3 { font-weight: 700; margin-bottom: 8px; }
.step-card p { font-size: 0.85rem; color: var(--text-secondary); }
.step-arrow { color: var(--text-muted); font-size: 1.5rem; }

/* ===== Footer ===== */
.site-footer {
  padding: 40px 0; border-top: 1px solid var(--border);
  margin-top: 40px;
}
.footer-content { text-align: center; }
.footer-brand {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 1.1rem; font-weight: 700; margin-bottom: 8px;
}
.footer-brand .material-icons-round { font-size: 24px; color: var(--primary); }
.footer-note { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 4px; }
.footer-copy { color: var(--text-muted); font-size: 0.75rem; }

/* ===== Utility ===== */
.hidden { display: none !important; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .nav-links, .nav-cta { display: none; }
  .nav-toggle { display: block; }
  .hero { padding: 120px 0 60px; }
  .hero-stats { gap: 16px; }
  .stat-divider { display: none; }
  .tool-card { padding: 20px; }
  .options-row { flex-direction: column; gap: 12px; }
  .size-threshold { margin-left: 0; }
  .results-header { flex-direction: column; align-items: stretch; }
  .results-actions { justify-content: center; }
  .image-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
  .features-grid { grid-template-columns: 1fr; }
  .steps-grid { flex-direction: column; }
  .step-arrow { transform: rotate(90deg); }
}
