:root {
  --bg-dark: #0f111a;
  --bg-card: rgba(26, 30, 46, 0.6);
  --bg-card-hover: rgba(40, 46, 70, 0.8);
  --text-primary: #ffffff;
  --text-secondary: #94a3b8;
  --accent-primary: #ec4899;
  --accent-secondary: #8b5cf6;
  --border-color: rgba(255, 255, 255, 0.1);
  --font-main: 'Outfit', sans-serif;
  --shadow-glow: 0 0 24px rgba(236, 72, 153, 0.3);
  --border-radius: 16px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font-main);
  background-color: var(--bg-dark);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Background Mesh Gradient */
.bg-mesh {
  position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; z-index: -1;
  background-color: var(--bg-dark);
  background-image: 
    radial-gradient(at 0% 0%, rgba(139, 92, 246, 0.15) 0px, transparent 50%),
    radial-gradient(at 100% 0%, rgba(236, 72, 153, 0.15) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(14, 165, 233, 0.15) 0px, transparent 50%);
  filter: blur(60px);
}

/* Typography & Utils */
.text-gradient {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.container { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; }

/* Navbar */
.navbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 1.5rem 2rem; border-bottom: 1px solid var(--border-color);
  background: rgba(15, 17, 26, 0.7); backdrop-filter: blur(12px);
  position: sticky; top: 0; z-index: 50;
}
.nav-brand { display: flex; align-items: center; gap: 0.5rem; font-weight: 700; font-size: 1.25rem; }
.logo-icon { font-size: 1.5rem; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0.75rem 1.5rem; border-radius: 8px; font-weight: 600; font-family: var(--font-main);
  cursor: pointer; transition: all 0.2s ease; border: none; font-size: 0.9rem;
}
.btn-primary { background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary)); color: white; }
.btn-primary:hover { transform: translateY(-2px); box-shadow: var(--shadow-glow); }
.btn-secondary { background: rgba(255,255,255,0.1); color: white; }
.btn-secondary:hover { background: rgba(255,255,255,0.15); }
.btn-ghost { background: transparent; color: var(--text-secondary); padding: 0.5rem 1rem; }
.btn-ghost:hover { color: white; background: rgba(255,255,255,0.05); }
.btn-icon { background: transparent; font-size: 1.2rem; padding: 0.5rem; color: var(--text-secondary); border-radius: 50%; }
.btn-icon:hover { color: white; background: rgba(255,255,255,0.1); }
.btn-large { padding: 1rem 2rem; font-size: 1.1rem; border-radius: 12px; }
.btn-full { width: 100%; margin-top: 1rem; }

/* Modals */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity 0.3s ease;
}
.modal-overlay.active { opacity: 1; pointer-events: all; }
.modal {
  background: #1a1e2e; border: 1px solid var(--border-color);
  padding: 2.5rem; border-radius: var(--border-radius);
  max-width: 450px; width: 90%; text-align: center;
  transform: translateY(20px); transition: transform 0.3s ease;
}
.modal-overlay.active .modal { transform: translateY(0); }
.modal h2 { margin-bottom: 1rem; font-size: 1.5rem; }
.modal p { color: var(--text-secondary); margin-bottom: 2rem; line-height: 1.5; font-size: 0.95rem; }
.input-group { display: flex; flex-direction: column; gap: 1rem; }
input[type="text"], input[type="number"], select {
  width: 100%; padding: 0.85rem 1rem; background: rgba(0,0,0,0.3);
  border: 1px solid var(--border-color); border-radius: 8px;
  color: white; font-family: var(--font-main); font-size: 0.95rem;
  transition: border-color 0.2s;
}
input:focus, select:focus { outline: none; border-color: var(--accent-secondary); }

/* Hero Section */
.hero-section { text-align: center; padding: 6rem 0; animation: fadeIn 0.8s ease; }
.hero-title { font-size: 4rem; font-weight: 800; line-height: 1.1; margin-bottom: 1.5rem; }
.hero-subtitle { font-size: 1.25rem; color: var(--text-secondary); max-width: 600px; margin: 0 auto 3rem; line-height: 1.6; }
.upload-card {
  background: var(--bg-card); border: 1px solid var(--border-color);
  backdrop-filter: blur(12px); border-radius: 24px;
  max-width: 400px; margin: 0 auto; padding: 3rem 2rem;
  transition: transform 0.3s ease;
}
.upload-card:hover { transform: translateY(-5px); border-color: rgba(255,255,255,0.2); }
.upload-icon { font-size: 3rem; margin-bottom: 1rem; }
.upload-card h3 { margin-bottom: 0.5rem; font-size: 1.25rem; }
.upload-card p { color: var(--text-secondary); margin-bottom: 2rem; font-size: 0.9rem; }

/* Gallery Section */
.gallery-section { padding: 4rem 0; animation: fadeIn 0.5s ease; }
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2rem; }
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1.5rem; }
.gallery-item {
  aspect-ratio: 1; border-radius: 12px; overflow: hidden;
  background: var(--bg-card); border: 1px solid var(--border-color);
  cursor: pointer; position: relative; transition: all 0.2s;
}
.gallery-item img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s ease; }
.gallery-item:hover { border-color: var(--accent-secondary); box-shadow: 0 8px 24px rgba(0,0,0,0.4); }
.gallery-item:hover img { transform: scale(1.05); }
.gallery-item-file { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; background: rgba(255,255,255,0.03); }
.gallery-item-file .file-icon { font-size: 3rem; }
.gallery-item-overlay {
  position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
  opacity: 0; transition: opacity 0.2s; display: flex; align-items: flex-end; padding: 1rem;
}
.gallery-item:hover .gallery-item-overlay { opacity: 1; }
.gallery-item-name { font-size: 0.8rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: 100%; }

/* Transformation Studio */
.studio-section { padding: 2rem 0 4rem; animation: slideUp 0.4s ease; }
.studio-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2rem; }
.studio-layout { display: grid; grid-template-columns: 1fr 320px; gap: 2rem; align-items: start; }

.studio-preview-container {
  background: var(--bg-card); border: 1px solid var(--border-color);
  border-radius: var(--border-radius); padding: 1.5rem;
  display: flex; flex-direction: column; gap: 1rem;
}
.preview-wrapper {
  background: #000; border-radius: 8px; overflow: hidden;
  position: relative; min-height: 400px; display: flex; align-items: center; justify-content: center;
}
#previewImage { max-width: 100%; max-height: 60vh; object-fit: contain; transition: opacity 0.2s; }
.loader-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; }
.spinner { width: 40px; height: 40px; border: 4px solid rgba(255,255,255,0.1); border-top-color: var(--accent-primary); border-radius: 50%; animation: spin 1s linear infinite; }

.preview-url-box { margin-top: auto; }
.preview-url-box label { display: block; font-size: 0.75rem; color: var(--text-secondary); margin-bottom: 0.5rem; text-transform: uppercase; letter-spacing: 0.05em; }
#transformUrlDisplay { font-family: monospace; font-size: 0.8rem; color: var(--text-secondary); background: rgba(0,0,0,0.4); border-color: rgba(255,255,255,0.05); }

.studio-controls {
  background: var(--bg-card); border: 1px solid var(--border-color);
  border-radius: var(--border-radius); padding: 1.5rem;
  display: flex; flex-direction: column; gap: 1.5rem;
}
.control-group h3 { font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-secondary); margin-bottom: 1rem; border-bottom: 1px solid var(--border-color); padding-bottom: 0.5rem; }
.input-row { display: flex; gap: 1rem; margin-bottom: 0.75rem; }
.input-col { flex: 1; }
.input-col label { display: block; font-size: 0.8rem; margin-bottom: 0.4rem; color: #cbd5e1; }
.checkbox-row { display: flex; align-items: center; gap: 0.5rem; font-size: 0.85rem; color: #cbd5e1; }

.slider-group { margin-bottom: 1rem; }
.slider-header { display: flex; justify-content: space-between; font-size: 0.85rem; margin-bottom: 0.5rem; color: #cbd5e1; }
input[type="range"] { width: 100%; accent-color: var(--accent-primary); }

.filter-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.filter-btn {
  background: rgba(0,0,0,0.3); border: 1px solid var(--border-color);
  color: var(--text-secondary); padding: 0.6rem; border-radius: 6px;
  font-family: var(--font-main); font-size: 0.85rem; cursor: pointer; transition: all 0.2s;
}
.filter-btn:hover { background: rgba(255,255,255,0.05); color: white; }
.filter-btn.active { background: rgba(236, 72, 153, 0.15); border-color: var(--accent-primary); color: white; }

/* Document Preview */
.document-preview-card {
  background: var(--bg-card); border: 1px solid var(--border-color);
  border-radius: var(--border-radius); padding: 3rem;
  display: flex; flex-direction: column; align-items: center; gap: 0.75rem;
  max-width: 420px; width: 100%; text-align: center;
}
.document-icon { font-size: 4rem; }
.document-meta { color: var(--text-secondary); font-size: 0.85rem; }

/* Animations */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes spin { to { transform: rotate(360deg); } }

/* Responsive */
@media (max-width: 900px) {
  .hero-title { font-size: 2.5rem; }
  .studio-layout { grid-template-columns: 1fr; }
}
