/* common.css */

/* ================================================
   Base Layout
================================================ */
body, html {
  margin: 0;
  padding: 0;
  font-family: Arial, sans-serif;
  background-color: #2a6a4f; /* matches top & bottom ribbons */
}

/* Allow bottom ribbon to push to bottom on all pages */
body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* General label styling */
label {
  display: block;
  font-size: 0.9em;
  cursor: pointer;
}

/* Checkboxes */
.checkbox-group {
  margin-left: 12px;
  margin-bottom: 0.3em;
}

.checkbox-group input[type="checkbox"] {
  margin-right: 0.5em;
  cursor: pointer;
}

/* ================================================
   Leaflet Popups (shared for all maps)
================================================ */
.leaflet-popup-content {
  font-size: 0.9em;
  line-height: 1.2em;
}

/* ================================================
   Top & Bottom Ribbons
================================================ */
.ribbon {
  width: 100%;
  background-color: #2a6a4f;
  color: #fff;
  display: flex;
  align-items: center; /* vertical centering */
  justify-content: space-between;
  height: 70px; /* fixed height for consistent alignment */
  padding: 0 1.5em; /* horizontal padding only */
  font-size: 1em;
  box-sizing: border-box;
  position: sticky;
  top: 0;
  z-index: 2000;
  border: none;
  box-shadow: none;
}

/* Links, spans, and buttons inside ribbon */
.ribbon a,
.ribbon span {
  color: #fff;
  text-decoration: none;
  font-weight: 500;
}

.ribbon a:hover {
  text-decoration: underline;
}

/* Button styling inside top ribbon */
.ribbon button {
  background-color: transparent;
  color: #fff;
  border: 1px solid #fff;
  border-radius: 4px;
  padding: 0.45em 1em;
  font-size: 0.95em;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
}

.ribbon button:hover {
  background-color: #fff;
  color: #2a6a4f;
}

/* Bottom ribbon */
.bottom-ribbon {
  background-color: #2a6a4f;
  width: 100%;
  position: static;   /* no sticky behaviour */
  margin-top: auto;   /* pushes it to the bottom in flex layouts */
  border: none;
  box-shadow: none;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75em 1.5em;
  padding: 0.75em 1.5em;
  box-sizing: border-box;
  font-size: 0.9em;
}

.bottom-ribbon a {
  color: #fff;
  text-decoration: none;
  font-weight: 500;
}

.bottom-ribbon a:hover {
  text-decoration: underline;
}

/* Stack the footer brand name and tagline. */
.footer-brand {
  display: flex;
  flex-direction: column;
  gap: 0.15em;
}

/* Bolden the Align brand label in the footer. */
.footer-brand-name {
  font-weight: 600;
}

/* Layout footer navigation links with even spacing. */
.footer-links {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.25em;
}

/* Collapse footer layout for handheld viewports. */
@media (max-width: 640px) {
  .bottom-ribbon {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5em;
  }
}

/* ================================================
   Logo in Top Ribbon
================================================ */
#logoHT {
  height: 125px;         /* Adjust as needed */
  width: auto;
  display: block;
  object-fit: contain;
  margin-left: -40px;    /* Shift logo slightly left */
  padding: 0;
}

#logoLink {
  display: flex;
  align-items: center;
  justify-content: flex-start; /* Align logo to the left */
  height: 100%;
}

/* Navigation links positioning */
#menuLinks {
  display: flex;
  gap: 1.2em;
  margin-left: auto;    /* push links toward the right */
  margin-right: 1em;    /* keep small gap before Login */
  flex-wrap: nowrap;
  align-items: center;
}

#menuLinks .active-link {
  font-weight: 700;
  border-bottom: 2px solid rgba(255, 255, 255, 0.85);
  padding-bottom: 0.1em;
}

#menuLinks a {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

/* Provide relative positioning for the unread badge on the messaging link. */
#menuLinks .conversations-link {
  position: relative;
}

/* Red dot that shows unread conversations in the header. */
.nav-badge {
  position: absolute;
  top: -7px;
  right: -10px;
  min-width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #e53935;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  box-sizing: border-box;
}

/* Shared styling for links pointing to member profiles. */
.user-link {
  color: #1e6e53;
  font-weight: 600;
  text-decoration: none;
}

/* Focus/hover state for the member profile link. */
.user-link:hover {
  text-decoration: underline;
}

/* Disabled profile links, e.g. when referencing missing authors. */
.user-link.disabled {
  color: #7a8c84;
  pointer-events: none;
  cursor: default;
}

/* ================================================
   Share Controls
================================================ */
.share-menu-wrapper {
  position: relative;
  display: inline-flex;
}

.share-toggle {
  border: none;
  background: #f3f7f4;
  border-radius: 999px;
  width: 48px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #355847;
  box-shadow: inset 0 0 0 1px #d1dfd7;
  transition: background 0.2s ease, transform 0.15s ease;
  position: relative;
}

.share-toggle svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

.share-toggle:hover {
  background: #e4efe7;
  transform: translateY(-1px);
}

.share-toggle:focus-visible {
  outline: 2px solid #2a6a4f;
  outline-offset: 2px;
}

.share-toggle--small {
  width: 40px;
  height: 40px;
}

.share-toggle--small svg {
  width: 20px;
  height: 20px;
}

.share-menu {
  position: absolute;
  top: calc(100% + 0.4rem);
  right: 0;
  min-width: 210px;
  background: #fff;
  border-radius: 14px;
  padding: 0.4rem;
  border: 1px solid #dfeae0;
  box-shadow: 0 20px 40px rgba(15, 30, 30, 0.15);
  display: none;
  flex-direction: column;
  gap: 0.15rem;
  z-index: 1000;
}

.share-menu.is-open {
  display: flex;
}

.share-menu-item {
  border: none;
  background: transparent;
  text-align: left;
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  font-size: 0.95rem;
  color: #1f2e2a;
  cursor: pointer;
}

.share-menu-item:hover,
.share-menu-item:focus-visible {
  background: #f0f6f2;
  color: #1a5038;
  outline: none;
}

.share-menu-item + .share-menu-item {
  margin-top: 0.1rem;
}

.share-toggle[data-share-feedback]::after {
  position: absolute;
  bottom: calc(100% + 0.35rem);
  right: 50%;
  transform: translateX(50%);
  background: #1b4c37;
  color: #fff;
  font-size: 0.75rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  white-space: nowrap;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.15);
  pointer-events: none;
  content: attr(data-share-feedback);
}

.share-toggle[data-share-feedback="error"]::after {
  content: "Copy failed";
  background: #b00020;
}

.share-toggle[data-share-feedback="copied"]::after {
  content: "Link copied";
}
