/* ============================================================
   AdaptIQ — Creative Adaptation Studio
   Main Stylesheet
   ============================================================ */

/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #111118;
  --bg-card: #16161f;
  --bg-elevated: #1e1e2a;
  --bg-hover: #22222f;

  --border: rgba(255,255,255,0.07);
  --border-subtle: rgba(255,255,255,0.04);
  --border-focus: rgba(99,102,241,0.6);

  --text-primary: #f0f0f5;
  --text-secondary: #9090a8;
  --text-muted: #5a5a72;
  --text-inverse: #0a0a0f;

  --accent: #6366f1;
  --accent-hover: #7577f3;
  --accent-glow: rgba(99,102,241,0.25);
  --accent-subtle: rgba(99,102,241,0.1);

  --green: #22c55e;
  --green-subtle: rgba(34,197,94,0.12);
  --orange: #f97316;
  --orange-subtle: rgba(249,115,22,0.12);
  --red: #ef4444;
  --red-subtle: rgba(239,68,68,0.12);
  --blue: #3b82f6;
  --blue-subtle: rgba(59,130,246,0.12);
  --purple: #a855f7;
  --purple-subtle: rgba(168,85,247,0.12);

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
  --shadow: 0 4px 16px rgba(0,0,0,0.5);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.6);
  --shadow-accent: 0 0 32px rgba(99,102,241,0.3);

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: 'Space Grotesk', 'Inter', sans-serif;

  --transition: 0.18s ease;
  --transition-slow: 0.35s ease;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* ── Typography ───────────────────────────────────────────── */
h1, h2, h3, h4, h5 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
h1 { font-size: clamp(2rem, 4vw, 3.5rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.25rem); }
h3 { font-size: 1.25rem; }
h4 { font-size: 1rem; }
p { color: var(--text-secondary); line-height: 1.7; }
a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent-hover); }

/* ── Layout ───────────────────────────────────────────────── */
.app-shell {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
}

.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
}
.container-sm { max-width: 800px; }
.container-lg { max-width: 1440px; }

/* ── Navigation ───────────────────────────────────────────── */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: 60px;
  background: rgba(10,10,15,0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 24px;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  cursor: pointer;
}

.nav-logo-mark {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--accent), #a855f7);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  color: white;
  font-family: var(--font-display);
  letter-spacing: -1px;
}

.nav-logo-text {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-primary);
  letter-spacing: -0.03em;
}
.nav-logo-text span { color: var(--accent); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-link {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 500;
  transition: all var(--transition);
  cursor: pointer;
  text-decoration: none;
  background: none;
  border: none;
}
.nav-link:hover { color: var(--text-primary); background: var(--bg-hover); }
.nav-link.active { color: var(--text-primary); background: var(--bg-hover); }

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

.nav-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #a855f7);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: white;
  cursor: pointer;
  border: 2px solid var(--border);
  transition: border-color var(--transition);
}
.nav-avatar:hover { border-color: var(--accent); }

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius);
  font-size: 13.5px;
  font-weight: 500;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all var(--transition);
  border: 1px solid transparent;
  white-space: nowrap;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: var(--shadow-accent);
  transform: translateY(-1px);
  color: white;
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--border);
}
.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: rgba(255,255,255,0.15);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}
.btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.btn-danger {
  background: var(--red-subtle);
  color: var(--red);
  border-color: rgba(239,68,68,0.2);
}
.btn-danger:hover { background: rgba(239,68,68,0.2); }

.btn-success {
  background: var(--green-subtle);
  color: var(--green);
  border-color: rgba(34,197,94,0.2);
}
.btn-success:hover { background: rgba(34,197,94,0.2); }

.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn-lg { padding: 13px 28px; font-size: 15px; }
.btn-xl { padding: 16px 36px; font-size: 16px; border-radius: var(--radius-lg); }

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
  font-size: 14px;
}
.btn-icon:hover { background: var(--bg-hover); color: var(--text-primary); border-color: rgba(255,255,255,0.15); }

/* ── Cards ────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: border-color var(--transition);
}
.card:hover { border-color: rgba(255,255,255,0.12); }
.card-sm { padding: 16px; border-radius: var(--radius); }

.card-elevated {
  background: var(--bg-elevated);
  border-color: var(--border);
}

/* ── Badges ───────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 11.5px;
  font-weight: 500;
}
.badge-default { background: var(--bg-elevated); color: var(--text-secondary); }
.badge-accent { background: var(--accent-subtle); color: var(--accent); }
.badge-green { background: var(--green-subtle); color: var(--green); }
.badge-orange { background: var(--orange-subtle); color: var(--orange); }
.badge-red { background: var(--red-subtle); color: var(--red); }
.badge-purple { background: var(--purple-subtle); color: var(--purple); }
.badge-blue { background: var(--blue-subtle); color: var(--blue); }

/* ── Forms ────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.form-hint { font-size: 12px; color: var(--text-muted); }

.form-input, .form-select, .form-textarea {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  color: var(--text-primary);
  font-size: 14px;
  font-family: var(--font-sans);
  transition: all var(--transition);
  width: 100%;
  outline: none;
}
.form-input::placeholder, .form-textarea::placeholder { color: var(--text-muted); }
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239090a8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}
.form-textarea { resize: vertical; min-height: 80px; }

.input-group {
  display: flex;
  gap: 0;
}
.input-group .form-input { border-radius: var(--radius) 0 0 var(--radius); }
.input-group .input-addon {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: none;
  padding: 10px 14px;
  color: var(--text-muted);
  font-size: 13px;
  border-radius: 0 var(--radius) var(--radius) 0;
  white-space: nowrap;
  display: flex;
  align-items: center;
}

.size-pair {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto;
  gap: 8px;
  align-items: center;
}
.size-pair-sep { color: var(--text-muted); font-size: 13px; }

/* ── Page shell ───────────────────────────────────────────── */
.page { padding-top: 60px; min-height: 100vh; }
.page-content { padding: 40px 0; }
.page-header { margin-bottom: 32px; }
.page-title { color: var(--text-primary); margin-bottom: 6px; }
.page-subtitle { color: var(--text-secondary); font-size: 15px; }

/* ── Section ──────────────────────────────────────────────── */
.section { padding: 80px 0; }
.section-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 12px;
}
.section-title { margin-bottom: 16px; }
.section-body { color: var(--text-secondary); font-size: 15px; max-width: 560px; }

/* ── Sidebar Layout ───────────────────────────────────────── */
.layout-sidebar {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: calc(100vh - 60px);
}

.sidebar {
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  padding: 24px 16px;
  position: sticky;
  top: 60px;
  height: calc(100vh - 60px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-section-label {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  padding: 12px 10px 6px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 500;
  transition: all var(--transition);
  text-decoration: none;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.sidebar-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.sidebar-item.active { background: var(--accent-subtle); color: var(--accent); }
.sidebar-item i { width: 16px; text-align: center; font-size: 13px; }

.sidebar-badge {
  margin-left: auto;
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: 10.5px;
  padding: 1px 7px;
  border-radius: var(--radius-full);
}

/* ── Drop Zone ────────────────────────────────────────────── */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-xl);
  padding: 48px 32px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--bg-secondary);
  position: relative;
  overflow: hidden;
}
.drop-zone::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 50%, var(--accent-subtle) 0%, transparent 70%);
  opacity: 0;
  transition: opacity var(--transition);
}
.drop-zone:hover { border-color: var(--accent); }
.drop-zone:hover::before { opacity: 1; }
.drop-zone.drag-over {
  border-color: var(--accent);
  background: var(--bg-card);
}
.drop-zone.drag-over::before { opacity: 1; }

.drop-zone-icon {
  width: 64px;
  height: 64px;
  background: var(--accent-subtle);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: var(--accent);
  margin: 0 auto 20px;
}
.drop-zone-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
  font-family: var(--font-display);
}
.drop-zone-sub { color: var(--text-secondary); font-size: 14px; margin-bottom: 20px; }
.drop-zone-formats {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ── Progress ─────────────────────────────────────────────── */
.progress-bar {
  width: 100%;
  height: 4px;
  background: var(--bg-elevated);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #a855f7);
  border-radius: var(--radius-full);
  transition: width 0.4s ease;
}

/* ── File List ────────────────────────────────────────────── */
.file-list { display: flex; flex-direction: column; gap: 8px; }
.file-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color var(--transition);
}
.file-item:hover { border-color: rgba(255,255,255,0.12); }
.file-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}
.file-icon.jpg, .file-icon.jpeg, .file-icon.png, .file-icon.tif, .file-icon.tiff { background: var(--blue-subtle); color: var(--blue); }
.file-icon.psd, .file-icon.ai { background: var(--purple-subtle); color: var(--purple); }
.file-icon.pdf { background: var(--red-subtle); color: var(--red); }
.file-icon.ttf, .file-icon.otf { background: var(--orange-subtle); color: var(--orange); }
.file-icon.mp4, .file-icon.mov { background: var(--green-subtle); color: var(--green); }
.file-icon.default { background: var(--bg-elevated); color: var(--text-muted); }

.file-info { flex: 1; min-width: 0; }
.file-name {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-meta { font-size: 12px; color: var(--text-muted); }
.file-status { flex-shrink: 0; }

/* ── Size Cards ───────────────────────────────────────────── */
.size-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
}
.size-card:hover { border-color: var(--accent); }
.size-card.selected { border-color: var(--accent); background: var(--accent-subtle); }
.size-card .check-indicator {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  opacity: 0;
  transition: opacity var(--transition);
}
.size-card.selected .check-indicator { opacity: 1; }

.size-card-visual {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.size-rect {
  background: var(--bg-elevated);
  border: 1.5px solid var(--border);
  border-radius: 3px;
  transition: border-color var(--transition);
}
.size-card.selected .size-rect { border-color: var(--accent); }

.size-card-info { flex: 1; min-width: 0; }
.size-card-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.size-card-dims { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.size-card-cat {
  font-size: 10.5px;
  background: var(--bg-elevated);
  color: var(--text-muted);
  padding: 1px 6px;
  border-radius: var(--radius-full);
  margin-top: 4px;
  display: inline-block;
}

/* ── Adaptation Canvas / Output ───────────────────────────── */
.adaptations-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
}

.adaptation-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition-slow);
  position: relative;
}
.adaptation-card:hover { border-color: rgba(255,255,255,0.15); transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.adaptation-card.shortlisted { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--shadow-accent); }
.adaptation-card.confirmed { border-color: var(--green); box-shadow: 0 0 0 1px var(--green); }

.adaptation-preview {
  background: #1a1a26;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  min-height: 200px;
}

.adaptation-canvas {
  position: relative;
  background: white;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: #333;
}

.canvas-layer {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.canvas-hero {
  background: linear-gradient(135deg, #2a2a3a, #3a3a5a);
  border-radius: 2px;
}

.canvas-text-block {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.canvas-headline {
  background: #1a1a2a;
  border-radius: 1px;
}
.canvas-body-text {
  background: #2a2a3a;
  border-radius: 1px;
  opacity: 0.6;
}
.canvas-logo {
  background: linear-gradient(135deg, var(--accent), #a855f7);
  border-radius: 2px;
}
.canvas-cta {
  background: var(--accent);
  border-radius: 2px;
}

.adaptation-confidence {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  border-radius: var(--radius-full);
  padding: 3px 10px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--green);
  border: 1px solid rgba(34,197,94,0.3);
}

.adaptation-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background var(--transition);
  opacity: 0;
}
.adaptation-card:hover .adaptation-overlay { opacity: 1; background: rgba(0,0,0,0.5); }

.adaptation-info {
  padding: 14px 16px;
}
.adaptation-size-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}
.adaptation-dims { font-size: 12px; color: var(--text-muted); }
.adaptation-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
}

/* ── Prompt Bar ───────────────────────────────────────────── */
.prompt-bar {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all var(--transition);
}
.prompt-bar:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.prompt-bar input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 14.5px;
  font-family: var(--font-sans);
}
.prompt-bar input::placeholder { color: var(--text-muted); }

/* ── Steps / Wizard ───────────────────────────────────────── */
.wizard-steps {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 40px;
}
.wizard-step {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}
.wizard-step:last-child { flex: none; }
.step-number {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
  border: 2px solid var(--border);
  color: var(--text-muted);
  transition: all var(--transition);
}
.step-number.active {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
}
.step-number.done {
  border-color: var(--green);
  background: var(--green-subtle);
  color: var(--green);
}
.step-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  transition: color var(--transition);
}
.step-label.active { color: var(--text-primary); }
.step-label.done { color: var(--green); }
.step-connector {
  flex: 1;
  height: 1px;
  background: var(--border);
  margin: 0 12px;
}
.step-connector.done { background: var(--green); }

/* ── Modal ────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  transition: opacity var(--transition);
}
.modal-overlay.visible { opacity: 1; }
.modal-overlay.hidden { display: none; }

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 32px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(16px);
  transition: transform var(--transition);
  box-shadow: var(--shadow-lg);
}
.modal-overlay.visible .modal { transform: translateY(0); }

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
}
.modal-title { font-size: 18px; font-weight: 700; }
.modal-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
  transition: all var(--transition);
  flex-shrink: 0;
}
.modal-close:hover { background: var(--bg-hover); color: var(--text-primary); }
.modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

/* ── Toast ────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 300px;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
  pointer-events: all;
  animation: toastIn 0.3s ease;
}
.toast.success { border-color: rgba(34,197,94,0.3); }
.toast.error { border-color: rgba(239,68,68,0.3); }
.toast.info { border-color: rgba(99,102,241,0.3); }
.toast-icon { font-size: 16px; flex-shrink: 0; }
.toast-msg { font-size: 13.5px; color: var(--text-primary); flex: 1; }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(16px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ── Tabs ─────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}
.tab {
  padding: 10px 18px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all var(--transition);
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
}
.tab:hover { color: var(--text-secondary); }
.tab.active { color: var(--text-primary); border-bottom-color: var(--accent); }

/* ── Empty State ──────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 64px 32px;
}
.empty-state-icon {
  width: 72px;
  height: 72px;
  background: var(--bg-elevated);
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  margin: 0 auto 20px;
  color: var(--text-muted);
}
.empty-state h3 { margin-bottom: 8px; color: var(--text-primary); }
.empty-state p { color: var(--text-secondary); font-size: 14px; max-width: 380px; margin: 0 auto 24px; }

/* ── Stats ────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.stat-label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 500; }
.stat-value { font-size: 2rem; font-weight: 700; font-family: var(--font-display); color: var(--text-primary); margin: 4px 0; }
.stat-change { font-size: 12px; color: var(--green); }

/* ── Loading / Skeleton ───────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--bg-hover) 50%, var(--bg-elevated) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius);
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Generating animation ─────────────────────────────────── */
.generating-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 32px;
  gap: 24px;
}
.generating-orbs {
  position: relative;
  width: 80px;
  height: 80px;
}
.orb {
  position: absolute;
  border-radius: 50%;
  animation: orbit 2.5s linear infinite;
}
.orb-1 {
  width: 80px;
  height: 80px;
  border: 2px solid var(--accent);
  opacity: 0.3;
  animation-duration: 3s;
}
.orb-2 {
  width: 56px;
  height: 56px;
  top: 12px;
  left: 12px;
  border: 2px solid #a855f7;
  opacity: 0.4;
  animation-duration: 2s;
  animation-direction: reverse;
}
.orb-3 {
  width: 32px;
  height: 32px;
  top: 24px;
  left: 24px;
  background: linear-gradient(135deg, var(--accent), #a855f7);
  animation: pulse 1.5s ease-in-out infinite;
}
@keyframes orbit { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { transform: scale(1); opacity: 0.8; } 50% { transform: scale(1.15); opacity: 1; } }

.generating-text {
  text-align: center;
}
.generating-text h3 { color: var(--text-primary); margin-bottom: 6px; }
.generating-text p { color: var(--text-secondary); font-size: 14px; }

/* ── Export Panel ─────────────────────────────────────────── */
.export-options {
  display: grid;
  gap: 12px;
}
.export-option {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  gap: 16px;
}
.export-option:hover { border-color: var(--accent); background: var(--accent-subtle); }
.export-option.selected { border-color: var(--accent); background: var(--accent-subtle); }
.export-option-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.export-option-info { flex: 1; }
.export-option-name { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.export-option-desc { font-size: 12.5px; color: var(--text-secondary); margin-top: 2px; }

/* ── Contextual Editor Panel ──────────────────────────────── */
.editor-panel {
  position: fixed;
  right: 0;
  top: 60px;
  bottom: 0;
  width: 420px;           /* wider default */
  min-width: 280px;
  max-width: 900px;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px 24px 24px 28px; /* left-padding leaves room for resize handle */
  transform: translateX(100%);
  transition: transform var(--transition-slow), width 0.1s ease;
  z-index: 50;
  box-shadow: -4px 0 24px rgba(0,0,0,0.18);
}
.editor-panel.open    { transform: translateX(0); }
.editor-panel.resizing { transition: none; user-select: none; }

/* Minimised: collapse to a thin tab showing only the title bar */
.editor-panel.minimised {
  width: 44px !important;
  overflow: hidden;
  padding: 20px 6px;
}
.editor-panel.minimised > *:not(.editor-panel-resize-handle) {
  /* hide everything except the titlebar when minimised */
  display: none !important;
}
/* We need the titlebar to remain, so we override with a specific rule */
.editor-panel.minimised .editor-panel-titlebar {
  display: flex !important;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  writing-mode: vertical-rl;
  width: 44px;
}
.editor-panel.minimised .editor-panel-titlebar h4 {
  font-size: 12px;
  white-space: nowrap;
}

/* Maximised: full width overlay */
.editor-panel.maximised {
  width: 50vw !important;
  min-width: 400px;
}

/* ── Resize handle on left edge ──────────────────────────── */
.editor-panel-resize-handle {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 6px;
  cursor: col-resize;
  background: transparent;
  transition: background 0.15s;
  z-index: 10;
  flex-shrink: 0;
}
.editor-panel-resize-handle:hover,
.editor-panel.resizing .editor-panel-resize-handle {
  background: var(--accent);
  opacity: 0.5;
}

/* ── Title bar ───────────────────────────────────────────── */
.editor-panel-titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: -20px;
  background: var(--bg-secondary);
  z-index: 5;
  padding-top: 4px;
}
.editor-panel-resize-icon {
  cursor: col-resize;
  padding: 2px 4px;
  border-radius: 3px;
  transition: background 0.1s;
}
.editor-panel-resize-icon:hover { background: var(--bg-elevated); }

/* ── Homepage hero ────────────────────────────────────────── */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  position: relative;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  z-index: 0;
}
.hero-bg::before {
  content: '';
  position: absolute;
  top: -20%;
  left: -10%;
  width: 60%;
  height: 80%;
  background: radial-gradient(ellipse at center, rgba(99,102,241,0.15) 0%, transparent 70%);
}
.hero-bg::after {
  content: '';
  position: absolute;
  bottom: -20%;
  right: -10%;
  width: 60%;
  height: 80%;
  background: radial-gradient(ellipse at center, rgba(168,85,247,0.12) 0%, transparent 70%);
}

.hero-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.015) 1px, transparent 1px);
  background-size: 60px 60px;
  z-index: 0;
}

.hero-content {
  position: relative;
  z-index: 1;
  text-align: center;
  max-width: 880px;
  margin: 0 auto;
  padding: 120px 24px 80px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent-subtle);
  border: 1px solid rgba(99,102,241,0.3);
  color: var(--accent);
  padding: 6px 16px;
  border-radius: var(--radius-full);
  font-size: 12.5px;
  font-weight: 500;
  margin-bottom: 28px;
}

.hero-title {
  font-size: clamp(2.8rem, 6vw, 5rem);
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.05;
  color: var(--text-primary);
  margin-bottom: 24px;
}
.hero-title .gradient-text {
  background: linear-gradient(135deg, var(--accent), #a855f7, #ec4899);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: clamp(1rem, 2vw, 1.2rem);
  color: var(--text-secondary);
  max-width: 620px;
  margin: 0 auto 40px;
  line-height: 1.7;
}

.hero-ctas {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
}

.hero-social-proof {
  margin-top: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  flex-wrap: wrap;
}
.hero-proof-item {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 13px;
}
.hero-proof-item i { color: var(--accent); font-size: 12px; }

/* ── Features ─────────────────────────────────────────────── */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}
.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 28px;
  transition: all var(--transition);
}
.feature-card:hover {
  border-color: rgba(255,255,255,0.12);
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}
.feature-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  margin-bottom: 18px;
}
.feature-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
  font-family: var(--font-display);
}
.feature-desc { font-size: 14px; color: var(--text-secondary); line-height: 1.65; }

/* ── Workflow steps ───────────────────────────────────────── */
.workflow-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0;
  position: relative;
}
.workflow-step {
  text-align: center;
  padding: 24px;
  position: relative;
}
.workflow-step::after {
  content: '';
  position: absolute;
  top: 36px;
  right: -1px;
  width: 2px;
  height: 32px;
  background: linear-gradient(to bottom, var(--accent), transparent);
  display: none;
}
@media (min-width: 640px) {
  .workflow-step::after { display: block; }
  .workflow-step:last-child::after { display: none; }
}
.workflow-num {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent-subtle);
  border: 2px solid var(--accent);
  color: var(--accent);
  font-size: 16px;
  font-weight: 700;
  font-family: var(--font-display);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
}
.workflow-step-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
  font-family: var(--font-display);
}
.workflow-step-desc { font-size: 13px; color: var(--text-secondary); }

/* ── Project card ─────────────────────────────────────────── */
.project-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: all var(--transition);
}
.project-card:hover { border-color: rgba(255,255,255,0.15); transform: translateY(-2px); box-shadow: var(--shadow); }

.project-thumb {
  height: 140px;
  background: linear-gradient(135deg, var(--bg-elevated), var(--bg-hover));
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  overflow: hidden;
}
.project-thumb-badge {
  position: absolute;
  top: 10px;
  right: 10px;
}
.project-mini-canvas {
  background: white;
  border-radius: 2px;
  box-shadow: var(--shadow-sm);
}

.project-card-body { padding: 16px; }
.project-card-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.project-card-client { font-size: 12.5px; color: var(--text-muted); margin-bottom: 10px; }
.project-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.project-card-date { font-size: 11.5px; color: var(--text-muted); }
.project-card-sizes { font-size: 11.5px; color: var(--accent); }

/* ── Media size picker tabs ───────────────────────────────── */
.size-picker-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.size-picker-tab {
  padding: 5px 14px;
  border-radius: var(--radius-full);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  background: var(--bg-elevated);
  transition: all var(--transition);
}
.size-picker-tab:hover { border-color: var(--accent); color: var(--accent); }
.size-picker-tab.active { background: var(--accent); border-color: var(--accent); color: white; }

.sizes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 10px;
  max-height: 380px;
  overflow-y: auto;
  padding-right: 4px;
}
.sizes-grid::-webkit-scrollbar { width: 4px; }
.sizes-grid::-webkit-scrollbar-track { background: var(--bg-secondary); }
.sizes-grid::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 768px) {
  .layout-sidebar { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .adaptations-grid { grid-template-columns: 1fr; }
  .hero-ctas { flex-direction: column; align-items: center; }
  .wizard-steps { flex-wrap: wrap; gap: 12px; }
  .step-connector { display: none; }
}

/* ── Utilities ────────────────────────────────────────────── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }
.gap-8 { gap: 32px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mt-8 { margin-top: 32px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.mb-8 { margin-bottom: 32px; }
.w-full { width: 100%; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-sm { font-size: 12.5px; }
.text-xs { font-size: 11px; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-primary { color: var(--text-primary); }
.text-accent { color: var(--accent); }
.text-green { color: var(--green); }
.text-orange { color: var(--orange); }
.text-red { color: var(--red); }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-medium { font-weight: 500; }
.hidden { display: none !important; }
.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }
.scroll-x { overflow-x: auto; }

/* ── Scroll customisation ─────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--bg-elevated); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--bg-hover); }

/* ── Selection box for layout editor ─────────────────────── */
.selected-outline {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── Refinement panel slider ──────────────────────────────── */
.slider-input {
  -webkit-appearance: none;
  width: 100%;
  height: 4px;
  background: var(--bg-elevated);
  border-radius: var(--radius-full);
  outline: none;
}
.slider-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* ── Breakout section ─────────────────────────────────────── */
.breakout-section {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 80px 0;
}

/* ── Color swatch ─────────────────────────────────────────── */
.color-swatch {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,0.1);
  cursor: pointer;
  transition: transform var(--transition);
}
.color-swatch:hover { transform: scale(1.15); }
.color-swatch.selected { outline: 2px solid white; outline-offset: 2px; }
