﻿/* ITAM Asset sidebar + shell — GLOBAL (not scoped).
   Must be global: the menu items are <NavLink> components, whose root <a>
   element does NOT receive Blazor's scoped-CSS attribute, so scoped rules
   like .itam-sb-item[b-xxx] never match. Plain global class selectors do. */

/* ── Shell: fills the viewport below the 70px top header; each pane scrolls on
      its own so a long menu never overflows the page. ── */
/* 2026-08-24 (user: มีพื้นที่ทะลุไปข้างล่าง) — หน้าในเชลล์ ITAM/SLM ออกแบบให้ scroll ภายใน
   shell-body อยู่แล้ว แต่ elements ท้าย body ของ Metronic (drawers/scrolltop ฯลฯ) + ระยะเผื่อของ
   layout ดันความสูงเอกสารให้ scroll ทะลุใต้เชลล์เป็นพื้นที่เปล่า — ล็อกเอกสารหลักไม่ให้ scroll
   เมื่อหน้านั้นมีเชลล์อยู่ (เนื้อหายาวยัง scroll ได้ปกติใน shell-body ซึ่ง overflow:auto) */
body:has(.asset-shell),
body:has(.slm-shell) {
    overflow: hidden;
    height: 100vh;
}

.asset-shell {
    display: flex;
    align-items: stretch;
    /* Fill from the content area's top down to the viewport bottom. The offset is
       the header + the content padding-top (~56px total here); tune this one value
       if a thin gap or scroll appears. */
    height: calc(100vh - 56px);
    background: var(--ops-bg, #f6f7f9);
    overflow: hidden;
    /* One font family for the whole ITAM section (sidebar + content) so it reads
       as one design — was: sidebar IBM Plex vs content Metronic default. */
    font-family: var(--sc-font-sans);
}

/* Content inherits the shell font; form controls + the page need it explicitly. */
.asset-shell-body,
.asset-shell-body .csp-page,
.asset-shell-body input,
.asset-shell-body select,
.asset-shell-body textarea,
.asset-shell-body button {
    font-family: var(--sc-font-sans);
}

/* Monospace fields (serial / asset numbers) stay mono but within the same
   IBM Plex family for a balanced look. */
.asset-shell-body .al-mono {
    font-family:var(--sc-font-mono);
}

/* Table header — the base style force-UPPERCASES it, which only hits the English
   labels (SERIAL NUMBER / ACTION) and leaves Thai as-is → looks mismatched. Use
   natural case + a calmer, cleaner header band. */
.asset-shell-body .csp-table thead tr {
    background: var(--ops-surface-2, #f7f8fa);
}
.asset-shell-body .csp-table th {
    padding: 11px 14px;
    font-size: 12px;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
    color: var(--ops-muted, #6b7384);
    border-bottom: 1px solid var(--ops-border, #e6e8ec);
}
.asset-shell-body .csp-table th:first-child { border-top-left-radius: 0; }

.asset-shell-body {
    flex: 1;
    min-width: 0;
    min-height: 0;
    overflow: auto;
}

/* Inside the ITAM shell the page content should fill the frame — drop the card
   margin/border/radius that configs-subpage.css adds (scoped here so other
   config pages keep their card look). */
.asset-shell-body .csp-page {
    margin: 0;
    border: none;
    border-radius: 0;
    height: 100%;
}

/* AssetDashboard ใช้ .at-page/.at-layout ของตัวเอง (ไม่ใช่ .csp-page) — ทำ full-bleed ชิด
   sidebar/top/footer แบบเดียวกัน: ตัด padding รอบตัว + ตัด border/radius ของกล่องเนื้อหา */
.asset-shell-body .at-page {
    padding: 0;
    height: 100%;
}
.asset-shell-body .at-layout {
    border: none;
    border-radius: 0;
}

/* ── Sidebar ── */
.itam-sb {
    width: 232px;
    flex-shrink: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--ops-surface, #fff);
    border-right: 1px solid var(--ops-border, #e8eaef);
    font-family: var(--sc-font-sans);
    overflow: hidden;
    transition: width .16s ease;
}

.itam-sb.is-collapsed { width: 56px; }

/* Header — single "Asset Management" line + hamburger, no logo. flex-shrink:0
   so it never scrolls away. */
.itam-sb-brand {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 12px 14px 11px;
    border-bottom: 1px solid var(--ops-border-soft, #f0f1f4);
}

.itam-sb-title {
    flex: 1;
    min-width: 0;
    font-size: 14px;
    font-weight: 700;
    color: var(--ops-text, #1f2433);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
/* 2026-09-02 sidebar polish: caption under module title */
.itam-sb-sub {
    font-size: 10.5px; font-weight: 400; color: var(--ops-muted-2, #98a0ae); line-height: 1.3; margin-top: 1px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.itam-sb-burger {
    border: none; background: transparent; color: var(--ops-muted-2, #9aa2b1); cursor: pointer;
    padding: 5px; border-radius: 7px; display: flex; flex-shrink: 0;
}
.itam-sb-burger:hover { background: var(--ops-surface-2, #f1f3f6); color: var(--ops-primary, #4f46e5); }

.itam-sb.is-collapsed .itam-sb-brand { justify-content: center; padding: 15px 0; }
.itam-sb.is-collapsed .itam-sb-burger { margin: 0 auto; }

/* Nav scroll area — flex:1 + min-height:0 is what lets overflow-y work inside a
   flex column. Slim visible scrollbar (was fully hidden — users couldn't tell the
   menu scrolls once the settings section made it taller than the viewport). */
.itam-sb-nav {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 8px 8px 20px;
    scrollbar-width: thin;
    scrollbar-color: #d3d7df transparent;
}
.itam-sb-nav::-webkit-scrollbar { width: 5px; height: 0; }
.itam-sb-nav::-webkit-scrollbar-track { background: transparent; }
.itam-sb-nav::-webkit-scrollbar-thumb { background: var(--ops-border-strong, #d3d7df); border-radius: 3px; }
.itam-sb-nav::-webkit-scrollbar-thumb:hover { background: var(--ops-border-strong, #b6bcc9); }

/* กลุ่มเมนูคั่นด้วยเส้นอย่างเดียว — หัวข้อเลข + ชื่อกลุ่มเอาออกแล้ว แบบเดียวกับแถบซ้าย ITSM (2026-10-09) */
.itam-sb-secdiv { height: 1px; background: var(--ops-border, #e6e8ec); margin: 8px 10px; }
.itam-sb-secdiv:first-child { display: none; }

/* Item (NavLink → <a>) */
.itam-sb-nav a.itam-sb-item,
.itam-sb-item {
    display: flex !important;
    align-items: center;
    gap: 10px;
    box-sizing: border-box;
    width: 100%;
    padding: 7px 10px;
    margin: 1px 0;
    border-radius: 8px;
    color: var(--ops-text-2, #3b4252);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
    transition: background .12s, color .12s;
}

.itam-sb-item:hover { background: var(--ops-surface-2, #f4f5f8); color: var(--ops-text, #1f2433); text-decoration: none; }
.itam-sb-item.active { background: var(--ops-primary-50, #e8edff); color: var(--ops-primary, #4f46e5); font-weight: 600; }

.itam-sb-ic {
    width: 18px; height: 18px; flex-shrink: 0; color: var(--ops-muted, #707888);
    display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.itam-sb-ic svg { width: 18px; height: 18px; display: block; }
.itam-sb-item:hover .itam-sb-ic { color: var(--ops-primary, #4f46e5); }
.itam-sb-item.active .itam-sb-ic { color: var(--ops-primary, #4f46e5); }

.itam-sb-lbl { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.itam-sb-ext { font-size: 11px; color: var(--ops-muted-2, #9aa2b1); flex-shrink: 0; line-height: 1; }
.itam-sb-item:hover .itam-sb-ext, .itam-sb-item.active .itam-sb-ext { color: inherit; }

/* "Coming soon" items: dimmed + small amber dot */
.itam-sb-item.is-soon { color: var(--ops-muted-2, #98a0ae); }
.itam-sb-item.is-soon .itam-sb-ic { color: var(--ops-faint, #c3c9d2); }
.itam-sb-item.is-soon:hover { color: var(--ops-muted, #5b6577); }
.itam-sb-dot { width: 5px; height: 5px; border-radius: 50%; background: #e0b73a; flex-shrink: 0; }

/* Collapsed: icon-only, centred (scrollbar hidden → full-width centring is exact) */
.itam-sb.is-collapsed .itam-sb-nav { padding-left: 0; padding-right: 0; }
.itam-sb.is-collapsed .itam-sb-item { justify-content: center; padding: 9px 0; }
.itam-sb.is-collapsed .itam-sb-lbl,
.itam-sb.is-collapsed .itam-sb-ext,
.itam-sb.is-collapsed .itam-sb-dot { display: none; }

/* ── Responsive ──────────────────────────────────────────────────────────────
   ที่ 232px sidebar กินพื้นที่เกิน 30% ของจอ tablet (เหลือเนื้อหาแค่ 536px จาก 768px)
   ทำให้ toolbar โดนบีบจนล้น. ใช้กฎชุดเดียวกับสถานะ "ย่อเมนู" ที่มีอยู่แล้ว แต่บังคับด้วย
   media query — ไม่ต้องแตะ state ฝั่ง C# และผู้ใช้ยังกดขยายเองได้เมื่อจอกว้างพอ */
@media (max-width: 1100px) {
    .itam-sb { width: 56px; }
    .itam-sb .itam-sb-brand { justify-content: center; padding: 15px 0; }
    .itam-sb .itam-sb-title,
    .itam-sb .itam-sb-sub,
    .itam-sb .itam-sb-lbl,
    .itam-sb .itam-sb-ext,
    .itam-sb .itam-sb-dot { display: none; }
    .itam-sb .itam-sb-burger { margin: 0 auto; }
    .itam-sb .itam-sb-nav { padding-left: 0; padding-right: 0; }
    .itam-sb .itam-sb-item { justify-content: center; padding: 9px 0; }
}


/* == ปุ่มเฟือง "ตั้งค่า" ท้ายแถบ + แผง popup (2026-09-15) ==============================
   ยกจาก slm-sidebar.css ทั้งบล็อก เปลี่ยนเฉพาะ prefix — SLM เองก็ยกมาจาก helpdesk-sidebar.css
   ด้วยเหตุผลเดียวกัน: สามแถบที่ทำงานต่างกันเล็กน้อยกลายเป็นบั๊กที่หาไม่เจอ

   ITAM เป็นโมดูลเดียวที่ไม่เคยมีเฟือง จึงมี 33 รายการอยู่ในแถบซ้ายทั้งหมด ส่วน ITSM/SLM
   เก็บ 15 และ 4 รายการไว้หลังเฟือง แล้วเหลือในแถบโมดูลละ 12

   ⚠️ แผง popup ต้องอยู่นอก <aside> เพราะแถบเป็น overflow:hidden — วางข้างในจะโดนตัด
   ============================================================================== */
/* ── ปุ่มเฟือง "ตั้งค่า" ท้ายแถบ + แผง popup ────────────────────────────────
   ยกมาจาก helpdesk-sidebar.css ทั้งบล็อก เปลี่ยนเฉพาะ prefix — ผู้ใช้ขอให้เหมือน ITSM
   และการมีสองชุดที่ทำงานต่างกันเล็กน้อยจะกลายเป็นบั๊กที่หาไม่เจอ
   แผง popup ต้องอยู่นอก <aside> เพราะแถบเป็น overflow:hidden (กับดักเดียวกับ ITSM) */
.itam-sb-foot {
    flex-shrink: 0;
    padding: 7px 8px 9px;
    border-top: 1px solid var(--ops-border-soft, #f0f1f4);
}

.itam-sb-set {
    width: 100%;
    display: flex; align-items: center; gap: 10px;
    padding: 8px 10px;
    border: none; border-radius: 8px;
    background: transparent;
    color: var(--ops-muted, #5b6577);
    font: inherit; font-size: 13px;
    cursor: pointer;
    text-align: left;
}

.itam-sb-set:hover { background: var(--ops-surface-2, #f4f5f8); color: var(--ops-text, #1f2433); }

.itam-sb-set:hover .itam-sb-ic { color: var(--ops-primary, #4f46e5); }

.itam-sb-set.is-open { background: var(--ops-primary-50, #e8edff); color: var(--ops-primary, #4f46e5); font-weight: 600; }

.itam-sb-set.is-open .itam-sb-ic { color: var(--ops-primary, #4f46e5); }

.itam-sb-setcar { flex-shrink: 0; opacity: .45; transition: transform .16s ease; }

.itam-sb-set.is-open .itam-sb-setcar { transform: rotate(90deg); opacity: .8; }

.itam-sb.is-collapsed .itam-sb-set { justify-content: center; padding: 9px 0; }

.itam-sb.is-collapsed .itam-sb-setcar { display: none; }

/* แผงลอย — อยู่นอก <aside> เพราะแถบซ้ายเป็น overflow:hidden */
.itam-sb-popveil {
    position: fixed; inset: 0; z-index: 1040;
    background: transparent;
}

.itam-sb-pop {
    position: fixed; z-index: 1041;
    left: 12px; bottom: 14px;
    width: min(580px, calc(100vw - 24px));
    max-height: min(560px, calc(100vh - 120px));
    display: flex; flex-direction: column;
    background: var(--ops-surface, #fff);
    border: 1px solid var(--ops-border, #e8eaef);
    border-radius: 12px;
    box-shadow: 0 12px 34px rgba(16, 22, 40, .16), 0 2px 6px rgba(16, 22, 40, .06);
    font-family: var(--sc-font-sans);
    overflow: hidden;
    animation: itam-sb-pop-in .13s ease-out;
}

.itam-sb-pop { animation: none; }

.itam-sb-setcar { transition: none; }

.itam-sb-pophd {
    flex-shrink: 0;
    display: flex; align-items: flex-start; gap: 10px;
    padding: 13px 14px 11px;
    border-bottom: 1px solid var(--ops-border-soft, #f0f1f4);
}

.itam-sb-pophd-txt { flex: 1; min-width: 0; }

.itam-sb-poptitle { font-size: 13.5px; font-weight: 650; color: var(--ops-text, #1f2433); }

.itam-sb-popsub   { font-size: 11px; color: var(--ops-muted-2, #98a0ae); margin-top: 1px; }

.itam-sb-popx {
    flex-shrink: 0;
    border: none; background: transparent; cursor: pointer;
    color: var(--ops-muted-2, #9aa2b1);
    padding: 4px; border-radius: 7px; display: flex;
}

.itam-sb-popx:hover { background: var(--ops-surface-2, #f1f3f6); color: var(--ops-text, #1f2433); }

.itam-sb-popbody {
    flex: 1; min-height: 0; overflow-y: auto;
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px 10px;
    align-items: start;
    padding: 11px 11px 13px;
    scrollbar-width: thin;
    scrollbar-color: var(--ops-border-strong, #d3d7df) transparent;
}

.itam-sb-popsec {
    font-size: 10px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase;
    color: var(--ops-muted-2, #98a0ae);
    padding: 4px 8px 6px;
}

.itam-sb-popbody a.itam-sb-popitem,
.itam-sb-popitem {
    display: flex; align-items: center; gap: 9px;
    padding: 7px 8px;
    border-radius: 7px;
    font-size: 12.5px;
    color: var(--ops-muted, #5b6577);
    text-decoration: none;
}

.itam-sb-popitem:hover { background: var(--ops-surface-2, #f4f5f8); color: var(--ops-text, #1f2433); text-decoration: none; }

.itam-sb-popitem:hover .itam-sb-ic { color: var(--ops-primary, #4f46e5); }

.itam-sb-popitem.active { background: var(--ops-primary-50, #e8edff); color: var(--ops-primary, #4f46e5); font-weight: 600; }

.itam-sb-popitem.active .itam-sb-ic { color: var(--ops-primary, #4f46e5); }

.itam-sb-popbody { grid-template-columns: 1fr; }
