html,
body {
  scrollbar-width: none;
}
html::-webkit-scrollbar,
body::-webkit-scrollbar {
  display: none;
}
.hide-scrollbar {
  scrollbar-width: none;
}
.hide-scrollbar::-webkit-scrollbar {
  display: none;
}
.no-scroll {
  overflow: hidden;
}

/* Mobile Navbar Improvements */
@media (max-width: 991px) {
  .navbar-collapse {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    z-index: 1050; /* Above everything */
    padding: 80px 20px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
    transform: translateY(-100%);
    opacity: 0;
  }

  .navbar-collapse.collapsing {
    /* Bootstrap adds .collapsing during transition, force our styles */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    z-index: 1050;
    padding: 80px 20px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
  }

  .navbar-collapse.show {
    transform: translateY(0);
    opacity: 1;
  }

  .navbar-nav {
    width: 100%;
    text-align: center;
    gap: 15px;
  }

  .navbar-nav .nav-link {
    color: #112127 !important;
    font-size: 1.2rem;
    font-weight: 700;
    padding: 10px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  }

  .navbar-nav .nav-link:hover,
  .navbar-nav .nav-link:focus {
    color: var(--color-primary) !important;
    background: transparent;
  }

  /* Adjust auth buttons in mobile menu */
  .auth-actions {
    margin-top: 20px;
    width: 100%;
    justify-content: center;
    flex-direction: column;
  }
  .auth-actions .btn {
    width: 100%;
    max-width: 250px;
  }

  /* Ensure toggler is visible above the overlay */
  .navbar-toggler {
    z-index: 1100;
    border-color: transparent !important; /* Cleaner look */
  }
  .navbar-toggler:focus {
    box-shadow: none;
  }

  /* Fix logo visibility if needed */
  .navbar-brand {
    z-index: 1100;
  }

  /* Update toggler icon for visibility on white background if sticky */
  .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(0, 0, 0, 0.75)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e") !important;
  }
}

/* Footer Styles */
.site-footer {
  background-color: #112127; /* Deep rich dark teal/black */
  padding-top: 80px;
  padding-bottom: 30px;
  position: relative;
  overflow: hidden;
}

/* Optional subtle pattern overlay */
.site-footer::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: radial-gradient(
      circle at 10% 10%,
      rgba(255, 255, 255, 0.03) 0%,
      transparent 50%
    ),
    radial-gradient(
      circle at 90% 90%,
      rgba(255, 255, 255, 0.03) 0%,
      transparent 50%
    );
  pointer-events: none;
}

.footer-heading {
  font-weight: 700;
  position: relative;
  display: inline-block;
}

.footer-heading::after {
  content: "";
  position: absolute;
  bottom: -10px;
  right: 0; /* RTL alignment */
  width: 40px;
  height: 2px;
  background-color: var(
    --color-primary,
    #0088cc
  ); /* Fallback if var not defined */
  border-radius: 2px;
}

.footer-links li {
  margin-bottom: 12px;
}

.footer-links a {
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  transition: all 0.3s ease;
  display: inline-block;
}

.footer-links a:hover {
  color: #fff;
  transform: translateX(-5px); /* Move left on hover for RTL */
}

/* Specific LTR override for contact links if needed to prevent RTL flip issues with numbers/emails, 
   though dir="ltr" on the element handles text direction manually. */
.contact-info a {
  font-family: "Cairo", sans-serif; /* Keep font consistent */
}

/* Social Icons */
.social-icons .icon {
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.1rem;
  transition: all 0.3s ease;
}

.social-icons .icon:hover {
  background: var(--color-primary, #0088cc);
  transform: translateY(-3px);
  color: #fff;
}

.border-white-10 {
  border-color: rgba(255, 255, 255, 0.1) !important;
}

/* Component Flip Card Styles */
.component-card {
  perspective: 1000px;
  cursor: pointer;
  height: 400px; /* Fixed height is critical */
  position: relative;
  z-index: 1;
}

.component-flip {
  position: relative;
  width: 100%;
  height: 100%;
  text-align: center;
  transition: transform 0.8s;
  transform-style: preserve-3d;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
  border-radius: 16px;
}

.component-flip.flipped {
  transform: rotateY(180deg);
}

.component-face {
  position: absolute;
  width: 100%;
  height: 100%;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  border-radius: 16px;
  overflow: hidden;
  background: #fff;
  top: 0;
  left: 0;
}

.component-face.front {
  display: flex;
  flex-direction: column;
  z-index: 2;
  transform: rotateY(0deg); /* Explicitly set default state */
}

.component-face.back {
  background: #112127; /* Dark theme */
  color: white;
  transform: rotateY(180deg);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 2rem;
  z-index: 1;
}

/* Ensure z-index swaps for better browser support */
.component-flip.flipped .component-face.front {
  z-index: 1;
}
.component-flip.flipped .component-face.back {
  z-index: 2;
}

.component-image {
  height: 200px;
  overflow: hidden;
  width: 100%;
}

.component-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.component-card:hover .component-image img {
  transform: scale(1.05);
}

.component-content {
  padding: 1.5rem;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.component-title {
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: #112127;
}

.component-face.back .component-title {
  color: #fff;
  border-bottom: 2px solid var(--color-primary, #0088cc);
  padding-bottom: 10px;
  display: inline-block;
}

.component-desc {
  color: #6c757d;
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
  flex-grow: 1; /* Push button down */
}

.component-link {
  color: var(--color-primary, #0088cc);
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s;
}

.component-link:hover {
  text-decoration: underline;
}

/* Navbar & Dropdown Styling */
.navbar-nav .nav-link {
  font-weight: 600;
  transition: color 0.3s ease;
}

/* Global Dropdown Styling - Dark Glass Theme */
.dropdown-menu {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  padding: 0.5rem;
  background-color: rgba(17, 33, 39, 0.95); /* Deep Teal with Transparency */
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  margin-top: 0px;
}

/* Dropdown Item Styling */
.dropdown-item {
  border-radius: 8px;
  padding: 10px 15px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.85); /* Off-white text */
  transition: all 0.2s ease;
  margin-bottom: 2px;
}

.dropdown-item:last-child {
  margin-bottom: 0;
}

.dropdown-item:hover,
.dropdown-item:focus,
.dropdown-item.active {
  background-color: rgba(255, 255, 255, 0.1);
  color: #fff;
  transform: translateX(-5px); /* Move slightly left for RTL */
}

/* Ensure aligned under parent */
.navbar-nav .dropdown-menu {
  top: 100%;
  left: auto; /* Allow bootstrap to handle or set right:0 for RTL */
}

/* Navbar Hover Animation (Desktop) */
@media (min-width: 992px) {
  .navbar-nav .dropdown:hover > .dropdown-menu {
    display: block;
    animation: fadeInUp 0.3s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
  }

  /* Remove default Bootstrap margin adjustments that might conflict */
  .navbar-nav .dropdown-menu {
    display: none;
    margin-top: 0;
  }
}

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

/* Nested Dropdown Support */
.dropdown-menu .dropdown-submenu {
  position: relative;
}

.dropdown-menu .dropdown-submenu > .dropdown-menu {
  top: 0;
  right: 100%; /* RTL: open to the left */
  margin-top: -5px;
  margin-right: 5px; /* Gap for nested */
  display: none;
  /* Handle long lists like Governance policies */
  max-height: 50vh;
  overflow-y: auto;
  min-width: 250px;
  border-radius: 12px;
  box-shadow: 0 5px 25px rgba(0, 0, 0, 0.15);
}

/* Custom scrollbar for dropdowns */
.dropdown-menu::-webkit-scrollbar {
  width: 5px;
}
.dropdown-menu::-webkit-scrollbar-thumb {
  background-color: #cbd5e1;
  border-radius: 10px;
}
.dropdown-menu::-webkit-scrollbar-track {
  background: transparent;
}

.dropdown-menu .dropdown-submenu:hover > .dropdown-menu {
  display: block;
  animation: fadeInRight 0.3s ease forwards;
}

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

/* Submenu arrow for RTL */
.dropdown-item.dropdown-toggle::after {
  content: "";
  display: inline-block;
  border: solid currentColor;
  border-width: 0 0 2px 2px; /* Bottom-Left arrow shape */
  padding: 3px;
  transform: rotate(45deg); /* Points Left */
  margin-right: auto;
  margin-left: 5px;
  vertical-align: middle;
  opacity: 0.6;
  transition: all 0.2s;
}

.dropdown-item.dropdown-toggle:hover::after {
  /* Ensure arrow stays white on hover */
  /* removed invert(1) as text is now white */
  opacity: 1;
  transform: rotate(45deg) translateX(-3px);
}

/* Mega Menu Definitions */
.navbar-nav .nav-item.dropdown.mega-dropdown {
  position: static; /* Allows menu to be wider if needed, or relative context */
}

@media (min-width: 992px) {
  .dropdown-menu.mega-menu {
    width: 650px; /* Wide menu */
    left: auto;
    right: 0; /* Align to the right edge of the nav item or container if static */
    padding: 0;
    overflow: hidden;
    background-color: rgba(
      17,
      33,
      39,
      0.95
    ); /* Deep Teal #112127 with 0.95 alpha */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    border-radius: 16px;
    display: none; /* Controlled by hover animation */
    margin-top: 0px;
  }

  .navbar-nav .nav-item.mega-dropdown:hover > .dropdown-menu.mega-menu {
    display: flex; /* Flex layout for columns */
    animation: fadeInUp 0.3s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
  }
}

.mega-menu-row {
  display: flex;
  width: 100%;
}

.mega-column {
  flex: 1;
  padding: 25px;
  position: relative;
}

.mega-column:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 25px;
  bottom: 25px;
  left: 0;
  width: 1px;
  background: linear-gradient(
    to bottom,
    transparent,
    rgba(255, 255, 255, 0.15),
    transparent
  );
}

.mega-header {
  color: #fff;
  font-size: 1.1rem;
  font-weight: 800;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.mega-header::before {
  content: "";
  display: block;
  width: 4px;
  height: 20px;
  background-color: var(--color-primary, #0088cc);
  border-radius: 4px;
}

.mega-menu-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.mega-menu-list li {
  margin-bottom: 8px;
}

.mega-menu .dropdown-item {
  color: rgba(255, 255, 255, 0.85); /* Off-white text */
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  transition: all 0.2s ease;
  background: transparent; /* Reset */
}

.mega-menu .dropdown-item:hover {
  color: #fff;
  background-color: rgba(255, 255, 255, 0.1);
  transform: translateX(-5px);
  padding-right: 18px; /* Slight expansion */
}

.mega-menu .dropdown-item::before {
  content: "•";
  margin-left: 8px;
  color: var(--color-primary, #0088cc);
  font-weight: bold;
  opacity: 0.5;
  transition: opacity 0.2s;
}

.mega-menu .dropdown-item:hover::before {
  opacity: 1;
}

/* Scrollable container for long governance list overrides */
.mega-menu .scrollable-list {
  max-height: 400px;
  overflow-y: auto;
  padding-left: 10px; /* Space for scrollbar */
}

/* Custom scrollbar for dark theme */
.mega-menu .scrollable-list::-webkit-scrollbar {
  width: 4px;
}
.mega-menu .scrollable-list::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.2);
  border-radius: 10px;
}
.mega-menu .scrollable-list::-webkit-scrollbar-track {
  background: transparent;
}
