/* ================================================================
   CROUS de Ziguinchor — Design System
   Animations 3D, effets glassmorphism, transitions fluides
================================================================ */

:root {
  --primary:   #15803D;
  --primary-d: #052E16;
  --accent:    #E8A020;
  --accent-l:  #F5C842;
  --dark:      #0F172A;
  --text:      #334155;
  --glass:     rgba(255,255,255,0.08);
  --glass-b:   rgba(255,255,255,0.15);
}

/* ── Fonts & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  color: var(--text);
  background: #fff;
  overflow-x: hidden;
}

/* ── Page Loader ──────────────────────────────────────────── */
#page-loader {
  position: fixed; inset: 0; z-index: 9999;
  background: var(--primary-d);
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 1rem;
  transition: opacity .5s ease, visibility .5s ease;
}
#page-loader.hidden { opacity: 0; visibility: hidden; }
.loader-logo {
  width: 70px; height: 70px;
  border-radius: 20px;
  background: rgba(255,255,255,.1);
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem; font-weight: 900; color: #fff;
  animation: loader-pulse 1.4s ease-in-out infinite;
}
.loader-bar {
  width: 200px; height: 3px;
  background: rgba(255,255,255,.15);
  border-radius: 10px; overflow: hidden;
}
.loader-bar-fill {
  height: 100%; width: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-l));
  border-radius: 10px;
  animation: loader-fill 1.2s ease forwards;
}
@keyframes loader-fill { to { width: 100%; } }
@keyframes loader-pulse {
  0%,100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(232,160,32,.4); }
  50% { transform: scale(1.05); box-shadow: 0 0 0 15px rgba(232,160,32,0); }
}

/* ── Page Transition ──────────────────────────────────────── */
#page-transition {
  position: fixed; inset: 0; z-index: 8888;
  background: var(--primary);
  transform: scaleX(0); transform-origin: left;
  pointer-events: none;
}

/* ── Header ──────────────────────────────────────────────── */
#main-header {
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background: rgba(255,255,255,.92);
  border-bottom: 1px solid rgba(0,0,0,.06);
  transition: all .3s ease;
}
#main-header.scrolled {
  box-shadow: 0 8px 32px rgba(0,0,0,.1);
}
.nav-link-item {
  position: relative;
  padding: .5rem 0;
  font-size: .9rem;
  font-weight: 500;
  color: #475569;
  transition: color .25s;
}
.nav-link-item::after {
  content: '';
  position: absolute; bottom: 0; left: 0;
  width: 0; height: 2px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 2px;
  transition: width .35s cubic-bezier(.4,0,.2,1);
}
.nav-link-item:hover, .nav-link-item.active { color: var(--primary); }
.nav-link-item:hover::after, .nav-link-item.active::after { width: 100%; }

/* ── Hero ────────────────────────────────────────────────── */
.hero-section {
  min-height: 100vh;
  background: linear-gradient(135deg, #052E16 0%, #0a5e2a 40%, #15803D 80%, #1a9e50 100%);
  position: relative; overflow: hidden;
  display: flex; align-items: center;
}

/* Animated mesh background */
.hero-mesh {
  position: absolute; inset: 0; overflow: hidden;
}
.hero-mesh::before,
.hero-mesh::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: .25;
  animation: mesh-float 12s ease-in-out infinite;
}
.hero-mesh::before {
  width: 600px; height: 600px;
  background: radial-gradient(circle, #E8A020, transparent 70%);
  top: -200px; right: -150px;
  animation-delay: 0s;
}
.hero-mesh::after {
  width: 500px; height: 500px;
  background: radial-gradient(circle, #1d4ed8, transparent 70%);
  bottom: -200px; left: -100px;
  animation-delay: -6s;
}
@keyframes mesh-float {
  0%,100% { transform: translate(0,0) scale(1); }
  33% { transform: translate(30px,-50px) scale(1.1); }
  66% { transform: translate(-20px,30px) scale(.95); }
}

/* Floating particles */
.hero-particles {
  position: absolute; inset: 0; overflow: hidden;
  pointer-events: none;
}
.particle {
  position: absolute;
  background: rgba(255,255,255,.15);
  border-radius: 50%;
  animation: particle-rise linear infinite;
}
@keyframes particle-rise {
  0% { transform: translateY(0) rotate(0deg); opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: .5; }
  100% { transform: translateY(-110vh) rotate(720deg); opacity: 0; }
}

/* Hero grid lines */
.hero-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px);
  background-size: 60px 60px;
}

/* ── Glassmorphism Cards ──────────────────────────────────── */
.glass-card {
  background: rgba(255,255,255,.08);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 20px;
}

/* ── 3D Service Cards ─────────────────────────────────────── */
.service-card-wrapper {
  perspective: 1200px;
}
.service-card {
  position: relative;
  border-radius: 24px;
  overflow: hidden;
  background: #fff;
  border: 1px solid rgba(0,0,0,.06);
  box-shadow: 0 4px 20px rgba(0,0,0,.06);
  transition:
    transform .5s cubic-bezier(.23,1,.32,1),
    box-shadow .5s cubic-bezier(.23,1,.32,1);
  transform-style: preserve-3d;
  will-change: transform;
}
.service-card:hover {
  transform: translateY(-12px) rotateX(4deg) rotateY(-2deg) scale(1.02);
  box-shadow: 0 40px 80px rgba(0,0,0,.15), 0 0 0 1px rgba(0,0,0,.04);
}
.service-card-shine {
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,.2) 0%, transparent 60%);
  opacity: 0;
  transition: opacity .4s;
  pointer-events: none;
}
.service-card:hover .service-card-shine { opacity: 1; }

/* Icon 3D effect */
.service-icon-3d {
  position: relative;
  width: 70px; height: 70px;
  border-radius: 20px;
  display: flex; align-items: center; justify-content: center;
  transition: transform .4s cubic-bezier(.23,1,.32,1);
  transform-style: preserve-3d;
}
.service-card:hover .service-icon-3d {
  transform: translateZ(20px) rotateY(-10deg);
}
.service-icon-3d::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  opacity: .4;
  transform: translateZ(-8px) translateY(8px) scale(.85);
  filter: blur(10px);
  transition: all .4s;
}
.service-card:hover .service-icon-3d::after {
  transform: translateZ(-8px) translateY(14px) scale(.75);
  opacity: .7;
}
.icon-blue { background: linear-gradient(135deg,#dbeafe,#bfdbfe); }
.icon-blue::after { background: #3b82f6; }
.icon-green { background: linear-gradient(135deg,#d1fae5,#a7f3d0); }
.icon-green::after { background: #10b981; }
.icon-purple { background: linear-gradient(135deg,#ede9fe,#ddd6fe); }
.icon-purple::after { background: #8b5cf6; }

/* ── Stat Counter ─────────────────────────────────────────── */
.stat-card {
  text-align: center;
  padding: 2rem 1.5rem;
  border-radius: 20px;
  background: rgba(255,255,255,.06);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,.12);
  transition: all .4s ease;
}
.stat-card:hover {
  background: rgba(255,255,255,.12);
  transform: translateY(-4px);
  box-shadow: 0 20px 40px rgba(0,0,0,.3);
}
.stat-number {
  font-size: clamp(2rem,5vw,3.5rem);
  font-weight: 900;
  line-height: 1;
  background: linear-gradient(135deg, #fff 0%, var(--accent-l) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.stat-label {
  font-size: .875rem;
  color: rgba(255,255,255,.65);
  margin-top: .5rem;
  font-weight: 500;
}

/* ── News Cards ───────────────────────────────────────────── */
.news-card {
  border-radius: 20px;
  overflow: hidden;
  background: #fff;
  border: 1px solid rgba(0,0,0,.06);
  box-shadow: 0 4px 20px rgba(0,0,0,.05);
  transition: all .4s cubic-bezier(.23,1,.32,1);
  display: flex; flex-direction: column;
}
.news-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 24px 60px rgba(21,128,61,.15);
  border-color: rgba(21,128,61,.15);
}
.news-card-image {
  overflow: hidden; height: 220px; position: relative;
}
.news-card-image img,
.news-card-image .placeholder {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .6s cubic-bezier(.23,1,.32,1);
}
.news-card:hover .news-card-image img,
.news-card:hover .news-card-image .placeholder {
  transform: scale(1.08);
}
.news-card-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,.5) 0%, transparent 50%);
  opacity: 0; transition: opacity .4s;
}
.news-card:hover .news-card-overlay { opacity: 1; }

/* ── Animated Section Title ───────────────────────────────── */
.section-eyebrow {
  display: inline-flex; align-items: center; gap: .5rem;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--primary);
}
.section-eyebrow::before {
  content: '';
  width: 24px; height: 2px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 2px;
}

/* ── Floating elements ────────────────────────────────────── */
.float-1 { animation: float1 6s ease-in-out infinite; }
.float-2 { animation: float2 8s ease-in-out infinite; }
.float-3 { animation: float3 5s ease-in-out infinite; }
@keyframes float1 { 0%,100%{transform:translateY(0) rotate(0deg)} 50%{transform:translateY(-20px) rotate(5deg)} }
@keyframes float2 { 0%,100%{transform:translateY(0) rotate(0deg)} 50%{transform:translateY(-15px) rotate(-3deg)} }
@keyframes float3 { 0%,100%{transform:translateY(0) rotate(0deg)} 50%{transform:translateY(-25px) rotate(8deg)} }

/* ── Gradient text ────────────────────────────────────────── */
.gradient-text {
  background: linear-gradient(135deg, #fff 0%, var(--accent-l) 60%, #fbbf24 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.gradient-text-primary {
  background: linear-gradient(135deg, var(--primary) 0%, #22c55e 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── CTA Section ──────────────────────────────────────────── */
.cta-section {
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, var(--primary-d) 0%, var(--primary) 50%, #1a9e50 100%);
}
.cta-section::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    radial-gradient(circle at 20% 50%, rgba(232,160,32,.15) 0%, transparent 50%),
    radial-gradient(circle at 80% 50%, rgba(34,197,94,.15) 0%, transparent 50%);
}

/* ── Scroll indicator ─────────────────────────────────────── */
.scroll-indicator {
  display: flex; flex-direction: column; align-items: center; gap: .5rem;
  color: rgba(255,255,255,.6);
  font-size: .75rem; letter-spacing: .1em; text-transform: uppercase;
}
.scroll-mouse {
  width: 26px; height: 40px;
  border: 2px solid rgba(255,255,255,.4);
  border-radius: 13px;
  position: relative; overflow: hidden;
}
.scroll-wheel {
  width: 4px; height: 8px;
  background: rgba(255,255,255,.7);
  border-radius: 2px;
  position: absolute; top: 6px; left: 50%; transform: translateX(-50%);
  animation: scroll-wheel 2s ease infinite;
}
@keyframes scroll-wheel {
  0% { transform: translateX(-50%) translateY(0); opacity: 1; }
  100% { transform: translateX(-50%) translateY(18px); opacity: 0; }
}

/* ── Page hero inner pages ────────────────────────────────── */
.page-hero {
  position: relative; overflow: hidden;
  padding: 5rem 0 4rem;
  background: linear-gradient(135deg, #052E16 0%, #0a5e2a 50%, var(--primary) 100%);
}
.page-hero::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.03) 1px, transparent 1px);
  background-size: 50px 50px;
}
.page-hero .big-circle {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,.04);
  right: -120px; top: -120px;
  width: 400px; height: 400px;
}

/* ── Footer ───────────────────────────────────────────────── */
.footer-main {
  background: linear-gradient(180deg, #071a0e 0%, #030d06 100%);
}

/* ── Admin improvements ───────────────────────────────────── */
.admin-table-row:hover { background: #f8faff; }
.btn-primary {
  background: linear-gradient(135deg, var(--primary), #1a9e50);
  color: #fff;
  font-weight: 600;
  padding: .65rem 1.5rem;
  border-radius: .75rem;
  border: none; cursor: pointer;
  transition: all .3s ease;
  box-shadow: 0 4px 15px rgba(21,128,61,.3);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(21,128,61,.4);
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 768px) {
  .hero-section { min-height: 100svh; }
}

/* ── AOS Overrides ────────────────────────────────────────── */
[data-aos] { pointer-events: none; }
[data-aos].aos-animate { pointer-events: auto; }
