/* === APP SHELL === */
.app-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  border-bottom: 1px solid var(--border);
  background: rgba(12, 11, 15, 0.92);
  backdrop-filter: blur(20px);
}
.app-nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.app-logo { display: flex; align-items: center; gap: 0.6rem; text-decoration: none; color: var(--fg); }
.app-nav-links { display: flex; gap: 0.5rem; }
.tab-btn {
  background: none;
  border: none;
  color: var(--fg-muted);
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}
.tab-btn:hover { color: var(--fg); background: var(--surface); }
.tab-btn.active { color: var(--fg); background: var(--surface-2); }

/* === APP MAIN === */
.app-main { padding-top: 64px; min-height: 100vh; }
.tab-panel { display: none; padding: 3rem 2rem 4rem; }
.tab-panel.active { display: block; }

/* === CREATE TAB === */
.create-layout { max-width: 1200px; margin: 0 auto; display: grid; grid-template-columns: 1fr 1fr; gap: 4rem; align-items: start; }
.section-header { margin-bottom: 2.5rem; }
.section-header h1 { font-family: var(--font-display); font-size: clamp(1.8rem, 3vw, 2.8rem); line-height: 1.2; margin-bottom: 0.75rem; }
.section-header h1 em { font-style: italic; color: var(--accent); }
.section-header p { color: var(--fg-muted); font-size: 1rem; line-height: 1.7; max-width: 460px; }

/* Upload zone */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: 16px;
  padding: 2.5rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 1.5rem;
  position: relative;
}
.upload-zone:hover, .upload-zone.drag-over { border-color: var(--accent); background: var(--accent-glow); }
.upload-icon { font-size: 2.5rem; margin-bottom: 1rem; }
.upload-text { font-size: 1rem; color: var(--fg-muted); margin-bottom: 0.5rem; }
.upload-link { color: var(--accent); cursor: pointer; text-decoration: underline; }
.upload-hint { font-size: 0.8rem; color: var(--fg-dim); font-family: var(--font-mono); }
.preview-img { width: 100%; max-height: 280px; object-fit: cover; border-radius: 12px; margin-bottom: 0.75rem; }
.clear-btn {
  position: absolute;
  top: 0.75rem; right: 0.75rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--fg-muted);
  width: 28px; height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.8rem;
  display: flex; align-items: center; justify-content: center;
}
.clear-btn:hover { background: var(--comic); color: white; }

/* Name field */
.name-field { margin-bottom: 1.5rem; }
.name-field label { display: block; font-size: 0.85rem; font-weight: 600; color: var(--fg-muted); margin-bottom: 0.5rem; }
.name-field input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}
.name-field input:focus { border-color: var(--accent); }

/* Generate button */
.btn-generate {
  width: 100%;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 12px;
  padding: 1rem 1.5rem;
  font-family: var(--font-body);
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.2s;
  margin-bottom: 1.5rem;
}
.btn-generate:hover:not(:disabled) { background: #c94de8; transform: translateY(-1px); }
.btn-generate:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-icon { font-size: 1.2rem; }

/* Generation status */
.generation-status { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 1.25rem; }
.status-steps { display: flex; flex-direction: column; gap: 0.75rem; }
.status-step { display: flex; align-items: center; gap: 0.75rem; font-size: 0.9rem; color: var(--fg-muted); }
.step-spinner { font-size: 1rem; }

/* Result card */
.result-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; }
.result-label { font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); }
.result-img { width: 100%; aspect-ratio: 1; object-fit: cover; }
.result-info { padding: 1.25rem; }
.result-info h3 { font-size: 1.2rem; font-weight: 600; margin-bottom: 0.5rem; }
.result-info p { color: var(--fg-muted); font-size: 0.9rem; line-height: 1.6; margin-bottom: 0.75rem; }
.style-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding: 0.25rem 0.75rem;
  border-radius: 100px;
  background: var(--accent-glow);
  color: var(--accent);
  border: 1px solid rgba(224,94,255,0.2);
}
.result-actions { padding: 0.75rem 1.25rem 1.25rem; display: flex; gap: 0.75rem; }
.btn-secondary {
  flex: 1;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 0.75rem;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  transition: all 0.2s;
}
.btn-secondary:hover { background: #c94de8; }
.btn-ghost {
  background: none;
  border: 1px solid var(--border);
  color: var(--fg-muted);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  font-family: var(--font-body);
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s;
}
.btn-ghost:hover { border-color: var(--fg-muted); color: var(--fg); }

/* Example hints */
.example-hint { margin-top: 2rem; }
.example-label { font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--fg-dim); margin-bottom: 1rem; }
.example-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
.example-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--fg-muted);
  font-size: 0.875rem;
}
.example-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.ec-icon { font-size: 1.25rem; }

/* === GALLERY TAB === */
.gallery-header { max-width: 1200px; margin: 0 auto 2.5rem; }
.gallery-header h1 { font-family: var(--font-display); font-size: clamp(2rem, 4vw, 3rem); margin-bottom: 0.5rem; }
.gallery-header h1 em { font-style: italic; color: var(--accent); }
.gallery-header p { color: var(--fg-muted); }
.gallery-grid {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.5rem;
}
.gallery-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  transition: all 0.2s;
}
.gallery-card:hover { transform: translateY(-4px); border-color: var(--accent-glow); }
.gallery-card img { width: 100%; aspect-ratio: 1; object-fit: cover; }
.gc-info { padding: 1rem 1rem 0.5rem; }
.gc-info h3 { font-size: 1rem; font-weight: 600; margin-bottom: 0.4rem; }
.gc-actions { padding: 0.5rem 1rem 1rem; display: flex; gap: 0.5rem; }
.btn-sm {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--fg);
  border-radius: 8px;
  padding: 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-sm:hover { background: var(--accent); color: white; border-color: var(--accent); }
.btn-sm-ghost {
  background: none;
  border: 1px solid var(--border);
  color: var(--fg-dim);
  border-radius: 8px;
  width: 36px;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-sm-ghost:hover { border-color: var(--comic); color: var(--comic); }

/* === COMIC TAB === */
.comic-layout { max-width: 1200px; margin: 0 auto; display: grid; grid-template-columns: 1fr 1fr; gap: 4rem; align-items: start; }

.character-picker label, .scene-input label, .style-selector label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--fg-muted);
  margin-bottom: 0.75rem;
}
.character-list { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-bottom: 2rem; }
.char-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--fg-muted);
  font-size: 0.875rem;
}
.char-option img { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; }
.char-option:hover { border-color: var(--accent); color: var(--fg); }
.char-option.selected { border-color: var(--accent); background: var(--accent-glow); color: var(--fg); }
.no-chars { font-size: 0.9rem; color: var(--fg-dim); margin-bottom: 2rem; }
.no-chars a { color: var(--accent); }

.scene-input textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 1rem;
  resize: vertical;
  outline: none;
  margin-bottom: 0.75rem;
  transition: border-color 0.2s;
}
.scene-input textarea:focus { border-color: var(--accent); }
.scene-suggestions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 2rem; }
.scene-tag {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 0.35rem 0.85rem;
  font-size: 0.8rem;
  color: var(--fg-muted);
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font-body);
}
.scene-tag:hover { border-color: var(--accent); color: var(--accent); }

.style-options { display: flex; gap: 0.75rem; margin-bottom: 2rem; }
.style-opt {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.5rem 1.25rem;
  color: var(--fg-muted);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.9rem;
  transition: all 0.2s;
}
.style-opt:hover { border-color: var(--accent); color: var(--fg); }
.style-opt.active { border-color: var(--accent); background: var(--accent-glow); color: var(--accent); }

/* Comic result */
.comic-result { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; }
.comic-result-img { width: 100%; aspect-ratio: 16/9; object-fit: cover; }
.comic-meta { padding: 1.25rem; }
.comic-meta h3 { font-size: 1.1rem; font-weight: 600; margin-bottom: 0.5rem; }
.comic-meta p { color: var(--fg-muted); font-size: 0.9rem; }

/* Empty state */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4rem 2rem;
  color: var(--fg-dim);
  gap: 1rem;
}
.empty-icon { font-size: 3rem; opacity: 0.5; }
.empty-state h3 { font-size: 1.1rem; color: var(--fg-muted); }
.empty-state p { font-size: 0.9rem; }
.btn-primary {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 0.75rem 1.5rem;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s;
}
.btn-primary:hover { background: #c94de8; }

/* === RESPONSIVE === */
@media (max-width: 900px) {
  .create-layout, .comic-layout { grid-template-columns: 1fr; gap: 2rem; }
  .create-right { order: -1; }
}
@media (max-width: 600px) {
  .app-nav-links { gap: 0.25rem; }
  .tab-btn { padding: 0.4rem 0.6rem; font-size: 0.8rem; }
  .tab-panel { padding: 2rem 1rem 3rem; }
}