/* =========================================
   1. Font Definitions (Al Jazeera Arabic)
   ========================================= */

@font-face {
  font-family: "AlJazeera";
  src: url("../fonts/aljazeera-regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "AlJazeera";
  src: url("../fonts/aljazeera-bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "AlJazeera";
  src: url("../fonts/aljazeera-light.ttf") format("truetype");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

:root {
  /* --- COLOR PALETTE --- */
  /* Main Brand Purple */
  --primary: #522583;

  /* Stage Colors */
  --cubs-yellow: #f9d242; /* Jarameez */
  --scouts-green: #78a756; /* Kashaf */
  --advanced-orange: #f26522; /* Advanced (Moutaqadem) - NEW ORANGE */
  --rovers-red: #ba3642; /* Jawala */

  /* Accents */
  --text-dark: #232323;
  --text-light: #777;
  --bg-gray: #f9f9f9;
  --white: #ffffff;

  /* Shapes */
  --radius-pill: 50px;
  --radius-card: 16px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* =========================================
   2. Global Typography
   ========================================= */

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: var(--text-dark);
  line-height: 1.6;
  overflow-x: hidden;
}

html {
  scroll-behavior: smooth;
}

html[lang="ar"] body {
  font-family: "AlJazeera", "Segoe UI", Tahoma, sans-serif;
}

html[lang="ar"] h1,
html[lang="ar"] h2,
html[lang="ar"] h3 {
  font-family: "AlJazeera";
  font-weight: 700;
}

/* Helpers */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}
.section {
  padding: 80px 0;
}
.bg-light {
  background-color: var(--bg-gray);
}
.text-white {
  color: var(--white) !important;
}

/* --- Navbar --- */
.navbar {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  padding: 15px 0;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
  transition: padding 0.3s;
}

.nav-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  z-index: 1001;
}

.brand-logo {
  height: 70px;
  width: auto;
}

.nav-links {
  display: flex;
  gap: 30px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  text-decoration: none;
  color: var(--text-dark);
  font-weight: 700;
  font-size: 1rem;
  transition: color 0.3s;
  position: relative;
}

.nav-links a:hover {
  color: var(--primary);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 15px;
  z-index: 1001;
}

.btn-sm {
  padding: 8px 16px;
  font-size: 0.85rem;
}

.btn {
  padding: 10px 25px;
  border-radius: var(--radius-pill);
  text-decoration: none;
  font-weight: 700;
  cursor: pointer;
  border: none;
  font-family: inherit;
  transition: transform 0.2s;
}
.btn:hover {
  transform: scale(1.05);
}
.btn-primary {
  background: var(--primary);
  color: white;
}
.btn-outline {
  background: transparent;
  border: 2px solid var(--primary);
  color: var(--primary);
}
.btn-login {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f0f0f0;
  color: var(--primary);
  padding: 10px 20px;
  font-size: 0.9rem;
}
.btn-login:hover {
  background: #e0e0e0;
  color: var(--primary);
}

.mobile-only {
  display: none;
}
.hamburger {
  display: none;
}

/* Mobile Responsive Styles */
@media (max-width: 992px) {
  .nav-links {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    height: 100vh;
    background: var(--primary);
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 40px;
    transform: translateY(-100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 999;
  }

  .nav-links.active {
    transform: translateY(0);
  }

  .nav-links a {
    color: white;
    font-size: 1.5rem;
  }

  .desktop-only {
    display: none;
  }
  .mobile-only {
    display: block;
  }

  .hamburger {
    display: flex;
    flex-direction: column;
    gap: 6px;
    cursor: pointer;
  }

  .hamburger span {
    width: 30px;
    height: 3px;
    background-color: var(--primary);
    border-radius: 2px;
    transition: 0.3s;
  }

  .hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(8px, 6px);
  }
  .hamburger.active span:nth-child(2) {
    opacity: 0;
  }
  .hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(8px, -6px);
  }
}

html[dir="ltr"] .nav-links {
  right: auto;
  left: 0;
}

/* =========================================
   Hero Section (Updated with Flip & Text)
   ========================================= */
.hero {
  height: 90vh;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--white);
  overflow: hidden;
  z-index: 0;
}

.hero::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url("../images/hero-bg.jpg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  z-index: -2;
}

.hero .overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(82, 37, 131, 0.5);
  z-index: -1;
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 800px;
  padding: 20px;
}

.hero h1 {
  font-size: 3.5rem;
  font-weight: 900;
  margin-bottom: 15px;
  line-height: 1.2;
}

.hero p.lead {
  font-size: 1.5rem;
  opacity: 0.9;
  font-weight: 400;
}

@media (max-width: 768px) {
  .hero h1 {
    font-size: 2.5rem;
  }
  .hero p.lead {
    font-size: 1.2rem;
  }
}

/* Impact Stats */
.impact-section {
  background-color: var(--primary);
  color: white;
  padding: 60px 0;
  position: relative;
  z-index: 5;
  margin-top: -5px;
}

.impact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 40px;
  text-align: center;
}

.stat-item h3 {
  font-size: 3rem;
  font-weight: 900;
  margin-bottom: 10px;
  color: var(--cubs-yellow);
}

.stat-item p {
  font-size: 1.1rem;
  font-weight: 600;
  opacity: 0.9;
}

/* Identity Section */
.identity-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
  align-items: center;
}

.identity-image img {
  width: 100%;
  border-radius: var(--radius-card);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15);
  filter: sepia(0.5);
  transition: 0.3s;
}

.identity-image:hover img {
  filter: sepia(0);
}

/* Values Section */
.values-section {
  position: relative;
  background-image: url("../images/flag-bg.jpg");
  background-attachment: fixed;
  background-position: center;
  background-size: cover;
  padding: 120px 0;
  text-align: center;
  color: white;
}

.overlay-dark {
  position: absolute;
  inset: 0;
  background: rgba(82, 37, 131, 0.85);
}

.values-content {
  position: relative;
  z-index: 2;
  max-width: 800px;
  margin: 0 auto;
}

.values-content h2 {
  font-size: 2.5rem;
  margin-bottom: 30px;
  color: var(--cubs-yellow);
}

.values-content blockquote {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.8;
  font-family: "AlJazeera", serif;
  margin-bottom: 20px;
  white-space: pre-line;
  text-align: start;
}

/* Cards (Stages) */
.section-title {
  text-align: center;
  font-size: 2.5rem;
  margin-bottom: 50px;
  color: var(--primary);
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 30px;
}

.card {
  background: white;
  border-radius: var(--radius-card);
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  transition: transform 0.3s;
}

.card:hover {
  transform: translateY(-10px);
}

.card-top {
  height: 10px;
  width: 100%;
}

/* 2. New Image Wrapper Style */
.card-img-wrapper {
  width: 100%; /* 80% of the card width */
  height: auto; /* Allow height to scale naturally */
  aspect-ratio: 1/1; /* Keep it square-ish */
  margin: 0 auto 15px;
  padding: 0;
  border-radius: 50%; /* Remove circle */
  background: transparent; /* Remove background */
  box-shadow: none; /* Remove shadow box */
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-img-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: contain; /* Show full image without cropping */
  border-radius: 50%; /* Remove circle crop */
  filter: drop-shadow(
    0 5px 10px rgba(0, 0, 0, 0.1)
  ); /* Add shadow to the image itself */
}

.card-body {
  padding: 30px 20px;
  text-align: center;
}

/* UPDATED BORDERS FOR ORANGE (ADVANCED) */
.border-yellow {
  border: 3px solid var(--cubs-yellow);
}
.border-green {
  border: 3px solid var(--scouts-green);
}
.border-orange {
  border: 3px solid var(--advanced-orange);
} /* NEW */
.border-red {
  border: 3px solid var(--rovers-red);
}

.bg-yellow {
  background: var(--cubs-yellow);
}
.bg-green {
  background: var(--scouts-green);
}
.bg-orange {
  background: var(--advanced-orange);
} /* NEW */
.bg-red {
  background: var(--rovers-red);
}

.card-cubs {
  border-bottom: 5px solid var(--cubs-yellow);
}
.card-scouts {
  border-bottom: 5px solid var(--scouts-green);
}
.card-advanced {
  border-bottom: 5px solid var(--advanced-orange);
} /* NEW */
.card-rovers {
  border-bottom: 5px solid var(--rovers-red);
}

/* SDG Section */
.sdg-section {
  background-color: var(--text-dark);
  padding: 80px 0;
  overflow: hidden;
}

.sdg-slider-wrapper {
  display: flex;
  flex-wrap: nowrap;
  gap: 20px;
  align-items: center;
  position: relative;
  max-width: 100%;
  padding: 0 40px;
}

.sdg-container {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  gap: 20px;
  padding: 20px 0;
  scrollbar-width: none;
}

.sdg-container::-webkit-scrollbar {
  display: none;
}

.sdg-card {
  flex: 0 0 220px;
  height: 220px;
  scroll-snap-align: center;
  perspective: 1000px;
  cursor: pointer;
}

.sdg-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.6s;
  transform-style: preserve-3d;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  border-radius: 20px;
}

.sdg-card:hover .sdg-inner {
  transform: rotateY(180deg);
}

.sdg-front,
.sdg-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 20px;
  overflow: hidden;
}

.sdg-front img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sdg-back {
  transform: rotateY(180deg);
  background-color: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 15px;
  text-align: center;
  font-weight: 600;
}

/* --- SDG Slider Controls --- */
.slider-btn {
  background-color: transparent;
  color: white;
  border: none;
  cursor: pointer;
  font-size: 1.5rem;
  z-index: 10;
  transition: 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.prev-btn {
  inset-inline-start: 0;
}

.next-btn {
  inset-inline-end: 0;
}

/* News Section */
.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 30px;
  margin-top: 40px;
}

.news-card {
  background: white;
  border-radius: var(--radius-card);
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
  transition: transform 0.3s;
}

a.news-card {
  background: white;
  border-radius: var(--radius-card);
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
  transition: transform 0.3s;
  /* Fixes: */
  text-decoration: none;
  color: inherit;
  display: block;
}

a.news-card h3 {
  color: var(--primary); /* Keep title purple */
}

a.news-card p {
  color: var(--text-dark); /* Keep text dark/grey */
}

.news-card:hover {
  transform: translateY(-5px);
}

.news-img {
  height: 200px;
  width: 100%;
  object-fit: cover;
}

.news-content {
  padding: 20px;
}
.news-date {
  font-size: 0.85rem;
  color: var(--text-light);
  margin-bottom: 10px;
  display: block;
}
.news-content h3 {
  font-size: 1.2rem;
  margin-bottom: 10px;
  color: var(--primary);
}
.news-content a {
  text-decoration: none;
}

/* Map Section */
.section-subtitle {
  margin-bottom: 40px;
  text-align: center; /* Aligns Right in AR, Left in EN automatically */
  padding: 0 10px;
}

.map-wrapper {
  background: white;
  padding: 10px;
  border-radius: var(--radius-card);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

#map {
  height: 500px;
  width: 100%;
  border-radius: 12px;
  z-index: 1;
}

.custom-pin {
  background-color: #fff;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
}

.pin-inner {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  opacity: 0.9;
}

.map-legend {
  background: white;
  padding: 10px;
  border-radius: 8px;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
}
.legend-color {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

/* Footer */
.footer {
  background-color: var(--primary);
  color: white;
  padding: 80px 0 30px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 60px;
}

.footer-col h4 {
  font-size: 1.2rem;
  margin-bottom: 20px;
  color: var(--cubs-yellow);
  font-weight: 700;
}

.footer-mission {
  margin-top: 20px;
  opacity: 0.8;
  line-height: 1.6;
  max-width: 300px;
}

.footer-links {
  list-style: none;
  padding: 0;
}
.footer-links li {
  margin-bottom: 12px;
}
.footer-links a {
  color: white;
  text-decoration: none;
  opacity: 0.8;
}

.footer-contact-list {
  list-style: none;
  padding: 0;
}
.footer-contact-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 15px;
}

.social-icons {
  display: flex;
  gap: 15px;
}

.social-link {
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: 0.3s;
}

.social-link svg {
  width: 20px;
  height: 20px;
  fill: white;
}

.social-link:hover {
  background: var(--cubs-yellow);
}

.logo-white .brand-logo {
  filter: brightness(0) invert(1);
}

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 30px;
  text-align: center;
  font-size: 0.9rem;
  opacity: 0.6;
}

@media (max-width: 768px) {
  .footer-grid {
    grid-template-columns: 1fr;
    text-align: center;
  }
  .footer-contact-list li,
  .social-icons,
  .logo {
    justify-content: center;
  }

  .identity-grid {
    grid-template-columns: 1fr;
    gap: 30px;
    text-align: center;
  }

  .year-badge {
    font-size: 1.5rem;
    padding: 10px 20px;
  }
}

/* =========================================
   Login Page Styles
   ========================================= */
.login-page {
  background: linear-gradient(135deg, var(--bg-gray) 0%, #e6e6e6 100%);
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-container {
  width: 100%;
  max-width: 400px;
  padding: 20px;
}

.login-card {
  background: white;
  padding: 40px;
  border-radius: 20px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
  text-align: center;
}

.login-logo {
  height: 80px;
  margin-bottom: 20px;
}

.login-header h2 {
  color: var(--primary);
  margin-bottom: 5px;
}

.login-header p {
  color: var(--text-light);
  margin-bottom: 30px;
  font-size: 0.9rem;
}

.form-group {
  margin-bottom: 20px;
  text-align: right;
}

/* Flip text align for LTR */
html[dir="ltr"] .form-group {
  text-align: left;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-dark);
}

.form-group input {
  width: 100%;
  padding: 12px;
  border: 2px solid #eee;
  border-radius: 8px;
  font-family: inherit;
  transition: border 0.3s;
}

.form-group input:focus {
  border-color: var(--primary);
  outline: none;
}

.btn-block {
  width: 100%;
  margin-top: 10px;
}

.form-message {
  background: #ffebee;
  color: #c62828;
  padding: 10px;
  border-radius: 8px;
  margin-bottom: 15px;
  font-size: 0.9rem;
  font-weight: 600;
}

.login-footer {
  margin-top: 20px;
  font-size: 0.9rem;
}

.login-footer a {
  color: var(--text-light);
  text-decoration: none;
}

.login-footer a:hover {
  color: var(--primary);
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25%,
  75% {
    transform: translateX(5px);
  }
  50% {
    transform: translateX(-5px);
  }
}
.shake {
  animation: shake 0.3s ease-in-out;
}

/* --- Dropdown Menu Styles --- */
.dropdown {
  position: relative;
}

.dropdown .arrow {
  font-size: 0.7rem;
  margin-inline-start: 5px;
  transition: transform 0.3s;
}

.dropdown:hover .arrow {
  transform: rotate(180deg);
}

.dropdown-content {
  display: none;
  position: absolute;
  top: 100%;
  right: 0; /* Align right for Arabic */
  background-color: white;
  min-width: 200px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  z-index: 1002;
  padding: 10px 0;
  list-style: none;
  text-align: start;
}

/* LTR Alignment */
html[dir="ltr"] .dropdown-content {
  right: auto;
  left: 0;
}

.dropdown-content li {
  margin: 0;
}

.dropdown-content a {
  color: var(--text-dark);
  padding: 12px 20px;
  text-decoration: none;
  display: block;
  font-size: 0.95rem;
  font-weight: 600;
  transition: 0.2s;
}

.dropdown-content a:hover {
  background-color: var(--bg-gray);
  color: var(--primary);
}

/* Show on Hover (Desktop) */
@media (min-width: 993px) {
  .dropdown:hover .dropdown-content {
    display: block;
    animation: fadeIn 0.3s ease;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Mobile Dropdown Styling */
@media (max-width: 992px) {
  .dropdown {
    width: 100%;
    text-align: center;
  }

  .dropdown-content {
    position: static; /* Stack normally on mobile */
    display: none; /* Hidden by default */
    box-shadow: none;
    background: rgba(255, 255, 255, 0.1); /* Slight highlight */
    width: 100%;
  }

  .dropdown-content a {
    color: white; /* White text for mobile menu */
    padding: 15px;
    font-size: 1.1rem;
  }

  /* We will use JS to toggle 'open' class on mobile */
  .dropdown.open .dropdown-content {
    display: block;
  }
}

/* --- Clickable Card Fixes --- */
a.card {
  text-decoration: none; /* Remove underline */
  color: inherit; /* Keep text color */
  display: block; /* Ensure it behaves like a box */
  height: 100%; /* Full height */
}

a.card:hover {
  transform: translateY(-10px); /* Keep the hover effect */
  cursor: pointer;
}

a.card h3 {
  color: inherit;
} /* Keep headers inheriting colors */

/* --- Angled Arrow Icon --- */
.icon-angled {
  width: 14px;
  height: 14px;
  margin-inline-start: 8px; /* Adds space depending on language direction */
  fill: none;
  stroke: currentColor; /* Takes the color of the text */
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.3s ease;
  vertical-align: middle;
  margin-bottom: 2px;
}

/* Hover Effect: Move diagonally */
a:hover .icon-angled,
button:hover .icon-angled {
  transform: translate(3px, -3px);
}

/* RTL Hover Fix: Move Top-Left instead of Top-Right */
html[dir="rtl"] a:hover .icon-angled,
html[dir="rtl"] button:hover .icon-angled {
  transform: translate(-3px, -3px);
}

/* =========================================
   UI Polish (Scrollbar & Selection)
   ========================================= */

/* Custom Scrollbar (Webkit browsers - Chrome/Safari/Edge) */
::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: 5px;
  border: 2px solid #f1f1f1; /* Creates padding effect */
}

::-webkit-scrollbar-thumb:hover {
  background: #3a006b; /* Darker purple on hover */
}

/* Custom Text Selection */
::selection {
  background: var(--cubs-yellow); /* Yellow background */
  color: var(--primary); /* Purple text */
}

/* For Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--primary) #f1f1f1;
}

/* =========================================
   Map Popup Styling
   ========================================= */
.leaflet-popup-content-wrapper {
  border-radius: 12px; /* Match site radius */
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
  padding: 0;
  overflow: hidden;
}

.leaflet-popup-content {
  margin: 15px;
  font-family: "AlJazeera", "Segoe UI", sans-serif;
  text-align: center;
  font-size: 1rem;
}

.leaflet-popup-tip {
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
}

/* Style the text inside the popup */
.leaflet-popup-content b {
  color: var(--primary);
  display: block;
  margin-bottom: 4px;
  font-size: 1.1rem;
}

.leaflet-popup-content span {
  font-weight: 600;
  font-size: 0.9rem;
}

/* Version Tag Styling */
.version-tag {
  opacity: 0.5;
  font-size: 0.85em;
  margin-inline-start: 15px; /* Adds space based on language direction */
  font-family: monospace; /* Gives it a technical look */
}
