/* ─── VelvetPixel Design System ─────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;600;700;800&family=DM+Sans:wght@300;400;500;600&display=swap');

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --ink: #0a0a0a;
  --ink-light: #141414;
  --ink-lighter: #1a1a1a;
  --cream: #faf8f5;
  --cream-60: rgba(250,248,245,0.6);
  --cream-40: rgba(250,248,245,0.4);
  --cream-20: rgba(250,248,245,0.2);
  --cream-10: rgba(250,248,245,0.1);
  --cream-06: rgba(250,248,245,0.06);
  --blush: #e8b4b8;
  --mauve: #9b7ea6;
  --gold: #c9a96e;
  --slate: #4a4a4a;
  --error: #e85d75;
  --success: #5de8a0;
}

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--ink);
  color: var(--cream);
  overflow-x: hidden;
  min-height: 100vh;
}

/* Noise Texture Overlay */
.noise {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
}

/* ─── Navigation ──────────────────────────────────────────────── */
.app-nav {
  position: fixed;
  top: 0;
  width: 100%;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 100;
  backdrop-filter: blur(20px);
  background: rgba(10,10,10,0.85);
  border-bottom: 1px solid var(--cream-06);
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.nav-logo {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 1.3rem;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--blush), var(--mauve));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-decoration: none;
}

.nav-links {
  display: flex;
  gap: 0.5rem;
}

.nav-links a {
  font-size: 0.85rem;
  color: var(--cream-40);
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  transition: all 0.2s;
  letter-spacing: 0.02em;
}

.nav-links a:hover {
  color: var(--cream);
  background: var(--cream-06);
}

.nav-links a.active {
  color: var(--cream);
  background: var(--cream-10);
}

.nav-tag {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--gold);
  border: 1px solid rgba(201,169,110,0.3);
  padding: 0.35rem 0.8rem;
  border-radius: 100px;
}

/* ─── App Layout ──────────────────────────────────────────────── */
.app-container {
  padding-top: 60px;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

.page-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
}

/* ─── Buttons ─────────────────────────────────────────────────── */
.btn {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.75rem 1.5rem;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  transition: all 0.3s;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--blush), var(--mauve));
  color: var(--ink);
  font-weight: 600;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 30px rgba(232,180,184,0.3);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-secondary {
  background: var(--cream-10);
  color: var(--cream);
  border: 1px solid var(--cream-10);
}

.btn-secondary:hover {
  background: var(--cream-20);
  border-color: var(--cream-20);
}

.btn-ghost {
  background: transparent;
  color: var(--cream-60);
  border: 1px solid var(--cream-10);
}

.btn-ghost:hover {
  color: var(--cream);
  border-color: var(--cream-20);
}

.btn-danger {
  background: rgba(232,93,117,0.15);
  color: var(--error);
  border: 1px solid rgba(232,93,117,0.2);
}

.btn-danger:hover {
  background: rgba(232,93,117,0.25);
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.8rem;
}

.btn-lg {
  padding: 1rem 2rem;
  font-size: 1rem;
}

.btn-block {
  width: 100%;
  justify-content: center;
}

/* ─── Cards ───────────────────────────────────────────────────── */
.card {
  background: var(--ink-light);
  border: 1px solid var(--cream-06);
  border-radius: 16px;
  overflow: hidden;
}

.card-padded {
  padding: 1.5rem;
}

/* ─── Form Elements ───────────────────────────────────────────── */
.form-group {
  margin-bottom: 1.5rem;
}

.form-label {
  display: block;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--cream-40);
  margin-bottom: 0.5rem;
}

.form-textarea {
  width: 100%;
  padding: 1rem;
  background: var(--ink);
  border: 1px solid var(--cream-10);
  border-radius: 12px;
  color: var(--cream);
  font-family: 'DM Sans', sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  resize: vertical;
  min-height: 120px;
  transition: border-color 0.2s;
}

.form-textarea:focus {
  outline: none;
  border-color: var(--blush);
  box-shadow: 0 0 0 3px rgba(232,180,184,0.1);
}

.form-textarea::placeholder {
  color: var(--cream-20);
}

/* ─── Pill Selector ───────────────────────────────────────────── */
.pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.pill {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.8rem;
  padding: 0.5rem 1rem;
  border-radius: 100px;
  border: 1px solid var(--cream-10);
  background: transparent;
  color: var(--cream-40);
  cursor: pointer;
  transition: all 0.2s;
}

.pill:hover {
  color: var(--cream);
  border-color: var(--cream-20);
}

.pill.active {
  background: linear-gradient(135deg, rgba(232,180,184,0.2), rgba(155,126,166,0.2));
  border-color: var(--blush);
  color: var(--cream);
}

/* ─── Image Grid ──────────────────────────────────────────────── */
.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.image-card {
  background: var(--ink-light);
  border: 1px solid var(--cream-06);
  border-radius: 16px;
  overflow: hidden;
  transition: all 0.3s;
  cursor: pointer;
}

.image-card:hover {
  transform: translateY(-4px);
  border-color: var(--cream-10);
  box-shadow: 0 12px 40px rgba(0,0,0,0.4);
}

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

.image-card-info {
  padding: 1rem;
}

.image-card-prompt {
  font-size: 0.85rem;
  color: var(--cream-60);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.image-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.75rem;
  font-size: 0.75rem;
  color: var(--cream-20);
}

.image-card-style {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--gold);
  background: rgba(201,169,110,0.1);
  padding: 0.2rem 0.6rem;
  border-radius: 100px;
}

/* ─── Lightbox ────────────────────────────────────────────────── */
.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.95);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
}

.lightbox.active {
  opacity: 1;
  visibility: visible;
}

.lightbox-content {
  max-width: 900px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.lightbox-image {
  width: 100%;
  max-height: 70vh;
  object-fit: contain;
  border-radius: 12px;
}

.lightbox-actions {
  display: flex;
  justify-content: center;
  gap: 1rem;
}

.lightbox-close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--cream-10);
  border: none;
  color: var(--cream);
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.lightbox-close:hover {
  background: var(--cream-20);
}

.lightbox-info {
  text-align: center;
}

.lightbox-prompt {
  font-size: 0.95rem;
  color: var(--cream-60);
  line-height: 1.6;
  max-width: 600px;
  margin: 0 auto;
}

.lightbox-meta {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 0.75rem;
  font-size: 0.8rem;
  color: var(--cream-20);
}

/* ─── Loading States ──────────────────────────────────────────── */
.loading-pulse {
  background: linear-gradient(90deg, var(--ink-light) 0%, var(--ink-lighter) 50%, var(--ink-light) 100%);
  background-size: 200% 100%;
  animation: pulse 1.5s ease-in-out infinite;
}

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

.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--cream-10);
  border-top-color: var(--blush);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.generating-overlay {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  padding: 4rem 2rem;
  text-align: center;
}

.generating-ring {
  width: 60px;
  height: 60px;
  border: 3px solid var(--cream-06);
  border-top-color: var(--blush);
  border-right-color: var(--mauve);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.generating-text {
  font-size: 0.9rem;
  color: var(--cream-40);
}

/* ─── Empty State ─────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.3;
}

.empty-state h3 {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 1.3rem;
  margin-bottom: 0.5rem;
}

.empty-state p {
  color: var(--cream-40);
  font-size: 0.9rem;
}

/* ─── Persona Panel ───────────────────────────────────────────── */
.persona-panel {
  background: var(--ink-light);
  border: 1px solid var(--cream-06);
  border-radius: 16px;
  padding: 1.5rem;
}

.persona-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.persona-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blush), var(--mauve));
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 1.2rem;
  color: var(--ink);
}

.persona-name {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
}

.persona-subtitle {
  font-size: 0.75rem;
  color: var(--cream-40);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.persona-traits {
  list-style: none;
}

.persona-trait {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--cream-06);
  font-size: 0.85rem;
  color: var(--cream-60);
}

.persona-trait:last-child {
  border-bottom: none;
}

.trait-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--blush);
  margin-top: 0.45rem;
  flex-shrink: 0;
}

.trait-locked {
  font-size: 0.7rem;
  color: var(--gold);
  margin-left: auto;
  flex-shrink: 0;
}

/* ─── Toast ───────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  padding: 0.75rem 1.25rem;
  border-radius: 10px;
  font-size: 0.85rem;
  animation: slideIn 0.3s ease;
  max-width: 400px;
}

.toast-success {
  background: rgba(93,232,160,0.15);
  border: 1px solid rgba(93,232,160,0.3);
  color: var(--success);
}

.toast-error {
  background: rgba(232,93,117,0.15);
  border: 1px solid rgba(232,93,117,0.3);
  color: var(--error);
}

@keyframes slideIn {
  from { transform: translateX(100px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ─── Footer ──────────────────────────────────────────────────── */
.app-footer {
  padding: 2rem;
  border-top: 1px solid var(--cream-06);
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 4rem;
}

.footer-logo {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--cream-20);
}

.footer-text {
  font-size: 0.75rem;
  color: var(--cream-20);
}

/* ─── Section Headers ─────────────────────────────────────────── */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.section-title {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 1.5rem;
}

.section-subtitle {
  font-size: 0.85rem;
  color: var(--cream-40);
  margin-top: 0.25rem;
}

/* ─── Responsive ──────────────────────────────────────────────── */
@media (max-width: 768px) {
  .app-nav { padding: 0.75rem 1rem; }
  .nav-links { display: none; }
  .page-content { padding: 1rem; }
  .image-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 1rem; }
  .lightbox { padding: 1rem; }
  .app-footer { flex-direction: column; gap: 0.5rem; text-align: center; }
}

/* Mobile nav toggle */
.nav-mobile-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--cream);
  font-size: 1.5rem;
  cursor: pointer;
}

@media (max-width: 768px) {
  .nav-mobile-toggle { display: block; }
  .nav-links.open {
    display: flex;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(10,10,10,0.95);
    flex-direction: column;
    padding: 1rem;
    border-bottom: 1px solid var(--cream-06);
  }
}
