/**
 * Main CSS stylesheet for application
 */

/* BEGIN: CSS custom properties (variables) */
:root {
  --cag-background-body: #F5F6FA;
  --cag-body: #364A63;
  --cag-border-color: #DBDFEA;
  --cag-border-radius: 0.5rem; /* twice of Bootstrap, for containers such as cards, tables */
  --cag-form-control-border-radius: 0.25rem; /* same as Bootstrap, for form fields and buttons */
  --cag-z-index: 1024; /* must be more than z-index of 1020 for .sticky-top applied to cards and tables */

  /* Override Bootstrap colors */
  --cag-primary: var(--bs-primary);
  --cag-secondary: white;
  --cag-danger: #F82363;
  --cag-muted: #979CAB;

  /* Effects */
  --cag-checked-active: #4ADE80;
  --cag-hover-brightness: 85%;
}
/* CLOSE: CSS custom properties (variables) */


/* BEGIN: Containers */
html,
body {
  font-size: 16px; /* fix base font size for easier computation of rem units */
  margin: 0;
  padding: 0;
}

body {
  background: white;
  color: var(--cag-body);
}
body.login-page {
  background: var(--cag-background-body);
}

.container {
  padding-bottom: 1rem;
}

.login-wrapper .card {
  border: none;
  border-radius: var(--cag-border-radius);
  box-shadow: 0 1rem 3rem #7090B014;
}
/* CLOSE: Containers */


/* BEGIN: Alerts (including modals, popovers and session messages) */
#shared-modal .modal-description {
  color: var(--cag-muted);
}

#shared-modal .modal-error {
  color: var(--cag-danger);
}

.alert { /* override /epi/css/epi.css to make sure long messages do not overlap with close button */
  padding: 0.5rem 2rem 0.5rem 1rem;
}
/* CLOSE: Alerts */


/* BEGIN: Colors (typically used with .dot) */
.status-active,
.status-ready,
.status-success,
.status-verified,
.status-assessed,
.status-evaluated {
  color: var(--bs-teal); /* bright green (Bootstrap teal) used for completed states */
}

.status-pending,
.status-warning,
.status-processing,
.status-verifying,
.status-assessing,
.status-evaluating { /* --bs-orange looks too close to --bs-red hence using --bs-yellow */
  color: var(--bs-yellow); /* bright orange (Bootstrap yellow) used for warning and in-progress states */
}

.status-error,
.status-failure {
  color: var(--bs-red); /* red used for failed states */
}

.status-inactive,
.status-unknown {
  color: var(--bs-gray-400); /* gray used for unknown states */
}
/* CLOSE: Colors */


/* BEGIN: Forms */
fieldset {
  border: 1px solid var(--cag-border-color);
  border-radius: var(--cag-border-radius);
  padding: 1rem;
}

textarea.form-control {
  height: 5rem;
  overflow-y: scroll;
}

.dropzone {
  background: #eee;
  border: 0.25rem dashed var(--cag-body);
  border-radius: var(--cag-border-radius);
  font-size: 1.5rem;
  height: 12.5rem;
  padding: 1rem;
}

.input-group {
  margin-bottom: 1rem;
}

.input-group-note { /* meant to be placed after div.input-group hence offset margin-top */
  font-size: 0.85rem;
  font-style: italic;
  margin-bottom: 1rem;
  margin-top: -1rem;
}

.form-label.required {
  font-weight: bold;
}
.form-label.required:after {
  content: " *";
}

.form-select { /* override Bootstrap, ensure dropdown does not span entire page width nor exceed small screen width */
  cursor: pointer;
  max-width: 100%;
  width: auto;
}
.form-select,
.form-control {
  border-color: var(--cag-border-color);
  color: var(--cag-body);
}

/* Toggle switches */
.form-switch .form-check-input {
  border-color: var(--cag-border-color);
  cursor: pointer;
  height: 1.5rem;
  width: 3rem;
}
.form-switch .form-check-input:checked {
  background-color: var(--cag-checked-active);
  border-color: var(--cag-checked-active);
}

/* Clickable icons in fields such as Show Password icon for password fields */
.input-group-text.clickable {
  background: var(--cag-background-body);
}
.input-group-text.clickable:hover {
  background: var(--cag-primary);
  color: var(--cag-secondary);
}

/* Override Bootstrap .btn-* classes, must darken button on hover for visual confirmation else bad UX */
.btn {
  font-size: 0.85rem;
  font-weight: bold;
  padding: 0.75rem 1rem;
  text-transform: uppercase;
}
.btn-sm { /* need to redeclare cos .btn overridden above */
  border-radius: 0.2rem;
  font-size: .875rem;
  padding: 0.5rem 0.75rem;
}

.btn-primary,
.btn-primary.disabled,
.btn-primary:disabled,
.btn-primary:active,
.btn-primary:focus,
.btn-primary:hover {
  background-color: var(--cag-primary);
  border-color: var(--cag-primary);
}
.btn-primary:hover {
  filter: brightness(var(--cag-hover-brightness));
}
.btn-primary.disabled,
.btn-primary:disabled {
  filter: grayscale(100%);
}

.btn-secondary,
.btn-secondary.disabled,
.btn-secondary:disabled,
.btn-secondary:active,
.btn-secondary:focus,
.btn-secondary:hover {
  background-color: var(--cag-secondary);
  border-color: var(--cag-border-color);
  color: var(--cag-primary);
}
.btn-secondary:hover {
  background-color: var(--cag-primary);
  border-color: var(--cag-primary);
  color: var(--cag-secondary);
  /* filter: brightness(var(--cag-hover-brightness)); */ /* no need filter as background/color will change */
}
.btn-secondary.disabled,
.btn-secondary:disabled {
  filter: grayscale(100%);
}

.btn-light:hover {
  filter: brightness(var(--cag-hover-brightness));
}
.btn-light.disabled,
.btn-light:disabled {
  filter: grayscale(100%);
}

/* Custom button class with no background, text color will lighten on hover */
.btn-transparent,
.btn-transparent.disabled,
.btn-transparent:disabled,
.btn-transparent:active,
.btn-transparent:focus,
.btn-transparent:hover {
  background-color: transparent;
  border-color: transparent;
  box-shadow: none;
}
.btn-transparent:hover {
  filter: brightness(250%);
}
.btn-transparent.disabled,
.btn-transparent:disabled {
  filter: grayscale(100%);
}
/* CLOSE: Forms */


/* BEGIN: Navigation (includes links, breadcrumbs and tabs) */
a {
  color: var(--cag-primary);
  text-decoration: none;
}
a:hover {
  filter: brightness(var(--cag-hover-brightness));
}

.breadcrumb-item {
  font-size: 0.75rem;
  text-transform: capitalize;
}

.hover-underline:hover {
  text-decoration: underline;
}

.unclickable {
  color: var(--cag-muted);
  cursor: not-allowed;
  pointer-events: none;
  text-decoration: none;
}

/* Top menubar with dropdown menu */
nav.navbar-top {
  border-bottom: 1px solid var(--cag-border-color);
  margin-bottom: 2rem;
}

.navbar-top .navbar-logo {
  height: 2.5rem;
}

.navbar-top .dropdown-menu {
  padding: 1rem;
  z-index: var(--cag-z-index);
}

.navbar-top a.dropdown-item {
  padding: 0.5rem;
}
.navbar-top a.dropdown-item:hover {
  background: var(--cag-background-body);
}

.navbar-top .nav-link {
  border-radius: var(--cag-border-radius);
  color: var(--cag-body);
}
.navbar-top .nav-link:hover {
  color: var(--cag-primary);
}

/* Horizontal tabs */
ul.nav-tabs {
  border-bottom: none;
}
.nav-tabs .nav-link {
  color: var(--cag-body);
}
.nav-tabs .nav-link.active,
.nav-tabs .nav-link:hover {
  border-bottom: 2px solid var(--cag-primary);
  border-left: 1px solid transparent;
  border-right: 1px solid transparent;
  border-top: 1px solid transparent;
  color: var(--cag-primary);
}

/* Vertical pills */
.nav-pills .nav-link {
  color: var(--cag-body);
}
.nav-pills .nav-link.active {
  background-color: var(--cag-background-body);
  color: var(--cag-primary);
}
/* CLOSE: Navigation */


/* BEGIN: Pagination */
.pagination {
  /* override Bootstrap .pagination */
  font-size: 0.8rem;
  margin-bottom: 0;
}

.pagination-wrapper,
.pagination-wrapper label,
.pagination-wrapper .form-select {
  color: black;
  font-size: 0.85rem;
}

.page-item .page-link {
  border: none;
  border-color: transparent;
  border-radius: var(--cag-border-radius);
  margin: 0 0.125rem;
  color: var(--cag-body);
  padding: 0.25rem 0.5rem;
}

.page-item.disabled .page-link {
  color: var(--cag-muted);
}

.page-item.active .page-link {
  /* override Bootstrap */
  background-color: var(--cag-primary);
  border-color: var(--cag-primary);
  border-radius: var(--cag-border-radius);
}

.page-item.curr-page {
  margin-right: 0.25rem;
}
.page-item.curr-page .input-page {
  padding: 0.25rem 0.25rem;
  width: 3rem;
  background: white;
  border: 1px solid var(--cag-border-color);
  border-radius: var(--cag-form-control-border-radius);
  margin-right: 0.25rem;
  text-align: center;
}
/* CLOSE: Pagination */


/* BEGIN: Tables */
.table thead.sticky-top {
  background-color: white;
}

/* Search box */
.table-functions .search-field {
  margin-bottom: 0;
}
.table-functions .search-field .input-group-text {
  background: none;
  border-bottom-right-radius: 0;
  border-top-right-radius: 0;
}
.table-functions .search-field .form-control {
  border-left: none;
}

/* Filters */
.table-filters {
  border: 1px solid var(--cag-border-color);
  border-radius: var(--cag-form-control-border-radius);
}

.table-filters .btn-filter {
  padding: 0.5rem;
}
.table-filters .btn-filter:focus { /* override Bootstrap */
  border-bottom-right-radius: var(--cag-form-control-border-radius) !important;
  border-top-right-radius: var(--cag-form-control-border-radius) !important;
}

.table-filters .dropdown-menu {
  list-style-type: none;
  margin: 0;
  padding: 1rem;
  width: 12.5rem;
  z-index: var(--cag-z-index);
}
.table-filters .dropdown-menu li ul {
  list-style-type: none;
  margin: 0;
  margin-top: 1rem;
  padding: 0;
}

.table-filters .filter-body .form-row {
  margin-bottom: 0.5rem;
}

.table-filters .btn-footer {
  padding: 1rem 0;
}

.table-with-pagination.card {
  border: none;
}

.table-with-pagination .card-header,
.table-with-pagination .card-footer {
  background-color: white;
  border: none;
  padding: 1rem;
}

.table-with-pagination .card-body {
  border: 1px solid rgba(0, 0, 0, 0.125);
  border-radius: var(--cag-border-radius);
  padding: 0.25rem 0;
}

.table.record-listing {
  border-color: var(--cag-border-color);
  margin-bottom: 0;
}

.table.record-listing thead th {
  color: var(--cag-muted);
  font-size: 0.75rem;
  padding-top: 0;
  text-transform: uppercase;
  vertical-align: bottom;
  white-space: nowrap; /* prevent sorting arrows from going onto next line from header text */
}
.table.record-listing thead th[data-sort-col] {
  padding-bottom: 0.4rem;
}

.table.record-listing td.actions {
  text-align: right;
}

/* Bulk select column (<th> and <td>) */
.table.record-listing .bulk-select-column {
  font-size: 1rem; /* reduce Bootstrap icon size */
  padding-left: 0;
  text-align: right;
}
.table.record-listing .bulk-select-column .form-check {
  display: inline-block; /* to allow bulk delete icon to be rendered side-by-side with select all checkbox in <th> */
  min-height: auto;
  margin-bottom: 0;
  padding-left: 0;
}
.table.record-listing .bulk-select-column .form-check .form-check-input {
  float: none;
  height: 1.25rem; /* normal size of 1rem is too small */
  margin-left: 0;
  margin-top: 0.1rem; /* in <th>, align bulk delete icon vertically with select all checkbox */
  width: 1.25rem;
}

.table.record-listing .form-switch {
  padding-left: 2.5em;
}

.table.record-listing th .bi,
.table.record-listing td .bi {
  font-size: 1.25rem;
}
.table.record-listing td .bi {
  margin: 0 0.1rem;
}

/* Table borders */
.table > :not(:first-child) {
  /* Override Bootstrap, remove thick black bottom border of table header row */
  border-top: none;
}
.table.record-listing tbody td {
  border-color: var(--cag-border-color);
}
.table.record-listing tbody tr:last-child td {
  border: none;
}

/* Links in th/td */
th a,
td.actions a { /* only for header row and actions column */
  border-radius: 2rem;
  color: var(--cag-body);
  padding: 0.5rem;
}
th a:hover,
td.actions a:hover { /* only for header row and actions column */
  background: var(--cag-background-body);
  color: var(--cag-primary);
}
th a.bulk-delete,
td.actions a.record-delete {
  color: var(--cag-danger);
}
th a.bulk-delete:hover,
td.actions a.record-delete:hover {
  background: var(--cag-danger);
  color: var(--cag-secondary) !important; /* !important needed to override Bootstrap for .text-danger */
}

/* Hidden columns in responsive tables */
[data-show-hidden-columns-target] .dropdown-toggle {
  background: none;
  border: none;
  padding-block: 0;
  padding-inline: 0;
}
[data-show-hidden-columns-target] .dropdown-toggle::before {
  display: none;
}
[data-show-hidden-columns-target] .dropdown-menu {
  padding: 0.5rem;
}
/* CLOSE: Tables */


/* BEGIN: Text, Icons Images */
.dot { /* no color is set here so that it can be set with a status-* color class */
  font-size: 2rem;
  line-height: 1rem;
  margin-right: 0.5rem;
  position: relative;
  top: 0.15rem;
}
.dot::before {
  content: "\2022"; /* ASCII code for the bullet point character */
}

/* Hide dot for certain statuses */
.dot.status-unknown,
.dot.status-unverified,
.dot.status-unassessed {
  display: none;
}

.icon {
  cursor: pointer;
  font-size: 1.2rem;
}

.logo {
  max-height: 10rem;
}

.title {
  font-size: 1.5rem;
  font-weight: bold;
  text-transform: capitalize;
}

.subtitle {
  font-size: 1.25rem;
  font-weight: bold;
  margin-bottom: 1rem;
  text-transform: capitalize;
}

/* Animated ellipsis adapted from https://codepen.io/thetallweeks/pen/yybGra */
.loading:after { /* do not set font-size for .loading as it will change font size of adjacent text */
  animation: ellipsis steps(5, end) 1500ms infinite;
  bottom: -0.5rem;
  color: var(--cag-muted);
  content: "\2026"; /* ASCII code for the ellipsis character */
  display: inline-block;
  font-size: 3rem;
  margin-left: 0.25rem;
  margin-top: -3rem;
  overflow: hidden;
  position: relative;
  vertical-align: bottom;
  width: 0;
}
@keyframes ellipsis {
  to {
    width: 1.25em; /* must be 1.25em not rem to show all 3 dots in the ellipsis */
  }
}
/* CLOSE: Text, Icons Images */


/* BEGIN: Upload */
.upload-progress {
  height: 1.5rem;
  margin-bottom: 5rem;
  margin-top: 3rem;
}
/* CLOSE: Upload */
