:root {
  --color-bg-light: #f5f5f7;
  --color-bg-dark: #0f172a;
  --color-surface-light: #ffffff;
  --color-surface-dark: #111827;
  --color-primary: #2563eb;
  --color-primary-soft: rgba(37, 99, 235, 0.15);
  --color-text-light: #0f172a;
  --color-text-muted-light: #6b7280;
  --color-text-dark: #e5e7eb;
  --color-text-muted-dark: #9ca3af;
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-pill: 999px;
  --shadow-soft: 0 18px 45px rgba(15, 23, 42, 0.16);
  --shadow-subtle: 0 10px 30px rgba(15, 23, 42, 0.08);
  --transition-fast: 0.2s ease;
  --transition-med: 0.35s ease;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Cairo", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background-color: var(--color-bg-light);
  color: var(--color-text-light);
}

body.dark-theme {
  background-color: var(--color-bg-dark);
  color: var(--color-text-dark);
}

#app {
  min-height: 100vh;
}

.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.hero {
  padding: 4rem 0 2rem;
}

.hero-content {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 2fr);
  gap: 2rem;
  align-items: center;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.12), rgba(56, 189, 248, 0.06));
  border-radius: 32px;
  padding: 2.5rem 2rem;
  box-shadow: var(--shadow-soft);
  position: relative;
  overflow: hidden;
}

.hero-content::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top left, rgba(255, 255, 255, 0.25), transparent 55%);
  opacity: 0.7;
  pointer-events: none;
}

.hero-image {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
}

.hero-image img {
  width: 200px;
  height: 300px;
  border-radius: 32px;
  object-fit: cover;
  box-shadow: var(--shadow-soft);
  border: 4px solid rgba(255, 255, 255, 0.8);
}

.hero-text {
  position: relative;
  z-index: 1;
}

.hero-text h1 {
  margin: 0 0 0.25rem;
  font-size: 2.1rem;
  font-weight: 700;
}

.hero-text h2 {
  margin: 0 0 0.75rem;
  font-size: 1.2rem;
  font-weight: 500;
  color: var(--color-text-muted-light);
}

body.dark-theme .hero-text h2 {
  color: var(--color-text-muted-dark);
}

.hero-text .summary {
  margin: 0 0 0.75rem;
  font-size: 0.98rem;
  line-height: 1.7;
  color: var(--color-text-muted-light);
  text-align: justify;
}

body.dark-theme .hero-text .summary {
  color: var(--color-text-muted-dark);
}

.hero-text .location {
  margin: 0 0 1.25rem;
  font-size: 0.9rem;
  color: var(--color-text-muted-light);
}

body.dark-theme .hero-text .location {
  color: var(--color-text-muted-dark);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 1.5rem;
  border-radius: var(--radius-pill);
  border: none;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), background-color var(--transition-fast), color var(--transition-fast);
  text-decoration: none;
}

.btn.primary {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #ffffff;
  box-shadow: 0 12px 30px rgba(37, 99, 235, 0.45);
}

.btn.primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 40px rgba(37, 99, 235, 0.55);
}

.btn.outline {
  background: rgba(255, 255, 255, 0.85);
  color: #1f2937;
}

body.dark-theme .btn.outline {
  background: rgba(15, 23, 42, 0.75);
  color: var(--color-text-dark);
}

.btn.outline:hover {
  background: #ffffff;
}

.btn.full {
  width: 100%;
}

.theme-toggle {
  position: absolute;
  top: 1rem;
  left: 1.25rem;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: none;
  background: rgba(15, 23, 42, 0.12);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.2rem;
  transition: background-color var(--transition-fast), transform var(--transition-fast);
  z-index: 2;
}

.theme-toggle:hover {
  background: rgba(15, 23, 42, 0.18);
  transform: translateY(-1px);
}

.theme-icon {
  position: absolute;
  font-size: 1.25rem;
  line-height: 1;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.theme-icon-sun {
  opacity: 1;
  transform: scale(1);
}

.theme-icon-moon {
  opacity: 0;
  transform: scale(0.7) translateY(3px);
}

body.dark-theme .theme-icon-sun {
  opacity: 0;
  transform: scale(0.7) translateY(-3px);
}

body.dark-theme .theme-icon-moon {
  opacity: 1;
  transform: scale(1);
}

.lang-toggle {
  position: absolute;
  top: 1rem;
  left: 4.1rem;
  min-width: 44px;
  height: 40px;
  border-radius: 999px;
  border: none;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #111827;
  transition: background-color var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
  z-index: 2;
}

body.dark-theme .lang-toggle {
  background: rgba(15, 23, 42, 0.9);
  color: #e5e7eb;
}

.lang-toggle:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.35);
}

.main-nav {
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(245, 245, 247, 0.95);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(148, 163, 184, 0.15);
}

body.dark-theme .main-nav {
  background: rgba(15, 23, 42, 0.88);
  border-bottom-color: rgba(30, 64, 175, 0.45);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0;
}

.logo {
  font-weight: 700;
  color: var(--color-text-light);
  text-decoration: none;
}

body.dark-theme .logo {
  color: var(--color-text-dark);
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 1.25rem;
  padding: 0;
  margin: 0;
}

.lang-switch {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-inline-start: 1rem;
}

.lang-btn {
  min-width: 44px;
  padding: 0.2rem 0.9rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.7);
  background: rgba(255, 255, 255, 0.8);
  color: #111827;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast);
}

body.dark-theme .lang-btn {
  background: rgba(15, 23, 42, 0.9);
  color: #e5e7eb;
  border-color: rgba(55, 65, 81, 0.9);
}

.lang-btn.active {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 10px 20px rgba(37, 99, 235, 0.4);
}

.lang-btn:hover {
  transform: translateY(-1px);
}

.nav-links a {
  text-decoration: none;
  font-size: 0.9rem;
  color: var(--color-text-muted-light);
  position: relative;
  padding-bottom: 0.15rem;
}

body.dark-theme .nav-links a {
  color: var(--color-text-muted-dark);
}

.nav-links a::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  width: 0;
  height: 2px;
  background: var(--color-primary);
  transition: width var(--transition-fast);
}

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

.section {
  padding: 3.5rem 0;
}

.section.alt {
  background: radial-gradient(circle at top right, rgba(37, 99, 235, 0.06), transparent 50%);
}

.section-title {
  margin: 0 0 1.75rem;
  font-size: 1.4rem;
  position: relative;
}

.section-title::after {
  content: "";
  position: absolute;
  bottom: -0.5rem;
  right: 0;
  width: 60px;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, #2563eb, #38bdf8);
}

.timeline {
  border-right: 2px solid rgba(148, 163, 184, 0.45);
  margin-right: 0.35rem;
}

.timeline-item {
  position: relative;
  padding-right: 1.5rem;
  padding-bottom: 1.75rem;
}

.timeline-item::before {
  content: "";
  position: absolute;
  right: -0.7rem;
  top: 0.3rem;
  width: 11px;
  height: 11px;
  border-radius: 999px;
  background: #2563eb;
  box-shadow: 0 0 0 6px rgba(37, 99, 235, 0.2);
}

body.lang-en .timeline {
  border-right: none;
  border-left: 2px solid rgba(148, 163, 184, 0.45);
  margin-right: 0;
  margin-left: 0.35rem;
}

body.lang-en .timeline-item {
  padding-right: 0;
  padding-left: 1.5rem;
}

body.lang-en .timeline-item::before {
  right: auto;
  left: -0.7rem;
}

.timeline-date {
  font-size: 0.8rem;
  color: var(--color-text-muted-light);
  margin-bottom: 0.15rem;
}

body.dark-theme .timeline-date {
  color: var(--color-text-muted-dark);
}

.timeline-content h4 {
  margin: 0 0 0.2rem;
  font-size: 1rem;
}

.timeline-content .company {
  margin: 0 0 0.4rem;
  font-size: 0.88rem;
  color: var(--color-text-muted-light);
}

body.dark-theme .timeline-content .company {
  color: var(--color-text-muted-dark);
}

.timeline-content p {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.7;
}

.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.skill {
  background: rgba(255, 255, 255, 0.95);
  border-radius: var(--radius-md);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow-subtle);
}

body.dark-theme .skill {
  background: rgba(15, 23, 42, 0.92);
}

.skill-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.4rem;
}

.skill-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.skill-level {
  font-size: 0.8rem;
  color: var(--color-text-muted-light);
}

body.dark-theme .skill-level {
  color: var(--color-text-muted-dark);
}

.skill-bar {
  width: 100%;
  height: 7px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.3);
  overflow: hidden;
}

.skill-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #2563eb, #22c55e);
  border-radius: 999px;
  transform-origin: right;
  transform: scaleX(0);
  transition: transform 0.6s ease-out;
}

body.skills-visible .skill-bar-fill {
  transform: scaleX(1);
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
}

.project-card {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 20px;
  box-shadow: var(--shadow-subtle);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

body.dark-theme .project-card {
  background: rgba(15, 23, 42, 0.92);
}

.project-card img {
  width: 100%;
  height: 160px;
  object-fit: cover;
}

.project-content {
  padding: 1rem 1.2rem 1.2rem;
}

.project-content h4 {
  margin: 0 0 0.4rem;
}

.project-content p {
  margin: 0 0 0.7rem;
  font-size: 0.9rem;
  color: var(--color-text-muted-light);
}

body.dark-theme .project-content p {
  color: var(--color-text-muted-dark);
}

.project-link {
  font-size: 0.88rem;
  font-weight: 600;
  color: #2563eb;
  text-decoration: none;
}

.project-link:hover {
  text-decoration: underline;
}

.contact-layout {
  display: block;
}

.contact-modern {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.contact-primary-bar,
.contact-social-bar {
  border-radius: 22px;
  padding: 1rem;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(241, 245, 249, 0.92));
  border: 1px solid rgba(148, 163, 184, 0.24);
  box-shadow: var(--shadow-subtle);
}

body.dark-theme .contact-primary-bar,
body.dark-theme .contact-social-bar {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.96), rgba(15, 23, 42, 0.86));
  border-color: rgba(59, 130, 246, 0.3);
}

.contact-cards {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
}

.contact-card {
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: rgba(255, 255, 255, 0.8);
  padding: 0.8rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

body.dark-theme .contact-card {
  background: rgba(2, 6, 23, 0.42);
  border-color: rgba(96, 165, 250, 0.24);
}

.contact-label {
  font-size: 0.8rem;
  color: var(--color-text-muted-light);
}

body.dark-theme .contact-label {
  color: var(--color-text-muted-dark);
}

.contact-value {
  font-size: 0.94rem;
  font-weight: 700;
  color: var(--color-text-light);
  text-decoration: none;
  word-break: break-all;
}

.ltr-text {
  direction: ltr;
  unicode-bidi: bidi-override;
}

body.dark-theme .contact-value {
  color: var(--color-text-dark);
}

.contact-action {
  font-size: 0.78rem;
  color: #2563eb;
  text-decoration: none;
  width: fit-content;
}

.contact-action:hover {
  text-decoration: underline;
}

.social-title {
  margin: 0 0 0.65rem;
  font-size: 0.9rem;
  font-weight: 700;
}

.social-icons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.social-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(37, 99, 235, 0.25);
  background: rgba(37, 99, 235, 0.08);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #1d4ed8;
  transition: transform var(--transition-fast), background-color var(--transition-fast), border-color var(--transition-fast);
}

body.dark-theme .social-icon {
  border-color: rgba(59, 130, 246, 0.45);
  background: rgba(59, 130, 246, 0.14);
  color: #93c5fd;
}

.social-icon svg {
  width: 19px;
  height: 19px;
  fill: currentColor;
}

.social-icon:hover {
  transform: translateY(-2px);
  background: rgba(37, 99, 235, 0.16);
  border-color: rgba(37, 99, 235, 0.55);
}

.social-icon.disabled {
  opacity: 0.35;
  pointer-events: none;
}

.footer {
  border-top: 1px solid rgba(148, 163, 184, 0.3);
  padding: 1.5rem 0 2rem;
  font-size: 0.85rem;
  text-align: center;
  color: var(--color-text-muted-light);
}

body.dark-theme .footer {
  color: var(--color-text-muted-dark);
}

.placeholder {
  font-size: 0.9rem;
  color: var(--color-text-muted-light);
}

body.dark-theme .placeholder {
  color: var(--color-text-muted-dark);
}

.fade-in {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity var(--transition-med), transform var(--transition-med);
}

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

/* ─── Download CV Icon ──────────────────────────────────────────────── */

.download-cv-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1.5px solid rgba(161, 98, 7, 0.45);
  background: rgba(161, 98, 7, 0.08);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #92400e;
  cursor: pointer;
  transition: transform var(--transition-fast), background-color var(--transition-fast), border-color var(--transition-fast);
  outline: none;
  flex-shrink: 0;
}

body.dark-theme .download-cv-icon {
  border-color: rgba(251, 191, 36, 0.45);
  background: rgba(251, 191, 36, 0.1);
  color: #fbbf24;
}

.download-cv-icon svg {
  width: 19px;
  height: 19px;
  fill: currentColor;
}

.download-cv-icon:hover {
  transform: translateY(-2px);
  background: rgba(161, 98, 7, 0.16);
  border-color: rgba(161, 98, 7, 0.65);
}

body.dark-theme .download-cv-icon:hover {
  background: rgba(251, 191, 36, 0.2);
}

.download-cv-icon.loading {
  pointer-events: none;
  animation: pdf-loading-pulse 1s ease-in-out infinite;
}

@keyframes pdf-loading-pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

/* ─── PDF Code Modal ────────────────────────────────────────────────── */

.pdf-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.52);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.pdf-modal-overlay[hidden] {
  display: none;
}

.pdf-modal-box {
  background: #ffffff;
  border-radius: 22px;
  padding: 2rem 1.75rem;
  width: 100%;
  max-width: 370px;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.22);
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  direction: rtl;
}

body.dark-theme .pdf-modal-box {
  background: #0f172a;
  border: 1px solid rgba(59, 130, 246, 0.3);
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.55);
}

.pdf-modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-text-light, #1e293b);
  margin: 0;
}

body.dark-theme .pdf-modal-title {
  color: var(--color-text-dark, #e2e8f0);
}

.pdf-code-input {
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  padding: 0.75rem 1rem;
  font-family: 'Cairo', sans-serif;
  font-size: 1.1rem;
  outline: none;
  text-align: center;
  letter-spacing: 0.25em;
  transition: border-color 0.2s;
  background: transparent;
  color: inherit;
  width: 100%;
  box-sizing: border-box;
}

.pdf-code-input:focus {
  border-color: #2563eb;
}

body.dark-theme .pdf-code-input {
  background: #1e293b;
  border-color: #334155;
  color: #e2e8f0;
}

body.dark-theme .pdf-code-input:focus {
  border-color: #60a5fa;
}

.pdf-code-error {
  color: #ef4444;
  font-size: 0.85rem;
  text-align: center;
  margin: 0;
}

.pdf-code-error[hidden] {
  display: none;
}

.pdf-modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}

.pdf-confirm-btn {
  min-width: 130px;
}

.pdf-cancel-btn {
  min-width: 90px;
}

@media (max-width: 768px) {
  .hero {
    padding-top: 2.8rem;
  }

  .hero-content {
    grid-template-columns: 1fr;
    text-align: center;
    padding: 2rem 1.5rem 1.8rem;
  }

  .hero-image {
    order: -1;
  }

  .hero-text h1 {
    font-size: 1.7rem;
  }

  .hero-text h2 {
    font-size: 1.02rem;
  }

  .hero-actions {
    justify-content: center;
  }

  .nav-inner {
    flex-direction: column;
    gap: 0.35rem;
  }

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

  .contact-primary-bar,
  .contact-social-bar {
    padding: 0.9rem 0.85rem;
  }

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

  .timeline {
    margin-right: 0.1rem;
  }
}
