/* ─── Portal navigation bar — shared across Roster, Leave, and Admin ────────
   Requires: renderAppNav(user, currentPage) to be called from app-nav.js      */

#portal-nav {
  position: sticky;
  top: 0;
  z-index: 10002;
  background: linear-gradient(135deg, #121c2e 0%, #163054 100%);
  border-bottom: 1px solid rgba(255,255,255,0.10);
  box-shadow: 0 4px 20px rgba(0,0,0,0.28), inset 0 1px 0 rgba(255,255,255,0.08);
  overflow: visible;
  flex-shrink: 0;
  min-height: 52px;
}

.pnav-inner {
  display: flex;
  align-items: center;
  padding: 6px 16px;
  gap: 12px;
}

.pnav-brand {
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.3px;
  white-space: nowrap;
  flex-shrink: 0;
  margin: 0;
  line-height: 1.2;
}

.pnav-links {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
  align-items: center;
  margin-right: 8px;
}

.pnav-link {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border-radius: 7px;
  font-size: 12.5px;
  font-weight: 600;
  color: rgba(176,210,242,.65);
  text-decoration: none;
  transition: background 0.12s, color 0.12s;
  white-space: nowrap;
  border: 1px solid transparent;
  line-height: 1;
}
.pnav-link:hover {
  background: rgba(255,255,255,0.08);
  color: #e0f2fe;
}
.pnav-link--active {
  background: rgba(30,111,168,0.30);
  color: #bfdbfe;
  border-color: rgba(96,165,250,0.20);
}

.pnav-user-menu {
  position: relative;
  margin-left: 8px;
  flex-shrink: 0;
}

.pnav-user-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px 5px 6px;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 999px;
  color: #fff;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  transition: background .14s;
  white-space: nowrap;
  box-shadow: none;
}
.pnav-user-btn:hover { background: rgba(255,255,255,.22); }

.pnav-user-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(255,255,255,.25);
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}
.pnav-caret { font-size: 9px; opacity: .7; }
.pnav-name  { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.pnav-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: linear-gradient(145deg, rgba(18,28,52,0.97) 0%, rgba(14,24,44,0.99) 100%);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 12px;
  box-shadow: 0 12px 36px rgba(0,0,0,.40), inset 0 1px 0 rgba(255,255,255,0.10);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  min-width: 220px;
  z-index: 9300;
  overflow: hidden;
}
.pnav-dd-item {
  display: block;
  width: 100%;
  padding: 10px 16px;
  text-align: left;
  background: none;
  border: none;
  font-size: 13.5px;
  color: #d8eafc;
  cursor: pointer;
  font-family: inherit;
  transition: background .12s;
}
.pnav-dd-item:hover  { background: rgba(255,255,255,0.10); }
.pnav-dd-sep         { height: 1px; background: rgba(255,255,255,0.10); margin: 4px 0; }
.pnav-dd-danger      { color: #fca5a5; }
.pnav-dd-danger:hover{ background: rgba(220,38,38,0.18); }

/* ── Notification modal ──────────────────────────────────────────────── */
.pnav-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.pnav-modal-overlay[hidden] { display: none; }

.pnav-modal {
  background: #0f1e38;
  border: 1px solid rgba(96,165,250,.20);
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(0,0,0,.60);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  color: #c7dff7;
  font-family: inherit;
}
.pnav-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  font-size: 15px;
  font-weight: 700;
  color: #e0f2fe;
  flex-shrink: 0;
}
.pnav-modal-close {
  background: none;
  border: none;
  color: rgba(176,210,242,.6);
  cursor: pointer;
  font-size: 16px;
  padding: 4px 8px;
  border-radius: 6px;
  font-family: inherit;
}
.pnav-modal-close:hover { background: rgba(255,255,255,.10); color: #fff; }
.pnav-modal-body {
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.pnav-modal-loading { color: rgba(176,210,242,.6); text-align: center; padding: 20px; }

.pnav-notif-section    { display: flex; flex-direction: column; gap: 10px; }
.pnav-notif-section-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: rgba(148,194,240,.6); padding-bottom: 4px; border-bottom: 1px solid rgba(255,255,255,.06); }
.pnav-notif-group      { display: flex; flex-direction: column; gap: 3px; }
.pnav-notif-group-title{ font-size: 11.5px; font-weight: 600; color: rgba(176,210,242,.5); margin: 6px 0 2px; }
.pnav-notif-push-row   { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pnav-notif-hint       { font-size: 12.5px; color: rgba(176,210,242,.55); margin: 0; }
.pnav-notif-coming-soon { font-size: 12.5px; color: rgba(176,210,242,.35); margin: 0; font-style: italic; }
.pnav-notif-row        { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,.05); cursor: pointer; }
.pnav-notif-row:last-child { border-bottom: none; }
.pnav-notif-row-text   { flex: 1; min-width: 0; }
.pnav-notif-row-label  { font-size: 13px; color: #c7dff7; }
.pnav-notif-row-desc   { font-size: 11.5px; color: rgba(176,210,242,.5); margin-top: 2px; }
.pnav-notif-actions    { display: flex; justify-content: flex-end; gap: 8px; padding-top: 10px; border-top: 1px solid rgba(255,255,255,.08); margin-top: 4px; }

/* Toggle switch */
.pnav-notif-switch        { position: relative; display: inline-block; width: 36px; height: 20px; flex-shrink: 0; }
.pnav-notif-switch-input  { opacity: 0; width: 0; height: 0; }
.pnav-notif-switch-slider { position: absolute; inset: 0; border-radius: 999px; background: rgba(255,255,255,.15); transition: background .2s; cursor: pointer; }
.pnav-notif-switch-slider::before { content: ''; position: absolute; width: 14px; height: 14px; left: 3px; top: 3px; border-radius: 50%; background: #fff; transition: transform .2s; }
.pnav-notif-switch-input:checked + .pnav-notif-switch-slider { background: #2563eb; }
.pnav-notif-switch-input:checked + .pnav-notif-switch-slider::before { transform: translateX(16px); }

/* Buttons inside modal */
.pnav-btn-primary  { background: #1d4ed8; color: #fff; border: none; border-radius: 8px; padding: 7px 14px; font-size: 13px; font-family: inherit; cursor: pointer; transition: background .12s; }
.pnav-btn-primary:hover    { background: #1e40af; }
.pnav-btn-primary:disabled { opacity: .5; cursor: default; }
.pnav-btn-outline  { background: none; color: #93c5fd; border: 1px solid rgba(96,165,250,.35); border-radius: 8px; padding: 7px 14px; font-size: 13px; font-family: inherit; cursor: pointer; transition: background .12s, border-color .12s; }
.pnav-btn-outline:hover    { background: rgba(96,165,250,.10); }
.pnav-btn-outline:disabled { opacity: .5; cursor: default; }

/* ── Mobile hamburger button ─────────────────────────────────────── */
.pnav-hamburger-btn {
  display: none; /* shown via media query */
  flex-direction: column;
  justify-content: space-between;
  width: 44px;
  height: 44px;
  padding: 12px 9px;
  flex-shrink: 0;
  background: rgba(255,255,255,0.14);
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: 8px;
  cursor: pointer;
  box-shadow: none;
  gap: 0;
  -webkit-appearance: none;
  appearance: none;
}
.pnav-hamburger-btn span {
  display: block;
  height: 2px;
  border-radius: 2px;
  background: #fff;
}
.pnav-hamburger-btn:hover { background: rgba(255,255,255,0.24); }

/* ── Mobile app-nav drawer ────────────────────────────────────────── */
.pnav-drawer-overlay {
  position: fixed;
  inset: 0;
  z-index: 10100;
  background: rgba(10,20,35,0.45);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.pnav-drawer-overlay[hidden] { display: none; }

.pnav-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 260px;
  z-index: 10101;
  background: rgba(240,246,255,0.97);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  border-right: 1px solid rgba(200,216,234,0.55);
  box-shadow: 4px 0 32px rgba(12,29,48,0.22);
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform 0.22s cubic-bezier(0.4,0,0.2,1);
}
.pnav-drawer[hidden] { display: flex; visibility: hidden; pointer-events: none; }
.pnav-drawer--open   { transform: translateX(0); visibility: visible; pointer-events: auto; }

.pnav-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 12px;
  border-bottom: 1px solid rgba(200,216,234,0.40);
}
.pnav-drawer-title {
  font-size: 15px;
  font-weight: 800;
  color: #1e3a5f;
  letter-spacing: -0.2px;
}
.pnav-drawer-close {
  width: 30px; height: 30px;
  border: none;
  border-radius: 8px;
  background: rgba(200,216,234,0.35);
  color: #3a556e;
  font-size: 14px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.pnav-drawer-close:hover { background: rgba(200,216,234,0.70); }

.pnav-drawer-nav {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: 8px 0;
}
.pnav-drawer-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 20px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  color: #2c4a6a;
  border-left: 3px solid transparent;
  transition: background 0.12s, border-color 0.12s;
}
.pnav-drawer-item:hover { background: rgba(200,216,234,0.22); }
.pnav-drawer-item--active {
  background: rgba(30,111,168,0.09);
  border-left-color: #1e6fa8;
  color: #1e6fa8;
  font-weight: 700;
}

/* ── Responsive: show hamburger, hide inline nav links ───────────── */
@media (max-width: 680px) {
  .pnav-hamburger-btn { display: flex; }
  .pnav-links         { display: none; }
}

/* ── Bell button ─────────────────────────────────────────────────── */
.pnav-bell-wrap { position: relative; margin-left: auto; }
.pnav-bell-btn {
  position: relative; background: none; border: none; box-shadow: none; cursor: pointer;
  padding: 10px 9px; border-radius: 8px; line-height: 1;
  font-size: 17px; color: rgba(176,210,242,.65);
  transition: background .13s, color .13s;
}
.pnav-bell-btn:hover { background: rgba(255,255,255,.08); color: #c7dff7; }
.pnav-bell-badge {
  position: absolute; top: 1px; right: 1px;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 999px; background: #ef4444;
  color: #fff; font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.pnav-bell-badge[hidden] { display: none; }

/* ── Notification dropdown panel ─────────────────────────────────── */
.pnav-notif-panel {
  position: absolute; top: calc(100% + 8px); right: 0;
  width: 300px; max-height: 380px;
  background: rgba(14, 26, 50, 0.78);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border: 1px solid rgba(255,255,255,.13);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.08);
  display: flex; flex-direction: column;
  z-index: 9999; overflow: hidden;
}
.pnav-notif-panel[hidden] { display: none; }
.pnav-notif-panel-hd {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 14px 9px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  font-size: 12px; font-weight: 700; color: rgba(176,210,242,.65);
  flex-shrink: 0;
}
.pnav-btn-link {
  background: none; border: none; cursor: pointer; padding: 0;
  color: rgba(147,197,253,.6); font-size: 11.5px; font-family: inherit;
  transition: color .12s;
}
.pnav-btn-link:hover { color: #93c5fd; }
.pnav-notif-panel-list { overflow-y: auto; flex: 1; }
.pnav-notif-empty {
  text-align: center; padding: 22px 16px;
  color: rgba(176,210,242,.3); font-size: 12.5px; margin: 0;
}
.pnav-notif-item {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 10px 14px; border-bottom: 1px solid rgba(255,255,255,.04);
}
.pnav-notif-item:last-child { border-bottom: none; }
.pnav-notif-item--unread { background: rgba(55,120,182,.07); }
.pnav-notif-item-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #3b82f6; flex-shrink: 0; margin-top: 5px;
}
.pnav-notif-item-content { flex: 1; min-width: 0; }
.pnav-notif-item-title { font-size: 12.5px; font-weight: 600; color: #c7dff7; line-height: 1.3; }
.pnav-notif-item-body  { font-size: 11.5px; color: rgba(176,210,242,.5); margin-top: 2px; line-height: 1.4; word-break: break-word; }
.pnav-notif-item-time  { font-size: 10.5px; color: rgba(176,210,242,.28); margin-top: 4px; }
.pnav-notif-item-dismiss {
  background: none; border: none; cursor: pointer; padding: 2px 5px;
  color: rgba(176,210,242,.22); font-size: 15px; line-height: 1;
  flex-shrink: 0; align-self: flex-start; border-radius: 4px;
  transition: color .12s, background .12s;
}
.pnav-notif-item-dismiss:hover { color: rgba(176,210,242,.75); background: rgba(255,255,255,.06); }

@media (max-width: 640px) {
  .pnav-notif-panel {
    position: fixed;
    top: 60px;
    left: 8px;
    right: 8px;
    width: auto;
    max-height: 60vh;
  }
  /* Hide × button on mobile — swipe handles dismiss */
  .pnav-notif-item-dismiss { display: none; }
}

/* Toast */
.pnav-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #1c3352;
  color: #e0f2fe;
  padding: 10px 22px;
  border-radius: 10px;
  font-size: 13.5px;
  font-family: inherit;
  box-shadow: 0 4px 20px rgba(0,0,0,.40);
  z-index: 100000;
  white-space: nowrap;
  pointer-events: none;
}
.pnav-toast[hidden] { display: none; }

@media (max-width: 640px) {
  .pnav-brand { display: none; }
  .pnav-inner { padding: 6px 10px; gap: 8px; }
  .pnav-link  { padding: 5px 10px; font-size: 12px; }
  .pnav-name  { display: none; }
  .pnav-caret { display: none; }
}
