/* ── App-specific styles (extends theme.css design tokens) ── */

/* Nav */
.app-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: rgba(10, 10, 15, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.nav-brand {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 800;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-decoration: none;
}

.nav-credits {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent-2);
  background: rgba(192, 132, 252, 0.1);
  border: 1px solid rgba(192, 132, 252, 0.2);
  padding: 6px 14px;
  border-radius: 100px;
}

.credits-icon {
  font-size: 0.75rem;
}

/* Main */
.app-main {
  min-height: 100vh;
  padding: 80px 24px 60px;
  max-width: 560px;
  margin: 0 auto;
}

/* Steps */
.step-section {
  display: none;
  animation: fadeIn 0.3s ease;
}

.step-section.active {
  display: block;
}

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

.step-header {
  margin-bottom: 36px;
  padding-top: 20px;
}

.step-badge {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: var(--fg-muted);
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  padding: 5px 12px;
  border-radius: 100px;
  margin-bottom: 16px;
}

.step-header h1 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 5vw, 2.4rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
}

.step-sub {
  font-size: 0.95rem;
  color: var(--fg-muted);
  line-height: 1.65;
}

/* Upload zone */
.upload-zone {
  background: var(--bg-card);
  border: 2px dashed rgba(255,255,255,0.08);
  border-radius: var(--radius);
  min-height: 280px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
  position: relative;
  overflow: hidden;
  margin-bottom: 24px;
}

.upload-zone:hover {
  border-color: rgba(255,107,157,0.3);
  background: rgba(255,107,157,0.03);
}

.upload-zone.drag-over {
  border-color: var(--accent);
  background: rgba(255,107,157,0.06);
}

.upload-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 40px;
  text-align: center;
}

.upload-icon {
  font-size: 3rem;
}

.upload-label {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--fg);
}

.upload-hint {
  font-size: 0.8rem;
  color: var(--fg-muted);
}

.selfie-preview {
  width: 100%;
  height: 280px;
  object-fit: cover;
  border-radius: calc(var(--radius) - 2px);
  display: block;
}

.change-photo-btn {
  position: absolute;
  bottom: 12px;
  right: 12px;
  background: rgba(10, 10, 15, 0.85);
  border: 1px solid rgba(255,255,255,0.12);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 100px;
  cursor: pointer;
  backdrop-filter: blur(8px);
}

.hidden {
  display: none !important;
}

/* Buttons */
.btn-primary {
  width: 100%;
  background: var(--gradient);
  color: #fff;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  padding: 16px 24px;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: opacity 0.2s ease, transform 0.15s ease;
  letter-spacing: 0.01em;
}

.btn-primary:hover:not(:disabled) {
  opacity: 0.9;
  transform: translateY(-1px);
}

.btn-primary:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.btn-secondary {
  flex: 1;
  background: var(--bg-card);
  color: var(--fg-muted);
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 14px 20px;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.2s ease;
}

.btn-secondary:hover {
  border-color: rgba(255,255,255,0.12);
}

.btn-ghost {
  width: 100%;
  background: transparent;
  color: var(--fg-muted);
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 14px 24px;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.btn-ghost:hover {
  border-color: rgba(255,255,255,0.15);
  color: var(--fg);
}

/* Category tabs */
.category-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
}

.category-tab {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.06);
  color: var(--fg-muted);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 10px 12px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.category-tab.active {
  background: rgba(255,107,157,0.1);
  border-color: rgba(255,107,157,0.3);
  color: var(--accent);
}

/* Style grid */
.style-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 28px;
}

.style-card {
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius);
  padding: 24px 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  position: relative;
}

.style-card:hover {
  border-color: rgba(255,255,255,0.12);
  transform: translateY(-2px);
}

.style-card.selected {
  border-color: var(--accent);
  background: rgba(255,107,157,0.06);
}

.style-card.selected::after {
  content: '✓';
  position: absolute;
  top: 10px;
  right: 12px;
  font-size: 0.75rem;
  color: var(--accent);
  font-weight: 700;
}

.style-emoji {
  font-size: 2rem;
  margin-bottom: 10px;
}

.style-name {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--fg);
  line-height: 1.3;
}

.step-actions {
  display: flex;
  gap: 12px;
  align-items: stretch;
}

.step-actions .btn-primary {
  flex: 2;
  width: auto;
}

/* Generating */
.generating-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 60px 0;
  gap: 20px;
}

.generating-orb {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--gradient);
  animation: pulse 1.5s ease-in-out infinite;
  box-shadow: 0 0 40px rgba(255,107,157,0.4);
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%       { transform: scale(1.15); opacity: 0.8; }
}

.generating-container h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
}

.generating-sub {
  color: var(--fg-muted);
  font-size: 0.9rem;
  max-width: 300px;
}

.generating-steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 300px;
  margin-top: 12px;
}

.gen-step {
  font-size: 0.85rem;
  color: var(--fg-muted);
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.04);
  transition: all 0.4s ease;
}

.gen-step.active {
  color: var(--accent-2);
  border-color: rgba(192,132,252,0.2);
  background: rgba(192,132,252,0.06);
}

.gen-step.done {
  color: var(--accent);
  border-color: rgba(255,107,157,0.15);
}

/* Before/After */
.before-after {
  display: flex;
  align-items: stretch;
  gap: 12px;
  margin-bottom: 28px;
}

.ba-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ba-label {
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--fg-muted);
  text-align: center;
}

.ba-label-after {
  color: var(--accent);
}

.ba-image {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid rgba(255,255,255,0.06);
  display: block;
}

.ba-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding-top: 24px;
}

.ba-arrow {
  font-size: 1.5rem;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 700;
}

.result-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.credits-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--accent-2);
  background: rgba(192,132,252,0.06);
  border: 1px solid rgba(192,132,252,0.15);
  border-radius: 12px;
  padding: 12px;
}

.credits-banner.credits-empty {
  color: var(--fg-muted);
  background: rgba(255,255,255,0.02);
  border-color: rgba(255,255,255,0.06);
}

/* Error */
.error-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 60px 0;
  gap: 16px;
}

.error-icon {
  font-size: 3rem;
}

.error-container h2 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 800;
}

.error-message {
  color: var(--fg-muted);
  font-size: 0.9rem;
  max-width: 320px;
  line-height: 1.6;
}

/* ── Responsive ── */
@media (max-width: 480px) {
  .app-main { padding: 72px 16px 40px; }
  .before-after { flex-direction: column; }
  .ba-divider { padding-top: 0; transform: rotate(90deg); }
  .category-tabs { gap: 6px; }
  .category-tab { font-size: 0.78rem; padding: 8px 8px; }
  .style-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
}
