/* ============================================================
   PRO VERSION — Modern Premium Developer Portfolio Stylesheet
   Design: dark SaaS, glassmorphism, soft gradients, minimal
   Fonts: Inter (body) & Space Grotesk (headings)
   ============================================================ */

/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Space+Grotesk:wght@400;500;600;700&display=swap');

/* ---------- CSS Custom Properties ---------- */
:root {
  /* Brand colors */
  --bg-primary: #0a0a0a;
  --bg-secondary: #111111;
  --card-bg: rgba(20, 20, 20, 0.7);
  --card-border: rgba(255, 255, 255, 0.05);
  --text-primary: #f4f4f5;
  --text-secondary: #a1a1aa;
  --accent-start: #3b82f6;   /* blue */
  --accent-end: #06b6d4;     /* cyan */
  --accent-gradient: linear-gradient(135deg, var(--accent-start), var(--accent-end));
  --glass-bg: rgba(15, 15, 15, 0.6);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  --glass-blur: blur(16px);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --transition-fast: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --font-heading: 'Space Grotesk', 'Inter', sans-serif;
  --header-height: 70px;
}

/* ========== RTL (Persian) Support ========== */
html[dir="rtl"] {
  text-align: right;
  direction: rtl;
}

html[dir="rtl"] .hero-content,
html[dir="rtl"] .about-details,
html[dir="rtl"] .about-details p,
html[dir="rtl"] .project-info,
html[dir="rtl"] .contact-info,
html[dir="rtl"] .contact-form {
  text-align: right;
  direction: rtl;
}

html[dir="rtl"] .btn-group {
  justify-content: center;
  flex-direction: row-reverse;
}

html[dir="rtl"] .skill-card h3 {
  justify-content: flex-end;
  flex-direction: row-reverse;
}



/* Adjust icon margins for RTL */
html[dir="rtl"] .btn-primary i,
html[dir="rtl"] .btn-outline i {
  margin-right: 6px;
  margin-left: 0;
}

html[dir="rtl"] .contact-info i,
html[dir="rtl"] .skill-card h3 i {
  margin-left: 6px;
  margin-right: 0;
}

html[dir="rtl"] .contact-info p {
  flex-direction: row-reverse;
}

html[dir="rtl"] .nav-links {
  text-align: right;
  direction: rtl;
}

html[dir="rtl"] .skill-tags {
  justify-content: flex-start;
}

html[dir="rtl"] .contact-form form {
  direction: rtl;
}

html[dir="rtl"] .contact-form button {
  align-self: flex-start;
}

/* Navbar language switcher */
.lang-switch {
  display: flex;
  gap: 8px;
  background: rgba(255, 255, 255, 0.05);
  padding: 4px;
  border-radius: 40px;
  backdrop-filter: blur(4px);
}

.lang-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.8rem;
  padding: 6px 12px;
  border-radius: 30px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--font-heading);
}

.lang-btn.active {
  background: var(--accent-gradient);
  color: #fff;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.lang-btn:hover:not(.active) {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.1);
}

@media (max-width: 768px) {
  .nav-container {
    flex-direction: row;
    justify-content: space-between;
    flex-wrap: wrap;
  }
  .nav-links {
    order: 2;
    width: 100%;
  }
  .lang-switch {
    order: 1;
  }
}

/* ---------- Reset & Base ---------- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  /* Soft glowing background blur effects (ambient radial gradients) */
  background-image:
    radial-gradient(ellipse at 20% 10%, rgba(59, 130, 246, 0.07) 0%, transparent 70%),
    radial-gradient(ellipse at 80% 50%, rgba(6, 182, 212, 0.05) 0%, transparent 70%),
    radial-gradient(ellipse at 40% 90%, rgba(59, 130, 246, 0.04) 0%, transparent 70%);
}

/* ---------- Typography ---------- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 600;
  line-height: 1.2;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

p {
  color: var(--text-secondary);
}

a {
  text-decoration: none;
  color: inherit;
  transition: color var(--transition-fast);
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Navbar (sticky, glassmorphism) ---------- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--glass-border);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  transition: background var(--transition-smooth);
}

.nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
}

.logo {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.03em;
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 2rem;
}

.nav-links a {
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--text-secondary);
  position: relative;
  transition: color var(--transition-fast);
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent-gradient);
  border-radius: 2px;
  transition: width var(--transition-smooth);
}

.nav-links a:hover,
.nav-links a:focus-visible {
  color: var(--text-primary);
}

.nav-links a:hover::after,
.nav-links a:focus-visible::after {
  width: 100%;
}

/* ---------- Hero Section ---------- */
#hero {
  padding: 100px 0 80px;
  min-height: 90vh;
  display: flex;
  align-items: center;
}

.hero-wrapper {
  display: flex;
  align-items: center;
  gap: 60px;
  flex-wrap: wrap;
}

.hero-content {
  flex: 1 1 500px;
}

.hero-content h1 {
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 700;
  margin-bottom: 0.5rem;
  line-height: 1.1;
}

.highlight {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-role {
  font-size: 1.3rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 1.2rem;
  opacity: 0.9;
}

.hero-description {
  font-size: 1.05rem;
  max-width: 600px;
  margin-bottom: 2rem;
  color: var(--text-secondary);
}

.btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.btn-primary,
.btn-outline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 40px;
  font-weight: 600;
  font-size: 0.95rem;
  transition: all var(--transition-smooth);
  border: 1px solid transparent;
  cursor: pointer;
}

.btn-primary {
  background: var(--accent-gradient);
  color: #fff;
  border: none;
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(59, 130, 246, 0.5);
}

.btn-outline {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--text-primary);
  backdrop-filter: blur(4px);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.4);
  transform: translateY(-2px);
}

.hero-image {
  flex: 0 0 auto;
  display: flex;
  justify-content: center;
}

.profile-pic {
  width: 280px;
  height: 280px;
  object-fit: cover;
  border-radius: 50%;
  border: 2px solid transparent;
  background: var(--accent-gradient) border-box;
  box-shadow: 0 0 40px rgba(59, 130, 246, 0.2), 0 20px 30px rgba(0,0,0,0.5);
  transition: transform var(--transition-smooth), box-shadow var(--transition-smooth);
}

.profile-pic:hover {
  transform: scale(1.03);
  box-shadow: 0 0 60px rgba(59, 130, 246, 0.35);
}

/* ---------- Section Titles ---------- */
.section-title {
  font-size: 2.2rem;
  text-align: center;
  margin-bottom: 50px;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  display: inline-block;
  position: relative;
  left: 50%;
  transform: translateX(-50%);
}

.section-title::after {
  content: '';
  display: block;
  width: 60px;
  height: 3px;
  background: var(--accent-gradient);
  margin: 12px auto 0;
  border-radius: 2px;
}

/* ---------- About Section ---------- */
#about {
  padding: 80px 0;
}

.about-content {
  max-width: 800px;
  margin: 0 auto;
  text-align: center;
}

.about-details p {
  font-size: 1.05rem;
  line-height: 1.9;
  background: var(--card-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 42px 36px;
  box-shadow: var(--glass-shadow);
}

/* ---------- Skills Section ---------- */
#skills {
  padding: 100px 0;
}

.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 28px;
  animation: fadeUp 0.8s ease-out 0.2s both;
}

.skill-card {
  background: var(--card-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 28px 22px;
  transition: all var(--transition-smooth);
  box-shadow: var(--glass-shadow);
}

.skill-card:hover {
  transform: translateY(-6px);
  border-color: rgba(59, 130, 246, 0.2);
  box-shadow: 0 12px 40px rgba(0,0,0,0.5), 0 0 20px rgba(59, 130, 246, 0.1);
}

.skill-card h3 {
  font-size: 1.2rem;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-primary);
}

.skill-card h3 i {
  color: #3b82f6;
  font-size: 1.3rem;
}

.skill-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.skill-tags span {
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.25);
  color: #bfdbfe;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  transition: background var(--transition-fast);
}

.skill-tags span:hover {
  background: rgba(59, 130, 246, 0.2);
}

/* ---------- Projects Section ---------- */
#projects {
  padding: 100px 0;
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 36px;
  animation: fadeUp 0.8s ease-out 0.3s both;
}

.project-card {
  background: var(--card-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition-smooth);
  box-shadow: var(--glass-shadow);
  display: flex;
  flex-direction: column;
}

.project-card:hover {
  transform: translateY(-6px);
  border-color: rgba(59, 130, 246, 0.2);
  box-shadow: 0 12px 40px rgba(0,0,0,0.5), 0 0 30px rgba(59, 130, 246, 0.08);
}

.project-img {
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--card-border);
  padding: 0;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text-secondary);
  transition: color var(--transition-fast);
  min-height: 220px;
  overflow: hidden;
  position: relative;
}

.project-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  transition: transform var(--transition-smooth), filter var(--transition-smooth);
}

.project-card:hover .project-thumb {
  transform: scale(1.05);
  filter: brightness(1.1);
}

.project-img i {
  color: #3b82f6;
  opacity: 0.9;
}

.project-card:hover .project-img i {
  color: #06b6d4;
}

.project-img a {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.95rem;
  padding: 32px 20px;
  width: 100%;
}

.project-info {
  padding: 24px 20px 28px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.project-info h3 {
  font-size: 1.25rem;
  margin-bottom: 12px;
}

.project-info p {
  font-size: 0.9rem;
  margin-bottom: 18px;
  flex: 1;
}

.tech-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.tech-badge {
  background: rgba(59, 130, 246, 0.12);
  color: #93c5fd;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  border: 1px solid rgba(59, 130, 246, 0.2);
}

.project-links {
  display: flex;
  gap: 16px;
  margin-top: auto;
  flex-wrap: wrap;
}

html[dir="rtl"] .project-links {
  justify-content: flex-start;
  flex-direction: row-reverse;
}

.project-link {
  font-weight: 600;
  font-size: 0.85rem;
  color: #60a5fa;
  transition: color var(--transition-fast), transform var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.project-link:hover {
  color: #38bdf8;
  transform: translateX(3px);
}

/* ---------- Contact Section ---------- */
#contact {
  padding: 80px 0;
}

.contact-flex {
  display: flex;
  flex-wrap: wrap;
  gap: 40px;
  align-items: flex-start;
}

.contact-info,
.contact-form {
  flex: 1 1 350px;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  box-shadow: var(--glass-shadow);
}

.contact-info h3,
.contact-form h3 {
  font-size: 1.5rem;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.contact-info p {
  margin-bottom: 14px;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.contact-info i {
  width: 20px;
  color: #3b82f6;
}

.contact-info a {
  color: #60a5fa;
  font-weight: 500;
}

.contact-info a:hover {
  color: #38bdf8;
  text-decoration: underline;
}

.contact-note {
  margin-top: 18px;
  font-style: italic;
  color: var(--text-secondary);
  font-size: 0.9rem;
  border-top: 1px solid rgba(255,255,255,0.05);
  padding-top: 16px;
}

/* Contact Form */
.contact-form form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.contact-form input,
.contact-form textarea {
  width: 100%;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  color: var(--text-primary);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  resize: vertical;
}

.contact-form input:focus,
.contact-form textarea:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.contact-form input::placeholder,
.contact-form textarea::placeholder {
  color: var(--text-secondary);
  opacity: 0.7;
}

.contact-form button {
  align-self: flex-start;
  padding: 12px 28px;
  background: var(--accent-gradient);
  border: none;
  border-radius: 40px;
  color: #fff;
  font-weight: 600;
  font-size: 0.95rem;
  font-family: var(--font-heading);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all var(--transition-smooth);
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.3);
}

.contact-form button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(59, 130, 246, 0.5);
}

/* ---------- Footer ---------- */
footer {
  background: var(--bg-secondary);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding: 28px 0;
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.footer-links {
  margin-top: 10px;
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.footer-links a {
  color: var(--text-secondary);
  transition: color var(--transition-fast);
}

.footer-links a:hover {
  color: #60a5fa;
}

/* ---------- Animations (CSS Keyframes) ---------- */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero-content,
.hero-image,
.skill-card,
.project-card,
.contact-info,
.contact-form {
  animation: fadeUp 0.7s ease-out both;
}

/* Staggered delays for grid cards (optional, will be overwritten by inline animation if applied) */
.skill-card:nth-child(1) { animation-delay: 0.1s; }
.skill-card:nth-child(2) { animation-delay: 0.2s; }
.skill-card:nth-child(3) { animation-delay: 0.3s; }
.skill-card:nth-child(4) { animation-delay: 0.4s; }

/* ---------- Responsive Media Queries ---------- */
@media (max-width: 768px) {
  .hero-wrapper {
    flex-direction: column-reverse;
    text-align: center;
    gap: 32px;
  }

  .hero-content h1 {
    font-size: 2.2rem;
  }

  .hero-role {
    font-size: 1.1rem;
  }

  .btn-group {
    justify-content: center;
    flex-wrap: wrap;
  }

  .profile-pic {
    width: 200px;
    height: 200px;
  }

  .nav-container {
    flex-direction: column;
    height: auto;
    padding: 16px 24px;
    gap: 12px;
  }

  .nav-links {
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
  }

  .section-title {
    font-size: 1.8rem;
    margin-bottom: 32px;
  }

  .contact-flex {
    flex-direction: column;
  }

  .project-info {
    padding: 20px 16px 24px;
  }

  .project-info h3 {
    font-size: 1.1rem;
  }

  .project-info p {
    font-size: 0.85rem;
  }

  html[dir="rtl"] .hero-content,
  html[dir="rtl"] .project-info,
  html[dir="rtl"] .contact-info,
  html[dir="rtl"] .contact-form {
    text-align: right;
    direction: rtl;
  }

  html[dir="rtl"] .btn-group {
    justify-content: center;
  }

  html[dir="rtl"] .contact-flex {
    flex-direction: column;
  }

  html[dir="rtl"] .project-links {
    justify-content: flex-start;
  }
}

@media (max-width: 480px) {
  .hero-content h1 {
    font-size: 1.8rem;
  }

  .btn-group {
    flex-direction: column;
    align-items: center;
    gap: 12px;
  }

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

  .project-thumb {
    min-height: 200px;
  }

  .project-info {
    padding: 16px 12px 20px;
  }

  .section-title {
    font-size: 1.5rem;
  }

  .contact-info,
  .contact-form {
    padding: 24px 16px;
  }

  .contact-info h3,
  .contact-form h3 {
    font-size: 1.2rem;
  }

  .tech-stack {
    flex-wrap: wrap;
  }

  .project-links {
    flex-direction: column;
    gap: 8px;
  }

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

  html[dir="rtl"] .project-links {
    flex-direction: column;
  }
}

/* ---------- Accessibility: Focus Styles ---------- */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

/* Smooth scroll offset for sticky header (optional) */
section[id] {
  scroll-margin-top: calc(var(--header-height) + 20px);
}


/* ---------- Mobile Menu Toggle ---------- */
.mobile-menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.5rem;
  cursor: pointer;
}

@media (max-width: 768px) {
  .mobile-menu-toggle {
    display: block;
  }

  .nav-links {
    display: none;
    flex-direction: column;
    width: 100%;
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    padding: 16px 0;
    margin-top: 8px;
  }

  .nav-links.show {
    display: flex;
  }
}

/* ---------- Active Link (Scroll Spy) ---------- */
.nav-links a.active {
  color: #60a5fa !important;
}

.nav-links a.active::after {
  width: 100%;
}

/* ---------- Scroll / Intersection Animations ---------- */
.pre-animate {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- Form Message Styles ---------- */
.form-message {
  padding: 12px 16px;
  margin-top: 16px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  text-align: center;
}

.form-message.success {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.form-message.error {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}