/* 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) #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"],
.btn-rbac-tab[data-tab="tab-permission-matrix"],
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; }
}
