/* Tinh gon giao dien - xoa file nay (va js/ui.js) de tro ve nhu cu */

/* ---- Khach (phu huynh): an cong cu quan tri ---- */
body:not(.is-staff) #nv-admin-bar,
body:not(.is-staff) .nav-item:has(#nav-btn-rbac-open),
body:not(.is-staff) .nav-item:has(#nav-btn-account),
body:not(.role-admin) .nav-item:has(#nav-btn-account),
body:not(.is-staff) #sidebar-member-block { display: none !important; }
body:not(.is-staff) { padding-bottom: 0 !important; }

.ui-staff-login {
  background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.4);
  border-radius: 4px; padding: 3px 10px; font: inherit; font-size: 12px; cursor: pointer; margin-left: 8px;
}
.ui-staff-login:hover { background: rgba(255,255,255,.15); }

/* ---- Theo quyen ---- */
body.role-giaovien #nv-menu-site-admin,
body.role-giaovien #nv-menu-edit-footer,
body.role-giaovien #nv-menu-toggle-dnd,
body.role-giaovien #nv-menu-admin-account,
body.role-giaovien .btn-rbac-tab[data-tab="tab-categories"],
body.is-staff:not(.role-admin) #nv-menu-admin-account,
body.is-staff:not(.role-admin) .btn-rbac-tab[data-tab="tab-user-accounts"],
body.role-giaovien [data-rbac-open="tab-categories"],
/* moi chuc nang mo rieng tu menu "Bai viet" / "Tai khoan": an thanh the trong cua so */
#modal-rbac-dashboard .rbac-tabs-nav,
body.is-staff .rbac-role-switch-buttons { display: none !important; }

/* ---- Menu mot hang tren may tinh ---- */
@media screen and (min-width: 1100px) {
  .main-navbar .nav-link { font-size: 12.5px; padding: 12px 6px; gap: 4px; }
  .main-navbar .nav-link > .fa:not(.fa-caret-down):not(.fa-home) { display: none; }
}

/* ---- Dien thoai / may tinh bang: tin tuc truoc, cot phu sau ---- */
@media screen and (max-width: 992px) {
  .portal-body-layout > aside { order: 2; }
}

/* ---- Form dang tin ---- */
#form-cms-post:not(.show-advanced) .ui-adv { display: none !important; }
.ui-adv-toggle {
  display: block; margin: 0 0 10px auto; background: #eef2ff; color: #0d47a1;
  border: 1px solid #c7d2fe; border-radius: 4px; padding: 6px 12px; font-weight: 600; cursor: pointer;
}

/* ---- Bang ho so tuyen sinh ---- */
#modal-admin-panel .modal-window { max-width: 960px; width: 96%; }
#modal-admin-panel .modal-body { overflow: auto; }
.ui-adm-extra { font-size: 12px; color: #475569; margin-top: 3px; }
.ui-export {
  margin-right: auto; background: #16a34a; color: #fff; border: 0; border-radius: 4px;
  padding: 8px 14px; font-weight: 600; cursor: pointer;
}

/* ---- Cua so tren dien thoai: toan man hinh, cuon duoc ---- */
@media screen and (max-width: 768px) {
  .modal-window,
  .modal-window-rbac,
  #modal-admin-panel .modal-window {
    width: 100% !important; max-width: 100% !important;
    height: 100%; max-height: 100% !important; border-radius: 0; display: flex; flex-direction: column;
  }
  .modal-overlay { padding: 0 !important; z-index: 100000; }
  .modal-window > form { display: flex; flex-direction: column; flex: 1; min-height: 0; }
  .modal-body { flex: 1 1 auto; min-height: 0; overflow: auto !important; }
  .modal-header, .modal-footer { flex: 0 0 auto; }
  .modal-header h3 { font-size: 14px; }

  .modal-window-rbac .modal-body { padding: 10px; }
  .modal-window-rbac .modal-footer span { display: none; }
  .rbac-user-banner { padding: 8px !important; margin-bottom: 8px; }
  .btn-rbac-tab { flex: 0 0 auto !important; white-space: nowrap; }
  :has(> .btn-rbac-tab) { overflow-x: auto; flex-wrap: nowrap !important; flex-shrink: 0; }
  .rbac-tab-content { overflow-x: auto; }

  .cms-classic-grid { display: block !important; }
  .cms-classic-left, .cms-classic-right { width: 100% !important; max-width: 100% !important; min-width: 0; }
  .cms-table-bordered, .cms-table-bordered tbody, .cms-table-bordered tr, .cms-table-bordered td {
    display: block; width: 100% !important;
  }
  .cms-table-bordered tr.ui-adv { display: block; }
  #form-cms-post .cms-ctrl-text:not([style*="width: 105px"]),
  #form-cms-post .cms-ctrl-select[style*="250px"],
  #form-cms-post .cms-ctrl-select[style*="240px"] { width: 100% !important; max-width: 100% !important; }
  .cms-notice-card { flex-direction: column; align-items: flex-start; }
}

/* ---- Bo cac dong khong can cho nguoi dung ---- */
#modal-rbac-dashboard .cms-benchmark-bar,
#modal-rbac-dashboard .modal-footer span,
#modal-rbac-dashboard [class*="permission-banner"],
#modal-admin-panel .modal-body > div:first-child > span { display: none !important; }

#modal-admin-panel .modal-body > div:first-child h4 { display: none; }
body.role-admin #rbac-role-notice-box,
body.role-bgh #rbac-role-notice-box { display: none !important; }

/* Ho so tren dien thoai: moi ho so mot the */
@media screen and (max-width: 768px) {
  #modal-admin-panel table, #modal-admin-panel tbody, #modal-admin-panel tr, #modal-admin-panel td {
    display: block; width: 100% !important;
  }
  #modal-admin-panel thead, #modal-admin-panel tr:has(th) { display: none; }
  #modal-admin-panel tr { border: 1px solid #cbd5e1; border-radius: 6px; margin-bottom: 10px; padding: 6px; }
  #modal-admin-panel td { border: 0; padding: 3px 4px; }
  .ui-export { font-size: 12px; }
}

/* Danh sach bai viet tren dien thoai: the, nut thao tac nam ngay trong the */
@media screen and (max-width: 768px) {
  #tab-manage-posts table, #tab-manage-posts tbody, #tab-manage-posts tr, #tab-manage-posts td {
    display: block; width: auto !important;
  }
  #tab-manage-posts thead, #tab-manage-posts tr:has(th) { display: none; }
  #tab-manage-posts tr { border: 1px solid #cbd5e1; border-radius: 6px; margin-bottom: 10px; padding: 8px; }
  #tab-manage-posts td { border: 0; padding: 3px 0; text-align: left !important; }
  #tab-manage-posts td:first-child { display: none; }
}

/* ---- Theo nhom tu tao (js/groups.js) ---- */
body.no-perm-news .nav-item:has(#nav-btn-rbac-open),
body.no-perm-news #nv-menu-module-news,
body.no-perm-news #sidebar-btn-open-rbac,
body.no-perm-admissions #nv-menu-site-admin,
body.no-perm-admissions .ui-export,
body.no-perm-layout #nv-menu-edit-footer,
body.no-perm-layout #nv-menu-toggle-dnd,
body.no-perm-layout #sidebar-btn-toggle-dnd,
body.no-perm-layout #sidebar-btn-edit-footer,
body.no-perm-layout #footer-admin-toolbar { display: none !important; }

/* menu "Bai viet" / "Tai khoan" o gan mep phai: mo ve ben trai de khong tran man hinh */
@media screen and (min-width: 769px) {
  .nav-item:has(#nav-btn-rbac-open) .submenu-dropdown,
  .nav-item:has(#nav-btn-account) .submenu-dropdown { left: auto; right: 0; }
}

/* Quan tri co them 2 menu: thu gon chu de van nam tren mot hang */
@media screen and (min-width: 1100px) and (max-width: 1279px) {
  body.role-admin .main-navbar .nav-link { font-size: 11.5px; padding: 12px 3px; gap: 3px; }
}

/* Khung chua co noi dung */
.hero-slider-wrap:not(:has(.hero-slide)), #activity-single-frame:not(:has(.activity-single-slide)) { background:#e3f2fd; min-height:180px; }
.hero-slider-wrap:not(:has(.hero-slide))::before { content:"Chưa có bài đăng"; position:absolute; inset:0; display:flex; align-items:center; justify-content:center; color:#0d47a1; font-weight:700; }
#activity-single-frame:not(:has(.activity-single-slide))::before {
  content:"Nhà trường đang cập nhật hình ảnh"; position:absolute; inset:0; display:flex; align-items:center; justify-content:center; color:#0d47a1; font-weight:700; }
.hero-slider-wrap:not(:has(.hero-slide)) .slider-arrows, #activity-single-frame:not(:has(.activity-single-slide)) .activity-frame-nav { display:none; }
.top-info span[hidden] { display:none; }
/* Chua co bo dem luot xem that */
.feature-meta span:has(.fa-eye), .sub-news-meta span:has(.fa-eye), .article-detail-meta span:has(.fa-eye) { display:none !important; }

/* In rieng cua so dang mo (js/extras.js) */
#print-area { display:none; }
@media print {
  body.print-modal > *:not(#print-area) { display:none !important; }
  body.print-modal #print-area { display:block; }
}

/* Them / sua / xoa (js/manage.js) */
.manage-edit { display:block; margin:8px auto 0; border:1px dashed #1565c0; background:#fff; color:#1565c0; border-radius:999px; padding:5px 12px; font:inherit; font-size:12px; font-weight:700; cursor:pointer; }
.manage-li { list-style:none; text-align:center; padding:4px 8px; }
.manage-row { display:grid; gap:6px; border:1px solid #e2e8f0; border-radius:8px; padding:10px; margin:0 0 10px; }
.manage-file { font-size:12px; font-weight:700; color:#475569; }
.manage-banner { display:block; padding:12px; border-radius:6px; background:#0d47a1; color:#fff; text-align:center; font-weight:700; margin-bottom:8px; }
.manage-files { margin-top:14px; border-top:1px solid #e2e8f0; padding-top:10px; text-align:left; }
.manage-files h5 { margin:0 0 8px; font-size:14px; color:#0d47a1; }
.manage-file-row { display:flex; flex-wrap:wrap; gap:8px; align-items:center; padding:6px 0; }
.manage-file-row span { flex:1; min-width:140px; overflow-wrap:anywhere; }
.manage-hidden, body.admission-closed:not(.is-staff) [data-action="admission"] { display:none !important; }
.sidebar-admissions-banner.manage-off { opacity:.6; }
.sidebar-admissions-banner .manage-edit { color:#c62828; border-color:#c62828; }
.notice-download { white-space:nowrap; font-size:12px; font-weight:700; color:#0d47a1; }
@media print { .manage-edit, .manage-li, .manage-files { display:none !important; } }

/* Khung bai moi nhat va cot "Tin moi cap nhat" */
.hero-tools { position:absolute; top:10px; right:10px; z-index:6; display:flex; gap:6px; }
.hero-tools button { border:0; border-radius:999px; padding:7px 13px; background:#fff; color:#0d47a1; font:inherit; font-size:12px; font-weight:700; box-shadow:0 2px 8px rgba(0,0,0,.25); cursor:pointer; }
.hero-latest-news { display:flex; flex-direction:column; max-height:380px; min-height:0; }
.latest-news-list { flex:1; min-height:0; overflow-y:auto; justify-content:flex-start; }
.latest-news-item { flex:none; }
@media print { .hero-tools { display:none; } }

/* Anh dai dien bai viet (bat buoc) */
#cms-input-img { display:none; }
.cms-thumb-preview-wrap img { height:70px; max-width:120px; }
.cms-thumb-preview-wrap:has(img[src$="no-image.svg"]) { display:none !important; }
.btn-cms-cyan-browse.need-image { outline:3px solid #dc2626; outline-offset:2px; }

/* 4 tab van ban (js/notices.js) */
.notice-tabs { display:flex; flex-wrap:wrap; gap:6px; margin-bottom:10px; border-bottom:2px solid #e53935; padding-bottom:8px; }
.notice-tabs button { flex:1; min-width:140px; border:1px solid #ffcdd2; background:#fff; color:#b71c1c; border-radius:8px; padding:8px 10px; font:inherit; font-size:13px; font-weight:700; cursor:pointer; }
.notice-tabs button.on { background:#d32f2f; border-color:#d32f2f; color:#fff; }
.notice-tabs small { display:inline-block; min-width:18px; margin-left:4px; border-radius:999px; background:rgba(0,0,0,.12); font-size:11px; }
@media print { .notice-tabs { display:none; } }

/* Bo 3 nut o khoi Thanh vien (menu trai): da co o menu tren, thanh cong cu va chan trang */
#sidebar-btn-open-rbac, #sidebar-btn-toggle-dnd, #sidebar-btn-edit-footer { display:none !important; }

/* Hai kieu dang tin (js/link-post.js) */
.post-modes { display:flex; gap:8px; padding:10px 14px; }
.post-modes button { flex:1; border:2px solid #0d47a1; background:#fff; color:#0d47a1; border-radius:8px; padding:10px; font:inherit; font-weight:700; cursor:pointer; }
.post-modes button.on { background:#0d47a1; color:#fff; }
.link-post { display:none; padding:4px 14px 16px; }
.cms-classic-wrapper.link-mode > .link-post { display:grid; grid-template-columns:minmax(0, 1fr) 300px; gap:16px; align-items:start; }
@media (max-width:768px) { .cms-classic-wrapper.link-mode > .link-post { grid-template-columns:minmax(0, 1fr); } }
.link-main > label { display:block; font-weight:700; margin-bottom:10px; }
.cms-classic-wrapper.link-mode > :not(.post-modes):not(.link-post) { display:none !important; }
.link-post > label { display:block; font-weight:700; margin-bottom:10px; }
.link-post b { color:#dc2626; }
.link-row { display:flex; flex-wrap:wrap; gap:10px; align-items:center; margin-bottom:12px; }
.link-row img { height:90px; max-width:160px; object-fit:cover; border-radius:6px; border:1px solid #cbd5e1; }
.link-open { display:inline-block; background:#0d47a1; color:#fff !important; padding:10px 18px; border-radius:999px; font-weight:700; }

/* Ngay da cong khai theo cach khac (js/ingredients.js) */
.ing-lock { background:#fef3c7; border:1px solid #f59e0b; color:#92400e; border-radius:8px; padding:10px 14px; margin:10px 0; font-weight:700; }
.sup-toolbar [data-upload][hidden], .ing-lock[hidden] { display:none !important; }
@media print { .ing-lock { display:none; } }

/* Cong khai nguyen lieu nam duoi thuc don cua be (js/ingredients.js) */
.ing-section { margin-top:6px; padding:16px 14px; border-top:4px solid #00897b; }
.page-tabs button { padding:7px 14px; border-radius:999px; border:1px solid #cbd5e1; background:#fff; color:#0d47a1; font:inherit; font-weight:700; font-size:13px; cursor:pointer; }
.page-tabs button.on { background:#0d47a1; border-color:#0d47a1; color:#fff; }
#ing-print { display:none; }
@media print {
  body:not(.print-ing) .ing-section { display:none; }
  body.print-ing > *:not(#ing-print) { display:none !important; }
  body.print-ing #ing-print { display:block; }
  #ing-print .ing-table { min-width:0; width:100%; font-size:11px; border-collapse:collapse; }
  #ing-print .ing-table th, #ing-print .ing-table td { border:1px solid #333; padding:4px 6px; }
}

/* Trang Cong khai (js/disclosure.js) */
.dis-item { border:1px solid #e2e8f0; border-radius:10px; padding:10px 12px; margin-bottom:8px; background:#fff; }
.dis-head { display:flex; flex-wrap:wrap; gap:8px; align-items:flex-start; }
.dis-no { flex:none; width:28px; height:28px; border-radius:50%; background:#0d47a1; color:#fff; font-weight:700; font-size:13px; display:flex; align-items:center; justify-content:center; }
.dis-name { flex:1; min-width:180px; font-size:14px; }
.dis-name small { color:#64748b; }
.dis-badge { border-radius:999px; padding:3px 10px; font-size:12px; font-weight:700; }
.dis-badge.ok { background:#dcfce7; color:#166534; }
.dis-badge.soon { background:#fef3c7; color:#92400e; }
.dis-badge.late { background:#fee2e2; color:#b91c1c; }
.dis-badge.none { background:#f1f5f9; color:#475569; }
.dis-links, .dis-months, .dis-actions { display:flex; flex-wrap:wrap; gap:8px; align-items:center; margin:8px 0 0 36px; font-size:13px; }
.dis-months span { border:1px solid #cbd5e1; border-radius:6px; padding:2px 8px; color:#64748b; }
.dis-months span.ok { background:#dcfce7; border-color:#86efac; color:#166534; font-weight:700; }
.dis-file { display:flex; flex-wrap:wrap; gap:8px; align-items:center; margin:8px 0 0 36px; padding-top:8px; border-top:1px dashed #e2e8f0; }
.dis-file > div { flex:1; min-width:170px; overflow-wrap:anywhere; }
.dis-file small { display:block; color:#64748b; font-size:12px; }
.dis-file p { margin:4px 0 0; font-size:13px; white-space:pre-line; }
.dis-log { margin-top:14px; }
.dis-log summary { cursor:pointer; font-weight:700; color:#0d47a1; margin-bottom:8px; }
.nv-block-title .dis-entry { margin-left:auto; margin-right:12px; }
@media (max-width:600px) { .dis-links, .dis-months, .dis-actions, .dis-file { margin-left:0; } .nv-block-title .dis-entry { margin:0; } }

.dis-remind { display:flex; flex-wrap:wrap; gap:6px; align-items:center; background:#fef3c7; border:1px solid #f59e0b; color:#92400e; border-radius:10px; padding:10px 12px; margin:8px 0 12px; font-size:14px; }
.dis-remind[hidden] { display:none; }
.dis-remind button { border:1px solid #f59e0b; background:#fff; color:#92400e; border-radius:999px; padding:3px 10px; font:inherit; font-size:12px; font-weight:700; cursor:pointer; }
@media print { .dis-remind { display:none; } }

/* Trang Cong khai khong danh so muc */
.dis-links, .dis-months, .dis-actions, .dis-file { margin-left:0; }
.dis-add-item { display:block; margin:0 0 14px; border-style:dashed; }

/* Chon nhieu file (trang Cong khai hoat dong) */
.dis-drop { border:2px dashed #94a3b8; border-radius:10px; padding:12px; margin-bottom:10px; text-align:center; }
.dis-drop.over { background:#e3f2fd; border-color:#0d47a1; }
.dis-drop small { display:block; color:#64748b; margin:4px 0 8px; }
.dis-drop ul { list-style:none; margin:8px 0 0; padding:0; text-align:left; max-height:180px; overflow:auto; }
.dis-drop li { display:flex; gap:8px; align-items:center; justify-content:space-between; padding:4px 0; border-top:1px solid #e2e8f0; overflow-wrap:anywhere; }
.dis-drop li small { display:inline; margin:0 0 0 6px; }
.dis-drop li button { flex:none; width:26px; height:26px; border:0; border-radius:50%; background:#fee2e2; color:#b91c1c; cursor:pointer; }
.dis-drop li.total { font-weight:700; color:#0d47a1; }

/* Hai lien ket o tieu de khoi van ban nam ben phai */
#notice-section .nv-block-title { flex-wrap:wrap; gap:6px 14px; }
#notice-section .nv-block-title > .view-all-link:not(.dis-entry) { margin-left:auto; }
#notice-section .nv-block-title > .dis-entry { margin:0; }
