@import url("../variables.css");

.main-header {
  font-family: var(--font-family);
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  background: rgba(255, 255, 255, 0.95);
  z-index: 1000;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(138, 43, 226, 0.1);
}

.main-header.scrolled {
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 8px 32px rgba(138, 43, 226, 0.08);
  padding: 5px 0;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 18px 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: padding 0.3s ease;
}

.main-header.scrolled .container {
  padding: 10px 40px;
}

/* ====== الشعار ====== */
.logo {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo img {
  height: 50px;
  width: auto;
  transition: all 0.3s ease;
  filter: drop-shadow(0 4px 8px rgba(138, 43, 226, 0.15));
}

.logo:hover img {
  transform: scale(1.05) rotate(2deg);
}

.logo-text {
  font-size: 1.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, #8A2BE2 0%, #470d88 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-family: var(--font-family-main);
}

/* ====== روابط التنقل ====== */
.nav-links {
  display: flex;
  gap: 40px;
  align-items: center;
  position: relative;
}

.nav-links a {
  text-decoration: none;
  color: #470d88;
  font-weight: 600;
  font-family: var(--font-family-main);
  position: relative;
  padding: 8px 0;
  transition: all 0.3s ease;
  font-size: 1.1rem;
}

.nav-links a::before {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 3px;
  background: linear-gradient(90deg, #8A2BE2, #470d88);
  border-radius: 3px;
  transition: width 0.3s ease;
}

.nav-links a:hover {
  color: #8A2BE2;
  transform: translateY(-2px);
}

.nav-links a:hover::before {
  width: 100%;
}

.nav-links a.active {
  color: #8A2BE2;
  font-weight: 700;
}

.nav-links a.active::before {
  width: 100%;
  background: linear-gradient(90deg, #8A2BE2, #8A2BE2);
}

/* ====== الأزرار الجانبية ====== */
.right-buttons {
  display: flex;
  align-items: center;
  gap: 20px;
}

/* زر التواصل */
.contact-btn {
  background: linear-gradient(135deg, #8A2BE2 0%, #470d88 100%);
  color: #fff;
  border: none;
  padding: 12px 28px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
  font-size: 1rem;
  font-family: var(--font-family-main);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  z-index: 1;
  box-shadow: 0 8px 20px rgba(138, 43, 226, 0.2);
}

.contact-btn::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: left 0.6s ease;
  z-index: -1;
}

.contact-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 25px rgba(138, 43, 226, 0.3);
}

.contact-btn:hover::before {
  left: 100%;
}

.contact-btn:active {
  transform: translateY(-1px);
}

/* ====== قائمة اللغات ====== */
.language-wrapper {
  position: relative;
}

.lang-btn {
  background: rgba(138, 43, 226, 0.1);
  border: 2px solid rgba(138, 43, 226, 0.2);
  border-radius: 12px;
  padding: 10px 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.lang-btn:hover {
  background: rgba(138, 43, 226, 0.15);
  transform: translateY(-2px);
  border-color: #8A2BE2;
  box-shadow: 0 6px 15px rgba(138, 43, 226, 0.15);
}

.lang-btn img.lang-icon {
  width: 24px;
  height: 24px;
  filter: brightness(0) saturate(100%) invert(12%) sepia(93%) saturate(5230%) hue-rotate(210deg) brightness(90%) contrast(102%);
  transition: transform 0.3s ease;
}

.lang-btn:hover img.lang-icon {
  transform: rotate(15deg);
}

.lang-current {
  font-weight: 600;
  color: #470d88;
  font-family: var(--font-family-main);
  font-size: 0.9rem;
}

/* قائمة اللغات */
.lang-menu {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(20px);
  border-radius: 16px;
  padding: 10px 0;
  list-style: none;
  min-width: 180px;
  box-shadow: 0 15px 40px rgba(138, 43, 226, 0.15);
  border: 1px solid rgba(138, 43, 226, 0.1);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.3s ease;
  z-index: 1001;
}

.language-wrapper.active .lang-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.lang-menu li {
  padding: 12px 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.lang-menu li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 4px;
  background: #8A2BE2;
  transform: scaleY(0);
  transition: transform 0.2s ease;
}

.lang-menu li:hover {
  background: rgba(138, 43, 226, 0.05);
}

.lang-menu li:hover::before {
  transform: scaleY(1);
}

.lang-menu li:hover .lang-name {
  transform: translateX(5px);
}

.lang-name {
  flex: 1;
  color: #470d88;
  font-weight: 500;
  font-family: var(--font-family-main);
  transition: transform 0.2s ease;
}

.lang-flag {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  overflow: hidden;
}

.lang-flag img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ====== قائمة الهواتف (هامبرغر) ====== */
.menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 30px;
  height: 24px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 1001;
}

.menu-toggle span {
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, #8A2BE2, #470d88);
  border-radius: 3px;
  transition: all 0.3s ease;
  transform-origin: left center;
}

.menu-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translateY(-2px);
}

.menu-toggle.active span:nth-child(2) {
  opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translateY(2px);
}

/* ====== التجاوب ====== */

/* الأجهزة اللوحية */
@media (max-width: 1024px) {
  .container {
    padding: 15px 30px;
  }
  
  .nav-links {
    gap: 30px;
  }
  
  .logo img {
    height: 45px;
  }
  
  .contact-btn {
    padding: 10px 24px;
    font-size: 0.95rem;
  }
}

/* الهواتف الكبيرة */
@media (max-width: 768px) {
  .menu-toggle {
    display: flex;
  }
  
  .nav-links {
    position: fixed;
    top: 0;
    right: -100%;
    width: 80%;
    max-width: 350px;
    height: 100vh;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 30px;
    padding: 80px 0;
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -10px 0 40px rgba(138, 43, 226, 0.1);
    border-left: 1px solid rgba(138, 43, 226, 0.1);
  }
  
  .nav-links.active {
    right: 0;
  }
  
  .nav-links a {
    font-size: 1.3rem;
    padding: 10px 20px;
  }
  
  .nav-links a::before {
    bottom: 5px;
  }
  
  .container {
    padding: 12px 20px;
  }
  
  .logo img {
    height: 40px;
  }
  
  .logo-text {
    font-size: 1.3rem;
  }
  
  .contact-btn {
    padding: 10px 20px;
    font-size: 0.9rem;
  }
  
  .lang-btn {
    padding: 8px 14px;
  }
  
  .lang-current {
    display: none;
  }
}

/* الهواتف الصغيرة */
@media (max-width: 480px) {
  .container {
    padding: 10px 16px;
  }
  
  .logo img {
    height: 35px;
  }
  
  .logo-text {
    font-size: 1.1rem;
  }
  
  .contact-btn {
    padding: 8px 16px;
    font-size: 0.85rem;
  }
  
  .right-buttons {
    gap: 12px;
  }
  
  .nav-links {
    width: 85%;
  }
  
  .nav-links a {
    font-size: 1.2rem;
  }
}

/* أصغر الهواتف */
@media (max-width: 360px) {
  .container {
    padding: 8px 12px;
  }
  
  .logo img {
    height: 30px;
  }
  
  .logo-text {
    font-size: 1rem;
  }
  
  .contact-btn {
    padding: 6px 12px;
    font-size: 0.8rem;
  }
  
  .lang-btn {
    padding: 6px 10px;
  }
}

/* ====== RTL Support ====== */
html[dir="rtl"] .lang-btn img.lang-icon {
  transform: rotate(180deg);
}

html[dir="rtl"] .lang-menu li:hover .lang-name {
  transform: translateX(-5px);
}

html[dir="rtl"] .lang-menu li::before {
  left: auto;
  right: 0;
}

html[dir="rtl"] .nav-links a::before {
  left: auto;
  right: 0;
}

/* ====== تأثيرات إضافية ====== */
@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.main-header {
  animation: fadeInDown 0.6s ease-out;
}

/* تأثير عند التمرير */
html {
  scroll-behavior: smooth;
}

/* تأثير التداخل عند فتح قائمة الهواتف */
.menu-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(5px);
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.menu-overlay.active {
  opacity: 1;
  visibility: visible;
}