/* ============================================================
   NIR DepEd ICT Platform — Custom Styles
   ============================================================ */

/* ── CSS Variables ─────────────────────────────────────────── */
:root {
  --nir-blue:        #003087;
  --nir-blue-dark:   #001f5a;
  --nir-blue-light:  #1a4fa0;
  --nir-yellow:      #FFC300;
  --nir-yellow-dark: #e6b000;
  --sidebar-width:   260px;
  --sidebar-bg:      #1e2a3b;
  --sidebar-hover:   #2d3f55;
  --topbar-h:        56px;
  --radius:          10px;
  --shadow:          0 2px 12px rgba(0,0,0,.08);
}

/* ── Base ──────────────────────────────────────────────────── */
* { box-sizing: border-box; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: #f0f2f5;
  font-size: 14px;
  color: #2d3748;
}

.x-small { font-size: 0.72rem; }

/* ── Login Page ────────────────────────────────────────────── */
.login-body {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--nir-blue-dark) 0%, var(--nir-blue-light) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.login-wrapper {
  width: 100%;
  max-width: 420px;
}

.login-card {
  background: #fff;
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}

.login-brand {
  text-align: center;
  margin-bottom: 1.5rem;
}

.login-logo-circle {
  width: 72px;
  height: 72px;
  background: linear-gradient(135deg, var(--nir-blue), var(--nir-blue-light));
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 4px 15px rgba(0,48,135,.3);
}

.text-primary-custom { color: var(--nir-blue) !important; }

.btn-primary-custom {
  background: linear-gradient(135deg, var(--nir-blue) 0%, var(--nir-blue-light) 100%);
  border: none;
  color: #fff;
  border-radius: 8px;
  padding: .5rem 1.25rem;
  transition: opacity .2s, transform .1s;
}
.btn-primary-custom:hover  { opacity: .9; color: #fff; transform: translateY(-1px); }
.btn-primary-custom:active { transform: translateY(0); }
.btn-primary-custom.btn-sm { padding: .35rem .85rem; font-size: .8rem; }

/* ── Navbar ────────────────────────────────────────────────── */
.nir-navbar {
  background: linear-gradient(90deg, var(--nir-blue-dark), var(--nir-blue));
  height: var(--topbar-h);
  z-index: 1040;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}

.nir-navbar .navbar-brand,
.nir-navbar .btn-link { color: #fff !important; text-decoration: none; }

.brand-icon {
  width: 36px;
  height: 36px;
  background: rgba(255,255,255,.15);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.brand-text {
  font-weight: 700;
  font-size: .95rem;
  letter-spacing: .3px;
}

.user-avatar {
  width: 32px;
  height: 32px;
  background: var(--nir-yellow);
  color: var(--nir-blue-dark);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .85rem;
}

.notif-badge {
  font-size: .6rem;
  min-width: 18px;
}

.notif-dropdown { min-width: 320px; max-height: 420px; overflow: hidden; }
.notif-scroll   { max-height: 340px; overflow-y: auto; }

/* ── Layout Wrapper ────────────────────────────────────────── */
.wrapper {
  min-height: calc(100vh - var(--topbar-h));
  position: relative;
}

/* ── Sidebar ───────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  min-height: calc(100vh - var(--topbar-h));
  background: var(--sidebar-bg);
  flex-shrink: 0;
  transition: transform .3s ease, width .3s ease;
  z-index: 1030;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-inner { padding: 0; }

.sidebar-user-panel {
  background: rgba(255,255,255,.06);
  padding: 1.25rem 1rem;
  text-align: center;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.user-avatar-lg {
  width: 52px;
  height: 52px;
  background: var(--nir-yellow);
  color: var(--nir-blue-dark);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.2rem;
  box-shadow: 0 3px 10px rgba(0,0,0,.2);
}

.sidebar-role-badge {
  display: inline-block;
  margin-top: .4rem;
  font-size: .68rem;
  background: rgba(255,195,0,.2);
  color: var(--nir-yellow);
  border-radius: 20px;
  padding: .15rem .65rem;
  border: 1px solid rgba(255,195,0,.3);
}

.sidebar-heading {
  padding: .9rem 1.2rem .3rem;
  font-size: .65rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255,255,255,.35);
  font-weight: 600;
  list-style: none;
}

.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .65rem 1.2rem;
  color: rgba(255,255,255,.7);
  font-size: .84rem;
  border-radius: 0;
  transition: background .15s, color .15s;
  text-decoration: none;
}

.sidebar-nav .nav-link i {
  width: 18px;
  text-align: center;
  flex-shrink: 0;
  font-size: .9rem;
}

.sidebar-nav .nav-link:hover {
  background: var(--sidebar-hover);
  color: #fff;
}

.sidebar-nav .nav-link.active {
  background: var(--nir-blue);
  color: #fff;
  font-weight: 600;
  border-left: 3px solid var(--nir-yellow);
}

.text-danger-sidebar { color: rgba(255, 100, 100, .75) !important; }
.text-danger-sidebar:hover { color: #ff6464 !important; background: rgba(255,0,0,.1) !important; }

/* Sidebar overlay (mobile) */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 1025;
}
.sidebar-overlay.show { display: block; }

/* Desktop collapse — icon-only rail. Scoped to >=992px so it never fights the
   mobile overlay above (that uses transform + .show, entirely separate). */
@media (min-width: 992px) {
  .sidebar.collapsed { width: 76px; }
  .sidebar.collapsed .sidebar-user-panel .mt-2,
  .sidebar.collapsed .sidebar-heading,
  .sidebar.collapsed .sidebar-nav .nav-link span,
  .sidebar.collapsed .sidebar-nav .nav-link .badge {
    display: none;
  }
  .sidebar.collapsed .sidebar-user-panel { padding: 1.25rem .5rem; }
  .sidebar.collapsed .user-avatar-lg { width: 40px; height: 40px; font-size: 1rem; }
  .sidebar.collapsed .sidebar-nav .nav-link { justify-content: center; padding: .65rem .5rem; }
  .sidebar.collapsed .sidebar-nav .nav-link i { width: auto; font-size: 1.05rem; }
  .sidebar.collapsed .sidebar-nav .nav-link.active { border-left: none; border-top: 3px solid var(--nir-yellow); }
}

/* ── Main Content ──────────────────────────────────────────── */
.main-content {
  min-width: 0;
  transition: margin .3s ease;
}

.page-header {
  background: #fff;
  padding: .85rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .5rem;
  border-bottom: 1px solid #e2e8f0;
  margin-bottom: .25rem;
  position: sticky;
  top: var(--topbar-h);
  z-index: 100;
}

.page-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--nir-blue-dark);
}

/* ── Footer ────────────────────────────────────────────────── */
.app-footer {
  background: #fff;
  border-top: 1px solid #e2e8f0;
  padding: .6rem 1.25rem;
  margin-top: auto;
}

/* ── Stat Cards ────────────────────────────────────────────── */
.stat-card {
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: .25rem;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  content: '';
  position: absolute;
  right: -10px;
  bottom: -10px;
  width: 80px;
  height: 80px;
  background: rgba(255,255,255,.1);
  border-radius: 50%;
}

.stat-card-blue   { background: linear-gradient(135deg, #003087, #1a6fc4); }
.stat-card-green  { background: linear-gradient(135deg, #198754, #20c997); }
.stat-card-yellow { background: linear-gradient(135deg, #b5830a, #e6b000); }
.stat-card-orange { background: linear-gradient(135deg, #d35400, #e67e22); }

.stat-icon  { font-size: 1.4rem; opacity: .8; }
.stat-value { font-size: 1.8rem; font-weight: 800; line-height: 1; }
.stat-label { font-size: .75rem; opacity: .85; }

/* Mini stat cards */
.mini-stat-card {
  background: #fff;
  border-radius: 8px;
  padding: .75rem 1rem;
  box-shadow: var(--shadow);
  border-left: 4px solid;
}
.mini-stat-value { font-size: 1.5rem; font-weight: 800; color: #2d3748; }
.mini-stat-label { font-size: .75rem; color: #718096; }

/* ── Cards ─────────────────────────────────────────────────── */
.card {
  border: none;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card-header {
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  font-size: .85rem;
  padding: .75rem 1rem;
  border-radius: var(--radius) var(--radius) 0 0 !important;
}

.bg-primary-custom {
  background: linear-gradient(135deg, var(--nir-blue-dark), var(--nir-blue)) !important;
}

.table-primary-custom {
  background: linear-gradient(90deg, var(--nir-blue-dark), var(--nir-blue));
  color: #fff;
}

/* Bootstrap 5.3's `.table > :not(caption) > * > *` rule sets background-color directly
   on each <th>, which paints over the thead's gradient (white text on white = invisible
   header). Match its target + specificity, with !important as a safety margin, so the
   header background always wins regardless of stylesheet order. */
.table-primary-custom th {
  background: linear-gradient(90deg, var(--nir-blue-dark), var(--nir-blue)) !important;
  color: rgba(255,255,255,.9);
  font-weight: 600;
  font-size: .8rem;
  border-color: var(--nir-blue-dark);
}

/* ── Buttons ───────────────────────────────────────────────── */
.btn-xs {
  font-size: .72rem;
  padding: .2rem .5rem;
  line-height: 1.4;
  border-radius: 5px;
}

/* ── Project Cards ─────────────────────────────────────────── */
.project-card {
  border-radius: var(--radius);
  transition: transform .15s, box-shadow .15s;
}
.project-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,.12);
}

/* ── Asset type scroll row ─────────────────────────────────── */
.asset-summary-scroll {
  display: flex;
  gap: .75rem;
  overflow-x: auto;
  padding-bottom: .5rem;
}

.asset-type-card {
  background: #fff;
  border-radius: 10px;
  padding: .75rem 1rem;
  text-align: center;
  min-width: 80px;
  flex-shrink: 0;
  box-shadow: var(--shadow);
}

/* ── School info helper ─────────────────────────────────────── */
.info-label {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: #718096;
  margin-bottom: .15rem;
  font-weight: 600;
}

/* ── Notification dots ─────────────────────────────────────── */
.notif-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.notif-dot-lg {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
}

/* ── DataTables overrides ──────────────────────────────────── */
.dataTables_wrapper .dataTables_filter input {
  border-radius: 6px;
  border: 1px solid #cbd5e0;
  padding: .3rem .7rem;
  font-size: .82rem;
}

.dataTables_wrapper .dataTables_length {
  display: flex;
  align-items: center;
  gap: .4rem;
}

.dataTables_wrapper .dataTables_length label {
  display: flex;
  align-items: center;
  gap: .4rem;
  margin-bottom: 0;
  white-space: nowrap;
}

/* DataTables' Bootstrap5 integration applies Bootstrap's .form-select class to this
   select, which defaults to width:100% (a block-level field). Left unset, it stretches
   across the flex row and overlaps the "per page" text that follows it. */
.dataTables_wrapper .dataTables_length select {
  width: auto;
  border-radius: 6px;
  border: 1px solid #cbd5e0;
  padding: .25rem 1.75rem .25rem .5rem;
}

table.dataTable tbody tr:hover { background-color: #f7fafc !important; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 991.98px) {
  .sidebar {
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    height: calc(100vh - var(--topbar-h));
    transform: translateX(-100%);
    z-index: 1035;
  }

  .sidebar.show {
    transform: translateX(0);
  }

  .main-content { width: 100%; }

  .stat-value { font-size: 1.4rem; }
}

@media (max-width: 575.98px) {
  .page-header { padding: .65rem 1rem; }
  .container-fluid { padding-left: .75rem !important; padding-right: .75rem !important; }
  .login-card { padding: 1.5rem; }
  .stat-card { padding: .85rem 1rem; }
}

/* ── Scrollbar ─────────────────────────────────────────────── */
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.2); border-radius: 2px; }

/* ── Breadcrumb ────────────────────────────────────────────── */
.breadcrumb { margin-bottom: 0; }
.breadcrumb-item a { color: var(--nir-blue); text-decoration: none; }

/* ── Progress bar ──────────────────────────────────────────── */
.progress { background: #e2e8f0; }

/* ── Badge fixes ───────────────────────────────────────────── */
.badge { font-weight: 500; letter-spacing: .2px; }

/* ── School checkbox list ──────────────────────────────────── */
.school-checkbox-list .form-check { cursor: pointer; }
.school-checkbox-list .form-check:last-child { border-bottom: none !important; }
.school-checkbox-list .form-check:hover { background: #f7fafc; }

/* ── Module reports (print view) ──────────────────────────────── */
.report-meta { font-size: .8rem; color: #718096; }

@media print {
  .nir-navbar, .sidebar, .app-footer, .no-print { display: none !important; }
  body { background: #fff !important; }
  .wrapper { display: block !important; }
  .main-content { width: 100% !important; margin: 0 !important; }
  .container-fluid { padding: 0 !important; }
  .card { box-shadow: none !important; border: 1px solid #dee2e6 !important; break-inside: avoid; }
}
