/* =============================================
   FileForge — Main CSS
   Design System with Dark/Light Mode
   ============================================= */

/* --- Google Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* --- CSS Variables --- */
:root {
  --accent: #6c63ff;
  --accent-2: #a855f7;
  --accent-rgb: 108, 99, 255;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 6px;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --shadow: 0 4px 24px rgba(0,0,0,0.18);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.28);
}

[data-theme="dark"] {
  --bg: #0d0d14;
  --bg-2: #13131e;
  --surface: #1a1a28;
  --surface-2: #22222f;
  --card: #1e1e2e;
  --card-hover: #25253a;
  --border: rgba(255,255,255,0.07);
  --border-hover: rgba(108,99,255,0.4);
  --text: #f0f0f8;
  --text-2: #a0a0c0;
  --text-3: #606080;
  --navbar-bg: rgba(13,13,20,0.85);
  --hero-bg: #0d0d14;
}

[data-theme="light"] {
  --bg: #f4f4fb;
  --bg-2: #eeeef8;
  --surface: #ffffff;
  --surface-2: #f0f0fa;
  --card: #ffffff;
  --card-hover: #f5f5ff;
  --border: rgba(0,0,0,0.08);
  --border-hover: rgba(108,99,255,0.4);
  --text: #1a1a2e;
  --text-2: #4a4a70;
  --text-3: #9090b0;
  --navbar-bg: rgba(244,244,251,0.85);
  --hero-bg: #f4f4fb;
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  transition: background var(--transition), color var(--transition);
  overflow-x: hidden;
}
a { text-decoration: none; color: inherit; }
img { max-width: 100%; }

/* --- Container --- */
.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}

/* =============================================
   NAVBAR
   ============================================= */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background: var(--navbar-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  transition: background var(--transition), border-color var(--transition);
}
.nav-container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.15rem;
}
.logo-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, rgba(108,99,255,0.15), rgba(168,85,247,0.15));
  border-radius: var(--radius-xs);
  border: 1px solid rgba(108,99,255,0.25);
}
.logo-text { color: var(--text); }
.logo-accent { color: var(--accent); }

.nav-actions { display: flex; align-items: center; gap: 12px; }

.install-app-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
}
.install-app-btn:hover {
  background: var(--hover);
  transform: translateY(-2px);
  border-color: var(--accent);
}
.install-app-btn svg { width: 16px; height: 16px; }

@media (max-width: 480px) {
  .install-text { display: none; }
  .install-app-btn { padding: 8px; border-radius: 50%; width: 42px; height: 42px; justify-content: center; }
}

.theme-toggle {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}
.theme-toggle:hover {
  border-color: var(--accent);
  background: rgba(var(--accent-rgb), 0.1);
  transform: scale(1.05);
}
.theme-icon { position: absolute; transition: all var(--transition); }
[data-theme="dark"] .theme-icon-light { opacity: 0; transform: translateY(-20px); }
[data-theme="dark"] .theme-icon-dark { opacity: 1; transform: translateY(0); }
[data-theme="light"] .theme-icon-dark { opacity: 0; transform: translateY(20px); }
[data-theme="light"] .theme-icon-light { opacity: 1; transform: translateY(0); }

/* =============================================
   HERO
   ============================================= */
.hero {
  position: relative;
  padding: 110px 0 48px;
  overflow: hidden;
  background: var(--hero-bg);
}
.hero-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.hero-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.15;
}
[data-theme="dark"] .hero-orb { opacity: 0.18; }
[data-theme="light"] .hero-orb { opacity: 0.1; }
.hero-orb-1 {
  width: 600px; height: 600px;
  background: radial-gradient(circle, #6c63ff, transparent);
  top: -200px; left: -100px;
  animation: orbFloat 8s ease-in-out infinite;
}
.hero-orb-2 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, #a855f7, transparent);
  top: -100px; right: -150px;
  animation: orbFloat 10s ease-in-out infinite reverse;
}
@keyframes orbFloat {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-30px); }
}
.hero-grid {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(var(--border) 1px, transparent 1px),
                    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, black, transparent);
}

.hero-content {
  position: relative;
  z-index: 1;
  text-align: center;
  max-width: 700px;
  margin: 0 auto;
}
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  background: rgba(var(--accent-rgb), 0.1);
  border: 1px solid rgba(var(--accent-rgb), 0.25);
  border-radius: 100px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--accent);
  margin-bottom: 24px;
  letter-spacing: 0.02em;
}
.badge-dot {
  width: 6px; height: 6px;
  background: var(--accent);
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.3); }
}
.hero-title {
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin-bottom: 20px;
}
.gradient-text {
  background: linear-gradient(135deg, var(--accent), var(--accent-2), #ec4899);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-subtitle {
  font-size: 1rem;
  color: var(--text-2);
  max-width: 460px;
  margin: 0 auto;
  line-height: 1.65;
}
.hero-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 32px;
  padding: 24px 40px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: inline-flex;
  box-shadow: var(--shadow);
}
.stat { text-align: center; }
.stat-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -0.02em;
}
.stat-label {
  font-size: 0.75rem;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 500;
}
.stat-divider {
  width: 1px;
  height: 40px;
  background: var(--border);
}

/* =============================================
   TOOLS SECTION
   ============================================= */
.tools-section {
  padding: 80px 0;
}
.section-header {
  text-align: center;
  margin-bottom: 28px;
}
.section-tag {
  display: inline-block;
  padding: 4px 14px;
  background: rgba(var(--accent-rgb), 0.1);
  color: var(--accent);
  border-radius: 100px;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 16px;
}
.section-title {
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  margin-bottom: 12px;
}
.section-sub {
  color: var(--text-2);
  font-size: 1rem;
}

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

.tool-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 22px 24px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.tool-card:hover {
  border-color: var(--border-hover);
  background: var(--card-hover);
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}
.tool-card-glow {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(var(--accent-rgb), 0.6), transparent);
  opacity: 0;
  transition: opacity var(--transition);
}
.tool-card:hover .tool-card-glow { opacity: 1; }

.tool-icon-wrap {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, color-mix(in srgb, var(--tool-color) 15%, transparent), color-mix(in srgb, var(--tool-color-light) 10%, transparent));
  border: 1px solid color-mix(in srgb, var(--tool-color) 25%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--tool-color);
  flex-shrink: 0;
  transition: all var(--transition);
}
.tool-card:hover .tool-icon-wrap {
  transform: scale(1.08);
  box-shadow: 0 0 20px color-mix(in srgb, var(--tool-color) 30%, transparent);
}

.tool-info { flex: 1; min-width: 0; }
.tool-name {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--text);
}
.tool-desc {
  font-size: 0.85rem;
  color: var(--text-2);
  line-height: 1.4;
}

.tool-arrow {
  font-size: 1.2rem;
  color: var(--text-3);
  transition: all var(--transition);
  flex-shrink: 0;
}
.tool-card:hover .tool-arrow {
  color: var(--accent);
  transform: translateX(4px);
}

/* =============================================
   FEATURES SECTION
   ============================================= */
.features-section {
  padding: 20px 0 80px;
}
.features-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: nowrap;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 10px 24px;
  background: var(--surface);
  width: fit-content;
  margin: 0 auto;
}
.feature-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 16px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-2);
  white-space: nowrap;
}
.feature-pill-icon {
  font-size: 1rem;
}
.feature-pill-sep {
  width: 1px;
  height: 16px;
  background: var(--border);
  flex-shrink: 0;
}
.hero-strip {
  margin-top: 0;
}
.hero-strip-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: 28px;
}

/* =============================================
   FOOTER
   ============================================= */
.footer {
  border-top: 1px solid var(--border);
  padding: 28px 0;
  background: var(--bg-2);
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}
.footer-copy {
  font-size: 0.82rem;
  color: var(--text-3);
}

/* =============================================
   TOOL PAGE — Shared
   ============================================= */
.page-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.page-main {
  flex: 1;
  padding: 100px 0 60px;
}
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-3);
  margin-bottom: 32px;
}
.breadcrumb a { color: var(--text-2); transition: color var(--transition); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb-sep { color: var(--text-3); }

.tool-page-header {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 40px;
}
.tool-page-icon {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.tool-page-title {
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  margin-bottom: 8px;
}
.tool-page-subtitle {
  color: var(--text-2);
  font-size: 1rem;
}

/* Drop Zone */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 60px 40px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--surface);
  position: relative;
}
.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--accent);
  background: rgba(var(--accent-rgb), 0.04);
}
.drop-zone.drag-over { transform: scale(1.01); }
.drop-zone-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  display: block;
}
.drop-zone h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 8px;
}
.drop-zone p {
  font-size: 0.875rem;
  color: var(--text-2);
  margin-bottom: 20px;
}
.drop-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.btn-browse {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}
.btn-browse:hover { opacity: 0.9; transform: translateY(-1px); box-shadow: 0 4px 16px rgba(var(--accent-rgb), 0.4); }

/* File List */
.file-list {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.file-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  animation: slideIn 0.2s ease;
}
@keyframes slideIn {
  from { opacity: 0; transform: translateX(-10px); }
  to { opacity: 1; transform: translateX(0); }
}
.file-icon { font-size: 1.5rem; }
.file-name {
  flex: 1;
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-size {
  font-size: 0.8rem;
  color: var(--text-3);
  flex-shrink: 0;
}
.file-remove {
  width: 28px; height: 28px;
  border-radius: var(--radius-xs);
  border: none;
  background: rgba(239,68,68,0.1);
  color: #ef4444;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  transition: all var(--transition);
  flex-shrink: 0;
}
.file-remove:hover { background: rgba(239,68,68,0.2); transform: scale(1.1); }

/* Action Panel */
.action-panel {
  margin-top: 28px;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: none;
}
.action-panel.visible { display: block; }

/* Buttons */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 32px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
  width: 100%;
  justify-content: center;
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(var(--accent-rgb), 0.45);
}
.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all var(--transition);
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

/* Progress */
.progress-wrap {
  display: none;
  margin-top: 20px;
}
.progress-wrap.visible { display: block; }
.progress-label {
  font-size: 0.85rem;
  color: var(--text-2);
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
}
.progress-bar-bg {
  height: 6px;
  background: var(--surface-2);
  border-radius: 100px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 100px;
  transition: width 0.3s ease;
  width: 0%;
}

/* Result Panel */
.result-panel {
  display: none;
  margin-top: 20px;
  padding: 20px;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: var(--radius-sm);
  text-align: center;
}
.result-panel.visible { display: block; }
.result-panel h4 {
  font-size: 1rem;
  font-weight: 700;
  color: #10b981;
  margin-bottom: 8px;
}
.result-panel p {
  font-size: 0.85rem;
  color: var(--text-2);
  margin-bottom: 16px;
}
.result-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

/* Options row */
.options-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 20px;
  align-items: flex-end;
}
.option-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 160px;
}
.option-group label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.option-group select,
.option-group input {
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  transition: border-color var(--transition);
  appearance: none;
}
.option-group select:focus,
.option-group input:focus {
  outline: none;
  border-color: var(--accent);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 24px;
  border-radius: 100px;
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 999;
  white-space: nowrap;
  pointer-events: none;
}
.toast.show {
  transform: translateX(-50%) translateY(0);
}
.toast.success { border-color: rgba(16,185,129,0.4); color: #10b981; }
.toast.error { border-color: rgba(239,68,68,0.4); color: #ef4444; }

/* Install Banner */
.install-banner {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: var(--shadow-lg);
  z-index: 200;
  display: none;
  animation: slideIn 0.3s ease;
  max-width: 340px;
}
.install-banner.show { display: block; }
.install-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-size: 0.9rem;
}
.install-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.btn-install {
  padding: 8px 18px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  border: none;
  border-radius: var(--radius-xs);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all var(--transition);
}
.btn-install:hover { opacity: 0.9; }
.btn-dismiss {
  width: 32px; height: 32px;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  cursor: pointer;
  color: var(--text-3);
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}
.btn-dismiss:hover { border-color: var(--accent); color: var(--accent); }

/* Drag handles for sortable lists */
.drag-handle {
  cursor: grab;
  color: var(--text-3);
  padding: 0 4px;
  font-size: 1rem;
  flex-shrink: 0;
  user-select: none;
}
.drag-handle:active { cursor: grabbing; }
.file-item.dragging {
  opacity: 0.5;
  border-style: dashed;
}

/* Responsive */
@media (max-width: 640px) {
  .hero { padding: 100px 0 60px; }
  .hero-stats { padding: 16px 24px; gap: 20px; }
  .stat-value { font-size: 1.2rem; }
  .tools-grid { grid-template-columns: 1fr; }
  .tool-card { padding: 18px 16px; }
  .footer-inner { flex-direction: column; align-items: flex-start; }
  .install-banner { left: 16px; right: 16px; bottom: 16px; max-width: none; }
  .feature-pill { font-size: 0.75rem; padding: 4px 10px; gap: 5px; }
  .feature-pill-icon { font-size: 0.85rem; }
  .features-strip { padding: 8px 14px; }
}
