/* ============================================================
   N Health — Shared CI Theme
   ใช้ร่วมกันทุกหน้า (อ้างอิงจาก notification.html)
   ประกอบด้วย: ฟอนต์ CI, สีหลักของระบบ, และสไตล์ Sidebar
   ============================================================ */

/* === NHealth CI Font === */
@font-face {
  font-family: 'DB Helvethaica';
  src: url('nh-font.ttf') format('truetype');
  font-weight: bold;
  font-style: normal;
}

/* === NHealth CI Colors === */
:root {
  --nh-primary:    #007aff;
  --nh-secondary:  #0056cc;
  --nh-red:        #EA2839;
  --nh-dark-red:   #782327;
  --nh-steel:      #44697D;
  --nh-sidebar-bg: #def3ff;
}

body {
  font-family: 'DB Helvethaica', Arial, sans-serif;
  font-size: 16px;
}

/* ============================================================
   NHealth Sidebar (fixed, 260px)
   แทนที่ของเดิม (gradient น้ำเงินเข้ม) ด้วยธีมใหม่ตาม notification.html
   ============================================================ */
.nh-sidebar{
  position:fixed;left:0;top:0;width:260px;height:100vh;
  overflow-y:auto;overflow-x:hidden;
  background: var(--nh-sidebar-bg);
  border-right: 1px solid #b8dff8;
  z-index:99999;padding:0 0 32px;
  font-family:'DB Helvethaica',Arial,sans-serif;
  box-shadow: 1px 0 8px rgba(0,122,255,.06);
}
.nh-sidebar .nh-logo{
  display:flex;align-items:center;
  padding:20px 18px 16px;
  border-bottom:1px solid rgba(0,122,255,.15);
}
.nh-sidebar .nh-logo img{
  width:140px;height:auto;display:block;
}
.nh-sidebar .nh-group{
  font-size:11.5px;font-weight:700;letter-spacing:1.5px;
  text-transform:uppercase;color:rgba(0,86,204,.45);
  padding:16px 18px 5px;
}
.nh-sidebar a{
  display:flex;align-items:center;gap:9px;
  color: var(--nh-primary);
  text-decoration:none;
  padding:11px 14px;margin:1px 8px;
  border-radius:8px;font-size:15px;line-height:1.4;
  font-weight:500;
  transition:background .13s,color .13s;
}
.nh-sidebar a:hover{background:rgba(0,122,255,.12);color:var(--nh-secondary);}
.nh-sidebar a.nh-active{background:rgba(0,122,255,.18);color:var(--nh-secondary);font-weight:700;}
.nh-sidebar a .nh-ico{width:22px;text-align:center;flex-shrink:0;font-size:17px;}

/* == Layout overrides == */
/* Override any flex/grid body layout from original pages */
body.nh-body{
  display:block !important;
  padding-left:260px !important;
  margin-left:0 !important;
  min-height:100vh;
  background:#f0f6ff;
}
/* Bootstrap container-fluid / row that wraps the old sidebar + content:
   keep it as a block, full width */
body.nh-body > .container-fluid,
body.nh-body > .container{
  padding-left:0 !important;
  padding-right:0 !important;
  max-width:100% !important;
  width:100% !important;
}
/* Hide all original sidebar elements */
body.nh-body .app-sidebar,
body.nh-body aside.app-sidebar,
body.nh-body nav.app-sidebar,
body.nh-body .sidebar,
body.nh-body aside.sidebar{
  display:none !important;
}
/* Bootstrap col sidebar (col-2, col-3 etc used as sidebar) */
body.nh-body .col-2.bg-white,
body.nh-body .col-2.border-end,
body.nh-body aside.col-md-2,
body.nh-body aside.col-lg-2,
body.nh-body aside.col-md-3,
body.nh-body aside.col-lg-3{
  display:none !important;
}
/* Make Bootstrap content columns expand to full width */
body.nh-body .col-10,
body.nh-body .col-md-10,
body.nh-body .col-lg-10,
body.nh-body .col-9,
body.nh-body .col-md-9,
body.nh-body .col-lg-9{
  flex:0 0 100% !important;
  max-width:100% !important;
}
/* Flex-body pages: the main-content div gets full width */
body.nh-body .main-content,
body.nh-body main.main-content,
body.nh-body > main{
  flex:1 !important;
  width:100% !important;
  overflow-y:auto;
}
@media(max-width:768px){
  body.nh-body{padding-left:0 !important;}
  .nh-sidebar{position:relative;width:100%;height:auto;box-shadow:none;}
}

/* == NHealth Layout Fix v2 == */

/* 1. Kill any hardcoded margin-left on content areas */
body.nh-body .main-content,
body.nh-body main,
body.nh-body > .main-content {
  margin-left: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  flex: 1 1 auto !important;
  overflow-x: hidden !important;
  box-sizing: border-box !important;
}

/* 2. Force-hide ALL original sidebar variants including position:fixed ones */
body.nh-body .app-sidebar,
body.nh-body nav.app-sidebar,
body.nh-body aside.app-sidebar,
body.nh-body .sidebar,
body.nh-body aside.sidebar,
body.nh-body nav.sidebar {
  display: none !important;
  visibility: hidden !important;
  width: 0 !important;
  position: absolute !important;
  left: -9999px !important;
}

/* 3. Containers fill full remaining width */
body.nh-body .container,
body.nh-body .container-fluid,
body.nh-body .container-xl,
body.nh-body .container-lg {
  max-width: 100% !important;
  width: 100% !important;
  padding-left: 16px !important;
  padding-right: 16px !important;
  box-sizing: border-box !important;
}

/* 4. Prevent any element from overflowing right edge */
body.nh-body > *:not(.nh-sidebar):not(.nh-nav-bar) {
  max-width: 100% !important;
  overflow-x: hidden !important;
  box-sizing: border-box !important;
}

/* 5. Bootstrap row fix */
body.nh-body .row {
  margin-left: 0 !important;
  margin-right: 0 !important;
}

/* 6. Prevent horizontal scrollbar on html/body */
html {
  overflow-x: hidden !important;
}
body.nh-body {
  overflow-x: hidden !important;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}

/* ============================================================
   NHealth Page Nav Bar (quick navigation, bottom of page)
   ============================================================ */
.nh-nav-bar{
  position:fixed;bottom:0;left:260px;right:0;
  background: var(--nh-secondary);
  border-top:1px solid rgba(255,255,255,.15);
  padding:8px 20px;
  display:flex;align-items:center;flex-wrap:wrap;gap:6px;
  z-index:99998;
  font-family:'DB Helvethaica',Arial,sans-serif;
  box-shadow:0 -3px 14px rgba(0,86,204,.25);
}
.nh-nav-bar .nh-nav-label{
  color:rgba(255,255,255,.6);font-size:11.5px;font-weight:700;
  letter-spacing:1.2px;text-transform:uppercase;
  margin-right:6px;white-space:nowrap;
}
.nh-nav-bar a{
  display:inline-flex;align-items:center;gap:5px;
  color:#fff;text-decoration:none;
  background:rgba(255,255,255,.14);
  border:1px solid rgba(255,255,255,.22);
  padding:6px 14px;border-radius:20px;
  font-size:14px;font-weight:500;
  white-space:nowrap;
  transition:background .12s;
}
.nh-nav-bar a:hover{background:rgba(255,255,255,.28);}
.nh-nav-bar a.nh-nav-back{background:rgba(234,40,57,.18);border-color:rgba(234,40,57,.4);color:#ffd9dc;}
.nh-nav-bar a.nh-nav-next{background:rgba(50,200,120,.22);border-color:rgba(50,200,120,.45);color:#d4ffe9;}
/* Add bottom padding to body so content isn't hidden behind nav bar */
body.nh-body{ padding-bottom:54px !important; }
@media(max-width:768px){
  .nh-nav-bar{left:0;}
}

/* ============================================================
   Portal pages (no sidebar — เข้าถึงได้โดยไม่ต้อง Login)
   ใช้ class นี้แทน body.nh-body สำหรับหน้าใน /portal/
   ============================================================ */
body.nh-portal-body{
  margin-left:0 !important;
  padding-left:0 !important;
  padding-bottom:54px !important;
  min-height:100vh;
  background:#f0f6ff;
}
/* Nav bar spans full width since there's no sidebar to offset */
body.nh-portal-body .nh-nav-bar{
  left:0;
}