/**
 * Professional RTL Header - Complete Rework
 * Optimized for Arabic websites with perfect RTL alignment
 */

/* ====== Global Variables ====== */
:root {
  /* Colors */
  --primary: #134b8a;
  --primary-color: #134b8a; /* Alias for compatibility */
  --primary-dark: #0f3a6b;
  --primary-light: #1e5fa0;
  --secondary: #ffd700;
  --secondary-color: #e63946; /* For highlights and CTA elements */
  --white: #ffffff;
  --black: #000000;
  --dark: #1a1a1a;
  --text-dark: #1b1b1b;
  --text-medium: #555555;
  --text-light: #f8f9fa;
  --gray-light: #f8f9fa;
  --gray-medium: #e9ecef;
  --gray-dark: #6c757d;
  --bg-light: #f8f9fa;
  --bg-medium: #e9ecef;
  
  /* Shadows */
  --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.15);
  --shadow-xl: 0 12px 48px rgba(0,0,0,0.2);
  --shadow-inset: inset 0 2px 10px rgba(0, 0, 0, 0.1);
  
  /* Transitions */
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: all 0.3s ease;
  --transition-medium: all 0.5s ease;
  --transition-slow: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  
  /* Spacing */
  --header-height: 80px;
  --header-height-sticky: 65px;
  --mobile-header-height: 65px;
  --section-spacing: 100px;
  --container-padding: 15px;
  
  /* Border Radius */
  --radius: 8px;
  --radius-lg: 16px;
  --radius-full: 50%;
  --border-radius-sm: 5px;
  --border-radius-md: 10px;
  --border-radius-lg: 15px;
  --border-radius-full: 50%;
  
  /* Gradients */
  --gradient-primary: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
  --gradient-overlay: linear-gradient(to bottom, rgba(0,0,0,0.6), rgba(0,0,0,0.8));
}

/* ====== Global Reset & Base Styles ====== */
/* Note: Bootstrap handles base reset, we only override box-sizing for consistency */
*, *::before, *::after {
  box-sizing: border-box;
}

/* Base HTML styles */
html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px; /* For fixed header */
}

/* Base Body styles - only in header.css to avoid conflicts */
body {
  font-family: 'Noto Kufi Arabic', 'Cairo', sans-serif;
  direction: rtl;
  text-align: right;
  overflow-x: hidden;
  line-height: 1.6;
  font-size: 16px;
  color: var(--dark);
  background-color: #ffffff;
}

/* ====== Desktop Header ====== */
.site-header {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 1000;
  background: transparent;
  transition: var(--transition);
}

.site-header::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  bottom: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.5) 0%, transparent 100%);
  z-index: -1;
  transition: var(--transition);
}

/* Sticky Header State */
.site-header.sticky {
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-lg);
}

.site-header.sticky::before {
  opacity: 0;
}

/* Header Container */
.header-container {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 15px;
  height: var(--header-height);
  display: flex;
  align-items: center;
  transition: var(--transition);
}

.site-header.sticky .header-container {
  height: var(--header-height-sticky);
}

/* Header Layout Grid */
.header-content {
  width: 100%;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 30px;
}

/* ====== Logo Section ====== */
.header-logo {
  display: flex;
  align-items: center;
  position: relative;
}

.header-logo a {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  transition: var(--transition);
}

.header-logo::before {
  content: '';
  position: absolute;
  top: -5px;
  right: -5px;
  bottom: -5px;
  left: -5px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px) brightness(0.8);
  border-radius: 8px;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: -1;
}

/* Logo blending effect - only on transparent header */
.site-header:not(.sticky) .header-logo::before {
  opacity: 1;
}

.header-logo img {
  height: 75px;
  width: auto;
  object-fit: contain;
  transition: var(--transition);
  position: relative;
  z-index: 1;
  /* Blend mode to make white background blend with dark */
  mix-blend-mode: lighten;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.3));
}

/* Remove blend mode on sticky header (white background) */
.site-header.sticky .header-logo img {
  height: 60px;
  mix-blend-mode: normal;
  filter: none;
}

.site-header.sticky .header-logo::before {
  opacity: 0;
}

.header-logo a:hover {
  transform: translateY(-2px);
}

/* ====== Navigation Menu ====== */
.header-nav {
  display: flex;
  justify-content: center;
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 5px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-menu li {
  position: relative;
}

.nav-menu a {
  display: block;
  padding: 10px 20px;
  color: var(--white);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  border-radius: var(--radius);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.site-header.sticky .nav-menu a {
  color: var(--dark);
}

/* Nav Smooth Underline Effect */
.nav-menu a::after {
  content: '';
  position: absolute;
  bottom: 5px;
  right: 20px;
  left: 20px;
  height: 2px;
  background: var(--primary);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 2px;
}

.nav-menu a:hover::after {
  transform: scaleX(1);
}

.nav-menu a.active::after {
  transform: scaleX(1);
}

.nav-menu a:hover,
.nav-menu a.active {
  color: var(--white) !important;
}

.site-header.sticky .nav-menu a:hover,
.site-header.sticky .nav-menu a.active {
  color: var(--primary) !important;
}

.site-header.sticky .nav-menu a::after {
  background: var(--primary);
}

.nav-menu a span {
  position: relative;
  z-index: 1;
}

/* ====== Header Actions ====== */
.header-actions {
  display: flex;
  align-items: center;
  gap: 15px;
}

/* Modern CTA Button */
.header-cta.btn-modern {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: var(--white);
  border: 2px solid transparent;
  padding: 12px 28px;
  border-radius: 50px;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(19, 75, 138, 0.3);
}

.header-cta.btn-modern::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.5s ease;
}

.header-cta.btn-modern:hover::before {
  left: 100%;
}

.header-cta.btn-modern span {
  position: relative;
  z-index: 1;
}

.header-cta.btn-modern i {
  position: relative;
  z-index: 1;
  font-size: 14px;
  transition: transform 0.3s ease;
}

.site-header.sticky .header-cta.btn-modern {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  box-shadow: 0 4px 15px rgba(19, 75, 138, 0.4);
}

.header-cta.btn-modern:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 8px 25px rgba(19, 75, 138, 0.5);
  background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
}

.header-cta.btn-modern:hover i {
  transform: translateX(-3px);
}

.site-header.sticky .header-cta.btn-modern:hover {
  background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
}

/* Contact Icons */
.header-contacts {
  display: flex;
  align-items: center;
  gap: 10px;
}

.contact-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  color: var(--white);
  text-decoration: none;
  transition: var(--transition);
  font-size: 18px;
}

.site-header.sticky .contact-icon {
  background: var(--gray-light);
  color: var(--primary);
}

.contact-icon:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.contact-icon.whatsapp:hover {
  background: #25D366;
  color: var(--white);
}

.contact-icon.email:hover {
  background: #EA4335;
  color: var(--white);
}

.contact-icon.phone:hover {
  background: var(--primary);
  color: var(--white);
}

/* ====== Mobile Header ====== */
.mobile-header {
  display: none;
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  height: var(--mobile-header-height);
  z-index: 1000;
  background: transparent;
  transition: var(--transition);
}

.mobile-header::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  bottom: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0.3) 100%);
  z-index: -1;
  transition: var(--transition);
}

.mobile-header.sticky {
  background: var(--white);
  box-shadow: var(--shadow-md);
}

.mobile-header.sticky::before {
  opacity: 0;
}

.mobile-header-container {
  height: 100%;
  padding: 0 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Mobile Logo */
.mobile-logo {
  position: relative;
}

.mobile-logo::before {
  content: '';
  position: absolute;
  top: -5px;
  right: -5px;
  bottom: -5px;
  left: -5px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px) brightness(0.8);
  border-radius: 8px;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: -1;
}

.mobile-header:not(.sticky) .mobile-logo::before {
  opacity: 1;
}

.mobile-logo img {
  height: 55px;
  width: auto;
  object-fit: contain;
  transition: var(--transition);
  position: relative;
  z-index: 1;
  /* Blend mode to make white background blend with dark */
  mix-blend-mode: lighten;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.3));
}

.mobile-header.sticky .mobile-logo img {
  mix-blend-mode: normal;
  filter: none;
}

.mobile-header.sticky .mobile-logo::before {
  opacity: 0;
}

/* Hamburger Menu */
.hamburger {
  width: 45px;
  height: 45px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
  border: none;
  outline: none;
}

.mobile-header.sticky .hamburger {
  background: var(--gray-light);
}

.hamburger:hover {
  background: var(--primary);
}

.hamburger-icon {
  width: 24px;
  height: 20px;
  position: relative;
}

.hamburger-icon span {
  display: block;
  width: 100%;
  height: 3px;
  background: var(--white);
  border-radius: 2px;
  position: absolute;
  right: 0;
  transition: var(--transition);
}

.mobile-header.sticky .hamburger-icon span {
  background: var(--dark);
}

.hamburger:hover .hamburger-icon span {
  background: var(--white);
}

.hamburger-icon span:nth-child(1) {
  top: 0;
}

.hamburger-icon span:nth-child(2) {
  top: 50%;
  transform: translateY(-50%);
}

.hamburger-icon span:nth-child(3) {
  bottom: 0;
}

/* Hamburger Active State */
.hamburger.active .hamburger-icon span:nth-child(1) {
  transform: rotate(45deg);
  top: 50%;
  margin-top: -1.5px;
}

.hamburger.active .hamburger-icon span:nth-child(2) {
  opacity: 0;
  transform: translateX(20px);
}

.hamburger.active .hamburger-icon span:nth-child(3) {
  transform: rotate(-45deg);
  bottom: 50%;
  margin-bottom: -1.5px;
}

/* ====== Mobile Menu ====== */
.mobile-menu-overlay {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: rgba(0, 0, 0, 0.7);
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
  z-index: 998;
}

.mobile-menu-overlay.active {
  opacity: 1;
  visibility: visible;
}

.mobile-menu {
  position: fixed;
  top: 0;
  right: -320px;
  width: 320px;
  height: 100%;
  background: var(--white);
  box-shadow: var(--shadow-xl);
  transition: var(--transition);
  z-index: 999;
  overflow-y: auto;
}

.mobile-menu.active {
  right: 0;
}

/* Mobile Menu Header */
.mobile-menu-header {
  padding: 20px;
  border-bottom: 1px solid var(--gray-medium);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mobile-menu-logo img {
  height: 55px;
  width: auto;
  object-fit: contain;
  /* No blend mode needed in mobile menu (light background) */
}

.close-menu {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gray-light);
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
  border: none;
  font-size: 24px;
  color: var(--dark);
}

.close-menu:hover {
  background: var(--primary);
  color: var(--white);
  transform: rotate(90deg);
}

/* Mobile Menu Navigation */
.mobile-nav {
  padding: 20px;
}

.mobile-nav-menu {
  list-style: none;
  padding: 0;
  margin: 0;
}

.mobile-nav-menu li {
  margin-bottom: 5px;
}

.mobile-nav-menu a {
  display: flex;
  align-items: center;
  padding: 12px 20px;
  color: var(--dark);
  font-size: 16px;
  font-weight: 500;
  text-decoration: none;
  border-radius: var(--radius);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.mobile-nav-menu a::after {
  content: '';
  position: absolute;
  bottom: 8px;
  right: 20px;
  left: 20px;
  height: 2px;
  background: var(--primary);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 2px;
}

.mobile-nav-menu a:hover::after,
.mobile-nav-menu a.active::after {
  transform: scaleX(1);
}

.mobile-nav-menu a:hover,
.mobile-nav-menu a.active {
  color: var(--primary);
  background: transparent;
  padding-right: 20px;
}

/* Mobile Menu Footer */
.mobile-menu-footer {
  padding: 20px;
  border-top: 1px solid var(--gray-medium);
}

.mobile-cta-button.btn-modern {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: var(--white);
  padding: 15px 20px;
  text-align: center;
  border-radius: 50px;
  font-weight: 600;
  font-size: 15px;
  text-decoration: none;
  margin-bottom: 15px;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(19, 75, 138, 0.3);
  border: 2px solid transparent;
}

.mobile-cta-button.btn-modern::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.5s ease;
}

.mobile-cta-button.btn-modern:hover::before {
  left: 100%;
}

.mobile-cta-button.btn-modern span {
  position: relative;
  z-index: 1;
}

.mobile-cta-button.btn-modern i {
  position: relative;
  z-index: 1;
  font-size: 14px;
  transition: transform 0.3s ease;
}

.mobile-cta-button.btn-modern:hover {
  background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 8px 25px rgba(19, 75, 138, 0.5);
}

.mobile-cta-button.btn-modern:hover i {
  transform: translateX(-3px);
}

.mobile-contacts {
  display: flex;
  justify-content: center;
  gap: 15px;
}

.mobile-contact-icon {
  width: 45px;
  height: 45px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gray-light);
  border-radius: var(--radius-full);
  color: var(--primary);
  text-decoration: none;
  font-size: 20px;
  transition: var(--transition);
}

.mobile-contact-icon:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.mobile-contact-icon.whatsapp:hover {
  background: #25D366;
  color: var(--white);
}

.mobile-contact-icon.email:hover {
  background: #EA4335;
  color: var(--white);
}

.mobile-contact-icon.phone:hover {
  background: var(--primary);
  color: var(--white);
}

/* ====== Floating Buttons ====== */
.floating-buttons {
  position: fixed;
  bottom: 30px;
  left: 30px;
  display: flex;
  flex-direction: column;
  gap: 15px;
  z-index: 997;
}

.floating-btn {
  width: 55px;
  height: 55px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  color: var(--white);
  text-decoration: none;
  font-size: 24px;
  transition: var(--transition);
  box-shadow: var(--shadow-lg);
}

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

.floating-whatsapp {
  background: #25D366;
}

.floating-phone {
  background: var(--primary);
}

.go-top {
  background: var(--dark);
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}

.go-top.show {
  opacity: 1;
  visibility: visible;
}

/* ====== Responsive Design ====== */
@media (max-width: 991px) {
  .site-header {
    display: none;
  }
  
  .mobile-header {
    display: block;
  }
}

@media (max-width: 480px) {
  .mobile-menu {
    width: 280px;
  }
  
  .floating-buttons {
    bottom: 20px;
    left: 20px;
    gap: 10px;
  }
  
  .floating-btn {
    width: 45px;
    height: 45px;
    font-size: 20px;
  }
}

/* ====== RTL Specific Adjustments ====== */
[dir="rtl"] .header-logo {
  margin-left: 0;
  margin-right: auto;
}

[dir="rtl"] .nav-menu a::after {
  transform-origin: right;
}

[dir="rtl"] .mobile-menu {
  right: -320px;
  left: auto;
}

[dir="rtl"] .mobile-menu.active {
  right: 0;
  left: auto;
}

[dir="rtl"] .floating-buttons {
  left: 30px;
  right: auto;
}

/* ====== Focus Styles ====== */
a:focus,
button:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ====== Print Styles ====== */
@media print {
  .site-header,
  .mobile-header,
  .floating-buttons {
    display: none !important;
  }
}


