/*
 * ╔═══════════════════════════════════════════════════════════════╗
 * ║              FOOTER SECTION - CLEANED & COMPLIANT             ║
 * ║                  قسم الفوتر - منظف 100%                      ║
 * ╚═══════════════════════════════════════════════════════════════╝
 * 
 * ✅ 100% متوافق مع دستور التصميم
 * ✅ صفر hardcoded colors - كل شيء عبر CSS Variables
 * ✅ صفر !important
 * ✅ يعمل مع جميع الثيمات الأربعة
 * ✅ تطابق بصري 1:1 مع النسخة السابقة
 * 
 * آخر تحديث: 2026-01-16
 */

/* ========================================
   FOOTER STYLES - Enhanced & Modern
======================================== */

.main-footer {
  background: linear-gradient(135deg, var(--slate-800) 0%, var(--slate-700) 100%);
  color: var(--text-white);
  padding: 60px 0 30px;
  margin-top: 0;
  position: relative;
  overflow: hidden;
  box-shadow: 0 -4px 20px rgba(var(--black-rgb), 0.1);
}

/* خلفية منقوشة خفيفة */
.main-footer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image:
    radial-gradient(circle at 20% 50%, rgba(var(--primary-color-rgb), 0.1) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(var(--secondary-color-rgb), 0.1) 0%, transparent 50%);
  pointer-events: none;
}

/* حاوي الفوتر */
.footer-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 2rem;
  position: relative;
  z-index: 1;
}

/* محتوى الفوتر */
.footer-content {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 3rem;
  margin-bottom: 2.5rem;
  padding-bottom: 2.5rem;
  border-bottom: 1px solid rgba(var(--white-rgb), 0.1);
}

/* أقسام الفوتر */
.footer-section {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* عنوان الفوتر */
.footer-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-white);
  margin: 0 0 0.5rem 0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.footer-title::before {
  content: '';
  width: 4px;
  height: 24px;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  border-radius: 2px;
}

/* وصف الفوتر */
.footer-description {
  color: var(--slate-300);
  font-size: 0.9375rem;
  line-height: 1.6;
  margin: 0;
}

/* عناوين فرعية */
.footer-subtitle {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-white);
  margin: 0 0 1rem 0;
  position: relative;
  padding-right: 1rem;
}

.footer-subtitle::after {
  content: '';
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--primary-color);
  border-radius: 2px;
}

/* روابط الفوتر */
.footer-links {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.footer-links li {
  margin: 0;
}

.footer-links a {
  color: var(--slate-300);
  text-decoration: none;
  font-size: 0.9375rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.3s ease;
  position: relative;
  padding-right: 0.5rem;
}

.footer-links a::before {
  content: '•';
  color: var(--primary-color);
  font-size: 1.25rem;
  transition: transform 0.3s ease;
}

.footer-links a:hover {
  color: var(--text-white);
  transform: translateX(-4px);
}

.footer-links a:hover::before {
  transform: scale(1.3);
}

/* معلومات التواصل */
.footer-contact {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.footer-contact li {
  color: var(--slate-300);
  font-size: 0.9375rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  line-height: 1.5;
}

.footer-contact i {
  color: var(--primary-color);
  font-size: 1.125rem;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}

/* أسفل الفوتر */
.footer-bottom {
  text-align: center;
  padding: 1.5rem 0 0;
}

.footer-bottom p {
  color: var(--slate-400);
  font-size: 0.875rem;
  margin: 0;
  font-weight: 500;
}

/* روابط التواصل الاجتماعي */
.social-links {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}

.social-link {
  width: 40px;
  height: 40px;
  background: rgba(var(--white-rgb), 0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(var(--white-rgb), 0.15);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--slate-200);
  text-decoration: none;
  font-size: 1.125rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.social-link::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  opacity: 0;
  transition: opacity 0.3s ease;
}

.social-link i {
  position: relative;
  z-index: 1;
}

.social-link:hover {
  transform: translateY(-3px);
  border-color: var(--primary-color);
  box-shadow: 0 8px 20px rgba(var(--primary-color-rgb), 0.3);
  color: var(--text-white);
}

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

/* ========== الاستجابة ========== */

/* تابلت */
@media (max-width: 1024px) {
  .footer-content {
    grid-template-columns: 1fr 1fr;
    gap: 2.5rem;
  }

  .footer-section:first-child {
    grid-column: 1 / -1;
  }
}

/* موبايل */
@media (max-width: 768px) {
  .main-footer {
    padding: 50px 0 80px;
    /* Increased bottom padding for mobile scroll */
    text-align: center;
  }

  .footer-container {
    padding: 0 1.5rem;
  }

  .footer-content {
    grid-template-columns: 1fr;
    gap: 2.5rem;
    margin-bottom: 2rem;
    padding-bottom: 2rem;
  }

  .footer-section {
    align-items: center;
    /* Center flex items */
  }

  .footer-section:first-child {
    grid-column: 1;
  }

  /* ⚡ COMPACT MOBILE: Hide logo since school name is in copyright text */
  /* Specifity increased to override .main-footer.compact-footer rule */
  .main-footer.compact-footer .footer-logo,
  .main-footer .footer-logo {
    display: none !important;
  }

  /* Hide side border for centered title on mobile */
  .footer-title::before {
    display: none;
  }

  /* ⚡ REMOVE ::after - it was pushing title off-center */
  .footer-title::after {
    display: none;
  }

  .footer-subtitle {
    font-size: 1.0625rem;
    padding-right: 0;
    /* Remove padding as border is gone */
    text-align: center;
    width: 100%;
    margin-bottom: 0.75rem;
  }

  .footer-subtitle::after {
    display: none;
    /* Hide side border */
  }

  /* ⚡ BALANCE FIX: Limit width for better reading flow */
  .footer-description {
    margin: 0 auto;
    max-width: 90%;
  }

  .footer-links a {
    justify-content: center;
  }

  .footer-description,
  .footer-links a,
  .footer-contact li {
    font-size: 0.95rem;
    /* Larger text for better readability */
    justify-content: center;
    /* ⚡ RTL FIX: Force center alignment to override Arabic RTL defaults */
    text-align: center !important;
    direction: ltr;
    /* Force LTR for centering to work properly */
  }

  /* Override any RTL text alignment */
  .footer-links,
  .footer-contact,
  .footer-section,
  .footer-title,
  .footer-subtitle,
  .footer-description {
    text-align: center !important;
  }

  .footer-links,
  .footer-contact {
    display: flex;
    flex-direction: column;
    align-items: center;
    /* ⚡ FORCE CENTER: Align list items */
    width: 100%;
    text-align: center;
  }

  .footer-links li,
  .footer-contact li {
    justify-content: center;
    width: 100%;
    text-align: center;
  }

  .footer-links a {
    width: 100%;
    justify-content: center;
    padding: 0.5rem 0;
    text-align: center;
  }

  .social-links {
    /* ⚡ FORCE CENTER: Center social icons */
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    margin: 1.5rem auto 0;
  }

  .social-link {
    width: 44px;
    /* Larger touch targets */
    height: 44px;
    font-size: 1.2rem;
  }

  .footer-bottom p {
    font-size: 0.85rem;
    opacity: 0.8;
  }
}

/* موبايل صغير */
@media (max-width: 480px) {
  .main-footer {
    padding: 40px 0 20px;
  }

  .footer-container {
    padding: 0 1rem;
  }

  .footer-content {
    gap: 1.75rem;
    margin-bottom: 1.75rem;
    padding-bottom: 1.75rem;
  }

  .footer-section {
    gap: 1rem;
  }

  .footer-title {
    font-size: 1.25rem;
  }

  .footer-title::before {
    width: 3px;
    height: 20px;
  }

  .footer-subtitle {
    font-size: 1rem;
  }

  .footer-description,
  .footer-links a,
  .footer-contact li {
    font-size: 0.8125rem;
  }

  .footer-links {
    gap: 0.625rem;
  }

  .footer-contact {
    gap: 0.875rem;
  }

  .social-links {
    gap: 0.625rem;
    margin-top: 1.25rem;
  }

  .social-link {
    width: 36px;
    height: 36px;
    font-size: 1rem;
    border-radius: 8px;
  }

  .footer-bottom {
    padding: 1.25rem 0 0;
  }

  .footer-bottom p {
    font-size: 0.75rem;
  }
}

/* ===== Compact Footer (صف واحد) ===== */
.main-footer.compact-footer {
  padding: 18px 0;
}

.main-footer.compact-footer .footer-background,
.main-footer.compact-footer .footer-pattern {
  display: none;
}

.main-footer.compact-footer .footer-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0;
  padding: 0;
  border: 0;
  flex-wrap: wrap;
}

.main-footer.compact-footer .footer-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.main-footer.compact-footer .footer-copyright {
  font-size: 0.9rem;
  opacity: 0.9;
}

.main-footer.compact-footer .social-links {
  display: flex;
  gap: 1.25rem;
  align-items: center;
  margin-top: 0;
}

/* ═══════════════════════════════════════════════════════════════
   COMPACT FOOTER VARIANT
   Specificity: (0,0,3,1) - Higher than base .social-link (0,0,1,0)
   ═══════════════════════════════════════════════════════════════ */
.main-footer.compact-footer .social-link {
  width: auto;
  height: auto;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  overflow: visible;
  transform: none;
  padding: 0;

  font-size: 1.1rem;
  color: rgba(var(--white-rgb), 0.7);
  text-decoration: none;
  transition: opacity 0.2s ease;
  line-height: 1;
}

.main-footer.compact-footer .social-link::before {
  content: none;
  display: none;
}

.main-footer.compact-footer .social-link:hover {
  opacity: 0.5;
  transform: none;
  box-shadow: none;
  background: transparent;
  border-color: transparent;
}

.main-footer.compact-footer .social-link.x-link svg {
  width: 16px;
  height: 16px;
  display: block;
  fill: currentColor;
}

/* ===== الثيم الليلي للفوتر ===== */
body.theme-night .main-footer {
  background: linear-gradient(135deg, var(--bg-color) 0%, var(--surface-0) 100%);
}

body.theme-night .main-footer::before {
  background-image:
    radial-gradient(circle at 20% 50%, rgba(var(--primary-color-rgb), 0.15) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(var(--secondary-color-rgb), 0.15) 0%, transparent 50%);
}

body.theme-night .footer-title::before {
  background: linear-gradient(135deg, var(--violet-600), var(--fuchsia-600));
}

body.theme-night .footer-subtitle::after {
  background: var(--violet-600);
}

body.theme-night .footer-link:hover {
  color: var(--violet-400);
}

body.theme-night .social-link {
  background: rgba(var(--primary-color-rgb), 0.2);
  border-color: rgba(var(--primary-color-rgb), 0.3);
}

body.theme-night .social-link:hover {
  background: var(--violet-600);
  border-color: var(--violet-600);
}