/*
 * Almalki Educational Group — Theme Styles (Enhanced)
 * Built on Bootstrap 5 RTL with brand-specific overrides
 */

/* ===== GOOGLE FONTS ===== */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700;800;900&family=Tajawal:wght@400;500;700;800&display=swap');

:root {
  --almalki-primary:      #02307F;
  --almalki-primary-dark: #011C4B;
  --almalki-secondary:    #12A86B;
  --almalki-secondary-dark: #0e8a56;
  --almalki-bg:           #f8fafc;
  --almalki-text:         #1f2937;
  --almalki-muted:        #6b7280;
  --shadow-sm:  0 2px 8px rgba(0,0,0,0.06);
  --shadow-md:  0 8px 24px rgba(0,0,0,0.09);
  --shadow-lg:  0 16px 48px rgba(0,0,0,0.12);
  --radius-md:  0.75rem;
  --radius-lg:  1.25rem;
  --radius-xl:  1.75rem;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Cairo', 'Tajawal', system-ui, sans-serif;
  color: var(--almalki-text);
  background-color: #ffffff;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--almalki-primary); text-decoration: none; }
a:hover { color: var(--almalki-secondary); }

img { max-width: 100%; height: auto; }

/* ===== TOPBAR ===== */
.topbar {
  background: var(--almalki-primary-dark);
  font-size: 0.82rem;
  letter-spacing: 0.01em;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

/* ===== HEADER / NAVBAR ===== */
.site-header {
  transition: box-shadow .3s, background .3s;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  z-index: 1040;
}
.site-header .navbar {
  padding-top: 0.6rem;
  padding-bottom: 0.6rem;
  min-height: 72px;
}
.site-header .navbar-brand img {
  height: 60px;
  width: auto;
  transition: transform .3s;
}
.site-header .navbar-brand img:hover { transform: scale(1.03); }

/* Nav links */
.site-header .nav-link {
  font-weight: 700;
  font-size: 0.92rem;
  color: #1f2937 !important;
  padding: 0.45rem 0.75rem !important;
  border-radius: 0.5rem;
  position: relative;
  transition: color .25s, background .25s;
  white-space: nowrap;
}
.site-header .nav-link:hover,
.site-header .nav-link.active {
  color: var(--almalki-primary) !important;
  background: rgba(2,48,127,0.06);
}
.site-header .nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  right: 0.75rem;
  left: 0.75rem;
  height: 2px;
  background: var(--almalki-secondary);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform .3s;
  border-radius: 2px;
}
.site-header .nav-link:hover::after { transform: scaleX(1); }

/* Register button */
.btn-register {
  background: linear-gradient(135deg, var(--almalki-secondary), var(--almalki-secondary-dark)) !important;
  border: 0 !important;
  font-size: 0.88rem;
  padding: 0.5rem 1.4rem !important;
  transition: transform .2s, box-shadow .2s, opacity .2s;
  letter-spacing: 0.02em;
}
.btn-register:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(18,168,107,0.35) !important;
  opacity: 0.92;
}

/* ===== MEGA MENU ===== */
.mega-menu {
  border-radius: var(--radius-lg) !important;
  margin-top: 0.5rem;
  border: 1px solid rgba(0,0,0,0.07) !important;
  box-shadow: var(--shadow-lg) !important;
}
.mega-school-link {
  border-radius: var(--radius-md);
  transition: background .2s, transform .2s;
}
.mega-school-link:hover {
  background: #f0f7ff;
  transform: translateX(-3px);
}

/* ===== PAGE HERO ===== */
.page-hero {
  background: linear-gradient(135deg, var(--almalki-primary) 0%, var(--almalki-primary-dark) 100%);
  padding: 4rem 0;
  position: relative;
  overflow: hidden;
}
.page-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
}
.page-hero h1 { position: relative; text-shadow: 0 2px 12px rgba(0,0,0,0.15); }
.page-hero p  { position: relative; }

/* ===== HERO SECTION (Homepage) ===== */
.hero h1 {
  letter-spacing: -0.5px;
  line-height: 1.2;
  text-shadow: 0 2px 16px rgba(0,0,0,0.2);
}
.fade-up { opacity: 0; transform: translateY(24px); animation: fadeUp .8s ease forwards; }
.fade-up:nth-child(2) { animation-delay: .15s; }
.fade-up:nth-child(3) { animation-delay: .3s; }
.fade-up:nth-child(4) { animation-delay: .45s; }
@keyframes fadeUp { to { opacity: 1; transform: none; } }

/* ===== SECTION SPACING ===== */
section { padding-top: 5rem; padding-bottom: 5rem; }
section.py-5 { padding-top: 4.5rem !important; padding-bottom: 4.5rem !important; }

/* ===== STATS SECTION ===== */
.stat-icon { transition: transform .3s; }
.counter { font-variant-numeric: tabular-nums; }

/* ===== SCHOOL CARDS ===== */
.school-card {
  transition: transform .35s cubic-bezier(.34,1.56,.64,1), box-shadow .35s;
  border-radius: var(--radius-lg) !important;
  overflow: hidden;
}
.school-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-lg) !important;
}
.school-card:hover img { transform: scale(1.08); }
.school-card .card-body { transition: background .3s; }
.school-card img { transition: transform .5s cubic-bezier(.25,.46,.45,.94); }

/* ===== CARDS GENERAL ===== */
.card {
  border-radius: var(--radius-lg) !important;
  border: 1px solid rgba(0,0,0,0.06) !important;
}
.shadow-sm { box-shadow: var(--shadow-sm) !important; }
.shadow { box-shadow: var(--shadow-md) !important; }

/* ===== JOURNEY / STEPS ===== */
.journey-row { padding-top: 48px; }
.journey-card {
  transition: transform .3s cubic-bezier(.34,1.56,.64,1);
}
.journey-card:hover { transform: translateY(-6px); }
.journey-line {
  position: absolute;
  top: 32px;
  right: 12%;
  left: 12%;
  height: 2px;
  border-top: 2px dashed rgba(18,168,107,0.25);
  z-index: 0;
}
.journey-row > * { z-index: 1; }

/* ===== SECTION HEADINGS ===== */
h2.display-6, h2.display-5 {
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.3px;
}
.section-label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--almalki-secondary);
}

/* ===== GALLERY SWIPER ===== */
.swiper-button-next,
.swiper-button-prev {
  width: 42px !important;
  height: 42px !important;
  background: rgba(255,255,255,0.97);
  border-radius: 50%;
  box-shadow: var(--shadow-md);
  transition: transform .2s, box-shadow .2s;
}
.swiper-button-next:hover,
.swiper-button-prev:hover {
  transform: scale(1.1);
  box-shadow: var(--shadow-lg);
}
.swiper-button-next::after,
.swiper-button-prev::after { font-size: 15px !important; font-weight: 900 !important; color: var(--almalki-primary); }
.school-gallery-swiper { padding-bottom: 44px; }
.school-gallery-swiper .swiper-slide { height: auto; }
.school-gallery-swiper img { transition: transform .5s; }
.school-gallery-swiper a:hover img { transform: scale(1.05); }

/* ===== FOOTER ===== */
.site-footer {
  background: linear-gradient(180deg, var(--almalki-primary-dark) 0%, #000814 100%);
}
.site-footer a { color: rgba(255,255,255,0.72); transition: color .25s; }
.site-footer a:hover { color: #fff; }
.site-footer .footer-links li { padding: 5px 0; }
.site-footer .social-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255,255,255,0.09);
  transition: background .25s, transform .25s;
  font-size: 1rem;
}
.site-footer .social-icon:hover {
  background: var(--almalki-secondary);
  transform: translateY(-3px);
}

/* ===== WHATSAPP FAB ===== */
.whatsapp-fab {
  position: fixed;
  bottom: 28px;
  left: 28px;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #25D366;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  box-shadow: 0 8px 28px rgba(37,211,102,0.45);
  z-index: 999;
  transition: transform .25s, box-shadow .25s;
}
.whatsapp-fab:hover {
  color: #fff;
  transform: scale(1.08) translateY(-2px);
  box-shadow: 0 12px 36px rgba(37,211,102,0.55);
}
.whatsapp-fab .ping {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: #25D366;
  opacity: 0.55;
  animation: ping 2s cubic-bezier(0,0,0.2,1) infinite;
}
.whatsapp-fab .ping-2 { animation-delay: 1s; }
@keyframes ping {
  0%       { transform: scale(1); opacity: 0.55; }
  80%, 100%{ transform: scale(2.2); opacity: 0; }
}
.whatsapp-fab i { position: relative; z-index: 1; }
[dir="rtl"] .whatsapp-fab { left: auto; right: 28px; }

/* ===== FORMS ===== */
.form-control,
.form-select {
  border: 2px solid #e5e7eb;
  border-radius: var(--radius-md) !important;
  font-family: 'Cairo', sans-serif;
  font-size: 0.95rem;
  padding: 0.65rem 1rem;
  transition: border-color .2s, box-shadow .2s;
  background-color: #fafafa;
}
.form-control:focus,
.form-select:focus {
  border-color: var(--almalki-secondary);
  box-shadow: 0 0 0 4px rgba(18,168,107,0.12);
  background-color: #fff;
}
.form-label {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--almalki-text);
  margin-bottom: 0.4rem;
}

/* ===== BUTTONS ===== */
.btn {
  font-family: 'Cairo', sans-serif;
  font-weight: 700;
  letter-spacing: 0.01em;
  transition: transform .2s, box-shadow .2s, opacity .2s;
}
.btn:hover { transform: translateY(-2px); }
.btn-lg { padding: 0.7rem 2rem; font-size: 1rem; }

/* ===== ALERTS ===== */
.alert { border: none; border-radius: var(--radius-lg) !important; }
.alert-success { background: #f0fdf8; color: #065f46; }
.alert-danger  { background: #fff1f2; color: #9f1239; }

/* ===== ROUNDED OVERRIDES ===== */
.rounded-4 { border-radius: var(--radius-lg) !important; }
.rounded-3 { border-radius: var(--radius-md) !important; }

/* ===== UTILITIES ===== */
.tracking-wider   { letter-spacing: 0.1em; }
.py-lg-6          { padding-top: 6rem; padding-bottom: 6rem; }
.prose-arabic p   { margin-bottom: 1.3rem; line-height: 2; }
.prose-arabic h2,
.prose-arabic h3  { color: var(--almalki-primary); font-weight: 800; margin-top: 2.2rem; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar       { width: 6px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: var(--almalki-primary); border-radius: 3px; }

/* ===== SELECTION COLOR ===== */
::selection { background: var(--almalki-primary); color: #fff; }

/* ================================================================
   MICRO ANIMATIONS
   ================================================================ */

/* ---- Scroll Reveal (transitions only — no hiding) ---- */
.reveal, .reveal-stagger > * {
  transition: opacity .65s cubic-bezier(.22,1,.36,1), transform .65s cubic-bezier(.22,1,.36,1);
}

/* ---- Stat icons bounce on hover ---- */
.stat-icon:hover {
  transform: translateY(-6px) scale(1.1);
  transition: transform .35s cubic-bezier(.34,1.56,.64,1);
}

/* ---- Feature cards glow + lift ---- */
.feature-card {
  transition: transform .35s cubic-bezier(.34,1.56,.64,1), box-shadow .35s, border-color .35s !important;
  position: relative;
  overflow: hidden;
}
.feature-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.06) 100%);
  opacity: 0;
  transition: opacity .3s;
}
.feature-card:hover { transform: translateY(-8px) !important; box-shadow: 0 24px 48px rgba(0,0,0,0.22) !important; }
.feature-card:hover::after { opacity: 1; }
.feature-card .rounded-3 { transition: transform .3s cubic-bezier(.34,1.56,.64,1), box-shadow .3s; }
.feature-card:hover .rounded-3 { transform: scale(1.12) rotate(-4deg); box-shadow: 0 8px 24px rgba(18,168,107,0.4); }

/* ---- Icon pulse (section labels) ---- */
@keyframes icon-pulse {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.18); }
}
.icon-pulse { animation: icon-pulse 2.4s ease-in-out infinite; }

/* ---- Button ripple ---- */
.btn { position: relative; overflow: hidden; }
.btn .ripple-wave {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.35);
  transform: scale(0);
  animation: ripple-anim .55s linear;
  pointer-events: none;
}
@keyframes ripple-anim {
  to { transform: scale(4); opacity: 0; }
}

/* ---- Button shine sweep ---- */
.btn::before {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(120deg, transparent 0%, rgba(255,255,255,0.22) 50%, transparent 100%);
  transform: skewX(-20deg);
  transition: left .5s ease;
  pointer-events: none;
}
.btn:hover::before { left: 140%; }

/* ---- Journey step icons spin on hover ---- */
.journey-card .journey-icon > div {
  transition: transform .4s cubic-bezier(.34,1.56,.64,1);
}
.journey-card:hover .journey-icon > div { transform: rotate(15deg) scale(1.1); }

/* ---- School card color accent bar ---- */
.school-card::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 3px;
  background: var(--school-color, var(--almalki-secondary));
  transform: scaleX(0);
  transform-origin: right;
  transition: transform .35s ease;
}
.school-card:hover::after { transform: scaleX(1); transform-origin: left; }

/* ---- Chairman photo float ---- */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-10px); }
}
.chairman-float { animation: float 5s ease-in-out infinite; }

/* ---- Testimonial card hover ---- */
.testimonials-swiper .swiper-slide > div {
  transition: transform .35s cubic-bezier(.34,1.56,.64,1), box-shadow .35s;
}
.testimonials-swiper .swiper-slide > div:hover {
  transform: translateY(-6px);
  box-shadow: 0 20px 40px rgba(0,0,0,0.25) !important;
}

/* ---- CTA band subtle shimmer ---- */
@keyframes cta-shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}
.cta-band {
  background-size: 800px 100% !important;
  animation: cta-shimmer 6s linear infinite;
  background-image: linear-gradient(135deg, var(--almalki-secondary) 0%, #0e8a56 40%, #16c97d 55%, #0e8a56 70%, var(--almalki-secondary) 100%) !important;
}

/* ---- Fade in on scroll (existing class enhanced) ---- */
.fade-in-on-scroll {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity .6s ease, transform .6s ease;
}
.fade-in-on-scroll.is-visible { opacity: 1; transform: none; }

/* ---- Social icons bounce ---- */
.social-icon { transition: background .25s, transform .35s cubic-bezier(.34,1.56,.64,1) !important; }
.social-icon:hover { transform: translateY(-5px) scale(1.12) !important; }

/* ---- WhatsApp FAB heartbeat ---- */
@keyframes heartbeat {
  0%,100% { transform: scale(1); }
  14%     { transform: scale(1.1); }
  28%     { transform: scale(1); }
  42%     { transform: scale(1.07); }
  70%     { transform: scale(1); }
}
.whatsapp-fab { animation: heartbeat 3s ease-in-out infinite; }
.whatsapp-fab:hover { animation: none; transform: scale(1.1) translateY(-3px); }

/* ---- Navbar logo wiggle on hover ---- */
@keyframes wiggle {
  0%,100% { transform: rotate(0); }
  25%     { transform: rotate(-4deg) scale(1.05); }
  75%     { transform: rotate(4deg) scale(1.05); }
}
.site-header .navbar-brand img:hover { animation: wiggle .5s ease; transform: none !important; }

/* ---- Form focus ring pulse ---- */
@keyframes focus-ring {
  0%   { box-shadow: 0 0 0 0 rgba(18,168,107,0.35); }
  100% { box-shadow: 0 0 0 6px rgba(18,168,107,0); }
}
.form-control:focus,
.form-select:focus {
  animation: focus-ring .5s ease forwards;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1199.98px) {
  .site-header .nav-link { padding: 0.4rem 0.55rem !important; font-size: 0.87rem; }
}

@media (max-width: 991.98px) {
  .site-header .navbar { min-height: 64px; }
  .navbar-collapse {
    padding: 1rem 0.5rem;
    margin-top: 0.75rem;
    border-top: 1px solid #e5e7eb;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    background: #fff;
  }
  .site-header .nav-link::after { display: none; }
  .mega-menu { min-width: 100% !important; box-shadow: none !important; border: none !important; }
  section { padding-top: 3.5rem; padding-bottom: 3.5rem; }
}

@media (max-width: 767.98px) {
  .display-3 { font-size: 2.4rem; }
  .display-4 { font-size: 1.9rem; }
  .display-5 { font-size: 1.65rem; }
  .display-6 { font-size: 1.35rem; }
  .py-lg-6   { padding-top: 3rem; padding-bottom: 3rem; }
  .whatsapp-fab { width: 56px; height: 56px; font-size: 26px; bottom: 18px; }
  [dir="rtl"] .whatsapp-fab { right: 18px; }
  section { padding-top: 2.75rem; padding-bottom: 2.75rem; }
  .btn-lg { padding: 0.6rem 1.5rem; font-size: 0.95rem; }
}

@media (max-width: 575.98px) {
  .display-3 { font-size: 2rem; }
  .display-4 { font-size: 1.65rem; }
  .page-hero { padding: 2.5rem 0; }
}
