/* ============================================================
   Design System
   ============================================================ */

@font-face {
  font-family: "B Nazanin Local";
  src: url("../../fonts/B-NAZANIN/B-NAZANIN.TTF") format("truetype");
  font-weight: 400;
  font-style: normal;
}

@font-face {
  font-family: "B Titr Local";
  src: url("../../fonts/B-Titr/B Titr Bold_0.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
}

:root {
  --bg: #f7f8fb;
  --bg-elevated: #ffffff;
  --bg-soft: #f1f5f9;
  --text: #0f172a;
  --text-muted: #64748b;
  --line: #e2e8f0;
  --primary: #1e3a5f;
  --primary-2: #155e75;
  --accent: #6d28d9;
  --success: #0f766e;
  --danger: #dc2626;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05), 0 8px 24px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 12px 30px rgba(15, 23, 42, 0.08);
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 20px;
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --focus: 0 0 0 4px rgba(30, 58, 95, 0.14);
}

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

html {
  direction: rtl;
  color-scheme: light;
}

body {
  font-family: "B Nazanin Local", "Vazirmatn", "IRANSans", "Tahoma", sans-serif;
  background:
    radial-gradient(circle at top right, rgba(30, 58, 95, 0.06), transparent 35%),
    radial-gradient(circle at bottom left, rgba(109, 40, 217, 0.05), transparent 28%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 1rem 2rem;
  direction: rtl;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

button,
input,
textarea {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

/* ============================================================
   Header & Progress
   ============================================================ */
.app-header {
  width: 100%;
  max-width: 920px;
  padding: 1rem 0 0.75rem;
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(14px);
  background: linear-gradient(to bottom, rgba(247, 248, 251, 0.92), rgba(247, 248, 251, 0.78));
}

.progress-bar {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  position: relative;
  margin-bottom: 0.45rem;
}

.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  font-size: 0.72rem;
  color: var(--text-muted);
  transition: color 0.2s ease;
}

.step .circle {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.84rem;
  color: var(--text-muted);
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.step.active .circle {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
  border-color: transparent;
  transform: translateY(-1px);
}

.step.done .circle {
  background: rgba(15, 118, 110, 0.1);
  color: var(--success);
  border-color: rgba(15, 118, 110, 0.18);
}

.step .label {
  margin-top: 0.4rem;
  font-size: 0.66rem;
  color: inherit;
}

.progress-connector {
  height: 4px;
  width: 100%;
  margin: 0 auto;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(30, 58, 95, 0.12), rgba(30, 58, 95, 0.24), rgba(30, 58, 95, 0.12));
}

/* ============================================================
   Layout
   ============================================================ */
.app-main {
  width: 100%;
  max-width: 920px;
  flex: 1;
}

.step-panel {
  display: none;
  animation: fadeIn 0.22s ease;
}

.step-panel.active {
  display: block;
}

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

h1, h2, .hero-card .hero-badge, .form-section > legend, .sub-section h4 {
  font-family: "B Titr Local", "B Nazanin Local", sans-serif;
}

h1 {
  font-size: 1.55rem;
  line-height: 1.3;
  margin-bottom: 0.5rem;
  color: var(--text);
  letter-spacing: -0.02em;
}

h2 {
  font-size: 1.24rem;
  line-height: 1.35;
  margin-bottom: 0.4rem;
  color: var(--text);
  letter-spacing: -0.01em;
}

h2 + p, .section-intro p, .hero-card p {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.85;
  margin-bottom: 1.25rem;
}

/* ============================================================
   Hero / Section Intro
   ============================================================ */

.hero-card {
  background: linear-gradient(180deg, #ffffff, #fbfdff);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 1.25rem 1.1rem;
  margin: 0.4rem 0 1rem;
  box-shadow: var(--shadow-sm);
}

.hero-card .hero-badge {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 0.8rem;
  border-radius: 999px;
  background: rgba(30, 58, 95, 0.08);
  color: var(--primary);
  font-size: 0.82rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.hero-card h1 {
  margin: 0 0 0.55rem;
}

.hero-card p {
  margin-bottom: 0;
  max-width: 58ch;
}

.section-intro {
  margin-bottom: 1rem;
}

.section-intro h2 {
  margin-bottom: 0.35rem;
}


/* ============================================================
   Step 0: Language
   ============================================================ */
.language-selector {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
  margin: 1.25rem 0 0.5rem;
}

.lang-btn {
  min-height: 56px;
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 0.95rem 1rem;
  border-radius: 16px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  justify-content: center;
  box-shadow: var(--shadow-sm);
}

.lang-btn .icon {
  font-size: 1.35rem;
}

.lang-btn:hover {
  border-color: rgba(30, 58, 95, 0.28);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.lang-btn.selected {
  border-color: rgba(30, 58, 95, 0.28);
  background: linear-gradient(180deg, rgba(30, 58, 95, 0.06), rgba(30, 58, 95, 0.02));
}

.lang-btn:active {
  transform: translateY(0);
}

/* ============================================================
   Step 1: Templates
   ============================================================ */
.template-scroll {
  max-height: 62vh;
  overflow-y: auto;
  padding: 0.25rem 0.15rem 0.85rem;
  margin-bottom: 1rem;
  scroll-behavior: smooth;
}

.template-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
}

.template-card {
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 0.75rem;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
  aspect-ratio: 3 / 4;
  box-shadow: var(--shadow-sm);
}

.template-card:hover {
  border-color: rgba(30, 58, 95, 0.24);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.template-card.selected {
  border-color: rgba(30, 58, 95, 0.42);
  box-shadow: 0 14px 34px rgba(30, 58, 95, 0.12);
}

.template-card img {
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  object-fit: contain;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #f8fafc;
}

.template-card .info {
  text-align: center;
  width: 100%;
}

.template-card .info h4 {
  font-size: 0.92rem;
  color: var(--text);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.template-card .info p {
  font-size: 0.74rem;
  color: var(--text-muted);
  margin: 0.15rem 0 0;
}

/* ============================================================
   Forms
   ============================================================ */
.resume-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding-bottom: 1rem;
}

.form-section {
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 1rem;
  background: var(--bg-elevated);
  box-shadow: var(--shadow-sm);
}

.form-section > legend {
  font-weight: 800;
  color: var(--primary);
  padding: 0 0.35rem;
  font-size: 0.98rem;
}

.sub-section {
  margin-top: 1rem;
  padding-top: 0.95rem;
  border-top: 1px solid rgba(226, 232, 240, 0.9);
}

.sub-section:first-of-type {
  margin-top: 0.35rem;
  padding-top: 0.35rem;
  border-top: 0;
}

.sub-section h4 {
  font-size: 0.98rem;
  color: var(--text);
  margin-bottom: 0.85rem;
  letter-spacing: -0.01em;
}

.form-group {
  margin-bottom: 0.8rem;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.form-group .required {
  color: var(--danger);
}

.form-group input,
.form-group textarea {
  width: 100%;
  min-height: 48px;
  padding: 0.8rem 0.95rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.6;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
  font-family: inherit;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: #94a3b8;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: rgba(30, 58, 95, 0.45);
  box-shadow: var(--focus);
}

.form-group textarea {
  resize: vertical;
  min-height: 96px;
}

.conditional-field {
  transition: opacity 0.2s ease;
}

.sub-section-head {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 0.9rem;
}

.sub-section-head p {
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.7;
}

.repeater-item-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.9rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(226, 232, 240, 0.85);
}

.card-kicker {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 0.7rem;
  border-radius: 999px;
  background: rgba(30, 58, 95, 0.08);
  color: var(--primary);
  font-size: 0.76rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.repeater-item-head strong {
  display: block;
  font-size: 0.96rem;
  color: var(--text);
}

.education-card {
  overflow: hidden;
}

.education-card .repeater-item-head {
  margin-bottom: 0.85rem;
}

.education-card .form-row {
  margin-top: 0.1rem;
}

.education-card .form-group:last-child {
  margin-bottom: 0;
}

.experience-card {
  overflow: hidden;
}

.experience-card .repeater-item-head {
  margin-bottom: 0.85rem;
}

.experience-card .form-group:last-child {
  margin-bottom: 0;
}

.skill-card,
.project-card,
.language-card {
  overflow: hidden;
}

.skill-card .repeater-item-head,
.project-card .repeater-item-head,
.language-card .repeater-item-head {
  margin-bottom: 0.85rem;
}

.skill-card .form-group:last-child,
.language-card .form-group:last-child {
  margin-bottom: 0;
}

.skill-card .form-group input,
.language-card .form-group input {
  min-height: 44px;
}

.skill-card {
  max-width: 460px;
}

.skill-card .form-group {
  margin-bottom: 0;
}

.project-card .form-group:last-child {
  margin-bottom: 0;
}

/* ============================================================
   Repeater cards
   ============================================================ */
.repeater-item {
  background: linear-gradient(180deg, #ffffff, #fbfdff);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1rem;
  margin-bottom: 0.9rem;
  position: relative;
  box-shadow: var(--shadow-sm);
}

.repeater-item .btn-remove-item {
  position: static;
  flex: 0 0 auto;
  min-width: 44px;
  min-height: 44px;
  padding: 0 0.5rem;
  background: rgba(220, 38, 38, 0.08);
  border: 1px solid rgba(220, 38, 38, 0.16);
  color: var(--danger);
  font-size: 1rem;
  cursor: pointer;
  border-radius: 999px;
  transition: transform 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
  line-height: 1;
}

.repeater-item .btn-remove-item:hover {
  background: rgba(220, 38, 38, 0.14);
  box-shadow: 0 6px 14px rgba(220, 38, 38, 0.12);
  transform: translateY(-1px);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 0.85rem;
}

.form-row .form-group {
  grid-column: span 12;
  min-width: 0;
}

.btn-add-item {
  min-height: 48px;
  background: rgba(30, 58, 95, 0.05);
  border: 1px dashed rgba(30, 58, 95, 0.28);
  color: var(--primary);
  padding: 0.75rem 1rem;
  border-radius: 14px;
  cursor: pointer;
  font-size: 0.92rem;
  font-weight: 700;
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
  width: 100%;
  margin-top: 0.15rem;
}

.btn-add-item:hover {
  background: rgba(30, 58, 95, 0.08);
  border-color: rgba(30, 58, 95, 0.42);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

/* ============================================================
   Navigation buttons
   ============================================================ */
.nav-buttons {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-top: 0.35rem;
}

.btn {
  min-height: 48px;
  padding: 0.75rem 1.3rem;
  border: 1px solid transparent;
  border-radius: 14px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.btn:focus-visible,
.lang-btn:focus-visible,
.btn-add-item:focus-visible,
.repeater-item .btn-remove-item:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

.btn:active,
.lang-btn:active,
.btn-add-item:active,
.repeater-item .btn-remove-item:active {
  transform: translateY(0);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
  box-shadow: 0 12px 22px rgba(21, 94, 117, 0.16);
}

.btn-primary:hover {
  box-shadow: 0 14px 26px rgba(21, 94, 117, 0.22);
  transform: translateY(-1px);
}

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

.btn-secondary {
  background: #fff;
  color: var(--text);
  border-color: var(--line);
}

.btn-secondary:hover {
  border-color: rgba(30, 58, 95, 0.22);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.btn-success {
  background: linear-gradient(135deg, #0f766e, #15803d);
  color: #fff;
  box-shadow: 0 12px 22px rgba(15, 118, 110, 0.16);
}

.btn-success:hover {
  box-shadow: 0 14px 26px rgba(15, 118, 110, 0.22);
  transform: translateY(-1px);
}

/* ============================================================
   Summary
   ============================================================ */
.summary-box {
  background: var(--bg-elevated);
  border-radius: 20px;
  padding: 1rem;
  max-height: 50vh;
  overflow-y: auto;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

.summary-box .summary-section {
  margin-bottom: 1rem;
}

.summary-box .summary-section h4 {
  color: var(--primary);
  font-size: 0.92rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.45rem;
  margin-bottom: 0.65rem;
}

.summary-box .summary-item {
  font-size: 0.88rem;
  line-height: 1.8;
  padding: 0.2rem 0;
  color: var(--text);
}

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

/* ============================================================
   Notification
   ============================================================ */
.notification-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.18s ease;
}

.notification-overlay.show {
  display: flex;
}

.notification-box {
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 2rem 1.5rem;
  text-align: center;
  max-width: 340px;
  width: 88%;
  box-shadow: var(--shadow-md);
  animation: popIn 0.22s ease;
}

.notification-icon {
  font-size: 3rem;
  margin-bottom: 0.9rem;
}

.notification-text {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 0.4rem;
}

.notification-sub {
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.7;
}

@keyframes popIn {
  from { transform: scale(0.96); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* ============================================================
   Scrollbars
   ============================================================ */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(100, 116, 139, 0.35);
  border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(100, 116, 139, 0.55);
}

/* ============================================================
   Responsive
   ============================================================ */
@media (min-width: 700px) {
  .app-header,
  .app-main {
    max-width: 980px;
  }

  .form-row .form-group:nth-child(1),
  .form-row .form-group:nth-child(2) {
    grid-column: span 6;
  }

  .form-row .form-group:nth-child(3) {
    grid-column: span 4;
  }

  .form-row .form-group:nth-child(4) {
    grid-column: span 12;
  }
}

@media (min-width: 980px) {
  .app-main {
    padding-inline: 0.25rem;
  }

  .template-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .hero-card {
    padding: 1.5rem 1.4rem;
  }

  .skill-card {
    max-width: 520px;
  }
}

@media (max-width: 480px) {
  body {
    padding-inline: 0.65rem;
  }

  .language-selector {
    grid-template-columns: 1fr;
  }

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

  h1 {
    font-size: 1.28rem;
  }

  h2 {
    font-size: 1.18rem;
  }

  .step .circle {
    width: 32px;
    height: 32px;
    font-size: 0.78rem;
  }

  .step .label {
    font-size: 0.58rem;
  }

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

  .nav-buttons {
    flex-direction: column-reverse;
  }

  .repeater-item {
    padding: 0.9rem;
  }

  .form-section {
    padding: 0.9rem;
  }

  .repeater-item-head {
    flex-direction: column;
  }

  .education-card .repeater-item-head {
    margin-bottom: 0.7rem;
  }

  .experience-card .repeater-item-head {
    margin-bottom: 0.7rem;
  }

  .repeater-item .btn-remove-item {
    align-self: flex-start;
  }
}
