/* ── Agent #2801 — Dark Theme ── */

:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-card: #1a1a28;
  --bg-hover: #22223a;
  --text-primary: #e8e8f0;
  --text-secondary: #8888a0;
  --accent: #7c5cff;
  --accent-hover: #9b7fff;
  --accent-glow: rgba(124, 92, 255, 0.3);
  --accent-soft: rgba(124, 92, 255, 0.08);
  --border: #2a2a40;
  --success: #4caf50;
  --success-glow: rgba(76, 175, 80, 0.2);
  --warning: #ff9800;
  --error: #f44336;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* ── Header ── */

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  background: rgba(18, 18, 26, 0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-logo {
  cursor: pointer;
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-logo-img {
  width: 32px;
  height: 32px;
  border-radius: 4px;
  image-rendering: pixelated;
}

.brand-prefix {
  color: var(--text-primary);
}

.brand-accent {
  color: var(--accent);
}

.header-nav {
  display: flex;
  gap: 24px;
}

.header-link {
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 500;
  transition: color 0.2s;
  background: none;
  border: none;
  font-family: inherit;
}

.header-link:hover {
  color: var(--text-primary);
}

.header-wallet {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-connected {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-address {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.85rem;
  color: var(--text-secondary);
  background: var(--bg-card);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.header-connecting {
  color: var(--accent);
  font-size: 0.9rem;
}

/* ── Buttons ── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  border: none;
  transition: all 0.25s ease;
  font-family: inherit;
  gap: 8px;
}

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 0 24px var(--accent-glow), 0 4px 12px rgba(0,0,0,0.3);
  transform: translateY(-1px);
}

.btn-lg {
  padding: 14px 32px;
  font-size: 1.05rem;
  border-radius: var(--radius);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.8rem;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.btn-outline:hover {
  border-color: var(--accent);
  color: var(--text-primary);
  background: var(--accent-soft);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* ── Landing ── */

.landing {
  min-height: 100vh;
}

.landing-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 120px 24px 80px;
  background: radial-gradient(ellipse at 50% 30%, rgba(124, 92, 255, 0.08) 0%, transparent 60%);
}

.landing-title {
  margin-bottom: 24px;
}

.landing-title-main {
  font-size: 3.5rem;
  font-weight: 900;
  letter-spacing: -2px;
  background: linear-gradient(135deg, var(--text-primary) 30%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.landing-title-sub {
  font-size: 1.5rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.landing-desc {
  max-width: 560px;
  font-size: 1.1rem;
  line-height: 1.7;
  color: var(--text-secondary);
  margin-bottom: 40px;
}

.highlight {
  color: var(--accent);
  font-weight: 600;
}

.landing-cta {
  display: flex;
  gap: 16px;
}

/* ── Steps ── */

.landing-steps {
  padding: 80px 32px;
  max-width: 1000px;
  margin: 0 auto;
}

.landing-section-title {
  text-align: center;
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 48px;
  color: var(--text-primary);
}

.steps-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}

.step-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 20px;
  text-align: center;
  transition: border-color 0.2s, transform 0.2s;
}

.step-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 16px;
}

.step-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.step-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ── Footer ── */

.landing-footer {
  text-align: center;
  padding: 40px 24px;
  color: var(--text-secondary);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
}

/* ── Main content placeholder ── */

.main-content {
  max-width: 800px;
  margin: 0 auto;
  padding: 80px 24px;
  text-align: center;
}

.page-title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.page-subtitle {
  color: var(--text-secondary);
  font-size: 1.1rem;
}

/* ── Wallet Picker ── */

.wallet-picker-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}

.wallet-picker {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  min-width: 340px;
  max-width: 420px;
}

.wallet-picker-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.wallet-picker-title {
  font-size: 1.1rem;
  font-weight: 700;
}

.wallet-picker-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0 4px;
}

.wallet-picker-close:hover {
  color: var(--text-primary);
}

.wallet-picker-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.wallet-picker-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.2s;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.95rem;
  width: 100%;
}

.wallet-picker-item:hover {
  border-color: var(--accent);
}

.wallet-picker-icon {
  width: 32px;
  height: 32px;
  border-radius: 6px;
}

.wallet-picker-name {
  font-weight: 600;
}

.wallet-picker-empty {
  text-align: center;
  padding: 20px 0;
  color: var(--text-secondary);
}

.wallet-picker-hint {
  font-size: 0.85rem;
  margin-top: 8px;
}

/* ── Prompt Form ── */

.prompt-form {
  max-width: 600px;
  margin: 0 auto;
  text-align: left;
}

.form-title {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 32px;
  text-align: center;
}

.form-group {
  margin-bottom: 24px;
}

.form-label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-input {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 1rem;
  transition: border-color 0.2s;
}

.form-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-textarea {
  resize: vertical;
  min-height: 100px;
  line-height: 1.6;
}

.model-selector {
  display: flex;
  gap: 12px;
}

.model-btn {
  flex: 1;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  font-family: inherit;
  transition: all 0.2s;
}

.model-btn:hover {
  border-color: var(--text-secondary);
  color: var(--text-primary);
}

.model-btn--active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(124, 92, 255, 0.08);
}

.form-error {
  background: rgba(244, 67, 54, 0.1);
  border: 1px solid var(--error);
  color: var(--error);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  margin-bottom: 16px;
}

.form-actions {
  text-align: center;
  margin-top: 8px;
}

.form-hint {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 20px;
  line-height: 1.5;
}

/* ── Generation Status ── */

.status-page {
  max-width: 760px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

.status-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 80px 0;
  color: var(--text-secondary);
  font-size: 1rem;
}

.status-loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.status-content {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.status-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.status-title {
  font-size: 1.6rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--text-primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.status-badge {
  display: inline-block;
  padding: 6px 16px;
  border-radius: 24px;
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  white-space: nowrap;
}

.status-badge--pending {
  background: rgba(136, 136, 160, 0.12);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.status-badge--processing {
  background: rgba(124, 92, 255, 0.12);
  color: var(--accent);
  border: 1px solid rgba(124, 92, 255, 0.4);
  animation: pulse 2s ease-in-out infinite;
}

.status-badge--fulfilled {
  background: rgba(76, 175, 80, 0.12);
  color: var(--success);
  border: 1px solid rgba(76, 175, 80, 0.4);
}

.status-badge--failed {
  background: rgba(244, 67, 54, 0.12);
  color: var(--error);
  border: 1px solid rgba(244, 67, 54, 0.4);
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

/* ── Progress Bar ── */

.status-progress {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.status-progress-bar {
  height: 4px;
  background: var(--bg-card);
  border-radius: 2px;
  overflow: hidden;
}

.status-progress-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.5s ease;
}

.status-progress-fill--pending {
  width: 30%;
  background: var(--text-secondary);
  animation: progress-slide 2.5s ease-in-out infinite;
}

.status-progress-fill--processing {
  width: 70%;
  background: linear-gradient(90deg, var(--accent), var(--accent-hover));
  animation: progress-slide 1.8s ease-in-out infinite;
}

@keyframes progress-slide {
  0% { opacity: 0.4; }
  50% { opacity: 1; }
  100% { opacity: 0.4; }
}

.status-progress-text {
  font-size: 0.9rem;
  color: var(--text-secondary);
  text-align: center;
}

/* ── Info Card ── */

.status-info-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.status-field {
  display: flex;
  gap: 12px;
  font-size: 0.95rem;
  align-items: baseline;
}

.status-label {
  color: var(--text-secondary);
  font-weight: 600;
  min-width: 90px;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.status-value {
  color: var(--text-primary);
  word-break: break-word;
}

.status-prompt-value {
  font-style: italic;
  color: var(--accent-hover);
}

.status-error {
  background: rgba(244, 67, 54, 0.08);
  border: 1px solid rgba(244, 67, 54, 0.3);
  color: var(--error);
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
}

/* ── Viewer Section ── */

.status-viewer-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.status-viewer-label {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-secondary);
}

.status-viewer {
  margin-top: 8px;
}

.status-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  padding-top: 8px;
}

/* ── Model Viewer ── */

.model-viewer {
  position: relative;
  width: 100%;
  min-height: 450px;
  background: var(--bg-primary);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}

.model-viewer canvas {
  display: block;
  width: 100% !important;
  height: 450px !important;
  border-radius: var(--radius);
}

.model-viewer-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: var(--bg-primary);
  z-index: 5;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.model-viewer-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.model-viewer-fallback {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  color: var(--text-secondary);
  gap: 8px;
  text-align: center;
  padding: 24px;
}

.model-viewer-fallback-detail {
  font-size: 0.85rem;
  color: var(--error);
  max-width: 400px;
  word-break: break-word;
}

/* ── Gallery ── */

.gallery-page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

.gallery-header {
  text-align: center;
  margin-bottom: 40px;
}

.gallery-title {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 8px;
  background: linear-gradient(135deg, var(--text-primary) 30%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.gallery-subtitle {
  color: var(--text-secondary);
  font-size: 1rem;
  margin-bottom: 20px;
}

.gallery-stats {
  display: flex;
  justify-content: center;
  gap: 32px;
}

.gallery-stat {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.gallery-stat-num {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--accent);
}

.gallery-stat-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.gallery-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 80px 24px;
  color: var(--text-secondary);
  font-size: 1rem;
}

.gallery-loading-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.gallery-empty {
  text-align: center;
  padding: 80px 24px;
  color: var(--text-secondary);
}

.gallery-empty-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.5;
}

.gallery-empty h3 {
  font-size: 1.3rem;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.gallery-empty p {
  margin-bottom: 24px;
  font-size: 1rem;
}

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

.gallery-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s ease;
}

.gallery-card:hover {
  border-color: var(--accent);
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4), 0 0 20px var(--accent-glow);
}

.gallery-card-thumb {
  height: 180px;
  background: linear-gradient(135deg, var(--bg-primary) 0%, #15152a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.gallery-card-thumb::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 50%, rgba(124, 92, 255, 0.06) 0%, transparent 70%);
}

.gallery-card-visual {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  z-index: 1;
}

.gallery-card-orb {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(124, 92, 255, 0.4), rgba(124, 92, 255, 0.1));
  border: 1px solid rgba(124, 92, 255, 0.2);
  box-shadow: 0 0 30px rgba(124, 92, 255, 0.15);
  animation: orb-float 4s ease-in-out infinite;
}

@keyframes orb-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.gallery-card:hover .gallery-card-orb {
  box-shadow: 0 0 40px rgba(124, 92, 255, 0.3);
}

.gallery-card-label {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.75rem;
  color: var(--text-secondary);
  opacity: 0.6;
  letter-spacing: 1px;
}

.gallery-card-icon {
  font-size: 2rem;
  font-weight: 900;
  color: var(--accent);
  opacity: 0.5;
}

.gallery-card-info {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.gallery-card-prompt {
  font-weight: 600;
  font-size: 0.95rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-primary);
}

.gallery-card-meta {
  display: flex;
  gap: 10px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  align-items: center;
}

.gallery-card-type {
  background: rgba(124, 92, 255, 0.1);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 0.75rem;
}

.gallery-card-size {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.75rem;
}

.gallery-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-secondary);
  padding-top: 4px;
  border-top: 1px solid rgba(42, 42, 64, 0.5);
}

.gallery-card-id {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-weight: 600;
  color: var(--accent);
  opacity: 0.7;
}

.gallery-card-date {
  font-size: 0.75rem;
}

/* ── Responsive ── */

@media (max-width: 768px) {
  .app-header {
    padding: 12px 16px;
  }

  .header-nav {
    display: none;
  }

  .landing-title-main {
    font-size: 2.2rem;
  }

  .landing-title-sub {
    font-size: 1.1rem;
  }

  .steps-grid {
    grid-template-columns: 1fr 1fr;
  }

  .landing-hero {
    padding: 80px 16px 60px;
  }

  .status-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .status-actions {
    flex-direction: column;
  }

  .status-actions .btn {
    width: 100%;
  }

  .model-viewer {
    min-height: 300px;
  }

  .model-viewer canvas {
    height: 300px !important;
  }

  .gallery-grid {
    grid-template-columns: 1fr;
  }

  .gallery-stats {
    flex-direction: column;
    gap: 8px;
    align-items: center;
  }
}

@media (max-width: 480px) {
  .steps-grid {
    grid-template-columns: 1fr;
  }

  .header-address {
    display: none;
  }

  .status-page {
    padding: 24px 16px 60px;
  }

  .gallery-page {
    padding: 24px 16px 60px;
  }
}
