/* ===================================================================
   DMS Baumit — site.css
   Migrated from AdminLTE 3.2.0 (Bootstrap 4.6) to a custom Fluent-style
   Bootstrap 5.3.8 template. Design tokens use the real Baumit brand
   colour (red, sampled from wwwroot/img/baumit.png) instead of the
   generic Microsoft blue from the working template.
   =================================================================== */

/* ===== Design tokens (Fluent 2, Baumit brand) ===== */
:root {
  --brand: #d6362b;
  --brand-hover: #b82c22;
  --brand-tint: #fbeae9;
  --bg: #f3f2f1;
  --surface: #fff;
  --surface-2: #faf9f8;
  --stroke: #e1dfdd;
  --stroke-soft: #edebe9;
  --ink: #242424;
  --ink-2: #605e5c;
  --ink-3: #8a8886;
  --ok: #107c10;
  --warn: #ca5010;
  --danger: #d13438;
  --purple: #8764b8;
  --teal: #038387;
  --radius: 8px;
  --radius-sm: 6px;
  --sidebar-w: 264px;
  --topbar-h: 56px;
  --shadow-2: 0 1px 2px rgba(0, 0, 0, .08), 0 0 1px rgba(0, 0, 0, .06);
  --shadow-8: 0 4px 8px rgba(0, 0, 0, .10), 0 0 2px rgba(0, 0, 0, .08);
  --shadow-16: 0 8px 16px rgba(0, 0, 0, .10), 0 0 2px rgba(0, 0, 0, .08);

  /* Legacy alias kept for any inline/legacy references to the old accent */
  --main-color: var(--brand);

  /* Bootstrap primary override so btn-primary/text-primary/etc. follow the brand */
  --bs-primary: var(--brand);
  --bs-primary-rgb: 214, 54, 43;
}

html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

html {
  position: relative;
  min-height: 100%;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a {
  text-decoration: none;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}

/* ===== App shell: full-width topbar on top, sidebar below-left ===== */
.app {
  display: block;
}

/* Sidebar — fixed on the left, starting BELOW the full-width topbar */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--stroke);
  position: fixed;
  top: var(--topbar-h);
  left: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 1040;
  transition: transform .2s ease;
}

/* Brand logo lives in the topbar now (no divider after it) */
.topbar-brand {
  display: flex;
  align-items: center;
}

.topbar-brand img {
  max-width: 112px;
  height: auto;
  display: block;
}

.nav-scroll {
  overflow-y: auto;
  padding: 12px;
  flex: 1;
}

.nav-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .6px;
  text-transform: uppercase;
  color: var(--ink-3);
  padding: 14px 12px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--ink-2);
  font-weight: 500;
  position: relative;
  transition: background .12s, color .12s;
  cursor: pointer;
  white-space: nowrap;
}

.nav-item > i:first-child {
  font-size: 17px;
  width: 20px;
  flex: 0 0 20px;
  text-align: center;
}

.nav-item:hover {
  background: var(--surface-2);
  color: var(--ink);
}

/* Active = text colour only (no background fill, no accent bar) */
.nav-item.active {
  background: transparent;
  color: var(--brand);
  font-weight: 600;
}

/* Expanded submenu: subtle left hairline instead of icons; child labels align
   on the SAME left line as the parent item's label (SB Admin Pro nested nav) */
.nav-scroll .collapse,
.nav-scroll .collapsing {
  position: relative;
  margin: 2px 0 4px 22px;
  border-left: 1px solid var(--stroke);
}

.nav-scroll .collapse .nav-item > i:first-child,
.nav-scroll .collapsing .nav-item > i:first-child {
  display: none;
}

.nav-scroll .collapse .nav-item,
.nav-scroll .collapsing .nav-item {
  gap: 0;
  padding-top: 7px;
  padding-bottom: 7px;
  padding-left: 22px !important;   /* overrides Bootstrap ps-5 so text aligns with parent */
}

.nav-item .badge {
  margin-left: auto;
  font-weight: 600;
}

.nav-item[aria-expanded="true"] .bi-chevron-down {
  transform: rotate(180deg);
}

.nav-item .bi-chevron-down {
  transition: transform .15s ease;
}

.nav-item .badge, .topbar .badge {
  min-width: 20px;
  height: 20px;
  padding: 0 7px;
}

/* Main column, pushed right of the sidebar and below the topbar; sticky footer */
.main {
  margin-left: var(--sidebar-w);
  margin-top: var(--topbar-h);
  min-width: 0;
  min-height: calc(100vh - var(--topbar-h));
  display: flex;
  flex-direction: column;
}

/* Topbar — full width, fixed on top, above the sidebar, unified/solid */
.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--stroke);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1050;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px 0 20px;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--ink-2);
  display: grid;
  place-items: center;
  font-size: 18px;
  position: relative;
}

.icon-btn:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.dot {
  position: absolute;
  top: 7px;
  right: 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
  border: 2px solid #fff;
}

/* Microsoft-style user chip (avatar initials + name + chevron) */
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 600;
  font-size: 12.5px;
  background: var(--brand);
  flex: 0 0 32px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px 8px 4px 4px;
  border-radius: 999px;
  color: var(--ink);
}

.user-chip:hover {
  background: var(--surface-2);
}

.user-chip__name {
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-chip .bi-chevron-down {
  font-size: 12px;
  color: var(--ink-3);
}

/* Content grows so the footer sticks to the bottom; fills wide screens (no
   narrow centred cap that wastes space on 1920px+/2K displays) */
.content {
  padding: 24px 28px 32px;
  width: 100%;
  max-width: none;
  flex: 1 0 auto;
}

@media (min-width: 1600px) {
  .content {
    padding-left: 32px;
    padding-right: 32px;
  }
}

.app-footer {
  margin-top: auto;
}

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.page-head h1 {
  font-size: 19px;
  font-weight: 600;
  margin: 0;
  letter-spacing: -.2px;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.crumb {
  color: var(--ink-3);
  font-size: 12px;
  margin-bottom: 1px;
}

.crumb a {
  color: var(--ink-2);
}

/* Cards (replacement for AdminLTE .card) */
.card-fluent {
  background: var(--surface);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
}

.card-fluent .hd {
  padding: 14px 18px;
  border-bottom: 1px solid var(--stroke-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

/* Uniform card header title across the whole app */
.card-fluent .hd h2,
.card-fluent .hd > h1,
.card-fluent .hd > h3,
.card-fluent .hd > h4,
.card-fluent .hd > h5,
.card-fluent .hd .card-title {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
  margin: 0;
}

.card-fluent .bd {
  padding: 18px;
}

/* Bootstrap .card / .card-header (used e.g. in Report views) aligned to the
   same Fluent look + 16px header title, so headers are uniform app-wide */
.card {
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
}

.card > .card-header {
  padding: 14px 18px;
  background: var(--surface);
  border-bottom: 1px solid var(--stroke-soft);
}

.card > .card-header .card-title,
.card > .card-header > h1,
.card > .card-header > h2,
.card > .card-header > h3,
.card > .card-header > h4,
.card > .card-header > h5,
.card > .card-header > h6 {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
  margin: 0;
}

/* No decorative icons in card-header titles (icons inside action buttons stay) */
.card-fluent .hd > i.bi,
.card-fluent .hd h2 > i.bi,
.card-fluent .hd .card-title > i.bi,
.card > .card-header > i.bi,
.card > .card-header .card-title > i.bi,
.card > .card-header > h1 > i.bi,
.card > .card-header > h2 > i.bi,
.card > .card-header > h3 > i.bi,
.card > .card-header > h4 > i.bi,
.card > .card-header > h5 > i.bi {
  display: none;
}

/* Card header layout: title left, actions grouped right, vertically centred */
.card-fluent .hd,
.card > .card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px 14px;
  flex-wrap: wrap;
}

.card-fluent .hd .page-actions,
.card > .card-header .page-actions,
.card-fluent .hd .card-actions,
.card > .card-header .card-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Tables: white rows (kill Bootstrap table-striped's grey stripes); only a
   subtle hover tint, matching the clean template look */
.table {
  --bs-table-bg: var(--surface);
  --bs-table-striped-bg: transparent;
  --bs-table-striped-color: var(--ink);
  --bs-table-hover-bg: var(--surface-2);
  --bs-table-hover-color: var(--ink);
  color: var(--ink);
}

/* KPI (replacement for .small-box / .info-box) */
.kpi {
  padding: 18px;
}

.kpi .ico {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 20px;
}

.kpi .val {
  font-size: 28px;
  font-weight: 600;
  margin: 12px 0 2px;
  letter-spacing: -.5px;
}

.kpi .lab {
  color: var(--ink-2);
  font-size: 12.5px;
}

.trend {
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-top: 10px;
}

.trend.up {
  color: var(--ok);
}

.trend.down {
  color: var(--danger);
}

.trend span {
  color: var(--ink-3);
  font-weight: 400;
}

.tint-blue {
  background: #eef4fb;
  color: #0f6cbd;
}

.tint-green {
  background: #eef7ee;
  color: var(--ok);
}

.tint-orange {
  background: #fdf1ea;
  color: var(--warn);
}

.tint-purple {
  background: #f3effa;
  color: var(--purple);
}

.tint-red {
  background: var(--brand-tint);
  color: var(--brand);
}

/* Statuses (replacement for .badge-*) */
.pill {
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.pill.ok {
  background: #eef7ee;
  color: var(--ok);
}

.pill.wait {
  background: #fdf1ea;
  color: var(--warn);
}

.pill.new {
  background: var(--brand-tint);
  color: var(--brand);
}

.pill.cancel {
  background: #fce9ea;
  color: var(--danger);
}

/* Fluent buttons */
.btn-fluent {
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  font-weight: 600;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-fluent:hover {
  background: var(--brand-hover);
  color: #fff;
}

.btn-ghost {
  background: #fff;
  border: 1px solid var(--stroke);
  color: var(--ink);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-weight: 600;
  font-size: 13px;
}

.btn-ghost:hover {
  background: var(--surface-2);
}

/* Fluent card header action cluster (title left / actions right on one line) */
.card-fluent .hd .page-actions {
  flex: 0 0 auto;
}

/* Reusable list filter bar (restrained, neutral, single brand accent on focus) */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 14px;
  margin-bottom: 16px;
  background: var(--surface-2);
  border: 1px solid var(--stroke-soft);
  border-radius: var(--radius-sm);
}

.filter-bar .filter-search {
  position: relative;
  flex: 1 1 260px;
  min-width: 200px;
}

.filter-bar .filter-search > i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-3);
  font-size: 14px;
  pointer-events: none;
}

.filter-bar .filter-search input {
  width: 100%;
  padding: 7px 12px 7px 34px;
  border: 1px solid var(--stroke);
  border-radius: var(--radius-sm);
  font-size: 13px;
  background: var(--surface);
  color: var(--ink);
}

.filter-bar .filter-search input::placeholder {
  color: var(--ink-3);
}

.filter-bar .filter-search input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-tint);
}

.filter-bar .filter-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.filter-bar label {
  font-size: 12px;
  color: var(--ink-2);
  margin: 0;
  white-space: nowrap;
}

.filter-bar .form-select,
.filter-bar .form-control {
  width: auto;
  min-width: 150px;
  font-size: 13px;
  padding: 7px 12px;
}

.filter-bar .filter-search input:focus,
.filter-bar .form-select:focus,
.filter-bar .form-control:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-tint);
}

/* Mobile backdrop */
.backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .35);
  z-index: 1035;
}

/* Responsive */
@media (max-width: 991px) {
  .sidebar {
    transform: translateX(-100%);
    box-shadow: var(--shadow-16);
  }

  body.nav-open .sidebar {
    transform: translateX(0);
  }

  body.nav-open .backdrop {
    display: block;
  }

  .main {
    margin-left: 0;
  }

  .search {
    display: none;
  }
}

/* ===================================================================
   App-specific rules preserved from the AdminLTE-era site.css
   =================================================================== */

/* Table action-button rows (list views: edit/delete/etc.) */
tr td:last-child a, tr td:last-child form {
  display: flex;
  gap: 2px;
  align-items: center;
  margin-bottom: 0.25rem;
}

tr td:last-child:has(.btn) {
  display: flex;
  justify-content: flex-end;
  gap: 2px;
}

/* List-row action buttons: plain uncoloured icon buttons (no rainbow of
   btn-primary/danger/warning/success). Colour is conveyed on hover only. */
tr td:last-child .btn,
td .btn-group .btn {
  background: transparent !important;
  border-color: transparent !important;
  color: var(--ink-2) !important;
  box-shadow: none !important;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
}

tr td:last-child .btn:hover,
td .btn-group .btn:hover {
  background: var(--surface-2) !important;
  color: var(--ink) !important;
}

tr td:last-child .btn.btn-danger:hover,
tr td:last-child .btn-outline-danger:hover,
tr td:last-child .btn[class*="danger"]:hover {
  background: #fce9ea !important;
  color: var(--danger) !important;
}

/* Mobile refinements */
@media (max-width: 991px) {
  .content {
    padding: 16px 14px 28px;
  }

  .topbar-brand img {
    max-width: 96px;
  }

  .filter-bar {
    gap: 8px;
  }
}

/* Cart item-count badge (topbar / nav) */
.cart-badge {
  position: absolute;
  top: 3px;
  right: -0px;
  font-size: 0.7rem;
  min-width: 15px;
  height: 15px;
  line-height: 15px;
  font-weight: bold;
  text-align: center;
  border-radius: 50%;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.nav-link:hover .cart-badge, .nav-item:hover .cart-badge {
  transform: scale(1.05);
  transition: transform 0.2s ease;
}

@media (max-width: 576px) {
  .cart-badge {
    right: -5px;
    font-size: 0.65rem;
    min-width: 16px;
    height: 16px;
    line-height: 16px;
  }
}

/* Login page */
.login-logo a {
  color: white !important;
}
