/* ImgEditor Pro - Stripe-inspired Design System */
:root {
  --bg: #0a0a0b;
  --bg-elevated: #111113;
  --bg-card: rgba(22, 22, 26, 0.9);
  --border: rgba(255,255,255,0.08);
  --text: #fff;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --primary: #635bff;
  --primary-light: #7c75ff;
  --secondary: #00d4ff;
  --accent: #ff5caa;
  --success: #00d084;
  --warning: #ffbb00;
  --gradient: linear-gradient(135deg, #635bff, #00d4ff);
  --gradient-accent: linear-gradient(135deg, #ff5caa, #ffbb00);
  --shadow: 0 24px 48px rgba(0,0,0,0.4);
  --radius: 16px;
  --radius-lg: 24px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
}

/* Animated Background */
.bg-grid {
  position: fixed; inset: 0; z-index: 0;
  background-image: 
    linear-gradient(rgba(99,91,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(99,91,255,0.03) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse 80% 50% at 50% 0%, black 70%, transparent 100%);
}

.orbs {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden;
}

.orb {
  position: absolute; border-radius: 50%; filter: blur(100px); opacity: 0.5;
  animation: orbFloat 25s ease-in-out infinite;
}

.orb-1 { width: 600px; height: 600px; top: -15%; left: 10%; background: var(--primary); }
.orb-2 { width: 500px; height: 500px; bottom: 0; right: 5%; background: var(--secondary); animation-delay: -10s; }
.orb-3 { width: 400px; height: 400px; top: 40%; left: 50%; background: var(--accent); animation-delay: -18s; }

@keyframes orbFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(40px, -30px) scale(1.1); }
  66% { transform: translate(-30px, 20px) scale(0.9); }
}

/* Navigation */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  padding: 1rem 2rem;
  background: rgba(10,10,11,0.8);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: 1400px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
}

.nav-brand {
  display: flex; align-items: center; gap: 0.75rem;
  text-decoration: none; color: var(--text);
}

.nav-logo {
  width: 40px; height: 40px; border-radius: 12px;
  background: var(--gradient);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem;
}

.nav-brand span { font-size: 1.25rem; font-weight: 700; }

.nav-links { display: flex; gap: 0.5rem; }

.nav-link {
  padding: 0.625rem 1.25rem; border-radius: 10px;
  color: var(--text-secondary); text-decoration: none;
  font-size: 0.9rem; font-weight: 500;
  transition: all 0.2s ease;
}

.nav-link:hover, .nav-link.active { color: var(--text); background: rgba(255,255,255,0.05); }

.nav-cta {
  padding: 0.625rem 1.5rem; border-radius: 10px;
  background: var(--gradient); color: white;
  text-decoration: none; font-weight: 600; font-size: 0.9rem;
  transition: all 0.3s ease;
}

.nav-cta:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(99,91,255,0.4); }

/* Hero Section */
.hero {
  position: relative; z-index: 10;
  min-height: 100vh; display: flex; align-items: center;
  padding: 8rem 2rem 4rem;
}

.hero-inner {
  max-width: 1200px; margin: 0 auto; text-align: center;
}

.hero-badge {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.5rem 1rem; border-radius: 100px;
  background: rgba(99,91,255,0.15);
  border: 1px solid rgba(99,91,255,0.3);
  color: var(--primary-light);
  font-size: 0.8rem; font-weight: 600;
  margin-bottom: 2rem;
}

.hero h1 {
  font-size: clamp(2.5rem, 8vw, 5rem);
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 1.5rem;
  background: linear-gradient(135deg, #fff 30%, var(--text-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero h1 .gradient {
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero p {
  font-size: 1.25rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 3rem;
}

.hero-buttons { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 1rem 2rem; border-radius: 12px;
  font-size: 1rem; font-weight: 600;
  text-decoration: none; border: none; cursor: pointer;
  transition: all 0.3s ease;
}

.btn-primary {
  background: var(--gradient); color: white;
  box-shadow: 0 4px 20px rgba(99,91,255,0.4);
}

.btn-primary:hover { transform: translateY(-3px); box-shadow: 0 8px 30px rgba(99,91,255,0.5); }

.btn-secondary {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  color: var(--text);
}

.btn-secondary:hover { background: rgba(255,255,255,0.1); border-color: var(--border); }

/* Feature Cards */
.features {
  position: relative; z-index: 10;
  padding: 6rem 2rem;
}

.features-inner { max-width: 1200px; margin: 0 auto; }

.section-header { text-align: center; margin-bottom: 4rem; }

.section-header h2 {
  font-size: 2.5rem; font-weight: 700; margin-bottom: 1rem;
}

.section-header p { color: var(--text-secondary); font-size: 1.1rem; }

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.feature-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: block;
}

.feature-card:hover {
  transform: translateY(-8px);
  border-color: var(--primary);
  box-shadow: 0 20px 40px rgba(99,91,255,0.15);
}

.feature-icon {
  width: 56px; height: 56px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
}

.feature-card h3 { font-size: 1.25rem; font-weight: 600; margin-bottom: 0.5rem; }
.feature-card p { color: var(--text-secondary); font-size: 0.95rem; }

.feature-tag {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 100px;
  font-size: 0.7rem;
  font-weight: 600;
  margin-top: 1rem;
}

.tag-ai { background: rgba(0,212,255,0.15); color: var(--secondary); }
.tag-new { background: rgba(255,92,170,0.15); color: var(--accent); }
.tag-pro { background: rgba(99,91,255,0.15); color: var(--primary-light); }

/* Tool Page Layout */
.tool-page {
  position: relative; z-index: 10;
  min-height: 100vh;
  padding: 6rem 2rem 2rem;
}

.tool-container { max-width: 1400px; margin: 0 auto; }

.tool-header {
  text-align: center;
  margin-bottom: 3rem;
}

.tool-header h1 { font-size: 2.5rem; font-weight: 700; margin-bottom: 0.5rem; }
.tool-header p { color: var(--text-secondary); }

.tool-workspace {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 1.5rem;
}

@media (max-width: 1024px) {
  .tool-workspace { grid-template-columns: 1fr; }
}

.workspace-main {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  min-height: 500px;
  display: flex;
  flex-direction: column;
}

.workspace-sidebar {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
}

/* Upload Zone */
.upload-zone {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  margin: 1.5rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--primary);
  background: rgba(99,91,255,0.05);
}

.upload-icon {
  width: 80px; height: 80px;
  border-radius: 50%;
  background: rgba(99,91,255,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  margin-bottom: 1.5rem;
}

.upload-zone h3 { font-size: 1.25rem; margin-bottom: 0.5rem; }
.upload-zone p { color: var(--text-secondary); font-size: 0.9rem; }

/* File Grid */
.files-container {
  padding: 1.5rem;
  flex: 1;
  overflow-y: auto;
}

.files-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.files-header h3 { font-size: 1rem; font-weight: 600; }

.files-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1rem;
}

.file-item {
  aspect-ratio: 1;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  cursor: pointer;
  position: relative;
  transition: all 0.3s ease;
}

.file-item:hover { transform: scale(1.02); border-color: var(--primary); }

.file-item img { width: 100%; height: 100%; object-fit: cover; }

.file-item-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
  opacity: 0;
  display: flex;
  align-items: flex-end;
  padding: 0.75rem;
  transition: opacity 0.3s ease;
}

.file-item:hover .file-item-overlay { opacity: 1; }

.file-item-name {
  font-size: 0.75rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Sidebar Controls */
.sidebar-section {
  padding: 1.25rem;
  border-bottom: 1px solid var(--border);
}

.sidebar-section:last-child { border-bottom: none; }

.sidebar-section h4 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.control-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.control-row label { font-size: 0.9rem; color: var(--text-secondary); }
.control-row .value { font-size: 0.9rem; color: var(--primary-light); font-weight: 600; }

input[type="range"] {
  width: 100%; height: 6px;
  background: var(--border);
  border-radius: 3px;
  outline: none;
  -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px;
  background: var(--primary);
  border-radius: 50%;
  cursor: pointer;
}

.format-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

.format-btn {
  padding: 0.75rem;
  border-radius: 10px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.format-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.format-btn:hover:not(.active) { border-color: var(--primary); color: var(--text); }

/* Action Buttons */
.action-buttons {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.action-btn {
  width: 100%;
  padding: 1rem;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.3s ease;
}

.action-btn-primary {
  background: var(--gradient);
  color: white;
}

.action-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(99,91,255,0.4);
}

.action-btn-secondary {
  background: rgba(255,255,255,0.05);
  color: var(--text);
  border: 1px solid var(--border);
}

.action-btn-secondary:hover { background: rgba(255,255,255,0.1); }

/* Footer */
.footer {
  position: relative;
  z-index: 10;
  padding: 4rem 2rem;
  border-top: 1px solid var(--border);
  text-align: center;
}

.footer p { color: var(--text-muted); font-size: 0.9rem; }

/* Utilities */
.hidden { display: none !important; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
