* { box-sizing: border-box; margin: 0; padding: 0; }
.hidden { display: none !important; }

:root {
  --bg: #0c0d12;
  --surface: #13151c;
  --surface2: #1a1d28;
  --surface3: #21253a;
  --border: #262a3d;
  --border-hover: #363b54;
  --text: #e4e6ef;
  --text-secondary: #a0a5c0;
  --text-muted: #636985;
  --accent: #6366f1;
  --accent-hover: #5558e6;
  --accent-glow: rgba(99, 102, 241, 0.15);
  --accent-subtle: rgba(99, 102, 241, 0.08);
  --success: #22c55e;
  --danger: #ef4444;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.25);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.3);
  --transition: 0.15s ease;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Layout ── */
.app { display: flex; height: 100vh; overflow: hidden; }

.sidebar {
  width: 260px;
  min-width: 260px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

.panel {
  flex: 1;
  overflow-y: auto;
  padding: 28px;
}

/* ── Sidebar ── */
.sidebar-header {
  padding: 20px 18px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-mark {
  width: 32px;
  height: 32px;
  background: var(--accent);
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
}

.sidebar-header h1 {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text);
  line-height: 1.2;
}

.sidebar-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
}

.sidebar-section-label {
  padding: 16px 18px 6px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-muted);
}

.brand-list { padding: 4px 10px; flex: 1; overflow-y: auto; }

.brand-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  transition: all var(--transition);
}

.brand-item:hover { background: var(--surface2); color: var(--text); }
.brand-item.active { background: var(--accent-subtle); color: var(--text); }

.brand-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  opacity: 0.6;
}

.brand-item.active .brand-dot { opacity: 1; box-shadow: 0 0 6px var(--accent); }

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border);
}

/* ── Tabs ── */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  background: var(--surface);
  flex-shrink: 0;
  gap: 2px;
}

.tab-btn {
  padding: 13px 14px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
}

.tab-btn:hover { color: var(--text-secondary); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }

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

/* ── Generator layout ── */
.generator-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 32px;
  height: 100%;
}

.controls-panel {
  overflow-y: auto;
  padding-right: 12px;
}

.results-panel {
  min-width: 0;
}

/* ── Forms ── */
.section { margin-bottom: 22px; }
.section-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

label { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 5px; font-weight: 500; }

input[type="text"],
textarea,
select {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text);
  font-size: 13px;
  padding: 9px 12px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  font-family: inherit;
}

input[type="text"]:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

input[type="text"]::placeholder,
textarea::placeholder {
  color: var(--text-muted);
  opacity: 0.7;
}

input[type="color"] {
  width: 100%;
  padding: 2px;
  height: 38px;
  cursor: pointer;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
}

textarea { resize: vertical; min-height: 72px; }

.form-row { margin-bottom: 12px; }

.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }

.color-pickers {
  display: flex;
  gap: 12px;
}

.color-picker-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.color-picker-item input[type="color"] {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  padding: 2px;
  cursor: pointer;
}

.color-picker-item span {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

.hex-input {
  width: 72px;
  padding: 4px 6px;
  font-size: 12px;
  font-family: monospace;
  text-align: center;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  text-transform: uppercase;
}
.hex-input:focus {
  outline: none;
  border-color: var(--accent);
}

/* ── Toggle (mode switch) ── */
.toggle-group {
  display: flex;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 3px;
}

.toggle-btn {
  flex: 1;
  padding: 8px;
  background: none;
  border: none;
  border-radius: var(--radius-xs);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}

.toggle-btn:hover { color: var(--text-secondary); }

.toggle-btn.active {
  background: var(--accent);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: var(--radius-xs);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  font-family: inherit;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 1px 3px rgba(99, 102, 241, 0.3);
}
.btn-primary:hover { background: var(--accent-hover); box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
  background: var(--surface2);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--surface3); border-color: var(--border-hover); color: var(--text); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px dashed var(--border);
}
.btn-ghost:hover { background: var(--surface2); border-style: solid; color: var(--text); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 6px 10px; font-size: 12px; }
.btn-full { width: 100%; }

/* ── Generate button ── */
.btn-generate {
  width: 100%;
  padding: 13px;
  font-size: 14px;
  margin-top: 4px;
  border-radius: var(--radius-sm);
}

/* ── Format selector ── */
.format-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.format-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 4px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}

.format-btn svg { width: 20px; height: 20px; }
.format-btn:hover { border-color: var(--border-hover); color: var(--text-secondary); }
.format-btn.active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-subtle);
  box-shadow: 0 0 0 1px var(--accent-glow);
}

/* ── Layout selector ── */
.layout-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.layout-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 4px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}
.layout-btn svg { width: 24px; height: 34px; }
.layout-btn:hover { border-color: var(--border-hover); color: var(--text-secondary); }
.layout-btn.active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-subtle);
  box-shadow: 0 0 0 1px var(--accent-glow);
}

/* ── Variants slider ── */
.variants-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

input[type="range"] {
  flex: 1;
  accent-color: var(--accent);
  height: 4px;
}

.variants-value {
  min-width: 28px;
  text-align: center;
  font-weight: 700;
  font-size: 15px;
  color: var(--accent);
}

/* ── Toggle switch ── */
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0;
}

.switch-label {
  margin: 0 !important;
  color: var(--text) !important;
  font-size: 13px !important;
  font-weight: 500 !important;
}

.switch {
  position: relative; width: 38px; height: 22px;
}

.switch input { opacity: 0; width: 0; height: 0; }

.switch-slider {
  position: absolute; inset: 0;
  background: var(--border);
  border-radius: 22px;
  cursor: pointer;
  transition: background 0.2s;
}

.switch-slider:before {
  content: "";
  position: absolute;
  height: 16px; width: 16px;
  left: 3px; bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: var(--shadow-sm);
}

.switch input:checked + .switch-slider { background: var(--accent); }
.switch input:checked + .switch-slider:before { transform: translateX(16px); }

/* ── Upload area ── */
.upload-area {
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.upload-area:hover,
.upload-area.drag-over {
  border-color: var(--accent);
  background: var(--accent-subtle);
  color: var(--text-secondary);
}

.upload-area input { display: none; }

.upload-compact {
  flex-direction: row;
  padding: 14px 16px;
  flex: 1;
}

.logo-upload-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-preview-img {
  height: 48px;
  display: none;
  border-radius: var(--radius-xs);
  background: var(--surface2);
  padding: 4px;
}

/* ── Reference thumbnails ── */
.ref-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.ref-thumb {
  position: relative;
  aspect-ratio: 4/5;
  border-radius: var(--radius-xs);
  overflow: hidden;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
}

.ref-thumb img { width: 100%; height: 100%; object-fit: cover; }

.ref-thumb:hover { border-color: var(--border-hover); }
.ref-thumb.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-glow); }

.ref-thumb .del-btn {
  position: absolute; top: 4px; right: 4px;
  background: rgba(0,0,0,0.7);
  border: none; border-radius: 50%;
  width: 20px; height: 20px;
  color: #fff; font-size: 10px;
  cursor: pointer; display: flex;
  align-items: center; justify-content: center;
  opacity: 0; transition: opacity var(--transition);
  backdrop-filter: blur(4px);
}

.ref-thumb:hover .del-btn { opacity: 1; }

/* ── Remix drop zone ── */
.remix-drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 28px 16px;
  text-align: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.remix-drop-zone p { font-size: 13px; line-height: 1.4; }
.remix-drop-zone .drop-zone-link {
  color: var(--accent);
  text-decoration: underline;
  cursor: pointer;
}
.remix-drop-zone:hover,
.remix-drop-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-subtle);
  color: var(--text-secondary);
}
.remix-drop-zone svg { opacity: 0.6; }

.remix-preview {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  border: 2px solid var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.remix-preview img {
  width: 100%;
  max-height: 200px;
  object-fit: contain;
  display: block;
  background: var(--surface2);
}
.remix-preview-clear {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(0,0,0,0.7);
  color: white;
  border: none;
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.remix-preview-clear:hover { background: var(--danger); }

.remix-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 12px 0;
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.remix-divider::before,
.remix-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── Results ── */
.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.results-header h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.result-card {
  position: relative;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
}

.result-card:hover { border-color: var(--border-hover); box-shadow: var(--shadow-md); transform: translateY(-1px); }

.result-card img {
  width: 100%;
  display: block;
  cursor: zoom-in;
}

.result-card .card-actions {
  display: flex;
  gap: 6px;
  padding: 8px;
  background: var(--surface);
  border-top: 1px solid var(--border);
}

/* ── Loading skeleton ── */
.skeleton {
  background: linear-gradient(90deg, var(--surface2) 25%, var(--border) 50%, var(--surface2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.88);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  padding: 20px;
  backdrop-filter: blur(8px);
}

.modal-overlay.hidden { display: none; }

.modal-overlay img {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: var(--radius);
  object-fit: contain;
  box-shadow: var(--shadow-lg);
}

/* ── Progress bar ── */
.progress-bar {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  margin-bottom: 20px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #818cf8);
  border-radius: 2px;
  transition: width 0.4s ease;
}

/* ── Status messages ── */
.status-msg {
  padding: 10px 14px;
  border-radius: var(--radius-xs);
  font-size: 13px;
  margin-top: 12px;
  font-weight: 500;
}

.status-msg.error { background: rgba(239,68,68,0.12); color: #fca5a5; border: 1px solid rgba(239,68,68,0.25); }
.status-msg.success { background: rgba(34,197,94,0.12); color: #86efac; border: 1px solid rgba(34,197,94,0.25); }
.status-msg.hidden { display: none; }

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-icon {
  opacity: 0.3;
  margin-bottom: 16px;
}

.empty-state p { font-size: 14px; margin-bottom: 4px; }

.hint-text {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 8px;
}

/* ── Brand form ── */
.brand-form-container {
  max-width: 560px;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Responsive ── */
@media (max-width: 900px) {
  .sidebar { display: none; }
  .generator-layout {
    grid-template-columns: 1fr;
  }
}
