/* ========== RESET & VARIABLES ========== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

:root {
  --bg: #0a0f1c;
  --glass: rgba(255, 255, 255, 0.06);
  --stroke: rgba(255, 255, 255, 0.12);
  --txt: #fff;
  --muted: rgba(255, 255, 255, 0.7);
  --radius: 28px;
  --shadow: 0 25px 45px rgba(0, 0, 0, 0.4);
  --fz-xl: clamp(22px, 5vw, 32px);
  --fz-lg: clamp(14px, 3.5vw, 18px);
  --fz-md: 14px;
  --transition: all 0.3s cubic-bezier(0.2, 0.9, 0.4, 1.1);
}

body {
  font-family: system-ui, -apple-system, 'Segoe UI', 'Vazirmatn', 'IRANSans', Tahoma, sans-serif;
  background: var(--bg);
  color: var(--txt);
  overflow-x: hidden;
  min-height: 100vh;
  position: relative;
}

/* ========== صفحه لودینگ ========== */
#loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #0a0f1c;
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: opacity 0.8s ease-out, visibility 0.8s ease-out;
}

.loading-container {
  text-align: center;
  direction: ltr;
}

.code-loader {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  font-family: 'Courier New', 'Fira Code', monospace;
  font-size: clamp(28px, 8vw, 48px);
  font-weight: bold;
  margin-bottom: 30px;
}

.bracket {
  color: #7c3aed;
  text-shadow: 0 0 20px #7c3aed;
  animation: bracketPulse 1.5s ease-in-out infinite;
}

@keyframes bracketPulse {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.1); }
}

.loading-text {
  display: flex;
  gap: 2px;
}

.loading-char {
  color: #22d3ee;
  animation: charGlow 0.5s ease-in-out infinite alternate;
  animation-delay: calc(var(--i, 0) * 0.05s);
}

.loading-char.space {
  width: 15px;
}

@keyframes charGlow {
  from { color: #22d3ee; text-shadow: 0 0 5px #22d3ee; }
  to { color: #a78bfa; text-shadow: 0 0 20px #a78bfa; }
}

.loader-progress {
  width: 280px;
  max-width: 70vw;
  height: 3px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  margin: 20px auto;
  overflow: hidden;
}

.loader-progress-bar {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #7c3aed, #4f46e5, #22d3ee);
  border-radius: 10px;
  transition: width 0.1s linear;
}

.loader-percent {
  font-family: 'Courier New', monospace;
  font-size: 14px;
  color: #a78bfa;
  letter-spacing: 2px;
  margin-bottom: 15px;
}

.loader-cursor {
  font-family: 'Courier New', monospace;
  font-size: 20px;
  color: #22d3ee;
  display: inline-block;
  animation: blink 1s step-end infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* ========== کانتینر ذرات ========== */
#particles-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* ========== MAIN LAYOUT ========== */
.wrap {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 16px;
  opacity: 0;
  transition: opacity 0.6s ease-out;
}

.card {
  width: min(800px, 94vw);
  background: var(--glass);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: 20px;
  transition: var(--transition);
}

/* ========== HEADER ========== */
.card__header {
  background: linear-gradient(135deg, #7c3aed, #4f46e5, #06b6d4);
  padding: 2px;
  border-radius: 24px;
  margin-bottom: 20px;
}

.card__header-inner {
  background: rgba(10, 15, 28, 0.7);
  border-radius: 22px;
  padding: 22px 16px;
  position: relative;
  text-align: center;
}

/* ردیف بالایی برای دکمه دسکتاپ */
.header-top-row {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 20px;
}

/* دکمه‌های زبان دسکتاپ (بالا سمت راست) */
.lang-switch {
  display: flex;
  gap: 12px;
}

.lang-btn {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 40px;
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  transition: all 0.25s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.lang-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: white;
  stroke-width: 2;
}

.lang-btn.en-btn {
  border-color: rgba(59, 130, 246, 0.5);
}

.lang-btn.fa-btn {
  border-color: rgba(168, 85, 247, 0.5);
}

.lang-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

.lang-btn.active {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.5);
}

/* دکمه‌های زبان موبایل (پایین هدر) - پیش‌فرض مخفی */
.lang-switch-mobile {
  display: none;
  justify-content: center;
  gap: 16px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.lang-btn-mobile {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 40px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  transition: all 0.25s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.lang-btn-mobile svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: white;
  stroke-width: 2;
}

.lang-btn-mobile.active {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.5);
}

/* عکس */
.avatar-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 14px;
}

.avatar {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.6);
  object-fit: cover;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  transition: transform 0.3s;
}

.avatar:hover {
  transform: scale(1.03);
}

.name {
  font-size: var(--fz-xl);
  margin: 10px 0 6px;
  font-weight: 800;
  letter-spacing: -0.5px;
  text-align: center;
}

.title {
  font-size: var(--fz-lg);
  color: var(--muted);
  letter-spacing: 0.5px;
  font-weight: 500;
  text-align: center;
}

/* ========== TABS ========== */
.tabs {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 24px 0 16px;
}

.tab {
  font-size: 14px;
  padding: 8px 20px;
  border-radius: 50px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--txt);
  cursor: pointer;
  transition: 0.2s;
  font-weight: 600;
}

.tab:hover {
  background: rgba(255, 255, 255, 0.12);
  transform: translateY(-2px);
}

.tab.is-active {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.4), rgba(6, 182, 212, 0.4));
  border-color: rgba(255, 255, 255, 0.3);
}

/* ========== CONTENT ========== */
.content {
  padding: 8px 4px 20px;
}

.tab-pane {
  display: none;
  animation: fade 0.3s ease;
}

.tab-pane.is-active {
  display: block;
}

@keyframes fade {
  from { opacity: 0; transform: translateY(5px);}
  to { opacity: 1; transform: translateY(0);}
}

/* ========== مهارت‌ها ========== */
.skills-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 8px 0;
}

.skill-item {
  width: 100%;
}

.skill-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 500;
}

.skill-name {
  color: var(--txt);
}

.skill-percent {
  color: var(--muted);
  font-size: 13px;
}

.skill-bar {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  overflow: hidden;
}

.skill-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #7c3aed, #4f46e5, #06b6d4);
  border-radius: 10px;
  transition: width 1s cubic-bezier(0.2, 0.9, 0.4, 1.1);
}

/* ========== سوابق کاری اسکرول ========== */
.tab-pane#exp {
  max-height: 55vh;
  overflow-y: auto;
  padding-right: 6px;
  scrollbar-width: thin;
  scrollbar-color: #7c3aed rgba(255, 255, 255, 0.08);
}

.tab-pane#exp::-webkit-scrollbar {
  width: 5px;
}

.tab-pane#exp::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.06);
  border-radius: 10px;
}

.tab-pane#exp::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #7c3aed, #4f46e5, #06b6d4);
  border-radius: 10px;
}

/* ========== جاب باکس ========== */
.job {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 16px;
  border-radius: 20px;
  margin: 12px 0;
  transition: all 0.2s;
}

.job:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: translateX(5px);
}

[dir="rtl"] .job:hover {
  transform: translateX(-5px);
}

.job h3 {
  font-size: 17px;
  margin-bottom: 6px;
}

.job span {
  font-size: 12px;
  color: var(--muted);
  display: block;
  margin-bottom: 10px;
}

.job ul {
  padding-right: 22px;
  margin-top: 8px;
}

.job li {
  font-size: 13px;
  line-height: 1.6;
  margin-bottom: 6px;
}

/* ========== استایل مخصوص تحصیلات ========== */
.edu-detailed {
  padding: 18px;
}

.edu-details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
  margin: 12px 0;
  padding: 12px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 16px;
}

.edu-details p {
  margin: 0;
  font-size: 13px;
}

.edu-details strong {
  color: #a78bfa;
  margin-left: 6px;
}

.edu-description {
  font-size: 13.5px;
  line-height: 1.7;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed rgba(255, 255, 255, 0.1);
  color: var(--muted);
}

/* ========== تماس ========== */
.row {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 14px 18px;
  border-radius: 20px;
  margin: 12px auto;
  max-width: 100%;
}

.socials {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-top: 24px;
  flex-wrap: wrap;
}

.socials a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 8px 22px;
  border-radius: 50px;
  text-decoration: none;
  color: white;
  font-weight: 500;
  font-size: 13px;
  transition: 0.2s;
}

.socials a:hover {
  background: rgba(255, 255, 255, 0.16);
  transform: scale(1.02);
}

.credit {
  font-size: 11px;
  text-align: center;
  margin-top: 24px;
  color: rgba(255, 255, 255, 0.4);
}

/* ========== لینک‌ها ========== */
a {
  color: #fff;
  text-decoration: none;
}

.row a:hover {
  color: #22d3ee;
}

/* ========== موبایل (نمایش دکمه پایین و مخفی کردن دکمه بالایی) ========== */
@media (max-width: 768px) {
  .lang-switch {
    display: none;
  }
  
  .lang-switch-mobile {
    display: flex;
  }
  
  .header-top-row {
    margin-bottom: 0;
  }
}

/* ========== ریسپانسیو موبایل ========== */
@media (max-width: 640px) {
  .wrap {
    padding: 12px;
  }
  .card {
    padding: 14px;
  }
  .avatar {
    width: 85px;
    height: 85px;
  }
  .tab {
    font-size: 12px;
    padding: 6px 14px;
  }
  .job h3 {
    font-size: 14px;
  }
  .job li {
    font-size: 12px;
  }
  .row {
    flex-direction: column;
    text-align: center;
  }
  .socials a {
    padding: 6px 16px;
    font-size: 12px;
  }
  .tab-pane#exp {
    max-height: 48vh;
  }
  .skill-header {
    font-size: 12px;
  }
  .skill-percent {
    font-size: 11px;
  }
  .skill-bar {
    height: 6px;
  }
  .edu-details {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .edu-description {
    font-size: 12px;
  }
}

@media (max-width: 480px) {
  .tab {
    font-size: 11px;
    padding: 5px 12px;
  }
  .lang-btn-mobile {
    padding: 5px 12px;
    font-size: 11px;
  }
}