/* App-specific styles — complements theme.css (landing page tokens).
   Never redefine theme variables here, only compose them. */

/* ─── NAV UPDATES FOR APP PAGES ─── */
.nav-logo {
  text-decoration: none;
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  background: var(--gradient-hero);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
}

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

.btn-nav {
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--fg-muted);
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 100px;
  border: 1px solid rgba(255,255,255,0.08);
  transition: color 0.2s, border-color 0.2s;
}

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

/* ─── LAYOUT ─── */
.app-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 100px 24px 80px;
}

/* ─── PAGE HEADER ─── */
.page-header {
  text-align: center;
  margin-bottom: 64px;
}

.page-badge {
  display: inline-block;
  padding: 6px 16px;
  border-radius: 100px;
  background: var(--gradient-subtle);
  border: 1px solid rgba(244, 114, 182, 0.15);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 20px;
}

.page-header h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 16px;
}

.page-lede {
  color: var(--fg-muted);
  font-size: 1.1rem;
  font-weight: 300;
  max-width: 560px;
  margin: 0 auto;
  line-height: 1.7;
}

/* ─── BUTTONS ─── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 28px;
  border-radius: 12px;
  background: var(--gradient-hero);
  color: #fff;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.2s, transform 0.15s;
  letter-spacing: -0.01em;
}

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

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-spinner svg {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ─── FORMS ─── */
.form-group {
  margin-bottom: 24px;
}

.form-group label {
  display: block;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--fg);
}

.form-group input,
.form-group textarea {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 14px 16px;
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.5;
  outline: none;
  transition: border-color 0.2s;
  resize: vertical;
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: rgba(244, 114, 182, 0.4);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--fg-muted);
  opacity: 0.6;
}

.form-hint {
  display: block;
  font-size: 0.82rem;
  color: var(--fg-muted);
  margin-top: 6px;
  font-weight: 300;
}

.error-msg {
  margin-top: 12px;
  padding: 12px 16px;
  border-radius: 10px;
  background: rgba(244, 63, 94, 0.1);
  border: 1px solid rgba(244, 63, 94, 0.25);
  color: #f87171;
  font-size: 0.9rem;
}

/* ─── CHARACTER CREATOR GRID ─── */
.creator-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: start;
}

.creator-form-panel {
  background: var(--bg-surface);
  border-radius: var(--radius);
  border: 1px solid rgba(255,255,255,0.05);
  padding: 36px;
}

/* ─── PREVIEW PANEL ─── */
.creator-preview-panel {
  position: sticky;
  top: 100px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.preview-card {
  background: var(--bg-surface);
  border-radius: var(--radius);
  border: 1px solid rgba(255,255,255,0.05);
  overflow: hidden;
  min-height: 320px;
}

.preview-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 320px;
  padding: 40px;
  text-align: center;
  gap: 12px;
}

.preview-placeholder-icon {
  font-size: 2.5rem;
  background: var(--gradient-hero);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.preview-placeholder p {
  color: var(--fg-muted);
  font-weight: 300;
}

.preview-note {
  font-size: 0.82rem !important;
  opacity: 0.6;
}

.preview-result {
  display: flex;
  flex-direction: column;
}

.character-portrait {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
}

.preview-meta {
  padding: 24px;
}

.preview-meta h3 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.preview-traits {
  color: var(--fg-muted);
  font-size: 0.9rem;
  font-weight: 300;
  line-height: 1.5;
}

.tips-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid rgba(255,255,255,0.04);
  padding: 24px;
}

.tips-card h4 {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--secondary);
}

.tips-card ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tips-card li {
  font-size: 0.88rem;
  color: var(--fg-muted);
  font-weight: 300;
  padding-left: 16px;
  position: relative;
  line-height: 1.5;
}

.tips-card li::before {
  content: '→';
  position: absolute;
  left: 0;
  color: var(--accent);
  opacity: 0.7;
}

/* ─── CHARACTER DETAIL ─── */
.character-header {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 48px;
  margin-bottom: 64px;
  align-items: start;
}

.character-portrait-wrapper {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.06);
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}

.character-portrait-lg {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
}

.character-portrait-placeholder {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  background: var(--gradient-hero);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.character-bio h1 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 3vw, 2.8rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 28px;
}

.bio-fields {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.bio-field {
  padding: 16px 20px;
  border-radius: 12px;
  background: var(--bg-surface);
  border: 1px solid rgba(255,255,255,0.04);
}

.bio-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin-bottom: 4px;
}

.bio-field p {
  color: var(--fg-muted);
  font-size: 0.95rem;
  font-weight: 300;
  line-height: 1.6;
}

/* ─── SCENE GENERATOR ─── */
.scene-generator {
  background: var(--bg-surface);
  border-radius: var(--radius);
  border: 1px solid rgba(255,255,255,0.05);
  padding: 36px;
  margin-bottom: 48px;
}

.section-header {
  margin-bottom: 24px;
}

.section-header h2 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 6px;
  letter-spacing: -0.02em;
}

.section-header p {
  color: var(--fg-muted);
  font-size: 0.95rem;
  font-weight: 300;
}

.scene-form-row {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.scene-form-row textarea {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 14px 16px;
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.5;
  outline: none;
  resize: none;
  transition: border-color 0.2s;
}

.scene-form-row textarea:focus {
  border-color: rgba(244, 114, 182, 0.4);
}

.scene-form-row textarea::placeholder {
  color: var(--fg-muted);
  opacity: 0.6;
}

/* ─── SCENE GALLERY ─── */
.scenes-section {
  margin-top: 16px;
}

.scenes-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 24px;
  color: var(--fg);
}

.scene-count {
  color: var(--fg-muted);
  font-weight: 400;
}

.scenes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.scenes-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 24px;
  color: var(--fg-muted);
  font-weight: 300;
}

.scene-card {
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-surface);
  border: 1px solid rgba(255,255,255,0.05);
  transition: transform 0.2s, border-color 0.2s;
}

.scene-card:hover {
  transform: translateY(-3px);
  border-color: rgba(255,255,255,0.1);
}

.scene-card--new {
  animation: fadeInUp 0.4s ease;
}

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

.scene-img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
}

.scene-desc {
  padding: 14px 16px;
  font-size: 0.88rem;
  color: var(--fg-muted);
  font-weight: 300;
  line-height: 1.5;
}

/* ─── CHARACTERS LIST ─── */
.characters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 24px;
}

.character-card {
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-surface);
  border: 1px solid rgba(255,255,255,0.05);
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s, border-color 0.2s;
  display: block;
}

.character-card:hover {
  transform: translateY(-4px);
  border-color: rgba(244, 114, 182, 0.2);
}

.character-card-img {
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: var(--bg-card);
}

.character-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.character-card-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
}

.character-card-img--empty {
  background: var(--gradient-subtle);
  border: 2px dashed rgba(244, 114, 182, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
}

.add-icon {
  font-size: 2.5rem;
  color: var(--accent);
  opacity: 0.6;
}

.character-card--new:hover .add-icon {
  opacity: 1;
}

.character-card-info {
  padding: 16px 20px;
}

.character-card-info h3 {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.character-card-traits {
  font-size: 0.82rem;
  color: var(--fg-muted);
  font-weight: 300;
  line-height: 1.4;

  /* truncate to 2 lines */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ─── EMPTY STATE ─── */
.empty-state {
  text-align: center;
  padding: 80px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.empty-icon {
  font-size: 3rem;
  background: var(--gradient-hero);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.empty-state h3 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
}

.empty-state p {
  color: var(--fg-muted);
  font-size: 1rem;
  font-weight: 300;
  max-width: 400px;
}

/* ─── VIDEO GENERATOR ─── */
.video-generator {
  background: var(--bg-surface);
  border-radius: var(--radius);
  border: 1px solid rgba(255,255,255,0.05);
  padding: 36px;
  margin-bottom: 48px;
}

.video-section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.video-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 100px;
  background: rgba(139, 92, 246, 0.12);
  border: 1px solid rgba(139, 92, 246, 0.25);
  font-size: 0.72rem;
  font-weight: 600;
  color: #a78bfa;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.video-section-header h2 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.video-section-header p {
  color: var(--fg-muted);
  font-size: 0.95rem;
  font-weight: 300;
  margin-top: 4px;
}

.btn-video {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 28px;
  border-radius: 12px;
  background: linear-gradient(135deg, #7c3aed, #4f46e5);
  color: #fff;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

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

.btn-video:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* ─── VIDEO GALLERY ─── */
.videos-section {
  margin-top: 16px;
}

.videos-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 24px;
  color: var(--fg);
}

.video-count {
  color: var(--fg-muted);
  font-weight: 400;
}

.videos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.videos-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 24px;
  color: var(--fg-muted);
  font-weight: 300;
}

.video-card {
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-surface);
  border: 1px solid rgba(255,255,255,0.05);
  transition: transform 0.2s, border-color 0.2s;
}

.video-card:hover {
  transform: translateY(-3px);
  border-color: rgba(139, 92, 246, 0.2);
}

.video-card--new {
  animation: fadeInUp 0.4s ease;
}

.video-card video {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
  background: #000;
}

.video-card-status {
  width: 100%;
  aspect-ratio: 16 / 9;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--bg-card);
  color: var(--fg-muted);
  font-size: 0.88rem;
  font-weight: 300;
}

.video-card-status--processing {
  border-bottom: 2px solid rgba(139, 92, 246, 0.3);
}

.video-card-status--error {
  color: #f87171;
  border-bottom: 2px solid rgba(244, 63, 94, 0.3);
}

.video-progress-ring {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(139, 92, 246, 0.2);
  border-top-color: #7c3aed;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.video-card-desc {
  padding: 14px 16px;
  font-size: 0.88rem;
  color: var(--fg-muted);
  font-weight: 300;
  line-height: 1.5;
}

.video-card-time {
  font-size: 0.75rem;
  color: var(--fg-muted);
  opacity: 0.5;
  padding: 0 16px 12px;
}

/* ─── RESPONSIVE ─── */
@media (max-width: 900px) {
  .creator-grid {
    grid-template-columns: 1fr;
  }

  .creator-preview-panel {
    position: static;
  }

  .character-header {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .character-portrait-wrapper {
    max-width: 280px;
    margin: 0 auto;
  }
}

@media (max-width: 600px) {
  .scene-form-row {
    flex-direction: column;
  }

  .btn-primary {
    width: 100%;
  }

  .characters-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
}
