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

html {
  scroll-behavior: smooth;
}

:root {
  --primary-color: #0f172a;
  --secondary-color: #475569;
  --accent-color: #3b82f6;
  --bg-color: #f8fafc;
  --text-color: #1e293b;
  --border-color: #e2e8f0;
  --card-bg: #ffffff;
  --shadow-color: rgba(0, 0, 0, 0.1);
  --header-bg: rgba(255, 255, 255, 0.9);
}

[data-theme="dark"] {
  --primary-color: #e2e8f0;
  --secondary-color: #94a3b8;
  --accent-color: #60a5fa;
  --bg-color: #0f172a;
  --text-color: #e2e8f0;
  --border-color: #334155;
  --card-bg: #1e293b;
  --shadow-color: rgba(0, 0, 0, 0.3);
  --header-bg: rgba(15, 23, 42, 0.9);
}

.skip-to-main {
  position: absolute;
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent-color);
  color: white;
  padding: 12px 24px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  z-index: 9999;
  transition: top 0.3s ease;
}

.skip-to-main:focus {
  top: 10px;
  outline: 3px solid var(--accent-color);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

body {
  font-family:
    "Inter",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  background: var(--bg-color);
  color: var(--text-color);
  line-height: 1.6;
  transition:
    background-color 0.3s ease,
    color 0.3s ease;
}

.resume-header {
  position: sticky;
  top: 0;
  background: var(--header-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 2rem;
  z-index: 100;
  display: flex;
  justify-content: center;
  align-items: center;
  direction: ltr;
}

.header-buttons {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: center;
}

.back-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--accent-color);
  font-weight: 500;
  transition: transform 0.3s ease;
}

.back-link:hover {
  transform: translateX(-3px);
}

[dir="rtl"] .back-link:hover {
  transform: translateX(3px);
}

.back-arrow {
  font-size: 1.2rem;
}

[dir="rtl"] .back-arrow {
  transform: scaleX(-1);
}

.toggle-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-color);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  font-family: inherit;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.toggle-btn:hover {
  background: var(--accent-color);
  color: white;
  border-color: var(--accent-color);
}

.toggle-btn:focus-visible {
  outline: 3px solid var(--accent-color);
  outline-offset: 2px;
}

.toggle-btn .sun-icon {
  display: block;
}

.toggle-btn .moon-icon {
  display: none;
}

[data-theme="dark"] .toggle-btn .sun-icon {
  display: none;
}

[data-theme="dark"] .toggle-btn .moon-icon {
  display: block;
}

.action-buttons {
  display: flex;
  gap: 0.75rem;
}

.action-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--accent-color);
  color: white;
  border: none;
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: inherit;
  text-decoration: none;
}

.action-btn:hover {
  background: #1e3a8a;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--shadow-color);
}

.action-btn:focus-visible {
  outline: 3px solid var(--accent-color);
  outline-offset: 2px;
}

.action-btn svg {
  flex-shrink: 0;
}

.back-btn svg {
  transition: transform 0.3s ease;
}

.back-btn:hover svg {
  transform: translateX(-3px);
}

[dir="rtl"] .back-btn:hover svg {
  transform: translateX(3px) scaleX(-1);
}

[dir="rtl"] .back-btn svg {
  transform: scaleX(-1);
}

.resume-container {
  max-width: 850px;
  margin: 2rem auto;
  padding: 3rem;
  background: var(--card-bg);
  box-shadow: 0 4px 20px var(--shadow-color);
  border-radius: 12px;
  transition: background-color 0.3s ease;
}

[dir="rtl"] .resume-container {
  text-align: right;
}

.personal-info {
  text-align: center;
  margin-bottom: 3rem;
  padding-bottom: 2rem;
  border-bottom: 2px solid var(--border-color);
}

.name {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 0.5rem;
}

[dir="rtl"] .name {
  text-align: center;
}

.title {
  font-size: 1.2rem;
  color: var(--secondary-color);
  margin-bottom: 1.5rem;
}

[dir="rtl"] .title {
  text-align: center;
}

.contact-info {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 1rem;
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-color);
  text-decoration: none;
  font-size: 0.95rem;
  transition: color 0.3s ease;
}

.contact-item:hover {
  color: var(--accent-color);
}

.contact-item svg {
  flex-shrink: 0;
}

.resume-section {
  margin-bottom: 2.5rem;
}

.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--accent-color);
}

[dir="rtl"] .section-title {
  text-align: right;
}

.summary-text {
  color: var(--secondary-color);
  line-height: 1.8;
  font-size: 1rem;
}

.experience-item {
  margin-bottom: 2rem;
}

.experience-item:last-child {
  margin-bottom: 0;
}

.item-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.item-title {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--primary-color);
}

[dir="rtl"] .item-title {
  text-align: right;
}

.item-date {
  font-size: 0.9rem;
  color: var(--secondary-color);
  font-weight: 500;
}

[dir="rtl"] .item-date {
  text-align: right;
}

.item-subtitle {
  color: var(--accent-color);
  font-weight: 500;
  margin-bottom: 0.75rem;
}

.item-list {
  list-style: none;
  padding-left: 0;
}

.item-list li {
  position: relative;
  padding-left: 1.5rem;
  margin-bottom: 0.5rem;
  color: var(--secondary-color);
  line-height: 1.6;
}

.item-list li::before {
  content: "▸";
  position: absolute;
  left: 0;
  color: var(--accent-color);
  font-weight: bold;
}

[dir="rtl"] .item-list li {
  padding-left: 0;
  padding-right: 1.5rem;
}

[dir="rtl"] .item-list li::before {
  left: auto;
  right: 0;
  content: "◂";
}

.project-links {
  margin-top: 1rem;
  display: flex;
  gap: 1rem;
}

.project-link {
  color: var(--accent-color);
  text-decoration: none;
  font-weight: 500;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
}

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

[dir="rtl"] .project-link:hover {
  transform: translateX(-3px);
}

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

.skill-category {
  background: var(--bg-color);
  padding: 1.25rem;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.skill-category-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--primary-color);
  margin-bottom: 0.75rem;
}

.skill-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.skill-tag {
  background: linear-gradient(135deg, #3b82f6, #1e3a8a);
  color: white;
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  transition: transform 0.3s ease;
}

.skill-tag:hover {
  transform: translateY(-2px);
}

@media print {
  .no-print {
    display: none !important;
  }

  body {
    background: white;
    color: black;
  }

  .resume-container {
    max-width: 100%;
    margin: 0;
    padding: 0;
    box-shadow: none;
    border-radius: 0;
  }

  .resume-section {
    page-break-inside: avoid;
  }

  .experience-item {
    page-break-inside: avoid;
  }

  .section-title {
    page-break-after: avoid;
  }

  a {
    text-decoration: none;
    color: black;
  }

  .contact-item::after {
    content: "";
  }
}

@media (max-width: 768px) {
  .resume-header {
    padding: 0.75rem 0.5rem;
  }

  .header-buttons {
    gap: 0.5rem;
  }

  .resume-container {
    margin: 1rem;
    padding: 2rem 1.5rem;
    border-radius: 8px;
  }

  .name {
    font-size: 2rem;
  }

  .title {
    font-size: 1rem;
  }

  .contact-info {
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
  }

  .item-header {
    flex-direction: column;
    align-items: flex-start;
  }

  [dir="rtl"] .item-header {
    align-items: flex-end;
  }

  [dir="rtl"] .item-header .item-title,
  [dir="rtl"] .item-header .item-date {
    width: 100%;
    text-align: right;
  }

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

  .btn-text {
    display: none;
  }

  .action-btn {
    padding: 0.6rem;
  }

  .back-text {
    display: none;
  }
}

@media (max-width: 480px) {
  .resume-container {
    padding: 1.5rem 1rem;
  }

  .name {
    font-size: 1.75rem;
  }

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