:root {
  --primary-color: #222222;
  --secondary-color: #444444;
  --accent-color: #666666;
  --text-color: #333;
  --bg-color: #f8f8f8;
  --card-bg: #fff;
  --border-color: #ddd;
  --header-bg: #f0f0f0;
  --shadow-color: rgba(0, 0, 0, 0.1);
  --gradient-start: #222222;
  --gradient-end: #555555;
}

[data-theme="dark"] {
  --primary-color: #333333;
  --secondary-color: #555555;
  --accent-color: #777777;
  --text-color: #e0e0e0;
  --bg-color: #121212;
  --card-bg: #1e1e1e;
  --border-color: #444;
  --header-bg: #1a1a1a;
  --shadow-color: rgba(0, 0, 0, 0.3);
  --gradient-start: #222222;
  --gradient-end: #444444;
}

body {
  font-family: 'Tajawal', 'Roboto', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  transition: all 0.3s ease;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

.rtl {
  direction: rtl;
  text-align: right;
}

.ltr {
  direction: ltr;
  text-align: left;
}

/* Animated Background */
.bg-animation {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  opacity: 0.05;
  background: 
    radial-gradient(circle at 10% 20%, var(--primary-color) 0%, transparent 20%),
    radial-gradient(circle at 80% 30%, var(--secondary-color) 0%, transparent 20%),
    radial-gradient(circle at 30% 70%, var(--accent-color) 0%, transparent 20%),
    radial-gradient(circle at 70% 90%, var(--primary-color) 0%, transparent 20%);
  background-size: 150% 150%;
  animation: gradientAnimation 15s ease infinite;
}

@keyframes gradientAnimation {
  0% { background-position: 0% 0%; }
  50% { background-position: 100% 100%; }
  100% { background-position: 0% 0%; }
}

.header {
  background-color: var(--header-bg);
  padding: 20px 0;
  box-shadow: 0 4px 20px var(--shadow-color);
  position: sticky;
  top: 0;
  z-index: 1000;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.profile-section {
  padding: 70px 0 50px;
  position: relative;
  overflow: hidden;
}

.profile-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(142, 108, 58, 0.1) 0%, rgba(58, 74, 142, 0.1) 100%);
  z-index: -1;
  transform: skewY(-3deg);
  transform-origin: top left;
}

.profile-img-container {
  position: relative;
  display: inline-block;
  margin-bottom: 20px;
}

.profile-img {
  width: 220px;
  height: 220px;
  border-radius: 50%;
  object-fit: cover;
  border: 5px solid var(--primary-color);
  box-shadow: 0 10px 25px var(--shadow-color);
  transition: all 0.5s ease;
}

.profile-img:hover {
  transform: scale(1.05);
  box-shadow: 0 15px 35px var(--shadow-color);
}

.profile-badge {
  position: absolute;
  bottom: 0;
  right: 0;
  background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
  color: white;
  padding: 12px;
  border-radius: 50%;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
  transform: translate(10%, 10%);
  transition: all 0.3s ease;
}

.profile-badge:hover {
  transform: translate(10%, 10%) scale(1.1) rotate(10deg);
}

.profile-name {
  color: var(--primary-color);
  margin-top: 20px;
  font-weight: 700;
  font-size: 2.5rem;
  text-shadow: 1px 1px 3px var(--shadow-color);
  position: relative;
  display: inline-block;
}

.profile-name::after {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 50px;
  height: 3px;
  background: linear-gradient(to right, var(--gradient-start), var(--gradient-end));
  border-radius: 3px;
  transition: width 0.3s ease;
}

.profile-name:hover::after {
  width: 80px;
}

.profile-title {
  color: var(--secondary-color);
  margin: 25px 0 20px;
  font-size: 1.5rem;
  font-weight: 500;
  letter-spacing: 1px;
}

.section-title {
  color: var(--primary-color);
  position: relative;
  padding-bottom: 15px;
  margin-bottom: 40px;
  font-size: 2rem;
  font-weight: 700;
  text-align: center;
}

.section-title::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 4px;
  background: linear-gradient(to right, var(--gradient-start), var(--gradient-end));
  border-radius: 4px;
}

.card {
  background-color: var(--card-bg);
  border-radius: 15px;
  box-shadow: 0 10px 30px var(--shadow-color);
  padding: 25px;
  margin-bottom: 30px;
  border: 1px solid var(--border-color);
  transition: all 0.4s ease;
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 5px;
  background: linear-gradient(to right, var(--gradient-start), var(--gradient-end));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s ease;
}

.card:hover {
  transform: translateY(-10px);
  box-shadow: 0 15px 40px var(--shadow-color);
}

.card:hover::before {
  transform: scaleX(1);
}

.skill-card {
  position: relative;
  overflow: hidden;
  border-radius: 15px;
  transition: all 0.4s ease;
}

.skill-card::before {
  content: '';
  position: absolute;
  top: -10px;
  left: -10px;
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--gradient-start), transparent);
  border-radius: 50%;
  opacity: 0;
  transition: all 0.4s ease;
}

.skill-card:hover::before {
  opacity: 0.7;
  transform: scale(5);
}

.skill-card:hover .skill-icon-container {
  transform: translateY(-5px);
}

.skill-icon-container {
  position: relative;
  z-index: 2;
  transition: all 0.3s ease;
  padding: 20px 0;
}

.skill-icon {
  font-size: 2.5rem;
  color: var(--primary-color);
  margin-bottom: 15px;
  transition: all 0.3s ease;
}

.skill-card:hover .skill-icon {
  transform: scale(1.1);
}

.experience-item, .education-item {
  margin-bottom: 30px;
  padding-bottom: 30px;
  border-bottom: 1px solid var(--border-color);
  position: relative;
}

.experience-item:last-child, .education-item:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.experience-icon {
  position: relative;
  z-index: 2;
  transition: all 0.3s ease;
}

.experience-icon::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  background: rgba(142, 108, 58, 0.1);
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0);
  transition: all 0.3s ease;
  z-index: -1;
}

.experience-item:hover .experience-icon::after {
  transform: translate(-50%, -50%) scale(1.5);
}

.experience-title, .education-degree {
  color: var(--secondary-color);
  font-weight: 600;
  font-size: 1.3rem;
  margin-bottom: 5px;
  transition: all 0.3s ease;
}

.experience-item:hover .experience-title, .education-item:hover .education-degree {
  color: var(--primary-color);
}

.experience-company, .education-school {
  color: var(--accent-color);
  font-style: italic;
  margin-bottom: 15px;
  display: block;
}

.experience-date, .education-date {
  color: var(--text-color);
  opacity: 0.8;
}

.btn-theme-toggle, .btn-lang-toggle, .btn-cv-download {
  background-color: var(--card-bg);
  color: var(--text-color);
  border: 1px solid var(--border-color);
  padding: 8px 15px;
  border-radius: 30px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  text-decoration: none;
}

.btn-theme-toggle:hover, .btn-lang-toggle:hover, .btn-cv-download:hover {
  background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
  color: white;
  border-color: transparent;
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.cv-buttons-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
  width: 100%;
}

@media (min-width: 768px) {
  .cv-buttons-container {
    align-items: flex-start;
  }
}

.btn-cv-download {
  background: #222;
  color: white;
  border: none;
  padding: 15px 30px;
  font-weight: 600;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
  border-radius: 50px;
  position: relative;
  overflow: hidden;
  z-index: 1;
  width: 100%;
  max-width: 300px;
  margin: 0;
  transition: all 0.4s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.5px;
  font-size: 1.1rem;
}

.btn-cv-download::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: all 0.6s ease;
  z-index: -1;
}

.btn-cv-download:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
  background: #333;
}

.btn-cv-download:hover::before {
  left: 100%;
}

.btn-cv-download i {
  margin-right: 10px;
  font-size: 1.2em;
  transition: all 0.3s ease;
}

.btn-cv-download:hover i {
  transform: translateY(-2px);
}

.btn-theme-toggle i, .btn-lang-toggle i {
  transition: all 0.3s ease;
}

.btn-theme-toggle:hover i, .btn-lang-toggle:hover i {
  transform: rotate(30deg);
}

.btn-lang-toggle {
  margin-left: 10px;
}

.footer {
  background-color: var(--header-bg);
  padding: 30px 0;
  text-align: center;
  margin-top: 70px;
  position: relative;
  overflow: hidden;
}

.footer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 5px;
  background: linear-gradient(to right, var(--gradient-start), var(--gradient-end));
}

.social-icons {
  margin-top: 20px;
  display: flex;
  justify-content: center;
  gap: 20px;
}

.social-icon-link {
  color: var(--primary-color);
  transition: all 0.3s ease;
  position: relative;
  display: inline-block;
}

.social-icon-wrapper {
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: linear-gradient(145deg, #f0f0f0, #e6e6e6);
  box-shadow: 5px 5px 10px rgba(0,0,0,0.1), -5px -5px 10px rgba(255,255,255,0.8);
  transition: all 0.4s ease;
  position: relative;
  overflow: hidden;
}

[data-theme="dark"] .social-icon-wrapper {
  background: linear-gradient(145deg, #222, #2a2a2a);
  box-shadow: 5px 5px 10px rgba(0,0,0,0.3), -5px -5px 10px rgba(50,50,50,0.2);
}

.social-icon-wrapper::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(to right bottom, var(--primary-color), var(--secondary-color));
  opacity: 0;
  transition: all 0.4s ease;
  z-index: 0;
}

.social-icon-wrapper i {
  position: relative;
  z-index: 1;
  transition: all 0.3s ease;
}

.social-icon-link:hover .social-icon-wrapper {
  transform: translateY(-5px) scale(1.1);
  box-shadow: 7px 7px 15px rgba(0,0,0,0.15), -7px -7px 15px rgba(255,255,255,0.9);
}

[data-theme="dark"] .social-icon-link:hover .social-icon-wrapper {
  box-shadow: 7px 7px 15px rgba(0,0,0,0.4), -7px -7px 15px rgba(50,50,50,0.3);
}

.social-icon-link:hover .social-icon-wrapper::before {
  opacity: 1;
}

.social-icon-link:hover .social-icon-wrapper i {
  color: white;
  transform: scale(1.1);
}

.linkedin:hover .social-icon-wrapper::before {
  background: linear-gradient(to right bottom, #0077B5, #00669c);
}

.github:hover .social-icon-wrapper::before {
  background: linear-gradient(to right bottom, #333, #222);
}

.email:hover .social-icon-wrapper::before {
  background: linear-gradient(to right bottom, #D44638, #B23121);
}

.phone:hover .social-icon-wrapper::before {
  background: linear-gradient(to right bottom, #25D366, #128C7E);
}

/* Projects Section */
.project-card {
  position: relative;
  overflow: hidden;
  border-radius: 15px;
  margin-bottom: 30px;
  height: 100%;
}

.project-image {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: 15px 15px 0 0;
  transition: all 0.5s ease;
}

.project-card:hover .project-image {
  transform: scale(1.05);
}

.project-content {
  padding: 20px;
}

.project-title {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--primary-color);
  margin-bottom: 10px;
}

.project-description {
  margin-bottom: 15px;
}

.project-links {
  display: flex;
  gap: 15px;
}

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

.project-link:hover {
  color: var(--accent-color);
  transform: translateX(5px);
}

/* Certifications */
.cert-icon {
  font-size: 2.5rem;
  color: var(--primary-color);
  margin-right: 20px;
  transition: all 0.3s ease;
}

.cert-item:hover .cert-icon {
  transform: rotate(15deg) scale(1.1);
}

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

.animate-fade-in {
  animation: fadeIn 0.8s ease forwards;
}

.delay-100 { animation-delay: 0.1s; }
.delay-200 { animation-delay: 0.2s; }
.delay-300 { animation-delay: 0.3s; }
.delay-400 { animation-delay: 0.4s; }
.delay-500 { animation-delay: 0.5s; }

/* Responsive Styles */
@media (max-width: 768px) {
  .profile-img {
    width: 180px;
    height: 180px;
  }
  
  .section-title {
    text-align: center;
    font-size: 1.8rem;
  }
  
  .social-icons a {
    margin: 0 5px;
  }
  
  .card {
    padding: 20px;
  }
  
  h1 {
    font-size: 1.8rem;
  }
  
  h2 {
    font-size: 1.5rem;
  }
  
  h3 {
    font-size: 1.3rem;
  }
  
  h4 {
    font-size: 1.1rem;
  }
  
  .btn-theme-toggle, .btn-lang-toggle {
    padding: 6px 12px;
    font-size: 0.9rem;
  }
}

@media (max-width: 576px) {
  .profile-img {
    width: 150px;
    height: 150px;
  }
  
  .header .container {
    padding: 10px;
  }
  
  .btn-theme-toggle, .btn-lang-toggle {
    margin-bottom: 5px;
  }
  
  .social-icons a {
    font-size: 1.5rem;
  }
  
  .experience-item, .education-item {
    padding-bottom: 20px;
    margin-bottom: 20px;
  }
  
  .card {
    margin-bottom: 20px;
    padding: 15px;
  }
  
  .profile-name {
    font-size: 2rem;
  }
  
  .profile-title {
    font-size: 1.3rem;
  }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: var(--bg-color);
}

::-webkit-scrollbar-thumb {
  background: var(--primary-color);
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--secondary-color);
}
