/* ==========================================================
   app-nav.css - floating app-style bottom bar for Halaalu Gulhun
   Styles the existing <nav id="nav" class="app-nav"> that app.js fills.
   Selectors are deliberately specific so they win over old #nav rules
   in style.css.
   ========================================================== */
:root {
  --nav-purple: #5b2a8c;
  --nav-purple-deep: #3f1f66;
  --nav-gold: #f5c76a;
  --nav-gold-light: #ffe09a;
  --nav-ring: #f3ecfb; /* set to your page background colour */
  --nav-badge: #e5484d;
}

nav#nav.app-nav {
  position: fixed;
  top: auto;
  left: 12px;
  right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  z-index: 40;
  width: auto;
  height: auto;
  max-width: 460px;
  margin: 0 auto;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 0;
  border: 0;
  border-radius: 28px;
  transform: none;
  backdrop-filter: none;
  background: linear-gradient(160deg, var(--nav-purple), var(--nav-purple-deep));
  box-shadow: 0 10px 30px rgba(63, 31, 102, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

nav#nav.app-nav a {
  position: relative;
  flex: 1;
  min-width: 44px;
  min-height: 52px;
  height: auto;
  width: auto;
  padding: 4px 2px;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: 0;
  border-radius: 20px;
  background: none;
  color: rgba(255, 255, 255, 0.78);
  text-decoration: none;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.15;
  text-align: center;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.2s, color 0.2s, transform 0.15s;
}

nav#nav.app-nav .ic {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

nav#nav.app-nav svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

nav#nav.app-nav .lb {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
}

/* Thaana needs a bigger size to stay readable */
html[lang="dv"] nav#nav.app-nav .lb {
  font-size: 13px;
  line-height: 1.3;
}

nav#nav.app-nav a[aria-current="page"],
nav#nav.app-nav a.on {
  color: #fff;
  background: rgba(255, 255, 255, 0.16);
}
nav#nav.app-nav a[aria-current="page"] svg,
nav#nav.app-nav a.on svg {
  stroke: var(--nav-gold);
}

nav#nav.app-nav a:active {
  transform: scale(0.94);
}
nav#nav.app-nav a:focus-visible {
  outline: 2px solid var(--nav-gold);
  outline-offset: 2px;
}

/* ---------- Centre Join button: same size and alignment as other tabs ---------- */
nav#nav.app-nav a.cta {
  flex: 1;
  width: auto;
  height: auto;
  min-height: 52px;
  margin: 0;
  padding: 4px 2px;
  color: rgba(255, 255, 255, 0.78);
  background: none;
  border-radius: 20px;
  box-shadow: none;
}
nav#nav.app-nav a.cta svg {
  stroke: currentColor;
  stroke-width: 1.8;
}
nav#nav.app-nav a.cta.on,
nav#nav.app-nav a.cta[aria-current="page"] {
  color: #fff;
  background: rgba(255, 255, 255, 0.16);
}
nav#nav.app-nav a.cta.on svg,
nav#nav.app-nav a.cta[aria-current="page"] svg {
  stroke: var(--nav-gold);
}

/* ---------- Badge (interests count) ---------- */
nav#nav.app-nav .badge {
  position: absolute;
  top: -6px;
  inset-inline-start: 55%;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  color: #fff;
  background: var(--nav-badge);
  border-radius: 9px;
  box-shadow: 0 0 0 2px var(--nav-purple-deep);
}

/* ---------- Small legal line (replaces the big purple footer) ---------- */
.legal {
  margin: 28px 0 0;
  padding: 0 16px;
  text-align: center;
  font-size: 12px;
  line-height: 2;
  background: none;
  border: 0;
  box-shadow: none;
}
.legal a {
  margin: 0 4px;
  color: var(--nav-purple);
  text-decoration: underline;
  white-space: nowrap;
}
html[lang="dv"] .legal {
  font-size: 14px;
}

/* Keep content clear of the floating bar */
html body.has-app-nav {
  padding-bottom: calc(110px + env(safe-area-inset-bottom, 0px));
}

@media (prefers-reduced-motion: reduce) {
  nav#nav.app-nav a {
    transition: none;
  }
}
@media (min-width: 768px) {
  nav#nav.app-nav {
    max-width: 520px;
  }
}
