/*
Theme Name: VMI Portal
Author: Tangible
Author URI: https://tangible.agency
Version: 1.0
Description: A blank starter theme for the CompX VMI Portal.
Text Domain: vmi
*/

/* ========== Layout ========== */

/* Overall page column layout; let content fill viewport height */
.vmi-portal-layout {
  min-height: 100vh;
}

/* Sidebar: sticky within viewport, scrolls internally if long */
.vmi-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;       /* baseline */
  overflow-y: auto;
}

#logo {
  height: 36px;
  width: auto;
}

/* Prefer dvh on capable browsers (fixes mobile Safari chrome issues) */
@supports (height: 100dvh) {
  .vmi-sidebar { height: 100dvh; }
}

/* ========== Navigation states ========== */

.vmi-sidebar .nav-link.active,
.vmi-sidebar .current-menu-item > a {
  background: rgba(13, 110, 253, 0.1);
  font-weight: 600;
}

.vmi-sidebar a:focus-visible {
  outline: 2px solid #0d6efd;
  outline-offset: 2px;
  border-radius: .25rem;
}

/* ========== Admin bar adjustments (logged-in) ========== */

/* Desktop admin bar (32px) pushes sticky sidebar down and shortens height */
@media (min-width: 782px) {
  .admin-bar .vmi-sidebar {
    top: 32px;
    height: calc(100vh - 32px);
  }
  @supports (height: 100dvh) {
    .admin-bar .vmi-sidebar { height: calc(100dvh - 32px); }
  }
}

/* Mobile admin bar (~46px) */
@media (max-width: 781.98px) {
  .admin-bar .vmi-sidebar {
    top: 46px;
    height: calc(100vh - 46px);
  }
  @supports (height: 100dvh) {
    .admin-bar .vmi-sidebar { height: calc(100dvh - 46px); }
  }
}

/* Visually hidden, but focusable when tabbed (for skip links) */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}
.visually-hidden-focusable:active,
.visually-hidden-focusable:focus {
  position: static !important;
  width: auto; height: auto;
  margin: 0; overflow: visible; clip: auto; white-space: normal;
}

/* Clear focus style that works on all controls */
:where(a, button, [role="button"], input, select, textarea) {
  outline-offset: 2px;
}
:where(a, button, [role="button"], input, select, textarea):focus-visible {
  outline: 2px solid #0d6efd; /* Bootstrap primary */
}

/* Prefer-reduced-motion: minimize animation, including charts */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ========== Inventory Table ========== */

/* Column widths */
#vmi-rows th.vmi-col-onhand,
#vmi-rows td.vmi-col-onhand {
  width: 135px;
}

#vmi-rows th.vmi-col-util,
#vmi-rows td.vmi-col-util {
  width: 270px;
}

/* Skid icon tiles */
.vmi-skids {
  display: grid;
  grid-template-columns: repeat(10, 31px);
  gap: 2px;
  align-items: center;
  justify-content: flex-start;
}

.vmi-skid {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 31px;
  height: 31px;
  flex-shrink: 0;
  border-radius: 3px;
  font-size: 1rem;
  line-height: 1;
}

.vmi-skid .fa-solid,
.vmi-skid .fa-regular {
  color: #fff;
}

.vmi-skid.is-filled {
  background-color: var(--bs-primary);
}

.vmi-skid.is-empty {
  background-color: var(--bs-secondary);
  opacity: 0.3;
}

.vmi-col-onhand {
  padding: .25rem 1rem !important;
}

/* Caret animation */
.acc-caret:before {
  transition: transform .15s ease-in-out;
}

.acc-toggle[aria-expanded="true"] .acc-caret:before {
  transform: rotate(90deg);
}

/* ========== Cookie Banner ========== */

.cmplz-document, .cmplz-document > * {
    width: 100% !important;
    max-width: 100% !important;
}

.cmplz-deny, .cmplz-view-preferences {
    display: block !important;
}

/*.cmplz-accept {
    display: none !important;
}*/

#cmplz-manage-consent .cmplz-manage-consent {
    bottom: 20px !important;
    right: 20px !important;
    animation: unset;
    width: 45px !important;
    min-width: 45px !important;
    height: 45px !important;
    border-radius: 45px !important;
    padding: 0 !important;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #0d6efd !important;
    box-shadow: none !important;
}

#cmplz-manage-consent svg {
    width: 30px;
    height: 30px;
}

#cmplz-manage-consent svg path {
    fill: #fff !important;
}

#cmplz-manage-consent .cmplz-manage-consent .original {
    display: none;
}