/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0a0c12;
  --bg2: #111422;
  --bg3: #181d2e;
  --border: #252a3d;
  --border2: #2e3550;
  --text: #e8eaf0;
  --text2: #8b92b0;
  --text3: #555e7a;
  --blue: #4f7dfc;
  --blue2: #3563e9;
  --blue-glow: rgba(79,125,252,0.18);
  --green: #22c55e;
  --orange: #f97316;
  --red: #ef4444;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
}

html, body {
  height: 100%;
  font-family: 'Space Grotesk', sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
}

/* ===== GRID BG ===== */
.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(79,125,252,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(79,125,252,0.04) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: 0;
}

/* ===== APP LAYOUT ===== */
.app-wrapper {
  display: flex;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* ===== SIDEBAR ===== */
.sidebar {
  width: 240px;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 20px;
  border-bottom: 1px solid var(--border);
}

.brand-icon {
  font-size: 28px;
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, #2563eb, #4f46e5);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-name {
  display: block;
  font-weight: 700;
  font-size: 18px;
  color: var(--text);
}

.brand-sub {
  display: block;
  font-size: 11px;
  color: var(--text3);
  margin-top: 1px;
}

.sidebar-nav {
  padding: 16px 12px;
  flex: 1;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text2);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
  margin-bottom: 4px;
}

.nav-link:hover, .nav-link.active {
  background: var(--blue-glow);
  color: var(--blue);
}

.nav-icon { font-size: 16px; }

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
}

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue), #4f46e5);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
}

.user-email {
  font-size: 11px;
  color: var(--text3);
}

/* ===== MAIN CONTENT ===== */
.main-content {
  margin-left: 240px;
  flex: 1;
  padding: 36px 32px;
  max-width: 800px;
}

/* ===== PAGE HEADER ===== */
.page-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 32px;
}

.header-icon {
  font-size: 36px;
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, #1d4ed8, #4f46e5);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 24px rgba(79,125,252,0.3);
}

.page-title {
  font-size: 28px;
  font-weight: 800;
  background: linear-gradient(90deg, #60a5fa, #818cf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.page-sub {
  font-size: 13px;
  color: var(--text3);
  margin-top: 2px;
}

/* ===== PROGRESS BAR ===== */
.progress-bar-wrap {
  margin-bottom: 32px;
}

.progress-track {
  height: 4px;
  background: var(--border);
  border-radius: 99px;
  margin-bottom: 12px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--blue), #818cf8);
  border-radius: 99px;
  transition: width 0.5s ease;
}

.progress-steps {
  display: flex;
  justify-content: space-between;
}

.pstep {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: default;
}

.pstep-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg3);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--text3);
  transition: all 0.3s;
}

.pstep.done .pstep-num {
  background: var(--green);
  border-color: var(--green);
  color: white;
}

.pstep.active .pstep-num {
  background: var(--blue);
  border-color: var(--blue);
  color: white;
  box-shadow: 0 0 12px var(--blue-glow);
}

.pstep-label {
  font-size: 11px;
  color: var(--text3);
  font-weight: 500;
}

.pstep.active .pstep-label { color: var(--blue); }
.pstep.done .pstep-label { color: var(--green); }

/* ===== STEP CARDS ===== */
.step-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 20px;
  overflow: hidden;
  transition: all 0.3s;
}

.step-card.active {
  border-color: var(--blue);
  box-shadow: 0 0 0 1px var(--blue), 0 4px 32px rgba(79,125,252,0.12);
}

.step-card.locked {
  opacity: 0.5;
  pointer-events: none;
}

.step-card.completed {
  border-color: var(--green);
  opacity: 1;
}

.step-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg3);
}

.step-badge {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue), #4f46e5);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  flex-shrink: 0;
}

.step-card.locked .step-badge {
  background: var(--bg);
  border: 2px solid var(--border);
  color: var(--text3);
}

.step-card.completed .step-badge {
  background: var(--green);
}

.step-title {
  font-size: 17px;
  font-weight: 700;
}

.step-desc {
  font-size: 13px;
  color: var(--text2);
  margin-top: 2px;
}

.step-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ===== INFO BOX ===== */
.info-box {
  background: rgba(79,125,252,0.06);
  border: 1px solid rgba(79,125,252,0.2);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
}

.info-box h3 {
  font-size: 14px;
  font-weight: 600;
  color: #60a5fa;
  margin-bottom: 12px;
}

.info-box ol {
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.info-box li {
  font-size: 13px;
  color: var(--text2);
  line-height: 1.5;
}

.info-box a {
  color: #818cf8;
  text-decoration: none;
}

.info-box a:hover { text-decoration: underline; }

.warning-text {
  font-size: 12px;
  color: var(--orange);
  margin-top: 10px;
}

/* ===== FORM FIELDS ===== */
.field-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text2);
}

.field-input, .field-textarea, .field-select {
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  padding: 10px 14px;
  width: 100%;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
  appearance: none;
}

.field-input:focus, .field-textarea:focus, .field-select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(79,125,252,0.15);
}

.field-textarea { resize: vertical; min-height: 80px; }

.field-hint {
  font-size: 11px;
  color: var(--text3);
}

.mono { font-family: 'JetBrains Mono', monospace; font-size: 12px; }

/* ===== TOKEN DISPLAY ===== */
.token-display {
  display: flex;
  gap: 8px;
}

.token-display .field-input { flex: 1; }

/* ===== INPUT WITH BUTTON ===== */
.input-with-btn {
  display: flex;
  gap: 8px;
}

.input-with-btn .field-input { flex: 1; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  white-space: nowrap;
}

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

.btn-primary {
  background: linear-gradient(135deg, var(--blue), #4f46e5);
  color: white;
  box-shadow: 0 2px 12px rgba(79,125,252,0.3);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(79,125,252,0.4);
}

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

.btn-secondary:hover:not(:disabled) {
  border-color: var(--blue);
  color: var(--blue);
}

.btn-publish {
  background: linear-gradient(135deg, #16a34a, #15803d);
  color: white;
  font-size: 16px;
  padding: 14px 32px;
  box-shadow: 0 2px 16px rgba(34,197,94,0.25);
}

.btn-publish:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(34,197,94,0.35);
}

.btn-sm {
  padding: 8px 14px;
  font-size: 13px;
  background: var(--bg3);
  border: 1px solid var(--border2);
  color: var(--text2);
}

/* ===== ACTION ROW ===== */
.action-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.status-text {
  font-size: 13px;
  color: var(--text2);
}

.status-text.success { color: var(--green); }
.status-text.error { color: var(--red); }

/* ===== LAYOUT GRID ===== */
.layout-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.layout-card {
  background: var(--bg3);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 10px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

.layout-card:hover {
  border-color: var(--blue);
  background: var(--blue-glow);
}

.layout-card.selected {
  border-color: var(--blue);
  background: rgba(79,125,252,0.12);
  box-shadow: 0 0 0 1px var(--blue);
}

.layout-icon {
  font-size: 20px;
  margin-bottom: 6px;
}

.layout-name {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 2px;
}

.layout-slots {
  font-size: 11px;
  color: var(--text3);
}

/* ===== IMAGE SLOTS ===== */
.image-slots {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}

.img-slot {
  aspect-ratio: 1;
  border: 2px dashed var(--border2);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  overflow: hidden;
  position: relative;
  background: var(--bg3);
}

.img-slot:hover { border-color: var(--blue); }

.img-slot.filled { border-style: solid; border-color: var(--green); }

.img-slot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  inset: 0;
}

.img-slot-label {
  font-size: 12px;
  color: var(--text3);
  text-align: center;
  padding: 8px;
}

.img-slot-icon { font-size: 24px; margin-bottom: 6px; }

.img-slot input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

/* ===== INFO PILL ===== */
.info-pill {
  background: rgba(34,197,94,0.1);
  border: 1px solid rgba(34,197,94,0.25);
  border-radius: 99px;
  padding: 6px 14px;
  font-size: 13px;
  color: var(--green);
  display: inline-block;
}

/* ===== PUBLISH SUMMARY ===== */
.publish-summary {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.summary-item {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  color: var(--text2);
}

.summary-item strong { color: var(--text); }

/* ===== SUCCESS BOX ===== */
.success-box {
  background: rgba(34,197,94,0.07);
  border: 1px solid rgba(34,197,94,0.25);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.success-icon { font-size: 48px; }

.success-box h3 {
  font-size: 20px;
  font-weight: 700;
  color: var(--green);
}

.success-box p {
  font-size: 14px;
  color: var(--text2);
}

/* ===== MODAL ===== */
.modal-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);
}

.modal-box {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  width: 90%;
  max-width: 520px;
  box-shadow: var(--shadow);
  animation: slideUp 0.2s ease;
}

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

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 { font-size: 16px; font-weight: 700; }

.modal-close {
  background: none;
  border: none;
  color: var(--text3);
  cursor: pointer;
  font-size: 18px;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.2s;
}

.modal-close:hover { background: var(--bg3); color: var(--text); }

.modal-body {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-desc { font-size: 13px; color: var(--text2); line-height: 1.5; }

.link-count {
  font-size: 12px;
  color: var(--blue);
  font-weight: 600;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}

/* ===== TOAST ===== */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 500;
  z-index: 9999;
  box-shadow: var(--shadow);
  animation: slideUp 0.3s ease;
  max-width: 320px;
}

.toast.success { border-color: var(--green); color: var(--green); }
.toast.error { border-color: var(--red); color: var(--red); }
.toast.info { border-color: var(--blue); color: var(--blue); }

/* ===== FOOTER ===== */
.footer-text {
  text-align: center;
  font-size: 12px;
  color: var(--text3);
  margin-top: 40px;
  padding-bottom: 32px;
}

/* ===== UTILITY ===== */
.hidden { display: none !important; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main-content { margin-left: 0; padding: 20px 16px; }
  .layout-grid { grid-template-columns: repeat(3, 1fr); }
  .progress-steps { display: none; }
}
