/* Reset basic margins for a clean start */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: Arial, sans-serif;
}

/* Push website content down so the fixed navbar doesn't cover it */
.content {
  padding-top: 70px; 
  padding-left: 20px;
  padding-right: 20px;
}

/* Core Navbar Styling */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 50px;
  background-color: #ffffff;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1); 
  display: flex;
  flex-direction: row;
  justify-content: space-between; /* Pushes logo left, links right */
  align-items: center;
  padding: 0 20px;
  z-index: 9999;
}

/* Left Side Logo container alignment */
.nav-logo {
  display: flex;
  align-items: center;
  height: 100%;
}

/* Keeps the text and the scales image perfectly side-by-side and centered */
.nav-logo a {
  display: flex;
  align-items: center;
  gap: 8px; /* Creates a clean, elegant spacing between text and the image */
  text-decoration: none;
}

/* Styles your text to look bold, dark red, and matched to the navbar size */
.nav-logo .logo-text {
  color: black;
  font-size: 24px;
  font-weight: bold;
}

/* Logo Image auto-sizing to fit nicely inside the 50px navbar */
.logo-image {
  height: 45px; /* Slightly reduced height to match the text height perfectly */
  width: auto;  /* Keeps your image proportions perfectly crisp */
  display: block;
}

/* Right Side Links Layout */
.nav-links {
  display: flex;
  flex-direction: row;
  height: 100%;
  align-items: center;
}

/* Shared styles for normal links and the dropdown button */
.nav-links a, 
.dropdown .dropbtn {
  display: inline-block;
  color: #8B0000;
  text-align: center;
  padding: 0 20px;
  text-decoration: none;
  font-size: 16px;
  background: none;
  border: none;
  cursor: pointer;
  height: 50px;       
  line-height: 50px;  

    /* FIXED: Cross-platform explicit font weights for iOS Safari */
  font-weight: 800 !important; 
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Background hover color for right-side items */
.nav-links a:hover, 
.dropdown:hover .dropbtn {
  background-color: #E7E7E7;
}

/* Container for Dropdown */
.dropdown {
  position: relative;
  height: 100%;
}

/* Dropdown Hidden Box */
.dropdown-content {
  display: none;
  position: absolute;
  top: 50px;
  right: 0; /* Aligns to the right edge so it stays on screen */
  background-color: #f9f9f9;
  width: 220px; /* Fixed width forces text to wrap instead of stretching */
  max-width: 90vw; /* Prevents overflow on very small screens */
  box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
  z-index: 10000;
}

/* Individual links inside the dropdown drawer */
.dropdown-content a {
  color: #333333;
  padding: 6px 16px;
  text-decoration: none;
  display: block;
  text-align: left;
  height: auto;
  line-height: 1.2;
  white-space: normal; /* Explicitly allows text to wrap */
  word-wrap: break-word; /* Breaks long words if needed */
}

/* Hover style inside the dropdown menu */
.dropdown-content a:hover {
  background-color: #f1f1f1;
  color: #8B0000;
}

/* Show the dropdown menu when hovering over the container */
.dropdown:hover .dropdown-content {
  display: block;
}

/* ==========================================================================
   MOBILE RESPONSIVE PATCH FOR IPHONE AND SMALL SCREENS
   ========================================================================== */
/* ==========================================================================
   1. PORTRAIT MOBILE (Fixes top navbar overflowing off the right edge)
   ========================================================================== */
@media screen and (max-width: 620px) {
  .navbar {
    height: auto !important;
    min-height: 50px;
    flex-wrap: wrap;
    padding: 4px 0 !important;
    justify-content: center;
  }

  .nav-logo {
    width: 100%;
    justify-content: center;
    height: 32px;
  }

  .nav-logo .logo-text {
    font-size: 15px;
    white-space: nowrap;
  }

  .logo-image {
    height: 20px !important;
    width: auto !important;
  }

  .nav-links {
    width: 100%;
    justify-content: space-between;
    height: 34px;
    padding: 0 6px !important; /* Keeps a clean 6px margin from both screen edges */
    box-sizing: border-box;
  }

  .nav-links a, 
  .dropdown .dropbtn {
    -webkit-appearance: none; /* Removes hidden iOS Safari button padding */
    appearance: none;
    height: 34px !important;
    line-height: 34px !important;
    padding: 0 1px !important;
    margin: 0 !important;
    font-size: 10px !important; /* Fits "Comments" cleanly on narrow 375px iPhones */
    font-weight: 700 !important;
    white-space: nowrap !important;
    letter-spacing: -0.2px; /* Slightly tightens character spacing to save ~8px */
  }

  .dropdown-content {
    top: 34px !important;
  }

  .content {
    padding-top: 85px !important;
  }
}



/* ==========================================================================
   2. ALL TOUCH / LANDSCAPE SCREENS (Fixes dropdown height & spacing)
   ========================================================================== */
@media screen and (max-width: 950px), screen and (max-height: 500px) {
  .dropdown-content {
    min-width: 0 !important;
    width: 185px !important;
    max-width: 65vw !important;
    /* Caps height to fit inside the visible screen and enables scrolling */
    max-height: calc(100dvh - 85px) !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  /* Tightens vertical spacing between dropdown links */
  .dropdown-content a {
    height: auto !important;
    min-height: 0 !important;
    line-height: 1.2 !important;
    padding: 6px 10px !important;
    font-size: 13px !important;
    white-space: normal !important;
    word-wrap: break-word;
  }
}

/* ==========================================================================
   3. DROPDOWN ALIGNMENT & ACTIVE STATES
   ========================================================================== */
.dropdown.active .dropdown-content {
  display: block;
}

/* Left-side dropdown (Guidance) opens toward the right */
.dropdown:not(.menu-right) .dropdown-content {
  left: 0 !important;
  right: auto !important;
}

/* Right-side dropdowns (Government, My View) open toward the left so they never clip */
.dropdown.menu-right .dropdown-content {
  right: 0 !important;
  left: auto !important;
}

