/* ========================================
   تحسينات عامة لجميع الصفحات
   ======================================== */

/* المتغيرات العامة */
:root {
  --gov-primary: #0D2D4A;
  --gov-secondary: #1A4971;
  --text-dark: #1A202C;
  --text-medium: #4A5568;
  --text-light: #FFFFFF;
  --bg-white: #FFFFFF;
  --bg-light: #F7FAFC;
  --border-light: #E2E8F0;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
}

/* ===== Custom Scrollbar - شريط التمرير المخصص ===== */
/* For Webkit browsers (Chrome, Safari, Edge) */
::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

::-webkit-scrollbar-track {
  background: #1e3a5f;
  border-radius: 10px;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--gov-primary), var(--gov-secondary));
  border-radius: 10px;
  border: 2px solid #0a1929;
  transition: all 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, var(--gov-secondary), var(--gov-primary));
  border: 2px solid rgba(13, 45, 74, 0.1);
}

::-webkit-scrollbar-thumb:active {
  background: var(--gov-primary);
}

/* For Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--gov-primary) var(--bg-light);
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: 'Tajawal', sans-serif;
  color: var(--text-dark);
  background: var(--bg-light);
  line-height: 1.6;
  direction: rtl;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* العناوين */
h1, h2, h3, h4, h5, h6 {
  color: var(--gov-primary);
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 1rem;
}

h1 { font-size: 2.25rem; }
h2 { font-size: 1.875rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.125rem; }
h6 { font-size: 1rem; }

p {
  color: var(--text-medium);
  margin-bottom: 1rem;
  line-height: 1.6;
}

a {
  color: var(--gov-primary);
  text-decoration: none;
  transition: all 0.3s;
}

a:hover {
  color: var(--gov-secondary);
}

/* الحاوية */
.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* شريط التنقل المحسّن */
.navbar {
  background: linear-gradient(135deg, var(--gov-primary) 0%, var(--gov-secondary) 100%);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
}

.navbar.scrolled {
  padding: 0.75rem 0;
  box-shadow: 0 6px 16px rgba(0,0,0,0.2);
}

.navbar .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-brand {
  transition: transform 0.3s;
}

.nav-brand:hover {
  transform: scale(1.02);
}

.nav-brand a {
  text-decoration: none;
  color: inherit;
}

.nav-brand h2 {
  color: var(--text-light);
  margin: 0;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.datetime-display {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.7);
  margin-top: 0.25rem;
}

/* قائمة التنقل */
.nav-links {
  display: flex;
  gap: 2rem;
  list-style: none;
  margin: 0;
  padding: 0;
  align-items: center;
}

.nav-links a {
  color: rgba(255,255,255,0.9);
  font-weight: 500;
  font-size: 1rem;
  padding: 0.5rem 0;
  position: relative;
  transition: all 0.3s;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: 0;
  right: 0;
  width: 0;
  height: 2px;
  background: var(--text-light);
  transition: width 0.3s;
}

.nav-links a:hover::after,
.nav-links a.active::after {
  width: 100%;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text-light);
}

.mobile-menu-toggle {
  display: none;
}

/* الأقسام */
.section {
  padding: 3rem 0;
  background: var(--bg-white);
}

.section:nth-child(even) {
  background: var(--bg-light);
}

.section-title {
  text-align: center;
  margin-bottom: 3rem;
}

.section-title h2 {
  font-size: 2rem;
  color: var(--gov-primary);
  margin-bottom: 1rem;
}

/* البطاقات المحسّنة */
.card {
  background: var(--bg-white);
  border: 1px solid var(--border-light);
  border-radius: 0.75rem;
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s;
  height: 100%;
  position: relative;
  overflow: hidden;
}

.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.card::after {
  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;
}

.card:hover::after {
  left: 100%;
}

.card-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--gov-primary);
  margin-bottom: 1rem;
}

.card-body {
  color: var(--text-medium);
}

/* الشبكة */
.grid {
  display: grid;
  gap: 1.5rem;
}

.grid-2 {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.grid-4 {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

/* الأزرار المحسّنة */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 0.5rem;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.3s;
  text-decoration: none;
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
  width: 300px;
  height: 300px;
}

.btn-primary {
  background: var(--gov-primary);
  color: var(--text-light);
}

.btn-primary:hover {
  background: var(--gov-secondary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: transparent;
  color: var(--gov-primary);
  border: 2px solid var(--gov-primary);
}

.btn-secondary:hover {
  background: var(--gov-primary);
  color: var(--text-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* Footer محسّن */
.footer {
  background: linear-gradient(135deg, var(--gov-primary) 0%, #0a1f33 100%);
  color: var(--text-light);
  padding: 3rem 0 1rem;
  margin-top: auto;
}

.footer h1, .footer h2, .footer h3, .footer h4 {
  color: var(--text-light);
}

.footer p, .footer a {
  color: rgba(255,255,255,0.9);
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}

.footer-section ul {
  list-style: none;
  padding: 0;
}

.footer-section ul li {
  margin-bottom: 0.75rem;
}

.footer-links {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-links li {
  margin-bottom: 0.75rem;
}

.footer-links a {
  color: rgba(255,255,255,0.85);
  transition: all 0.3s;
  display: inline-block;
}

.footer-links a:hover {
  color: var(--text-light);
  transform: translateX(-3px);
}

.footer-slogan {
  font-style: italic;
  margin-top: 0.5rem;
  color: rgba(255,255,255,0.8);
}

.footer-bottom {
  padding-top: 2rem;
  border-top: 1px solid rgba(255,255,255,0.1);
  text-align: center;
}

.social-links {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-top: 1rem;
  max-width: 280px;
  justify-items: center;
}

.social-links a {
  width: 40px;
  height: 40px;
  background: transparent;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
  transition: all 0.3s;
}

.social-links a:hover {
  color: rgba(255,255,255,0.7);
  transform: translateY(-3px) scale(1.1);
}

/* زر العودة للأعلى */
#backToTop,
.scroll-to-top {
  position: fixed;
  bottom: 20px;
  left: 20px;
  width: 50px;
  height: 50px;
  background: linear-gradient(135deg, var(--gov-primary), var(--gov-secondary));
  color: var(--text-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 999;
  box-shadow: 0 4px 12px rgba(13, 45, 74, 0.3);
  border: none;
}

#backToTop.show,
.scroll-to-top.visible {
  opacity: 1;
  visibility: visible;
}

#backToTop:hover,
.scroll-to-top:hover {
  background: linear-gradient(135deg, var(--gov-secondary), var(--gov-primary));
  transform: translateY(-5px) scale(1.1);
  box-shadow: 0 6px 20px rgba(13, 45, 74, 0.4);
}

.scroll-to-top.pulsing {
  animation: pulse-btn 2s infinite;
}

/* تأثيرات الانيميشن */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes pulse-btn {
  0%, 100% {
    box-shadow: 0 4px 12px rgba(13, 45, 74, 0.3);
  }
  50% {
    box-shadow: 0 4px 20px rgba(13, 45, 74, 0.5);
  }
}

/* تحسين التركيز للوصول */
*:focus {
  outline: 3px solid rgba(26, 73, 113, 0.5);
  outline-offset: 2px;
}

a:focus,
button:focus {
  outline: 3px solid rgba(26, 73, 113, 0.6);
}

/* تحسين الاختيار */
::selection {
  background: var(--gov-primary);
  color: var(--text-light);
}

::-moz-selection {
  background: var(--gov-primary);
  color: var(--text-light);
}

/* Loading State */
.loading {
  opacity: 0.6;
  pointer-events: none;
}

/* Skeleton Loading */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
}

@keyframes loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* استجابة الموبايل */
@media (max-width: 991px) {
  .nav-links {
    position: fixed;
    top: 0;
    right: -100%;
    width: 300px;
    height: 100vh;
    background: linear-gradient(135deg, var(--gov-primary) 0%, var(--gov-secondary) 100%);
    flex-direction: column;
    padding: 2rem;
    gap: 1.5rem;
    transition: right 0.3s ease;
    z-index: 1001;
    box-shadow: -4px 0 12px rgba(0,0,0,0.2);
  }
  
  .nav-links.active {
    right: 0;
  }
  
  .mobile-menu-toggle {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    cursor: pointer;
    padding: 0.75rem;
    z-index: 1000;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  }
  
  .mobile-menu-toggle:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
  }
  
  .mobile-menu-toggle:active {
    transform: scale(0.95);
  }
  
  .mobile-menu-toggle span {
    width: 28px;
    height: 3px;
    background: var(--text-light);
    border-radius: 3px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  }
  
  /* تأثير التحول لزر X عند الفتح */
  .mobile-menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(8px, 8px);
  }
  
  .mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
    transform: translateX(20px);
  }
  
  .mobile-menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(8px, -8px);
  }
  
  .nav-links a::after {
    display: none;
  }
}

@media (max-width: 767px) {
  h1 { font-size: 1.75rem; }
  h2 { font-size: 1.5rem; }
  h3 { font-size: 1.25rem; }
  
  .container {
    padding: 0 1rem;
  }
  
  .section {
    padding: 2rem 0;
  }
  
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }
  
  .footer-content {
    grid-template-columns: 1fr;
    text-align: center;
  }
  
  .social-links {
    margin: 1rem auto 0;
  }
  
  .scroll-to-top,
  #backToTop {
    bottom: 15px;
    left: 15px;
    width: 45px;
    height: 45px;
  }
}

@media (max-width: 480px) {
  html {
    font-size: 14px;
  }
  
  .btn {
    padding: 0.65rem 1.25rem;
    font-size: 0.9rem;
  }
}
