:root {
  --primary: #2563eb;
  --secondary: #64748b;
  --background: #f8fafc;
  --white: #ffffff;
  --text: #334155;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-hover: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --dynamic-primary: #1e40af;
}

[data-theme='dark'] {
  --primary: #3b82f6;
  --secondary: #94a3b8;
  --background: #1e293b;
  --white: #1f2937;
  --text: #f1f5f9;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
  --shadow-hover: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
  --dynamic-primary: var(--primary);
}

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

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--background);
  color: var(--text);
  line-height: 1.6;
}

.content {
  max-width: 1400px;
  margin: 0 auto;
  padding: clamp(0.5rem, 2vw, 2rem);
}

.row-padding {
  display: flex;
  gap: clamp(1rem, 2vw, 2rem);
  flex-wrap: wrap;
}

.column-third {
  flex: 1 1 300px;
}
.column-twothird {
  flex: 2 1 400px;
}

.card {
  background: var(--white);
  border: 2px solid #ffffff;
  border-radius: 1rem;
  box-shadow: var(--shadow);
  transition: var(--transition);
  margin-bottom: 1.5rem;
  animation: fadeIn 0.5s ease-out;
}

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

.card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-hover);
}

.display-container {
  position: relative;
}

.display-container h4,
.display-container h3 {
  margin: 0;
  padding: 0;
  color: var(--text);
}

.display-container img {
  border-radius: 0.7rem 0.7rem 0 0;
  width: 100%;
  object-fit: cover;
  height: auto;
}

.container {
  padding: 1.5rem;
}

.text-teal {
  color: var(--primary);
}

h2,
h3,
h4,
h5,
h6 {
  color: var(--secondary);
  margin-bottom: 1rem;
}

.margin-right {
  margin-right: 0.75rem;
}

/* Progress bars */
.light-grey {
  background-color: #e2e8f0;
  border-radius: 9999px;
  overflow: hidden;
  margin: 0.5rem 0;
}

.teal {
  background: linear-gradient(135deg, var(--primary), #1d4ed8);
  color: var(--white);
  padding: 0.25rem;
  width: 0;
  transition: width 1s ease-in-out;
  animation: progressBar 1.5s ease-in-out;
  animation-fill-mode: both;
}

@keyframes progressBar {
  0% {
    width: 0;
  }
}

/* Skills section */
.large {
  font-size: 1.125rem;
  font-weight: 500;
  margin: 1.5rem 0 1rem 0;
}

.skills {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
}

.skills p {
  display: flex;
  flex: 1 1 100px;
  padding: 0.5rem;
  background-color: #2563eb;
  color: white;
  border-radius: 0.5rem;
  text-align: center;
  transition: var(--transition);
  justify-content: center;
  align-items: center;
  cursor: pointer;
}
.skills p:hover {
  transform: scale(1.05);
  opacity: 0.9;
}

.skills i {
  padding: 0 0.5rem;
}

/* Footer */
.bg-teal {
  background-color: var(--primary);
  color: var(--white);
  padding: 2rem;
  margin-top: 2rem;
  text-align: center;
}

[data-theme='dark'] .bg-teal {
  background-color: var(--white);
  color: var(--text);
}

[data-theme='dark'] .hover-opacity {
  color: var(--text);
}

/* Social Media Links */
.hover-opacity {
  color: var(--white);
  font-size: 1.5rem;
  margin: 0 0.5rem;
  text-decoration: none;
  opacity: 0.8;
  transition: var(--transition);
  display: inline-block;
  transform: scale(1);
}

.hover-opacity:hover {
  opacity: 1;
  transform: scale(1.2);
  color: var(--dynamic-primary);
}

/* Tags */
.tag {
  background-color: var(--primary);
  color: var(--white);
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.875rem;
}

/* Responsive Design */
@media (max-width: 768px) {
  .row-padding {
    flex-direction: column;
  }

  .column-third,
  .column-twothird {
    flex: 1 1 100%;
  }
}

@media (max-width: 480px) {
  .content {
    padding: 0.5rem;
  }

  .row-padding {
    gap: 1rem;
  }

  .hover-opacity {
    font-size: 1.25rem;
    margin: 0 0.25rem;
  }

  footer.container {
    padding: 1rem;
  }

  .bg-teal {
    margin-top: 1rem;
  }
}

@media (min-width: 1400px) {
  .content {
    max-width: 1400px;
  }
}

/* Additional Modern Touches */
hr {
  border: none;
  border-top: 1px solid #e2e8f0;
  margin: 1rem 0;
}

.opacity {
  opacity: 0.9;
}

.icon-large {
  font-size: 1.25rem;
}

/* Smooth Scrolling */
html {
  scroll-behavior: smooth;
  scroll-padding-top: 2rem;
}

/* Add theme toggle button */
.theme-toggle {
  position: fixed;
  top: 1rem;
  right: 1rem;
  padding: 0.5rem;
  border-radius: 50%;
  background: var(--white);
  border: none;
  cursor: pointer;
  box-shadow: 0 2px 4px rgb(0 0 0 / 0.1);
  transition: var(--transition);
  z-index: 1000;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
}

.theme-toggle:hover {
  transform: rotate(180deg);
  background: var(--primary);
  color: var(--white);
}

[data-theme='dark'] .theme-toggle {
  color: var(--white);
  background: var(--primary);
}

/* Loading Animation */
.loader {
  position: fixed;
  inset: 0;
  background: var(--background);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  transition: opacity 0.5s, visibility 0.5s;
}

.loader.hidden {
  opacity: 0;
  visibility: hidden;
}

.loader::after {
  content: '';
  width: 50px;
  height: 50px;
  border: 5px solid var(--secondary);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: loading 0.75s ease infinite;
}

@keyframes loading {
  from {
    transform: rotate(0turn);
  }
  to {
    transform: rotate(1turn);
  }
}

/* Tooltip */
[data-tooltip] {
  position: relative;
  cursor: help;
}

[data-tooltip]:hover::before {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.5rem;
  background: var(--primary);
  color: var(--white);
  border-radius: 0.25rem;
  font-size: 0.875rem;
  white-space: nowrap;
}

/* Download Button */
.download-btn {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  padding: 0.75rem;
  border-radius: 50%;
  background: var(--primary);
  color: var(--white);
  border: none;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: var(--transition);
  z-index: 1000;
}

.download-btn:hover {
  transform: scale(1.1);
}

/* Copy Button */
.copy-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--primary);
  transition: var(--transition);
}

.copy-btn:hover {
  transform: scale(1.2);
}

/* Typing Effect */
.typing::after {
  content: '|';
  animation: blink 1s infinite;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

/* Scroll Progress Bar */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 4px;
  background: linear-gradient(to right, var(--primary), #1d4ed8);
  z-index: 1001;
  transition: width 0.1s ease-out;
}

/* Project Links */
.project-links {
  display: flex;
  gap: 1rem;
  margin: 1rem 0;
}

.project-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background-color: var(--primary);
  color: var(--white);
  text-decoration: none;
  border-radius: 0.5rem;
  transition: var(--transition);
}

.project-link:hover {
  transform: translateY(-2px);
  opacity: 0.9;
}

[data-theme='dark'] .project-link {
  background-color: #2563eb;
  color: var(--text);
}

[data-theme='dark'] .project-link:hover {
  background-color: #1d4ed8;
  color: var(--text);
  transition: background-color 0.3s ease;
}

@media print {
  .card {
    break-inside: avoid;
  }

  .theme-toggle,
  .print-btn,
  .loader,
  .download-btn,
  .copy-btn,
  .scroll-progress {
    display: none;
  }
  .typing::after {
    content: none; /* حذف کاراکتر */
    animation: none; /* حذف انیمیشن */
  }

  /* حفظ رنگ و قابلیت کلیک لینک‌ها */
  a {
    text-decoration: underline;
    color: white !important;
  }

  /* جلوگیری از شکستن عناصر مهم */
  .container {
    break-inside: avoid;
  }

  /* بهینه‌سازی فضای صفحه */
  .content {
    margin: 0.8rem;
    padding: 0;
  }

  /* اطمینان از خوانایی متن */
  body {
    font-size: 12pt;
    line-height: 1.5;
  }
}
