/* =====================================================
   NCBS Learner Portal — Shared Navigation Component
   Topnav + Mobile Drawer + Bottom Nav (Mobile-First)

   Include on every learner page:
     <link rel="stylesheet" href="{depth}foundation/learner-nav.css" />
   ===================================================== */

/* ── Top Navigation Bar ── */
.topnav {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  position: sticky; top: 0; z-index: 200;
  padding: 0 20px; height: 56px;
  display: flex; align-items: center; justify-content: space-between;
}
.topnav-left { display: flex; align-items: center; gap: 8px; }
.topnav-brand { display: flex; align-items: center; gap: 8px; text-decoration: none; }
.topnav-logo { width: 22px; height: 22px; background: url(img/logo-ncbs.svg) center/contain no-repeat; flex-shrink: 0; }
.topnav-logo span { display: none; }
.topnav-brand-name { font-size: 14px; font-weight: var(--weight-bold); color: var(--purple-900); }

/* Desktop nav links */
.topnav-links { display: flex; align-items: center; gap: 2px; margin-left: 24px; }
.nav-link {
  padding: 7px 14px; border-radius: var(--radius-md); font-size: 13px; font-weight: var(--weight-medium);
  color: var(--gray-500); text-decoration: none; transition: all .15s; white-space: nowrap;
}
.nav-link:hover { background: var(--purple-50); color: var(--purple-500); }
.nav-link.active { background: var(--purple-100); color: var(--purple-600); font-weight: var(--weight-semibold); }

/* Right-side icon buttons */
.topnav-right { display: flex; align-items: center; gap: 6px; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 50%; border: none;
  background: var(--gray-100); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--gray-500); position: relative; transition: all .15s;
}
.icon-btn:hover { background: var(--purple-50); color: var(--purple-500); }
.icon-btn .dot {
  position: absolute; top: 7px; right: 7px; width: 7px; height: 7px;
  border-radius: 50%; background: var(--red-500); border: 2px solid var(--white);
}

/* Hamburger (mobile only) */
.hamburger {
  display: none; width: 36px; height: 36px; border: none; background: none;
  cursor: pointer; color: var(--gray-500); flex-direction: column; align-items: center;
  justify-content: center; gap: 4px;
}
.hamburger span { display: block; width: 18px; height: 2px; background: currentColor; border-radius: 2px; }

/* ── Mobile Drawer ── */
.mobile-drawer {
  display: none; position: fixed; top: 82px; left: 0; right: 0;
  background: var(--white); border-bottom: 1px solid var(--gray-200); padding: 8px 16px 16px;
  z-index: 190; flex-direction: column; gap: 2px;
}
.mobile-drawer.open { display: flex; }
.mobile-drawer .nav-link { padding: 10px 14px; border-radius: 10px; }

/* ── Mobile Bottom Navigation ── */
.bottom-nav {
  display: none; position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--white); border-top: 1px solid var(--gray-200); z-index: 200;
  padding: 6px 8px env(safe-area-inset-bottom,8px);
  grid-template-columns: repeat(4,1fr); gap: 2px;
}
.bottom-nav a {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 4px; text-decoration: none; border-radius: 10px;
  font-size: 10px; color: var(--gray-400); transition: all .15s;
}
.bottom-nav a svg { width: 20px; height: 20px; }
.bottom-nav a.active { color: var(--purple-600); }
.bottom-nav a.active svg { stroke: var(--purple-600); }

/* ── Notification Bell Dropdown ── */
.notif-dropdown {
  display: none; position: absolute; top: 100%; right: 0; margin-top: 8px;
  width: 360px; max-width: calc(100vw - 32px); background: var(--white);
  border-radius: 14px; box-shadow: 0 8px 32px rgba(0,0,0,.12), 0 2px 8px rgba(0,0,0,.06);
  border: 1px solid var(--gray-200); z-index: 300; overflow: hidden;
}
.notif-dropdown.open { display: block; }

.notif-dd-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 10px; border-bottom: 1px solid var(--gray-100);
}
.notif-dd-title { font-size: 14px; font-weight: var(--weight-bold); color: var(--gray-800); }
.notif-dd-all { font-size: 12px; font-weight: var(--weight-medium); color: var(--purple-500); text-decoration: none; }
.notif-dd-all:hover { color: var(--purple-600); text-decoration: underline; }

.notif-dd-list { max-height: 320px; overflow-y: auto; }
.notif-dd-item {
  display: flex; align-items: flex-start; gap: 10px; padding: 12px 16px;
  cursor: pointer; transition: background .12s; position: relative;
  border-bottom: 1px solid var(--gray-50);
}
.notif-dd-item:hover { background: var(--purple-25); }
.notif-dd-item.unread { background: var(--purple-25); }
.notif-dd-item.unread:hover { background: var(--purple-25); }

.notif-dd-icon {
  width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.ni-dd-transfer  { background: var(--purple-50); color: var(--purple-500); }
.ni-dd-payment   { background: var(--green-50); color: var(--green-500); }
.ni-dd-credit    { background: var(--blue-50); color: var(--blue-500); }
.ni-dd-system    { background: var(--orange-50); color: var(--orange-500); }
.ni-dd-document  { background: var(--yellow-50); color: var(--yellow-500); }
.ni-dd-general   { background: var(--gray-200); color: var(--gray-500); }

.notif-dd-content { flex: 1; min-width: 0; text-align: left; }
.notif-dd-item-title { font-size: 12px; font-weight: var(--weight-medium); color: var(--gray-700); line-height: 1.4; margin-bottom: 2px; text-align: left; }
.notif-dd-item.unread .notif-dd-item-title { font-weight: var(--weight-semibold); color: var(--gray-800); }
.notif-dd-time { font-size: 11px; color: var(--gray-400); text-align: left; }

.notif-dd-dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--purple-500);
  flex-shrink: 0; margin-top: 5px;
}

/* ── Responsive Breakpoints ── */
@media (max-width: 640px) {
  .notif-dropdown {
    position: fixed;
    top: 56px;
    left: 12px;
    right: 12px;
    width: auto;
    max-width: none;
    margin-top: 0;
  }
}

@media (max-width: 768px) {
  .topnav-links { display: none; }
  .hamburger { display: flex; }
  .bottom-nav { display: grid; }
}

/* ── Toast override for Learner Portal ──
   proto-nav = 26px (fixed) + topnav = 56px (sticky) = 82px total nav height
   ทำให้ toast ที่ top:24px ซ้อนทับ navigation zone
   Override ให้ toast ปรากฏใต้ nav ทั้งคู่ ─────────────────────────── */
.toast-container {
  top: 90px;  /* 26px proto-nav + 56px topnav + 8px gap */
}
