
/* MAPAid UI Enhancements (mobile-first) */
:root{
  --bg: #f6f7fb;
  --surface: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --brand: #0b7285;
  --brand-2: #0f766e;
  --border: rgba(17,24,39,.12);
  --shadow: 0 10px 30px rgba(17,24,39,.10);
  --radius: 16px;
  --topbar-h: 56px;
}

html, body{
  background: var(--bg);
  color: var(--text);
}

/* Topbar */
.topbar{
  position: sticky;
  top: 0;
  z-index: 1100;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  color: #fff;
  box-shadow: 0 6px 18px rgba(0,0,0,.18);
}

.topbar .brand{
  display:flex;
  align-items:center;
  gap:10px;
  min-width: 0;
}
.topbar .brand .brand-title{
  font-weight: 700;
  letter-spacing: .2px;
  font-size: 1.05rem;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar a{
  color:#fff;
  text-decoration:none;
}

.icon-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.25);
  background: rgba(255,255,255,.12);
  color:#fff;
}

.icon-btn:focus-visible{
  outline: 3px solid rgba(255,255,255,.65);
  outline-offset: 2px;
}

.hamburger{
  width: 18px;
  height: 12px;
  position: relative;
  display: inline-block;
}
.hamburger::before,
.hamburger::after,
.hamburger span{
  content:"";
  position:absolute;
  left:0;
  right:0;
  height:2px;
  background:#fff;
  border-radius: 2px;
}
.hamburger::before{ top:0; }
.hamburger span{ top:5px; }
.hamburger::after{ bottom:0; }

/* Right-side controls */
.topbar .controls{
  display:flex;
  align-items:center;
  gap:10px;
}
.topbar label{
  font-size: .9rem;
  margin: 0;
}
.topbar select{
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.28);
  background: rgba(255,255,255,.12);
  color:#fff;
  padding: 8px 10px;
}
.topbar select option{
  color:#111827;
}

/* Sidebar */
.sidebar{
  position: fixed;
  top: 0;
  left: 0;
  height: 100%;
  width: 280px;
  max-width: 86vw;
  background: var(--surface);
  border-right: 1px solid var(--border);
  box-shadow: var(--shadow);
  transform: translateX(-105%);
  transition: transform .22s ease;
  z-index: 1200;
  display:flex;
  flex-direction: column;
}
body.sidebar-open .sidebar{
  transform: translateX(0);
}

.sidebar-header{
  height: var(--topbar-h);
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(90deg, rgba(11,114,133,.10), rgba(15,118,110,.10));
}
.sidebar-header .title{
  font-weight: 800;
  margin: 0;
}

.sidebar nav{
  padding: 10px;
  display:flex;
  flex-direction: column;
  gap: 6px;
}
.sidebar a,
.sidebar button.install-btn{
  display:flex;
  align-items:center;
  gap:10px;
  text-decoration:none;
  color: var(--text);
  padding: 12px 12px;
  border-radius: 14px;
  border: 1px solid transparent;
  background: transparent;
  text-align:left;
  font-weight: 600;
}
.sidebar a:hover,
.sidebar button.install-btn:hover{
  background: rgba(11,114,133,.08);
  border-color: rgba(11,114,133,.12);
}
.sidebar a:focus-visible,
.sidebar button.install-btn:focus-visible{
  outline: 3px solid rgba(11,114,133,.35);
  outline-offset: 2px;
}

.sidebar .muted{
  color: var(--muted);
  font-weight: 500;
  font-size: .92rem;
  padding: 10px 12px 6px;
}

.sidebar-overlay{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.35);
  z-index: 1150;
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease;
}
body.sidebar-open .sidebar-overlay{
  opacity: 1;
  pointer-events: auto;
}

/* Content wrapper */
.app-shell{
  min-height: 100dvh;
}
.content{
  padding: 14px 12px 28px;
}

/* Cards / sections */
.cardish{
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 22px rgba(17,24,39,.08);
  padding: 14px;
}

.page-doc .doc-card{
  max-width: 980px;
  margin: 0 auto;
}
.page-doc h1{
  font-size: 1.45rem;
  margin: 6px 0 10px;
}
.page-doc p, .page-doc li{
  color: #1f2937;
  line-height: 1.6;
}
.page-doc .muted{
  color: var(--muted);
}

/* Improve default form feel on mobile */
input, select, textarea, button{
  border-radius: 14px !important;
}
button, .btn{
  font-weight: 700;
}

/* Make existing .app container feel modern */
.app{
  border-radius: var(--radius) !important;
  box-shadow: var(--shadow) !important;
  border: 1px solid var(--border);
}



/* Bottom navigation (mobile) */
.has-bottom-nav .content{
  padding-bottom: 96px;
}
.bottom-nav{
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 68px;
  display: flex;
  align-items: stretch;
  justify-content: space-around;
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -10px 24px rgba(17,24,39,.10);
  z-index: 1200;
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav .bn-item{
  flex: 1;
  min-width: 0;
  text-decoration: none;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  padding: 8px 6px;
}
.bottom-nav .bn-ico{
  font-size: 18px;
  line-height: 1;
}
.bottom-nav .bn-item.active{
  color: var(--brand);
  font-weight: 700;
}
.bottom-nav .bn-item:focus-visible{
  outline: 3px solid rgba(11,114,133,.35);
  outline-offset: 4px;
  border-radius: 12px;
}

/* Update toast */
.toast-container{
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(84px + env(safe-area-inset-bottom));
  z-index: 1300;
  display: flex;
  justify-content: center;
  pointer-events: none;
}
.toast-card{
  width: min(560px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 12px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  pointer-events: auto;
}
.toast-title{
  font-weight: 800;
  color: var(--text);
  font-size: 14px;
}
.toast-sub{
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}
.toast-actions{
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
}



/* Topbar logo sizing (keep it inside the banner on mobile) */
#topbar-logo{
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
}
@media (min-width: 576px){
  #topbar-logo{ width: 40px; height: 40px; }
}

@media (min-width: 992px){
  .sidebar{
    transform: translateX(0);
  }
  .sidebar-overlay{ display:none; }

  /* When sidebar is docked on desktop, keep header + content clear of it */
  .topbar{
    margin-left: 280px;
    width: calc(100% - 280px);
  }
  .content{
    margin-left: 280px;
    max-width: calc(100% - 280px);
    padding: 18px 18px 32px;
  }

  .bottom-nav{ display:none; }
}
