/* Modern Navbar and Topbar Styling */

:root {
  --primary-color: #e03034;
  --primary-hover: #c42528;
  --secondary-color: #fdcf3b;
  --secondary-hover: #e8bd2f;
  --text-dark: #2d3748;
  --text-light: #ffffff;
  --bg-light: #ffffff;
  --topbar-bg: #e03034;
  /* Changed to red */
  --nav-bg: rgba(255, 255, 255, 0.95);
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 5px 20px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.15);
  --border-radius: 8px;
  --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.modern-header {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1050;
  width: 100%;
  background: #fff;
  /* Ensure white background for the whole header area */
  transition: transform 0.3s ease;
  box-shadow: 0 2px 15px rgba(0, 0, 0, 0.1);
}

/* Body padding to prevent content from jumping under fixed header */
body {
  padding-top: 115px;
  /* Adjust based on topbar + navbar height */
}

@media (max-width: 991px) {
  body {
    padding-top: 160px; /* Increased to prevent hero banner cutoff */
    /* Adjust for mobile if needed */
  }
}

/* Topbar */
.modern-topbar {
  background: var(--topbar-bg);
  color: var(--text-light);
  padding: 8px 0;
  font-size: 14px;
  font-family: 'Inter', system-ui, sans-serif;
  position: relative;
  z-index: 1000;
}

.modern-topbar .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.topbar-info {
  display: flex;
  gap: 20px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.topbar-info li {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-info i {
  color: var(--secondary-color);
}

.topbar-info a {
  color: var(--text-light);
  text-decoration: none;
  transition: var(--transition);
}

.topbar-info a:hover {
  color: var(--secondary-color);
}

.topbar-social {
  display: flex;
  gap: 12px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.topbar-social a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-light);
  text-decoration: none;
  transition: var(--transition);
}

.topbar-social a:hover {
  background: var(--secondary-color);
  color: var(--text-dark);
  transform: translateY(-2px);
}

/* Navbar */
.modern-navbar-wrapper {
  background: var(--nav-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--shadow-md);
  transition: var(--transition);
}

.modern-navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 0;
}

.navbar-brand img {
  max-height: 50px;
  transition: var(--transition);
}

.nav-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  /* Increased gap for a more premium, spread-out look */
  list-style: none;
  margin: 0 auto;
  padding: 0;
  flex-wrap: nowrap;
}

.nav-item {
  position: relative;
}

.nav-link {
  color: var(--text-dark);
  font-weight: 600;
  font-size: 14px;
  /* Slightly larger for better readability */
  text-transform: uppercase;
  text-decoration: none;
  padding: 10px 0;
  font-family: 'Poppins', 'Inter', system-ui, sans-serif;
  /* Preferred Poppins for professional look */
  letter-spacing: 0.5px;
  /* Better letter spacing */
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 6px;
  position: relative;
  white-space: nowrap !important;
}

.nav-link:hover {
  color: var(--primary-color);
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--primary-color);
  transition: all 0.3s ease;
  transform: translateX(-50%);
}

.nav-link:hover::after {
  width: 100%;
}

.nav-icon {
  width: 24px;
  height: 24px;
  object-fit: contain;
  margin-right: 8px;
}



.nav-item.dropdown:hover>.dropdown-menu {
  opacity: 1 !important;
  visibility: visible !important;
  transform: translateY(0) !important;
  pointer-events: auto !important;
}

/* Dropdown Menu */
.dropdown-menu {
  display: block !important;
  /* Override Bootstrap display:none */
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 280px;
  background: var(--bg-light);
  box-shadow: var(--shadow-lg);
  border-radius: var(--border-radius);
  padding: 10px 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(15px);
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  z-index: 100;
  list-style: none;
  margin: 0;
  max-height: 70vh;
  /* Allow scrolling for long dropdowns like Treatments */
  overflow-y: auto;
}

/* 3-Column Mega Menu for Treatments */
@media (min-width: 992px) {
  .dropdown-menu.mega-menu {
    width: 900px;
    max-width: 95vw;
    left: 50%;
    transform: translateX(-50%) translateY(15px);
    display: flex !important;
    flex-wrap: wrap;
    padding: 20px;
    max-height: none;
    overflow-y: visible;
  }

  .nav-item.dropdown:hover>.dropdown-menu.mega-menu {
    transform: translateX(-50%) translateY(0) !important;
  }

  .mega-menu>li {
    width: 33.33%;
  }
}

/* Scrollbar styling for dropdown removed to enforce native scrolling */

/* Remove mega menu specific properties */
.dropdown-menu .nav-link {
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 500;
  text-transform: capitalize;
  letter-spacing: normal;
  white-space: normal;
  /* Allow dropdown text to wrap if it's too long */
  border-bottom: 1px solid #f5f5f5;
}

.dropdown-menu .nav-item:last-child .nav-link {
  border-bottom: none;
}

.dropdown-menu .nav-link::after {
  display: none;
}

.dropdown-menu .nav-link:hover {
  background: rgba(224, 48, 52, 0.05);
  padding-left: 25px;
  color: var(--primary-color);
}

/* CTA Button */
.cta-button {
  background: linear-gradient(135deg, var(--primary-color) 0%, #ff4b4f 100%);
  color: var(--secondary-color) !important;
  padding: 8px 18px;
  border-radius: 30px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  position: relative;
  overflow: hidden;
  border: 2px solid var(--secondary-color);
  box-shadow: 0 4px 15px rgba(224, 48, 52, 0.3);
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  font-size: 13px;
}

.cta-button::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -60%;
  width: 20%;
  height: 200%;
  background: rgba(255, 255, 255, 0.3);
  transform: rotate(45deg);
  animation: shine 3s infinite;
}

.cta-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(224, 48, 52, 0.4);
  background: linear-gradient(135deg, #ff4b4f 0%, var(--primary-color) 100%);
}

@keyframes shine {
  0% {
    left: -60%;
  }

  20% {
    left: 150%;
  }

  100% {
    left: 150%;
  }
}

@keyframes pulse-border {
  0% {
    box-shadow: 0 0 0 0 rgba(224, 48, 52, 0.4);
  }

  70% {
    box-shadow: 0 0 0 10px rgba(224, 48, 52, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(224, 48, 52, 0);
  }
}

.blink-modern {
  animation: pulse-border 2s infinite;
}

/* Mobile Toggle */
.mobile-toggle {
  display: none;
  font-size: 24px;
  color: var(--text-dark);
  background: none;
  border: none;
  cursor: pointer;
  transition: var(--transition);
}

.mobile-toggle:focus {
  outline: none;
}

/* Responsive */
@media (max-width: 1199px) {
  .nav-links {
    gap: 10px;
  }

  .nav-link {
    font-size: 13px;
    padding: 10px 0;
  }
}

@media (max-width: 991px) {
  .topbar-info li:first-child {
    display: none;
  }

  .modern-topbar .container {
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
  }

  .mobile-toggle {
    display: block;
  }

  .nav-links {
    position: fixed;
    top: 0;
    right: -100%;
    width: 300px !important; /* Fixed width */
    max-width: 85vw !important; /* Fallback for very small screens */
    height: 100vh;
    background: #fff;
    flex-direction: column;
    align-items: stretch !important; /* Force all children to respect the fixed width exactly */
    padding: 60px 0 30px; /* Adjusted to prevent overlap with the X button */
    box-shadow: -5px 0 25px rgba(0, 0, 0, 0.1);
    transition: 0.4s cubic-bezier(0.77, 0, 0.175, 1);
    overflow-y: auto !important;
    overflow-x: hidden !important; /* Avoid horizontal shifts */
    z-index: 2000 !important; /* Higher than header to prevent obscurement */
  }

  .nav-links.active {
    right: 0;
  }

  .nav-item {
    width: 100% !important;
    max-width: 100% !important; /* Force constraint */
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
    overflow: hidden; /* Ensure nothing breaks out */
    box-sizing: border-box !important;
  }
  
  .nav-link {
    width: 100% !important;
    max-width: 100% !important; /* Force constraint */
    box-sizing: border-box !important;
    padding: 16px 20px;
    justify-content: space-between;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.3px;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    white-space: normal !important;
    word-break: break-word !important;
    overflow-wrap: break-word !important;
    line-height: 1.4;
  }

  .nav-link::after {
    display: none !important;
  }

  .nav-item.dropdown>.nav-link i {
    font-size: 11px;
    transition: transform 0.3s ease;
    opacity: 0.5;
  }

  .nav-item.dropdown.open>.nav-link {
    background: #fdfdfd;
    color: var(--primary-color) !important;
  }

  .nav-item.dropdown.open>.nav-link i {
    transform: rotate(180deg);
    opacity: 1;
  }

  /* --- CLEAN MOBILE DROPDOWN REWRITE --- */
  .dropdown-menu,
  .dropdown-menu.mega-menu {
    position: static !important;
    display: none !important;
    width: 100% !important;
    max-width: 100% !important; /* Stay within sidebar */
    min-width: 100% !important;
    box-sizing: border-box !important; /* Include padding in width */
    left: 0 !important;
    right: 0 !important; /* Lock to sides */
    transform: none !important;
    background: #ffffff !important;
    padding: 0 !important;
    box-shadow: none !important;
    max-height: 0;
    overflow: hidden; /* Prevent horizontal burst */
    transition: max-height 0.4s ease;
    border-radius: 0 !important;
    margin: 0 !important;
    border: none !important;
    opacity: 1 !important;
    visibility: visible !important;
  }

  /* Specifically break any desktop flex layouts on the mega menu */
  .dropdown-menu.mega-menu {
    display: none !important; /* Default state */
    flex-wrap: nowrap !important;
    flex-direction: column !important;
  }

  /* Open state - smooth accordion with safe vertical scrollbar */
  .nav-item.dropdown.open>.dropdown-menu,
  .nav-item.dropdown.open>.dropdown-menu.mega-menu {
    display: block !important;
    max-height: 70vh !important; /* User requested scrollable dropdown inside sidebar */
    height: auto !important; 
    overflow-y: auto !important; /* Enable vertical scroll for long lists */
    overflow-x: hidden !important; /* Absolutely forbid horizontal bursting */
    border-top: 1px solid rgba(0, 0, 0, 0.05) !important;
  }

  /* Menu Item Resets */
  .dropdown-menu li,
  .mega-menu li,
  .mega-menu>li {
    width: 100% !important;
    max-width: 100% !important; /* Force constraint */
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    clear: both !important;
    float: none !important;
    box-sizing: border-box !important;
  }

  /* Clean, standard link styling */
  .dropdown-menu .nav-link {
    box-sizing: border-box !important;
    display: block !important; /* Use block for maximum stability with wrapping text */
    width: 100% !important;
    padding: 14px 20px 14px 35px !important; /* Standard left hierarchy indent */
    font-size: 14px !important;
    font-weight: 500 !important;
    color: #444444 !important;
    text-align: left !important;
    white-space: normal !important; /* Allow long medical terms to wrap */
    word-wrap: break-word !important;
    line-height: 1.5 !important;
    text-transform: capitalize !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.03) !important;
    border-left: 3px solid transparent !important;
    background: transparent !important;
    transition: all 0.2s ease !important;
  }

  /* Icons inside links */
  .dropdown-menu .nav-link .nav-icon {
    display: inline-block !important;
    vertical-align: middle !important;
    width: 18px !important;
    height: 18px !important;
    margin-right: 10px !important;
    margin-left: 0 !important;
    margin-top: -2px !important; /* Fine tune vertical alignment with text */
    opacity: 0.9 !important;
  }

  .dropdown-menu .nav-link:hover {
    background: rgba(224, 48, 52, 0.04) !important;
    color: var(--primary-color) !important;
    padding-left: 42px !important; /* Subtle shift */
    border-left: 3px solid var(--primary-color) !important;
  }

  @keyframes fadeIn {
    from {
      opacity: 0;
      transform: translateY(-5px);
    }

    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .close-menu {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 24px;
    color: var(--text-dark);
    cursor: pointer;
    display: block !important;
  }

  .mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2050; /* Just below the sidebar */
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
  }

  .mobile-overlay.active {
    opacity: 1;
    visibility: visible;
  }
}

.close-menu {
  display: none;
}