@import url('https://cdn.jsdelivr.net/gh/rastikerdar/vazirmatn@v33.003/Vazirmatn-font-face.css');

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface-2: #242836;
  --border: rgba(255, 255, 255, 0.08);
  --text: #e8eaef;
  --text-muted: #8b93a7;
  --primary: #6366f1;
  --primary-hover: #818cf8;
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --radius: 12px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Vazirmatn', Tahoma, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 20% -10%, rgba(99, 102, 241, 0.18), transparent),
    radial-gradient(ellipse 60% 40% at 90% 100%, rgba(139, 92, 246, 0.12), transparent);
  pointer-events: none;
  z-index: 0;
}

.app {
  position: relative;
  z-index: 1;
  max-width: 800px;
  margin: 0 auto;
  padding: 24px 20px 120px; /* Increased bottom padding to accommodate sticky navigation footer */
}

/* Header */
.header {
  text-align: center;
  margin-bottom: 36px;
  padding-top: 12px;
}

.header-badge {
  display: inline-block;
  background: rgba(99, 102, 241, 0.15);
  color: var(--primary-hover);
  font-size: 0.8rem;
  padding: 4px 14px;
  border-radius: 20px;
  border: 1px solid rgba(99, 102, 241, 0.3);
  margin-bottom: 12px;
}

.header h1 {
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 800;
  margin-bottom: 8px;
}

.header p {
  color: var(--text-muted);
  font-size: 0.95rem;
  max-width: 560px;
  margin: 0 auto;
}

/* Layout */
.main-grid {
  display: block;
}

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 16px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
  gap: 12px;
}

.card-header:hover {
  background: rgba(255, 255, 255, 0.04);
}

.card-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-icon {
  font-size: 1.2rem;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(99, 102, 241, 0.15);
  border-radius: 8px;
}

.card-title {
  font-weight: 700;
  font-size: 0.95rem;
}

.card-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.chevron {
  transition: transform 0.25s;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.card.collapsed .chevron {
  transform: rotate(-90deg);
}

.card-body {
  padding: 20px;
}

.card.collapsed .card-body {
  display: none;
}

/* Form */
.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 600px) {
  .form-grid.two-col {
    grid-template-columns: 1fr 1fr;
  }
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}

label .required {
  color: var(--danger);
  margin-right: 2px;
}

input[type="text"],
input[type="email"],
input[type="url"],
input[type="tel"],
input[type="color"],
select,
textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

textarea {
  resize: vertical;
  min-height: 80px;
}

.color-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.color-row input[type="color"] {
  width: 44px;
  height: 44px;
  padding: 2px;
  cursor: pointer;
  flex-shrink: 0;
}

.color-row input[type="text"] {
  flex: 1;
}

/* Section blocks */
.section-block {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 14px;
  overflow: hidden;
}

.section-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--border);
  gap: 10px;
}

.section-block-title {
  font-weight: 700;
  font-size: 0.88rem;
  flex: 1;
}

.section-block-title input {
  background: transparent;
  border: none;
  color: var(--text);
  font-family: inherit;
  font-weight: 700;
  font-size: 0.88rem;
  width: 100%;
  padding: 0;
}

.section-block-title input:focus {
  outline: none;
  box-shadow: none;
}

.section-block-body {
  padding: 14px 16px;
}

.section-badge {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(99, 102, 241, 0.2);
  color: var(--primary-hover);
  white-space: nowrap;
}

.section-badge.required {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
}

/* Repeater items */
.repeater-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 10px;
  position: relative;
}

.repeater-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.repeater-item-num {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
}

.repeater-fields {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

@media (min-width: 600px) {
  .repeater-fields.two-col {
    grid-template-columns: 1fr 1fr;
  }
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border: none;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-success {
  background: var(--success);
  color: #fff;
}

.btn-success:hover:not(:disabled) {
  filter: brightness(1.1);
}

.btn-outline {
  background: transparent;
  color: var(--text-muted);
  border: 1px dashed var(--border);
}

.btn-outline:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary-hover);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  padding: 5px 10px;
  font-size: 0.78rem;
}

.btn-danger:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.3);
}

.btn-icon {
  padding: 5px 8px;
  font-size: 0.9rem;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

.actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.add-section-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 16px;
  background: var(--surface-2);
  border-radius: var(--radius);
  border: 1px dashed var(--border);
  margin-top: 8px;
}

.add-section-bar label {
  width: 100%;
  margin-bottom: 4px;
}

/* Output panel */
.output-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.output-header {
  padding: 16px 20px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

.output-header h2 {
  font-size: 1rem;
  margin-bottom: 4px;
}

.output-header p {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.output-body {
  padding: 16px;
}

#prompt-output {
  width: 100%;
  min-height: 420px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: 'Vazirmatn', monospace;
  font-size: 0.78rem;
  line-height: 1.8;
  padding: 14px;
  resize: vertical;
  direction: rtl;
}

.output-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

/* Step Progress Indicator */
.step-progress-wrapper {
  margin-bottom: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: var(--shadow);
}

.step-progress-indicator {
  display: flex;
  justify-content: space-between;
  position: relative;
  margin-bottom: 12px;
}

.step-line {
  position: absolute;
  top: 18px;
  left: 20px;
  right: 20px;
  height: 3px;
  background: var(--surface-2);
  z-index: 1;
}

.step-line-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), #8b5cf6);
  transition: width 0.4s ease;
}

.step-dot {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
}

.step-dot-num {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 2px solid var(--border);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.step-dot-label {
  margin-top: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: color 0.3s;
}

.step-dot.active .step-dot-num {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 0 14px rgba(99, 102, 241, 0.4);
}

.step-dot.active .step-dot-label {
  color: var(--text);
}

.step-dot.completed .step-dot-num {
  background: #10b981;
  border-color: #10b981;
  color: #fff;
}

.step-dot.completed .step-dot-label {
  color: #10b981;
}

.step-text-summary {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* Slider Viewport and Slides */
.wizard-viewport {
  overflow: hidden;
  width: 100%;
  position: relative;
  border-radius: var(--radius);
}

.wizard-slides {
  display: flex;
  width: 400%; /* 4 steps */
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
}

.wizard-slide {
  width: 25%;
  flex-shrink: 0;
  box-sizing: border-box;
}

.wizard-slide .card {
  margin-bottom: 0;
}

/* Step 1 Specific: Actions */
.first-step-actions {
  background: var(--surface);
  border: 1px dashed rgba(255, 255, 255, 0.15);
  border-radius: var(--radius);
  padding: 20px;
  margin-top: 16px;
  box-shadow: var(--shadow);
}

.first-step-tip {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.auto-fill-buttons {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.ai-type-select {
  padding: 10px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  min-width: 140px;
}

.ai-type-select:focus {
  outline: none;
  border-color: var(--primary);
}

.btn-ai {
  background: linear-gradient(135deg, #8b5cf6, #6366f1);
  color: #fff;
  padding: 10px 18px;
  font-size: 0.85rem;
}

.btn-ai:hover:not(:disabled) {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.btn-ai:disabled {
  opacity: 0.7;
  cursor: wait;
}

.btn-ai-loading[hidden],
.btn-ai-text[hidden] {
  display: none;
}

.btn-random {
  background: linear-gradient(135deg, #0ea5e9, #2563eb);
  color: #fff;
  padding: 10px 18px;
  font-size: 0.85rem;
}

.btn-random:hover:not(:disabled) {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.btn-random:disabled {
  opacity: 0.7;
  cursor: wait;
}

/* Wizard Navigation Footer - Sticky / Fixed at the bottom */
.wizard-navigation {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 800px;
  background: rgba(26, 29, 39, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 16px 24px;
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.4);
  margin-top: 0;
  z-index: 1000;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.wizard-nav-dots {
  display: flex;
  gap: 10px;
}

.nav-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.3s ease;
}

.nav-dot.active {
  background: var(--primary);
  border-color: var(--primary);
  transform: scale(1.3);
  box-shadow: 0 0 8px rgba(99, 102, 241, 0.5);
}

.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 0.85rem;
  opacity: 0;
  transition: all 0.3s;
  z-index: 200;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.success {
  border-color: rgba(34, 197, 94, 0.4);
  color: #86efac;
}

.empty-hint {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 24px;
}

.divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}

.social-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

@media (min-width: 600px) {
  .social-grid {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

/* Logo upload row */
.logo-upload-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

#logo-preview-container {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Portfolio image upload row */
.portfolio-image-upload-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

@media print {
  body::before { display: none; }
  .generate-bar, .add-section-bar, .btn-danger, .add-section-btns { display: none !important; }
  .card.collapsed .card-body { display: block !important; }
  .output-panel { break-inside: avoid; }
}

/* Step-based Attachments Styles */
.step-attachments-wrapper {
  margin-top: 20px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.attachments-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
  display: block;
}

.attachments-upload-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.step-file-label {
  flex: 1;
  min-width: 200px;
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.8rem;
}

.step-file-label:focus {
  outline: none;
  border-color: var(--primary);
}

.step-attachments-progress {
  margin-top: 10px;
}

.media-progress-text {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.media-progress-line {
  width: 100%;
  height: 4px;
  background: var(--surface-2);
  border-radius: 2px;
  overflow: hidden;
}

.media-progress-line-fill {
  width: 0%;
  height: 100%;
  background: var(--primary);
  border-radius: 2px;
  transition: width 0.3s ease;
}

.step-attachments-list {
  margin-top: 14px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

@media (min-width: 600px) {
  .step-attachments-list {
    grid-template-columns: 1fr 1fr;
  }
}

.step-attachment-item {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
}

.attachment-preview-box {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.attachment-preview-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.attachment-preview-box span {
  font-size: 1.2rem;
}

.attachment-item-info {
  flex: 1;
  min-width: 0;
}

.attachment-item-name {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.attachment-item-label {
  font-size: 0.72rem;
  color: var(--primary-hover);
  font-weight: 600;
  margin-bottom: 1px;
}

.attachment-item-url-text {
  font-size: 0.68rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  direction: ltr;
  text-align: right;
}

.attachment-item-actions {
  display: flex;
  gap: 4px;
}

.attachment-item-btn {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 0.75rem;
  transition: all 0.2s;
}

.attachment-item-btn:hover {
  background: var(--primary);
  color: #fff;
}

.attachment-item-btn.delete-btn:hover {
  background: var(--danger);
  color: #fff;
}

/* Loading Game Modal Styles */
.game-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 15, 0.95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  animation: fadeIn 0.3s ease;
}

.game-modal-content {
  position: relative;
  width: 90%;
  max-width: 520px;
  background: #0f0e1a;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  animation: scaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  overflow: hidden;
}

.game-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  z-index: 2100;
}

.game-modal-close:hover {
  background: var(--danger);
  transform: rotate(90deg);
}

#loading-game-iframe {
  width: 100%;
  height: 480px;
  border: none;
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scaleIn {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
