﻿/* AdminLTE override - custom color palette
   Primary: Orange  #E9531D
   Secondary: Blue  #003366
   ONLY modify visual styles here. Keep specificity high and use !important where needed to override AdminLTE defaults.
*/
:root {
  --uni-primary: #E9531D; /* Orange */
  --uni-secondary: #003366; /* Deep Blue */
  --uni-sidebar: #153164; /* Sidebar and data-grid header blue */
}

/* Global text/link colors */
/* Apply secondary blue to regular anchors, but avoid forcing .nav-link (sidebar) to blue which hurts contrast */
a {
  color: var(--uni-secondary) !important;
}
a:hover {
  color: var(--uni-primary) !important;
}

/* Sidebar-specific: ensure nav links are readable on dark background */
.nav-sidebar .nav-link,
.sidebar-dark-primary .nav-sidebar .nav-link,
.nav-sidebar .nav-treeview .nav-link {
  color: rgba(255,255,255,0.92) !important; /* readable light text */
}
.nav-sidebar .nav-link:hover,
.nav-sidebar .nav-treeview .nav-link:hover {
  color: var(--uni-primary) !important;
}

/* Make the user-panel name readable (was too dim) */
.user-panel .info,
.user-panel .info a,
.user-panel .info p {
  color: rgba(255,255,255,0.92) !important;
}
.user-panel .info a:hover {
  color: var(--uni-primary) !important;
}

/* Icon color inside sidebar (e.g., the circle indicators) */
.nav-sidebar .nav-icon,
.nav-sidebar .nav-treeview .nav-icon {
  color: rgba(255,255,255,0.65) !important;
}

/* Brand / header */
.brand-link {
  background-color: var(--uni-secondary) !important;
  color: #ffffff !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important; /* center horizontally */
  padding: .45rem .5rem !important;
}
.brand-link .brand-image img {
  opacity: 0.95;
}
.brand-link .brand-text {
  color: #ffffff !important;
}

/* Hide the filler span used earlier to preserve spacing (we center via flexbox instead) */
.brand-link .brand-filler {
  display: none !important;
}

/* Ensure the SVG logo inside .brand-link is centered and doesn't carry extra left margin */
.brand-link img.brand-image {
  margin-left: 0 !important;
  display: inline-block !important;
}

/* Main navbar */
.main-header .navbar {
  background-color: var(--uni-secondary) !important;
  border-bottom: 1px solid rgba(255,255,255,0.06) !important;
}
.main-header .navbar .nav-link,
.main-header .navbar .navbar-nav .user-panel a {
  color: #ffffff !important;
}

/* Sidebar background and links */
.main-sidebar {
  /* background-color: #071a2b !important; */
  background-color: var(--uni-sidebar) !important; /* keep dark base for contrast */
  min-height: 100vh !important; /* ensure sidebar covers full viewport height */
  position: fixed !important;
  top: 0 !important;
  bottom: 0 !important;
  left: 0 !important;
  height: 100vh !important;
  overflow-y: auto !important;
}
.sidebar-dark-primary .nav-sidebar > .nav-item > .nav-link {
  color: rgba(255,255,255,0.9) !important;
}
.sidebar-dark-primary .nav-sidebar > .nav-item > .nav-link:hover {
  background-color: rgba(0,0,0,0.04) !important;
  color: var(--uni-primary) !important;
}
/* Active/selected sidebar item */
.sidebar-dark-primary .nav-sidebar > .nav-item > .nav-link.active,
.nav-pills .nav-link.active {
  background-color: var(--uni-primary) !important;
  color: #ffffff !important;
  border-left-color: var(--uni-primary) !important;
}

/* Buttons */
.btn-primary {
  background-color: var(--uni-primary) !important;
  border-color: var(--uni-primary) !important;
  color: #ffffff !important;
}
.btn-primary:hover,
.btn-primary:focus {
  background-color: #cf4016 !important; /* slightly darker orange */
  border-color: #cf4016 !important;
  color: #fff !important;
}
.btn-outline-primary {
  color: var(--uni-primary) !important;
  border-color: var(--uni-primary) !important;
}
.btn-outline-primary:hover {
  background-color: var(--uni-primary) !important;
  color: #ffffff !important;
}

/* Badges, bg utilities */
.bg-primary, .badge-primary,
.badge.bg-primary {
  background-color: var(--uni-primary) !important;
  color: #ffffff !important;
}
.text-primary {
  color: var(--uni-primary) !important;
}

/* Cards and headers */
.card.card-primary > .card-header,
.card.card-primary .card-header {
  background-color: var(--uni-secondary) !important;
  border-color: var(--uni-secondary) !important;
  color: #ffffff !important;
}
.card .card-header {
  background-color: rgba(0,0,0,0.02) !important;
}

/* Form controls focus states */
.form-control:focus,
.input-group-text:focus {
  border-color: var(--uni-primary) !important;
  box-shadow: 0 0 0 .2rem rgba(233,83,29,0.18) !important;
}

/* Progress bars, switches */
.progress-bar,
.custom-switch .custom-control-input:checked ~ .custom-control-label::before {
  background-color: var(--uni-primary) !important;
  border-color: var(--uni-primary) !important;
}

/* Small components */
.badge-pill.badge-primary,
.info-box .info-box-icon.bg-primary,
.callout.callout-primary {
  background-color: var(--uni-primary) !important;
  color: #ffffff !important;
}

/* Tables - header accent */
.table thead th {
  background-color: rgba(0,0,0,0.03) !important;
}
.table-hover tbody tr:hover {
  background-color: rgba(233,83,29,0.04) !important;
}

/* Breadcrumbs */
.breadcrumb {
  background: transparent !important;
}
.breadcrumb .breadcrumb-item a {
  color: var(--uni-secondary) !important;
}

/* Footer */
.main-footer {
  background-color: #021226 !important;
  color: rgba(255,255,255,0.7) !important;
  border-top: 1px solid rgba(255,255,255,0.04) !important;
}

/* Misc overrides for components that rely on AdminLTE "primary" variable */
.btn.btn-tool.text-primary,
.link-muted.text-primary {
  color: var(--uni-primary) !important;
}

/* Ensure forms of collapsed/expanded elements highlight with primary */
.nav-sidebar .menu-open > .nav-treeview,
.nav-sidebar .menu-open > .nav-treeview > .nav-item > .nav-link.active {
  background-color: rgba(233,83,29,0.06) !important;
  color: var(--uni-primary) !important;
}

/* Make sure badges/icons inside header menus use secondary color where appropriate */
.dropdown-menu .dropdown-item .fas,
.dropdown-menu .dropdown-item .ion {
  color: var(--uni-secondary) !important;
}

/* Utility: accent borders */
.border-accent-primary {
  border-color: var(--uni-primary) !important;
}
.border-accent-secondary {
  border-color: var(--uni-secondary) !important;
}

/* Responsive: keep overrides intact on small screens */
@media (max-width: 575.98px) {
  .brand-link {
    padding: .45rem .5rem !important;
  }
}

/* Sticky footer additions */
/* Fix the AdminLTE main footer to the bottom of the viewport and ensure content isn't hidden underneath it. */
.main-footer {
  position: fixed !important;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  z-index: 1030; /* above normal content but below modals */
}

/* Provide bottom padding on the app wrapper so the page content doesn't overlap the fixed footer. Adjust the padding to match footer height if you customize the footer size. */
.app-wrapper {
  padding-bottom: 3.5rem; /* ~56px, adjust if footer height changes */
}

/* On very small screens reduce the padding so the footer doesn't take too much space */
@media (max-width: 575.98px) {
  .app-wrapper {
    padding-bottom: 4.5rem; /* keep a bit more space on small screens if footer wraps */
  }
}

/* ── Fixed top navbar ──────────────────────────────────────────────── */
/* Pin the main header bar to the top of the viewport on scroll         */
.main-header {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  z-index: 1033 !important;
}

/* Push content area down so it starts below the fixed header           */
.content-wrapper {
  margin-top: calc(3.5rem + 1px) !important;
}

/* ── Sidebar scroll fix ───────────────────────────────────────────── */
/* Outer <aside> must NOT scroll — only the inner .sidebar nav list     */
/* scrolls, so the brand/logo area stays pinned at the top.             */
.main-sidebar {
  overflow-y: hidden !important;
}

.main-sidebar .sidebar {
  overflow-y: auto !important;
  height: calc(100vh - (3.5rem + 1px)) !important;
}

/* Account profile and password forms */
.account-settings-page {
  max-width: 720px;
  padding: 1rem 0;
  width: 100%;
}

.account-settings-card {
  border: 1px solid #d9e0e6;
  border-radius: 0;
  box-shadow: none;
  margin: 0;
  width: 100%;
}

.account-settings-card .card-header {
  background: #f7f9fb;
  border-bottom: 1px solid #d9e0e6;
  font-size: 1rem;
  padding: 0.8rem 1rem;
}

.account-settings-card .card-body {
  padding: 1.25rem;
}

.account-settings-card .form-group {
  margin-bottom: 1rem;
}

.account-settings-card label {
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.account-settings-card input[readonly] {
  background: #f5f7f9;
  color: #4b5563;
}

.account-settings-card .validation-message {
  color: #b42318;
  display: block;
  font-size: 0.85rem;
  margin-top: 0.25rem;
}

.account-profile-photo {
  align-items: center;
  display: flex;
  gap: 1rem;
}

.account-profile-photo img {
  border: 1px solid #d9e0e6;
  border-radius: 50%;
  height: 84px;
  object-fit: cover;
  width: 84px;
}

.account-profile-photo-actions {
  flex: 1;
  min-width: 0;
}

.account-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.25rem;
}

.account-form-actions .btn {
  align-items: center;
  display: inline-flex;
  gap: 0.45rem;
}

.account-password-field {
  position: relative;
}

.account-password-field .form-control {
  padding-right: 2.75rem;
}

.account-password-toggle {
  align-items: center;
  background: transparent;
  border: 0;
  color: #52616f;
  display: flex;
  height: 100%;
  justify-content: center;
  position: absolute;
  right: 0;
  top: 0;
  width: 2.65rem;
}

.account-password-toggle:hover,
.account-password-toggle:focus {
  color: #004f8c;
  outline: none;
}

@media (max-width: 575.98px) {
  .account-settings-page {
    padding-top: 0.5rem;
  }

  .account-settings-card .card-body {
    padding: 1rem;
  }

  .account-profile-photo {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* ── Fill-height grid page layout ────────────────────────────────── */
/* Wrap the entire ChildContent area of a grid page in .grid-page-wrapper */
/* then put the scrollable section in .grid-page-scroll.                  */
/* Result: filter stays at top, only the grid section scrolls — the       */
/* browser window itself does NOT scroll.                                  */
.grid-page-wrapper {
  display: flex;
  flex-direction: column;
  /* viewport minus: fixed header (3.5rem) + fixed footer (3.5rem) +      */
  /* page title h3 + content padding buffer (~3rem)                        */
  height: calc(100vh - 10rem);
  overflow: hidden;
}

.grid-page-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

/* ── Sticky filter bar ────────────────────────────────────────────── */
/* Add .sticky-filter-bar to any filter card on a grid page so filters  */
/* remain visible as the user scrolls through the grid rows.            */
/* On mobile (< 768px) filter fields stack vertically and take most of  */
/* the viewport height, so sticky is disabled — normal flow is better.  */
@media (min-width: 768px) {
  .sticky-filter-bar {
    position: sticky !important;
    top: calc(3.5rem + 1px) !important; /* just below the fixed header */
    z-index: 500 !important;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.14) !important;
  }
}

/* ── Sidebar menu search box (PR 4552 follow-up) ───────────────────── */
/* AdminLTE renders .form-control-sidebar on a sidebar-dark theme with a  */
/* dark/transparent background + light text, only turning white on focus. */
/* Keep the field light from the resting state and aligned with the global */
/* slate surface while retaining enough placeholder contrast.             */
[class*="sidebar-dark"] .form-control-sidebar,
[class*="sidebar-dark"] .form-control-sidebar:focus {
  background-color: var(--portal-surface) !important;
  border: 1px solid var(--portal-slate-300) !important;
  color: var(--portal-slate-800) !important;
}
[class*="sidebar-dark"] .form-control-sidebar:focus {
  border-color: var(--portal-slate-400) !important;
}
[class*="sidebar-dark"] .form-control-sidebar::placeholder {
  color: var(--portal-slate-500) !important;
  opacity: 1 !important;
}

