/*
 * SiteTrack v1.7 — small layer on top of the Dashtrap theme (style.min.css).
 * Only what the theme does not have: the company logo in the logo box, the old page-title boxes
 * laid out like the theme's page title, a few helper classes the app's pages use, and the Site App
 * bottom bar. Colours come from the theme's own variables so light and dark mode both work.
 */

/* ---------- Logo box (company logo or initials + name, like the Dashtrap wordmark) ---------- */
.logo-box a { text-decoration: none; }
.st-logo { display: inline-flex; align-items: center; gap: .6rem; min-width: 0; max-width: 200px; vertical-align: middle; }
.st-logo-mark { width: 30px; height: 30px; border-radius: .25rem; display: inline-flex; align-items: center; justify-content: center; flex: none;
  font-weight: 800; font-size: .8rem; letter-spacing: .02em; overflow: hidden; background: var(--st-brand, #346ee0); color: var(--st-on-brand, #fff); }
.st-logo-mark.has-logo { background: #fff; padding: 2px; }
.st-logo-mark img { width: 100%; height: 100%; object-fit: contain; display: block; }
.st-logo-name { font-weight: 800; font-size: 1rem; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logo-light .st-logo-name { color: #fff; }
.logo-dark .st-logo-name { color: var(--bs-emphasis-color); }
.navbar-custom .logo-box .st-logo-mark { width: 26px; height: 26px; font-size: .72rem; }

/* ---------- Topbar ---------- */
#theme-mode { cursor: pointer; }
.topbar .dropdown-item.active, .topbar .dropdown-item:active { color: var(--bs-dropdown-link-active-color); }
.profile-dropdown form .dropdown-item { width: 100%; text-align: start; }
.profile-dropdown .dropdown-header small { display: block; margin-top: 2px; }
.notification-list .notify-item .noti-item-title { margin-bottom: 2px; }

/* ---------- Page title: old .page-title-box headers laid out like partials/page-title.html ---------- */
.page-title-box { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem 1rem; padding: 1rem 0; }
@media (min-width: 992px) { .page-title-box { padding: 1.5rem 0; } }
.page-title-box > br { display: none; }
.page-title-box > h4, .page-title-box > .page-title { margin: 0 !important; order: 1; flex: 1 1 auto; }
.page-title-box > .page-title-right { order: 2; margin-left: auto; float: none !important; }
.page-title-box > :not(h4):not(.page-title):not(.page-title-right) { order: 3; flex: 1 1 100%; }
.page-title-box > p { margin-bottom: 0 !important; color: var(--bs-secondary-color); }
.page-title-box .breadcrumb { margin: 0; }
.page-title-box h4.mb-1, .page-title-box h4.mb-0 { margin-bottom: 0 !important; }
.page-title.mb-1 { margin-bottom: 0 !important; }

/* ---------- Helpers used by the app's pages (theme look) ---------- */
.sitetrack-accent { color: var(--st-brand-ink, #346ee0) !important; }
.sitetrack-badge { background: var(--st-brand, #346ee0) !important; color: var(--st-on-brand, #fff) !important; }

.st-section-note { color: var(--bs-secondary-color); font-size: .875rem; }
.st-empty { color: var(--bs-secondary-color); padding: 2rem 1rem !important; text-align: center; }
.st-empty-state { border: 1px dashed var(--bs-border-color); border-radius: var(--bs-border-radius); background: var(--bs-tertiary-bg); color: var(--bs-secondary-color); padding: 1.4rem; text-align: center; }

.st-actions { display: inline-flex !important; flex-wrap: nowrap !important; align-items: center; gap: .35rem !important; white-space: nowrap; }
.st-actions form { margin: 0 !important; display: inline-flex !important; }
.st-actions .btn { margin: 0 !important; }
td:has(> .st-actions) { white-space: nowrap; }

.st-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.st-chip { display: inline-block; background: rgba(52, 110, 224, .18); color: #346ee0; border-radius: 999px; padding: .2rem .55rem; font-size: .8rem; line-height: 1.25;
  max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }

/* Stat cards (same rhythm as the dashboard cards in index.html) */
.st-stat-card .st-stat-label, .st-kpi .st-kpi-label { color: var(--bs-secondary-color); font-size: .8125rem; font-weight: 600; margin-bottom: .35rem; }
.st-stat-card .st-stat-value, .st-kpi .st-kpi-value { color: var(--bs-emphasis-color); font-size: 1.5rem; font-weight: 700; line-height: 1.2; }
.st-kpi { background: var(--bs-secondary-bg); border: 1px solid var(--bs-border-color); border-radius: var(--bs-border-radius); box-shadow: var(--bs-box-shadow-sm); padding: 1rem; height: 100%; }

/* Generic card / stat boxes used by older page snippets */
.st-card { background: var(--bs-secondary-bg); border: 1px solid var(--bs-border-color); border-radius: var(--bs-border-radius); box-shadow: var(--bs-box-shadow-sm); padding: 1rem; margin-bottom: 1rem; color: var(--bs-body-color); }
.st-stat { background: var(--bs-secondary-bg); border: 1px solid var(--bs-border-color); border-radius: var(--bs-border-radius); padding: 1rem; height: 100%; }

/* Workflow tabs (material module) — theme nav-tabs underline style */
.st-workflow-tabs { border-bottom: 1px solid var(--bs-border-color); display: flex; gap: .25rem; overflow-x: auto; padding: 0; margin: 0 0 1.25rem; scrollbar-width: thin; list-style: none; }
.st-workflow-tabs .nav-link { border: 0 !important; border-bottom: 2px solid transparent !important; border-radius: 0 !important; background: transparent !important; color: var(--bs-secondary-color) !important; padding: .75rem 1rem; white-space: nowrap; font-weight: 600; }
.st-workflow-tabs .nav-link:hover { color: var(--bs-emphasis-color) !important; }
.st-workflow-tabs .nav-link.active { color: var(--bs-primary) !important; border-bottom-color: var(--bs-primary) !important; }

/* Project cards (All Projects) and project details */
.st-project-grid { align-items: stretch; }
.st-project-card { height: 100%; transition: box-shadow .2s ease, border-color .2s ease; }
.st-project-card:hover, .st-project-card:focus-within { border-color: rgba(52, 110, 224, .45); box-shadow: var(--bs-box-shadow); }
.st-project-card-title { font-size: 1rem; font-weight: 700; margin: 0; color: var(--bs-emphasis-color); }
.st-project-meta { display: grid; gap: .6rem; }
.st-project-meta > div { display: grid; grid-template-columns: 82px minmax(0, 1fr); gap: .65rem; align-items: start; }
.st-project-meta span { color: var(--bs-secondary-color); font-size: .8125rem; font-weight: 600; }
.st-project-meta strong { color: var(--bs-body-color); font-size: .875rem; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.st-project-assigned strong { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.st-project-card-actions { flex-wrap: wrap; }
.st-project-card-actions > .st-actions { margin-left: auto; }
.st-project-kicker { color: var(--bs-secondary-color); font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.st-project-detail-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .75rem; }
.st-project-detail-item, .st-project-budget-card { border: 1px solid var(--bs-border-color); border-radius: var(--bs-border-radius); padding: .85rem .95rem; background: var(--bs-secondary-bg); min-width: 0; }
.st-project-budget-card { height: 100%; padding: 1rem; }
.st-project-detail-item span { display: block; color: var(--bs-secondary-color); font-size: .75rem; font-weight: 700; margin-bottom: .3rem; text-transform: uppercase; letter-spacing: .03em; }
.st-project-detail-item strong { color: var(--bs-emphasis-color); font-size: .9rem; overflow-wrap: anywhere; }
@media (max-width: 991.98px) { .st-project-detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 575.98px) { .st-project-detail-grid { grid-template-columns: 1fr; } }

/* Tables: keep wide tables scrollable on phones */
.table-responsive { -webkit-overflow-scrolling: touch; }
@media (max-width: 767.98px) {
  .card-body form.row > [class*="col-md-"] { width: 100%; }
  .st-actions { min-width: max-content; }
  .table-responsive .btn-sm { min-width: max-content; }
}

/* Avatar with initials (lists, chat) */
.st-avatar { width: 36px; height: 36px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; flex: none;
  background: rgba(52, 110, 224, .18); color: #346ee0; font-weight: 700; font-size: .8rem; object-fit: cover; }

/* Progress ring (client dashboard, project overview) */
.st-ring { --p: 0; width: 64px; height: 64px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center;
  background: conic-gradient(#346ee0 calc(var(--p) * 1%), var(--bs-border-color) 0); }
.st-ring > span { width: 50px; height: 50px; border-radius: 50%; background: var(--bs-secondary-bg); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .85rem; color: var(--bs-emphasis-color); }

/* Soft icon squares used beside card titles (theme's avatar-title + bg-soft-*) */
.st-icon-box { width: 2.5rem; height: 2.5rem; border-radius: var(--bs-border-radius); display: inline-flex; align-items: center; justify-content: center; font-size: 1.35rem; flex: none; }

/* Feature tiles on the dashboard */
.st-tile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .5rem; text-align: center; padding: 1.1rem .5rem; height: 100%;
  color: var(--bs-body-color); text-decoration: none; border: 1px solid var(--bs-border-color); border-radius: var(--bs-border-radius); background: var(--bs-secondary-bg);
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease; }
.st-tile:hover, .st-tile:focus-visible { color: var(--bs-emphasis-color); border-color: rgba(52, 110, 224, .5); box-shadow: var(--bs-box-shadow-sm); transform: translateY(-1px); }
.st-tile .st-icon-box { width: 2.75rem; height: 2.75rem; }
.st-tile span.label { font-weight: 600; font-size: .875rem; line-height: 1.25; }
.st-tile small { color: var(--bs-secondary-color); font-size: .75rem; }

/* ---------- Site App bottom bar (employee portal, phones) ---------- */
.st-bottom-nav { display: none; }
@media (max-width: 991.98px) {
  .st-has-bottom-nav .page-content { padding-bottom: 72px; }
  .st-bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1001; display: grid; grid-template-columns: repeat(5, 1fr); align-items: end;
    background: var(--bs-secondary-bg); border-top: 1px solid var(--bs-border-color); box-shadow: 0 -.25rem .75rem rgba(56, 65, 74, .06);
    padding: .35rem .25rem calc(.35rem + env(safe-area-inset-bottom)); }
  .st-bottom-nav a { display: flex; flex-direction: column; align-items: center; gap: .15rem; color: var(--bs-secondary-color); text-decoration: none; font-size: .72rem; font-weight: 600; padding: .25rem 0; }
  .st-bottom-nav a i { font-size: 1.45rem; line-height: 1; }
  .st-bottom-nav a.active { color: var(--bs-primary); }
  .st-bottom-add-btn { width: 48px; height: 48px; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin-top: -22px;
    background: var(--st-brand, #346ee0); color: var(--st-on-brand, #fff); box-shadow: 0 .35rem 1rem rgba(var(--st-brand-rgb, 52, 110, 224), .35); }
  .st-bottom-add-btn i { font-size: 1.6rem !important; }
}

@media print {
  .st-bottom-nav, .footer, .navbar-custom, .main-menu { display: none !important; }
  .page-content { padding-bottom: 0 !important; }
}

/* Older pages wrap their body in another .container-fluid (content-page > content > container-fluid). */
.page-content .container-fluid .container-fluid { padding-left: 0; padding-right: 0; }

/* ---------- Multi-select with search (sitetrack-ui.js) ---------- */
.st-native-multiselect { position: absolute !important; width: 1px !important; height: 1px !important; opacity: 0 !important; pointer-events: none !important; }
.st-multiselect { position: relative; width: 100%; }
.st-multiselect-toggle { width: 100%; min-height: 38px; cursor: pointer; padding-right: 2.3rem !important; display: flex !important; align-items: center; }
.st-multiselect-placeholder { color: var(--bs-secondary-color); }
.st-multiselect-summary { display: flex; flex-direction: column; min-width: 0; }
.st-multiselect-summary strong { font-weight: 600; color: var(--bs-emphasis-color); line-height: 1.2; }
.st-multiselect-summary small { color: var(--bs-secondary-color); margin-top: .15rem; }
.st-multiselect-chips { display: flex; flex-wrap: wrap; gap: .3rem; min-width: 0; }
.st-multiselect-panel { display: none; position: absolute; z-index: 1080; top: calc(100% + 4px); left: 0; right: 0; background: var(--bs-secondary-bg); border: 1px solid var(--bs-border-color);
  border-radius: var(--bs-border-radius); box-shadow: var(--bs-box-shadow); overflow: hidden; }
.st-multiselect.open .st-multiselect-panel { display: block; }
.st-multiselect-search { position: relative; padding: .6rem; border-bottom: 1px solid var(--bs-border-color); }
.st-multiselect-search i { position: absolute; left: 1rem; top: 50%; transform: translateY(-50%); color: var(--bs-secondary-color); z-index: 1; }
.st-multiselect-search .form-control { padding-left: 2rem; }
.st-multiselect-options { max-height: 250px; overflow-y: auto; padding: .35rem; }
.st-multiselect-option { display: flex; align-items: center; gap: .6rem; padding: .5rem .6rem; margin: 0; border-radius: var(--bs-border-radius); color: var(--bs-body-color); cursor: pointer; }
.st-multiselect-option:hover { background: var(--bs-tertiary-bg); }
.st-select-all-option { font-weight: 700; border-bottom: 1px solid var(--bs-border-color); border-radius: 0; margin-bottom: .2rem; }
@media (max-width: 575.98px) {
  .st-multiselect-panel { position: fixed; left: .75rem; right: .75rem; top: 18vh; max-height: 64vh; }
  .st-multiselect-options { max-height: 46vh; }
}
.st-action-cell { white-space: nowrap !important; }
.st-action-cell > form { display: inline-flex !important; margin: 0 .2rem 0 0 !important; vertical-align: middle; }
.st-action-cell > .btn { margin-right: .2rem !important; vertical-align: middle; }

/* Title boxes whose heading sits inside another wrapper: breadcrumb in a second column. */
.page-title-box.st-pt-grid { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 1.5rem; }
.page-title-box.st-pt-grid > .page-title-right { grid-column: 2; grid-row: 1; margin: 0; }
.page-title-box.st-pt-grid > :not(.page-title-right) { grid-column: 1; }

/* The page column never grows wider than the window because of a wide table or tab row. */
.page-content { min-width: 0; }

/* Dark mode: light table headers keep readable text. */
html[data-bs-theme=dark] .table-light { --bs-table-color: var(--bs-emphasis-color); color: var(--bs-emphasis-color); }

/* Old title boxes whose right-hand part holds the page's own badges or buttons: breadcrumb at the end. */
.page-title-box > .page-title-right { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: .5rem 1rem; }
.page-title-box > .page-title-right > .st-crumb-inline { order: 99; }
.page-title-box > .page-title-right.d-none { display: none !important; }
@media (min-width: 992px) { .page-title-box > .page-title-right.d-lg-block { display: flex !important; } }
