/* ==========================================================================
   1. Design System & CSS Variables
   ========================================================================== */
:root {
  --bg-dark: #090d16;
  --bg-card: #111827;
  --bg-card-hover: #1e293b;
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --secondary: #06b6d4;
  --gradient-1: linear-gradient(135deg, #6366f1 0%, #06b6d4 100%);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --border: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(99, 102, 241, 0.5);
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;
  --font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

body {
  background-color: var(--bg-dark);
  color: var(--text-primary);
  font-family: var(--font);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
  width: 100%;
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 1.25rem 4rem;
}

/* ==========================================================================
   2. Header Navigation
   ========================================================================== */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: rgba(9, 13, 22, 0.85);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 50;
  gap: 0.75rem;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #fff;
}

.brand-icon {
  width: 34px;
  height: 34px;
  background: var(--gradient-1);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.brand-name {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.privacy-badge {
  background: rgba(16, 185, 129, 0.1);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.2);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

/* ==========================================================================
   3. Hero & Upload Dropzone
   ========================================================================== */
.hero {
  text-align: center;
  padding: 3rem 1rem 1.5rem;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.hero-title {
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 0.75rem;
  background: linear-gradient(180deg, #ffffff 0%, #cbd5e1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  color: var(--text-secondary);
  font-size: 1.05rem;
  max-width: 650px;
  margin: 0 auto;
}

.dropzone-container {
  background: var(--bg-card);
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem 1.5rem;
  text-align: center;
  margin: 1.5rem auto 2rem;
  max-width: 780px;
  width: 100%;
  cursor: pointer;
  transition: all 0.25s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.dropzone-container:hover,
.dropzone-container.drag-over {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.04);
  transform: translateY(-2px);
}

.hero.hidden,
.dropzone-container.hidden {
  display: none !important;
}

.upload-circle {
  width: 58px;
  height: 58px;
  background: rgba(99, 102, 241, 0.1);
  color: var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
}

.button-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
}

.btn {
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.btn-gradient {
  background: var(--gradient-1);
  color: #fff;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.3);
}

.btn-gradient:hover {
  opacity: 0.92;
  transform: translateY(-1px);
}

.btn-outline {
  background: var(--bg-dark);
  border: 1px solid var(--border);
  color: var(--text-primary);
}

.btn-outline:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.2);
}

/* ==========================================================================
   4. Studio Card Container & Grid
   ========================================================================== */
.studio-card-container {
  max-width: 980px;
  margin: 1rem auto 3rem;
  width: 100%;
  animation: cardEntrance 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes cardEntrance {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

.card-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  padding: 0 0.25rem;
  gap: 0.75rem;
}

.batch-stepper {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 4px 12px;
  border-radius: 30px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
}

.nav-arrow-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
  transition: color 0.2s;
}

.nav-arrow-btn:hover {
  color: #fff;
}

.top-meta-badge {
  font-size: 0.78rem;
  color: var(--text-secondary);
  max-width: 250px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.studio-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.55);
  display: grid;
  grid-template-columns: 1fr 340px;
  overflow: hidden;
}

/* ==========================================================================
   5. Stage Column & Thumbnail Queue
   ========================================================================== */
.stage-col {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  background: #080c14;
  background-image: 
    linear-gradient(45deg, #0e1420 25%, transparent 25%), 
    linear-gradient(-45deg, #0e1420 25%, transparent 25%), 
    linear-gradient(45deg, transparent 75%, #0e1420 75%), 
    linear-gradient(-45deg, transparent 75%, #0e1420 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
  min-height: 460px;
  min-width: 0;
  position: relative;
  overflow: hidden;
}

.canvas-viewport {
  width: 100%;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 380px;
  max-height: 420px;
  overflow: hidden;
}

.canvas-viewport canvas {
  max-width: 100%;
  max-height: 380px;
  width: auto !important;
  height: auto !important;
  object-fit: contain;
  background: transparent !important;
  border-radius: 4px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  display: block;
}

.queue-bar {
  width: 100%;
  max-width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 1.25rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  overflow: hidden;
}

.queue-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-secondary);
  white-space: nowrap;
}

.queue-list {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
}

.queue-list::-webkit-scrollbar {
  height: 4px;
}

.queue-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

.queue-thumb {
  background: var(--bg-dark);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.queue-thumb:hover {
  border-color: var(--primary);
  color: #fff;
}

.queue-thumb.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.4);
}

/* ==========================================================================
   6. Controls Column (Tabs, Sliders, Pickers & Actions)
   ========================================================================== */
.controls-col {
  padding: 1.5rem;
  background: var(--bg-card);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  min-width: 0;
}

.tool-tabs {
  display: flex;
  background: var(--bg-dark);
  padding: 3px;
  border-radius: var(--radius-sm);
  gap: 2px;
}

.tool-tab {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 8px 4px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  transition: all 0.2s ease;
}

.tool-tab .tab-icon {
  font-size: 0.85rem;
}

.tool-tab.active {
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.tab-panel {
  display: none;
  min-height: 52px;
}

.tab-panel.active {
  display: block;
}

.slider-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 600;
  margin-bottom: 8px;
}

.slider-val {
  color: var(--text-primary);
}

input[type="range"] {
  width: 100%;
  accent-color: var(--primary);
  cursor: pointer;
}

.swatches-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.swatch-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--border);
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s;
  flex-shrink: 0;
}

.swatch-btn:hover {
  transform: scale(1.1);
}

.swatch-btn.active {
  border-color: var(--secondary);
  box-shadow: 0 0 0 2px rgba(6, 182, 212, 0.4);
}

.swatch-transparent {
  background-color: #ffffff;
  background-image: 
    linear-gradient(45deg, #cbd5e1 25%, transparent 25%), 
    linear-gradient(-45deg, #cbd5e1 25%, transparent 25%), 
    linear-gradient(45deg, transparent 75%, #cbd5e1 75%), 
    linear-gradient(-45deg, transparent 75%, #cbd5e1 75%);
  background-size: 8px 8px;
  background-position: 0 0, 0 4px, 4px -4px, -4px 0px;
  position: relative;
}

.swatch-transparent::after {
  content: "∅";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 800;
  color: #64748b;
}

.swatch-transparent.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.5);
}

.auto-edge-btn {
  background: linear-gradient(135deg, #f59e0b, #ec4899);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.custom-color-label {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: conic-gradient(red, yellow, lime, aqua, blue, magenta, red);
  display: grid;
  place-items: center;
  cursor: pointer;
  overflow: hidden;
  border: 2px solid var(--border);
  flex-shrink: 0;
}

.custom-color-label input[type="color"] {
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.ratio-pill-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.ratio-pill {
  background: var(--bg-dark);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 8px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ratio-pill.active {
  border-color: var(--primary);
  color: #fff;
  background: rgba(99, 102, 241, 0.15);
}

.export-dropdowns-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.select-wrapper {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.select-wrapper label {
  font-size: 0.68rem;
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
}

.select-wrapper select {
  background: var(--bg-dark);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  width: 100%;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.action-buttons-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: auto;
}

.btn-main-download {
  background: var(--gradient-1);
  color: #fff;
  border: none;
  padding: 0.85rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
  transition: all 0.2s ease;
}

.btn-main-download:hover {
  opacity: 0.94;
  transform: translateY(-1px);
}

.btn-batch-download {
  background: var(--bg-dark);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 0.65rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.8rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.btn-batch-download:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.btn-upload-more {
  background: transparent;
  border: 1px dashed var(--border);
  color: var(--text-secondary);
  padding: 0.65rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.8rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.btn-upload-more:hover {
  border-color: var(--primary);
  color: var(--text-primary);
  background: rgba(99, 102, 241, 0.05);
}

/* ==========================================================================
   7. Feature Highlights & FAQ Accordions
   ========================================================================== */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin: 3.5rem 0;
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}

.feature-icon {
  font-size: 1.8rem;
  margin-bottom: 0.75rem;
}

.feature-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.feature-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.faq-container {
  max-width: 780px;
  margin: 0 auto;
}

.faq-heading {
  font-size: 1.5rem;
  font-weight: 800;
  text-align: center;
  margin-bottom: 1.5rem;
}

.faq-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 0.75rem;
  overflow: hidden;
  cursor: pointer;
}

.faq-question {
  padding: 1rem 1.25rem;
  font-weight: 600;
  font-size: 0.92rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
}

.faq-answer {
  display: none;
  padding: 0 1.25rem 1rem;
  color: var(--text-secondary);
  font-size: 0.85rem;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  padding-top: 0.75rem;
}

.faq-card.open .faq-answer {
  display: block;
}

/* ==========================================================================
   8. Footer & Mobile Responsive System
   ========================================================================== */
footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.8rem;
}

/* Tablet & Mobile Breakpoints */
@media (max-width: 860px) {
  .studio-card {
    grid-template-columns: 1fr;
  }

  .controls-col {
    border-left: none;
    border-top: 1px solid var(--border);
    padding: 1.25rem;
  }

  .stage-col {
    min-height: 320px;
    padding: 1rem;
  }

  .canvas-viewport {
    min-height: 280px;
    max-height: 340px;
  }

  .canvas-viewport canvas {
    max-height: 300px;
  }
}

@media (max-width: 600px) {
  header {
    padding: 0.75rem 1rem;
  }

  .privacy-badge {
    font-size: 0.72rem;
    padding: 3px 8px;
  }

  .hero {
    padding: 2rem 0.5rem 1rem;
  }

  .hero-title {
    font-size: 1.6rem;
  }

  .hero-subtitle {
    font-size: 0.9rem;
  }

  .dropzone-container {
    padding: 1.75rem 1rem;
  }

  .button-row {
    flex-direction: column;
  }

  .button-row .btn {
    width: 100%;
  }

  .stage-col {
    min-height: 260px;
  }

  .canvas-viewport {
    min-height: 220px;
    max-height: 260px;
  }

  .canvas-viewport canvas {
    max-height: 240px;
  }

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

  .ratio-pill-grid {
    grid-template-columns: 1fr 1fr;
  }

  .tool-tab {
    font-size: 0.65rem;
    padding: 6px 2px;
  }

  .features-grid {
    grid-template-columns: 1fr;
    margin: 2rem 0;
  }
}
