:root {
  --primary-color: #3a86ff;
  --secondary-color: #8338ec;
  --dark-color: #212529;
  --light-color: #f8f9fa;
  --gray-color: #6c757d;
  --transition: all 0.3s ease;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Tajawal', sans-serif;
}

html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--light-color);
  color: var(--dark-color);
  line-height: 1.6;
  overflow-x: hidden; /* يمنع الحركة الأفقية */
}

.container {
  width: 90%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 15px;
}

section {
  padding: 80px 0;
}

.section-title {
  font-size: 2.5rem;
  text-align: center;
  margin-bottom: 60px;
  position: relative;
}

.section-title span {
  color: var(--primary-color);
}

.section-title::after {
  content: '';
  position: absolute;
  bottom: -15px;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 4px;
  background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
  border-radius: 2px;
}

.btn {
  display: inline-block;
  padding: 12px 30px;
  background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
  color: white;
  border: none;
  border-radius: 50px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--primary-color);
  color: var(--primary-color);
  margin-right: 15px;
}

.btn-outline:hover {
  background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
  color: white;
}

/* شريط التنقل */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  padding: 20px 0;
  background-color: rgba(255, 255, 255, 0.95);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  transition: var(--transition);
}

.navbar.scrolled {
  padding: 15px 0;
  background-color: rgba(255, 255, 255, 0.98);
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.navbar .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--dark-color);
  text-decoration: none;
}

.logo span {
  color: var(--primary-color);
}

.nav-links {
  display: flex;
  list-style: none;
}

.nav-links li {
  margin-right: 30px;
}

.nav-links a {
  color: var(--dark-color);
  text-decoration: none;
  font-size: 1rem;
  font-weight: 500;
  transition: var(--transition);
  position: relative;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -5px;
  right: 0;
  width: 0;
  height: 2px;
  background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
  transition: var(--transition);
}

.nav-links a:hover::after {
  width: 100%;
}

.nav-links a:hover {
  color: var(--primary-color);
}

.menu-toggle {
  display: none;
  cursor: pointer;
  font-size: 1.5rem;
  color: var(--dark-color);
}

/* القسم الرئيسي */
.hero {
  height: 100vh;
  display: flex;
  align-items: center;
  padding-top: 80px;
  overflow: hidden; /* لتجنب الحركة الغير مرغوبة */
}

.hero-content {
  flex: 1;
  padding-left: 50px;
}

.hero-content h1 {
  font-size: 3.5rem;
  margin-bottom: 20px;
  line-height: 1.2;
}

.hero-content h1 span {
  color: var(--primary-color);
}

.hero-content h2 {
  font-size: 2rem;
  margin-bottom: 15px;
  color: var(--gray-color);
}

.hero-content p {
  font-size: 1.1rem;
  margin-bottom: 30px;
  color: var(--gray-color);
}

.hero-buttons {
  display: flex;
  flex-wrap: wrap;
}

.hero-image {
  flex: 1;
  position: relative;
  display: flex;
  justify-content: center;
}

/* دائرة مضيئة مع صورة بداخلها */
.glowing-circle {
  position: relative;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: visible; /* لكي لا تقطع الحركة */
}

.glowing-circle span {
  position: absolute;
  width: 100%;
  height: 100%;
  background: linear-gradient(var(--primary-color), var(--secondary-color));
  border-radius: 50%;
  animation: rotate 4s linear infinite;
  filter: blur(10px);
  top: 0;
  left: 0;
}

.glowing-circle img {
  position: relative;
  width: 380px;
  height: 380px;
  border-radius: 50%;
  object-fit: cover;
  z-index: 1;
  border: 10px solid white;
  user-select: none;
  pointer-events: none;
}

@keyframes rotate {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* قسم عني */
.about-content {
  display: flex;
  align-items: center;
  gap: 50px;
  flex-wrap: wrap;
}

.about-text {
  flex: 1;
  min-width: 300px;
}

.about-text h3 {
  font-size: 1.8rem;
  margin-bottom: 20px;
  color: var(--dark-color);
}

.about-text p {
  margin-bottom: 30px;
  color: var(--gray-color);
  font-size: 1.1rem;
}

.about-info {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-bottom: 30px;
}

.info-item {
  display: flex;
  align-items: center;
}

.info-item span {
  font-weight: 700;
  margin-left: 10px;
  color: var(--dark-color);
}

.info-item p {
  margin: 0;
  color: var(--gray-color);
}

.about-image {
  flex: 1;
  min-width: 300px;
  display: flex;
  justify-content: center;
}

/* شكل سداسي (متحرك) */
.hexagon {
  position: relative;
  width: 350px;
  height: 400px;
  background: linear-gradient(var(--primary-color), var(--secondary-color));
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  display: flex;
  justify-content: center;
  align-items: center;
  animation: float 6s ease-in-out infinite;
}

.hexagon-inner {
  width: 340px;
  height: 390px;
  background-color: white;
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  display: flex;
  justify-content: center;
  align-items: center;
}

.hexagon img {
  width: 330px;
  height: 380px;
  object-fit: cover;
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
}

@keyframes float {
  0% { transform: translateY(0px); }
  50% { transform: translateY(-20px); }
  100% { transform: translateY(0px); }
}

/* قسم المشاريع */
.projects {
  background-color: #f9f9ff;
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 30px;
  margin-top: 40px;
}

.project-card {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 5px 15px rgba(0,0,0,0.1);
  transition: all 0.3s ease;
}

.project-card:hover {
  transform: translateY(-10px);
  box-shadow: 0 15px 30px rgba(0,0,0,0.15);
}

.project-gallery {
  position: relative;
  height: 250px;
  overflow: hidden;
}

.main-image {
  width: 100%;
  height: 100%;
}

.main-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.project-card:hover .main-image img {
  transform: scale(1.05);
}

.thumbnail-grid {
  position: absolute;
  bottom: 15px;
  right: 15px;
  display: flex;
  gap: 8px;
}

.thumbnail {
  width: 50px;
  height: 50px;
  border: 2px solid white;
  border-radius: 5px;
  object-fit: cover;
  cursor: pointer;
  transition: all 0.3s ease;
}

.thumbnail:hover {
  transform: scale(1.1);
}

.more-images {
  width: 50px;
  height: 50px;
  background: rgba(0,0,0,0.7);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
  font-weight: bold;
  cursor: pointer;
}

.project-details {
  padding: 20px;
}

.project-details h3 {
  font-size: 1.4rem;
  margin-bottom: 10px;
  color: var(--dark-color);
}

.project-details p {
  color: var(--gray-color);
  margin-bottom: 15px;
  line-height: 1.5;
}

.tech-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.tech-tags span {
  background: #f1f3ff;
  color: var(--primary-color);
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
}

.project-actions {
  display: flex;
  gap: 10px;
}

.demo-btn, .code-btn {
  padding: 8px 20px;
  border-radius: 5px;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.3s ease;
}

.demo-btn {
  background: var(--primary-color);
  color: white;
}

.code-btn {
  border: 1px solid var(--primary-color);
  color: var(--primary-color);
}

.demo-btn:hover, .code-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 5px 10px rgba(0,0,0,0.1);
}

/* قسم المهارات */
.skills-container {
  display: flex;
  gap: 50px;
  flex-wrap: wrap;
}

.skills-technical {
  flex: 1;
  min-width: 300px;
}

.skill-item {
  margin-bottom: 25px;
}

.skill-info {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
}

.skill-info span {
  font-weight: 500;
  color: var(--dark-color);
}

.skill-bar {
  height: 10px;
  background-color: #f1f1f1;
  border-radius: 5px;
  overflow: hidden;
}

.skill-progress {
  height: 100%;
  background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
  border-radius: 5px;
}

/* قسم التواصل */
.contact-content {
  display: flex;
  gap: 50px;
  flex-wrap: wrap;
}

.contact-info {
  flex: 1;
  min-width: 280px;
}

.contact-info h3 {
  font-size: 1.8rem;
  margin-bottom: 30px;
  color: var(--dark-color);
}

.contact-info .info-item {
  display: flex;
  align-items: center;
  margin-bottom: 20px;
}

.contact-info .info-item i {
  font-size: 1.2rem;
  color: var(--primary-color);
  margin-left: 15px;
}

.contact-info .info-item p {
  color: var(--gray-color);
  font-size: 1.1rem;
}

.social-links {
  display: flex;
  gap: 15px;
  margin-top: 30px;
}

.social-links a {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 40px;
  height: 40px;
  background-color: white;
  color: var(--dark-color);
  border-radius: 50%;
  font-size: 1.2rem;
  transition: var(--transition);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.social-links a:hover {
  background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
  color: white;
  transform: translateY(-5px);
}

.contact-form {
  flex: 1;
  min-width: 280px;
  background-color: white;
  padding: 30px;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.form-group {
  margin-bottom: 20px;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 12px 15px;
  border: 1px solid #ddd;
  border-radius: 5px;
  font-size: 1rem;
  transition: var(--transition);
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--primary-color);
  outline: none;
  box-shadow: 0 0 0 3px rgba(58, 134, 255, 0.2);
}

.form-group textarea {
  min-height: 150px;
  resize: vertical;
}

/* الفوتر */
.footer {
  background-color: var(--dark-color);
  color: white;
  padding: 30px 0;
  text-align: center;
}
.footer p {
  margin: 0;
  font-size: 1rem;
}

.footer span {
  color: var(--primary-color);
}

/* زر العودة للأعلى */
.back-to-top {
  position: fixed;
  bottom: 30px;
  left: 30px;
  width: 50px;
  height: 50px;
  background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
  color: white;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.2rem;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
  z-index: 999;
  cursor: pointer;
}

.back-to-top.active {
  opacity: 1;
  visibility: visible;
}

.back-to-top:hover {
  transform: translateY(-5px);
}

/* تأثيرات الكتابة */
.typing-text {
  color: var(--primary-color);
  position: relative;
}

.typing-text::after {
  content: '|';
  position: absolute;
  right: -5px;
  color: var(--primary-color);
  animation: blink 0.7s infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* Responsive Design */
@media (max-width: 992px) {
  .hero-content {
    padding-left: 0;
  }
  
  .hero-content h1 {
    font-size: 2.8rem;
  }
  
  .hero-content h2 {
    font-size: 1.8rem;
  }
  
  .glowing-circle {
    width: 350px;
    height: 350px;
  }
  
  .glowing-circle img {
    width: 330px;
    height: 330px;
  }
  
  .about-content {
    flex-direction: column;
  }
  
  .skills-container {
    flex-direction: column;
  }
  
  .contact-content {
    flex-direction: column;
  }
}

@media (max-width: 768px) {
  .menu-toggle {
    display: block;
  }
  
  .nav-links {
    position: fixed;
    top: 80px;
    right: -100%;
    width: 100%;
    height: calc(100vh - 80px);
    background-color: white;
    flex-direction: column;
    align-items: center;
    padding: 40px 0;
    transition: var(--transition);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
  }
  
  .nav-links.active {
    right: 0;
  }
  
  .nav-links li {
    margin: 15px 0;
  }
  
  .hero {
    flex-direction: column;
    text-align: center;
    padding-top: 120px;
    height: auto;
  }
  
  .hero-buttons {
    justify-content: center;
  }
  
  .hero-image {
    margin-top: 50px;
  }
  
  .glowing-circle {
    width: 300px;
    height: 300px;
  }
  
  .glowing-circle img {
    width: 280px;
    height: 280px;
  }
  
  .hexagon {
    width: 300px;
    height: 350px;
  }
  
  .hexagon-inner {
    width: 290px;
    height: 340px;
  }
  
  .hexagon img {
    width: 280px;
    height: 330px;
  }
  
  .projects-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 576px) {
  .section-title {
    font-size: 2rem;
  }
  
  .hero-content h1 {
    font-size: 2.2rem;
  }
  
  .hero-content h2 {
    font-size: 1.5rem;
  }
  
  .hero-buttons {
    flex-direction: column;
  }
  
  .btn-outline {
    margin-right: 0;
    margin-top: 15px;
  }
  
  .about-info {
    grid-template-columns: 1fr;
  }
  
  .project-actions {
    flex-direction: column;
  }
  
  .demo-btn, .code-btn {
    width: 100%;
    text-align: center;
  }
}

/* تحسينات عامة للهاتف */
@media (max-width: 768px) {
  /* تحسين الشريط العلوي */
  .navbar {
    padding: 15px 0;
  }
  
  .logo {
    font-size: 1.5rem;
  }

  /* تحسين القسم الرئيسي */
  .hero {
    flex-direction: column;
    padding-top: 90px;
    height: auto;
    text-align: center;
  }

  .hero-content {
    padding: 0 20px;
  }

  .hero-buttons {
    justify-content: center;
  }

  /* تحسين قسم عني */
  .about-content {
    flex-direction: column;
  }

  .about-text {
    order: 2;
  }

  .about-image {
    order: 1;
    margin-bottom: 30px;
  }

  /* تحسين المشاريع */
  .projects-grid {
    grid-template-columns: 1fr;
  }

  /* تحسين المهارات */
  .skills-container {
    flex-direction: column;
  }

  /* تحسين التواصل */
  .contact-content {
    flex-direction: column;
  }
}

/* تحسينات إضافية للشاشات الصغيرة جداً */
@media (max-width: 480px) {
  .section-title {
    font-size: 2rem;
  }

  .hero-content h1 {
    font-size: 2.2rem;
  }

  .hero-content h2 {
    font-size: 1.5rem;
  }

  .hero-buttons {
    flex-direction: column;
    align-items: center;
  }

  .btn-outline {
    margin-right: 0;
    margin-top: 15px;
  }

  /* الحفاظ على حجم الصور الأصلي مع جعلها متجاوبة */
  .glowing-circle,
  .glowing-circle img,
  .hexagon,
  .hexagon-inner,
  .hexagon img {
    max-width: 100%;
    height: auto;
  }

  .project-gallery {
    height: auto;
    aspect-ratio: 16/9;
  }

  .thumbnail {
    width: 40px;
    height: 40px;
  }
}