/* ========= APP NAV ========= */
.app-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  height: 60px;
  background: rgba(5, 5, 7, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

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

.nav-links { display: flex; gap: 8px; }

.nav-link {
  font-size: 14px;
  font-weight: 500;
  color: var(--fg-muted);
  text-decoration: none;
  padding: 6px 14px;
  border-radius: 20px;
  transition: color 0.2s, background 0.2s;
}

.nav-link.active,
.nav-link:hover {
  color: var(--accent);
  background: rgba(180, 77, 255, 0.1);
}

/* ========= LAYOUT ========= */
.generator-layout {
  display: grid;
  grid-template-columns: 420px 1fr;
  min-height: 100vh;
  padding-top: 60px;
}

/* ========= FORM PANEL ========= */
.form-panel {
  background: var(--bg-elevated);
  border-right: 1px solid rgba(255, 255, 255, 0.04);
  overflow-y: auto;
  position: sticky;
  top: 60px;
  height: calc(100vh - 60px);
}

.form-panel-inner {
  padding: 48px 36px;
}

.panel-header {
  margin-bottom: 36px;
}

.panel-tag {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--accent);
  display: block;
  margin-bottom: 12px;
}

.panel-header h2 {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 800;
  color: var(--fg);
  margin-bottom: 10px;
}

.panel-sub {
  font-size: 14px;
  color: var(--fg-muted);
  line-height: 1.6;
}

/* ========= FORM FIELDS ========= */
.field-group {
  margin-bottom: 20px;
  flex: 1;
}

.field-row {
  display: flex;
  gap: 12px;
}

.field-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-muted);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.optional {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--fg-dim);
}

.field-group input,
.field-group select,
.field-group textarea {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 10px;
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 15px;
  padding: 12px 16px;
  outline: none;
  transition: border-color 0.2s;
  resize: none;
  appearance: none;
}

.field-group select {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%238a879a' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14L2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}

.field-group input:focus,
.field-group select:focus,
.field-group textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.field-group input::placeholder,
.field-group textarea::placeholder {
  color: var(--fg-dim);
}

/* ========= GENERATE BUTTON ========= */
.generate-btn {
  width: 100%;
  padding: 16px 24px;
  background: var(--gradient-accent);
  border: none;
  border-radius: 12px;
  color: #fff;
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s;
  margin-top: 8px;
  position: relative;
}

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

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

.btn-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

.gen-note {
  text-align: center;
  font-size: 13px;
  color: var(--fg-dim);
  margin-top: 12px;
}

/* ========= GALLERY PANEL ========= */
.gallery-panel {
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 60px);
  padding: 48px;
  position: relative;
}

/* ========= EMPTY STATE ========= */
.empty-state {
  text-align: center;
  max-width: 400px;
}

.empty-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 240px;
  height: 240px;
  margin: 0 auto 28px;
  opacity: 0.18;
}

.empty-cell {
  border-radius: 8px;
}

.ec-1 { background: linear-gradient(135deg, var(--accent-glow), transparent); }
.ec-2 { background: linear-gradient(135deg, rgba(255,77,106,0.3), transparent); }
.ec-3 { background: linear-gradient(135deg, rgba(255,77,106,0.3), transparent); }
.ec-4 { background: linear-gradient(135deg, var(--accent-glow), transparent); }

.empty-label {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--fg-muted);
  margin-bottom: 8px;
}

.empty-sub {
  font-size: 14px;
  color: var(--fg-dim);
}

/* ========= LOADING STATE ========= */
.loading-state {
  text-align: center;
  max-width: 380px;
}

.loading-orb {
  width: 80px;
  height: 80px;
  margin: 0 auto 32px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent) 0%, transparent 70%);
  animation: pulse-orb 2s ease-in-out infinite;
}

@keyframes pulse-orb {
  0%, 100% { transform: scale(0.9); opacity: 0.6; }
  50% { transform: scale(1.1); opacity: 1; }
}

.loading-label {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--fg);
  margin-bottom: 8px;
}

.loading-sub {
  font-size: 14px;
  color: var(--fg-muted);
  margin-bottom: 32px;
}

.loading-steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
  background: var(--bg-card);
  border-radius: 12px;
  padding: 20px 24px;
}

.lstep {
  font-size: 14px;
  color: var(--fg-dim);
  transition: color 0.4s;
}

.lstep.active {
  color: var(--accent);
}

.lstep.done {
  color: var(--fg-muted);
}

/* ========= RESULTS ========= */
.results-state {
  width: 100%;
  max-width: 860px;
}

.results-header {
  margin-bottom: 28px;
  text-align: center;
}

.results-header h3 {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 800;
  color: var(--fg);
  margin-bottom: 6px;
}

.results-sub {
  font-size: 13px;
  color: var(--fg-dim);
}

.covers-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 28px;
}

.cover-card {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.05);
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s;
  aspect-ratio: 1;
}

.cover-card:hover {
  transform: scale(1.02);
  border-color: rgba(180, 77, 255, 0.3);
}

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

.cover-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, transparent 50%);
  opacity: 0;
  transition: opacity 0.2s;
  display: flex;
  align-items: flex-end;
  padding: 16px;
  gap: 8px;
}

.cover-card:hover .cover-overlay {
  opacity: 1;
}

.cover-tag {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.7);
  flex: 1;
}

.download-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  background: var(--gradient-accent);
  border: none;
  border-radius: 8px;
  padding: 7px 14px;
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.2s;
}

.download-btn:hover { opacity: 0.85; }

.reset-btn {
  display: block;
  margin: 0 auto;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  color: var(--fg-muted);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  padding: 12px 28px;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

.reset-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ========= ERROR STATE ========= */
.error-state {
  text-align: center;
  max-width: 340px;
}

.error-icon {
  font-size: 48px;
  color: var(--accent-secondary);
  margin-bottom: 16px;
}

.error-label {
  font-size: 17px;
  color: var(--fg-muted);
  margin-bottom: 24px;
  line-height: 1.6;
}

/* ========= LIGHTBOX ========= */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  gap: 20px;
  backdrop-filter: blur(8px);
}

.lightbox-close {
  position: absolute;
  top: 24px;
  right: 24px;
  background: rgba(255,255,255,0.1);
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 18px;
  color: var(--fg);
  cursor: pointer;
  transition: background 0.2s;
}

.lightbox-close:hover { background: rgba(255,255,255,0.2); }

.lightbox-img {
  max-width: min(700px, 90vw);
  max-height: 70vh;
  border-radius: 12px;
  object-fit: contain;
}

.lightbox-actions { display: flex; gap: 12px; }

.download-btn-large {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  background: var(--gradient-accent);
  border-radius: 10px;
  padding: 12px 28px;
  text-decoration: none;
  transition: opacity 0.2s, transform 0.15s;
}

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

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

  .form-panel {
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid rgba(255,255,255,0.04);
  }

  .form-panel-inner {
    padding: 32px 20px;
  }

  .gallery-panel {
    padding: 32px 20px;
    min-height: 60vh;
  }

  .covers-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
}

@media (max-width: 480px) {
  .app-nav { padding: 0 16px; }
  .field-row { flex-direction: column; gap: 0; }
  .covers-grid { grid-template-columns: 1fr; }
  .empty-grid { width: 180px; height: 180px; }
}
