/* === FORM STACK === */
.bgs-form {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
  /* max-width: 1100px; */
}

.bgs-form-sm {
  max-width: 550px;
}
.bgs-form-md {
  max-width: 750px;
}
.bgs-form-lg {
  max-width: 1100px;
}

/* === GRID LAYOUT === */
.bgs-form-grid {
  display: grid;
  gap: 1.5rem 3rem;
  grid-template-columns: repeat(12, 1fr);
}

.bgs-form-grid--align-end {
  align-items: end;
}

/* Default: 1 columns per row
Its also possible to use .bgs-form-field without being wrapped in a .bgs-form-grid,
then it will automatically take the full width of the container. */
.bgs-form-field {
  /* min-width: 320px; */
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  grid-column: span 12; /* default full width */
}

.bgs-form-label {
  font-weight: 600;
  font-size: 0.85rem !important;
  display: flex;
  align-items: center;
}

.bgs-outline {
  border: 1px solid #dee2e6;
  border-radius: 8px;
  padding: 1rem;
}

/* === COLUMN UTILITIES === */
.span-2 {
  grid-column: span 2;
} /* 1/6 width */
.span-3 {
  grid-column: span 3;
} /* 1/4 width */
.span-4 {
  grid-column: span 4;
} /* 1/3 width */
.span-6 {
  grid-column: span 6;
} /* 1/2 width */
.span-8 {
  grid-column: span 8;
} /* 2/3 width */
.span-12 {
  grid-column: span 12;
} /* full width */

/* === MEDIA QUERY BREAKPOINT === */
@media (max-width: 720px) {
  .bgs-form-grid {
    grid-template-columns: 1fr;
  }

  .bgs-form-field,
  .span-4,
  .span-6,
  .span-8,
  .span-12 {
    grid-column: span 1;
  }

  /* .ui-dialog {
    width: calc(100vw - 2rem) !important;
  } */
}

.bgs-form-buttons {
  display: flex;
  justify-content: start;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin: 2rem 0;
}

.bgs-form-buttons .bgs-form-resetlink,
.bgs-form-buttons .bgs-form-resetlink:hover {
  font-size: 0.875rem;
  color: #6c757d;
}

/* === DIALOG BUTTON ROW === */
.bgs-dialog-buttons {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 3rem;
}
/* Delete button anchored to the far left via flex auto-margin */
.bgs-dialog-buttons .bgs-btn-delete {
  margin-right: auto;
}
/* Generic left-anchor: use for wizard Cancel buttons */
.bgs-dialog-buttons .bgs-btn-anchor-left {
  margin-right: auto;
}

body .ui-button.ui-button-flat {
  color: var(--text-color);
}

/* === FORM OVERRIDES === */

body .ui-chkbox {
  align-items: start;
}

body .ui-chkbox .ui-chkbox-box {
  background: none;
}

body .ui-chkbox .ui-chkbox-box.ui-state-active,
body .ui-chkbox .ui-chkbox-box.ui-state-active.ui-state-hover {
  background: none;
  border-color: #ced4da;
}

body .ui-chkbox .ui-chkbox-box .ui-chkbox-icon.ui-icon-check:before {
  content: "";
  display: inline-block;
  width: 20px;
  height: 20px;
  background-color: var(--primary-color);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M21.2287 6.60355C21.6193 6.99407 21.6193 7.62723 21.2287 8.01776L10.2559 18.9906C9.86788 19.3786 9.23962 19.3814 8.84811 18.9969L2.66257 12.9218C2.26855 12.5349 2.26284 11.9017 2.64983 11.5077L3.35054 10.7942C3.73753 10.4002 4.37067 10.3945 4.7647 10.7815L9.53613 15.4677L19.1074 5.89644C19.4979 5.50592 20.1311 5.50591 20.5216 5.89644L21.2287 6.60355Z'/%3E%3C/svg%3E")
    no-repeat center / contain;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M21.2287 6.60355C21.6193 6.99407 21.6193 7.62723 21.2287 8.01776L10.2559 18.9906C9.86788 19.3786 9.23962 19.3814 8.84811 18.9969L2.66257 12.9218C2.26855 12.5349 2.26284 11.9017 2.64983 11.5077L3.35054 10.7942C3.73753 10.4002 4.37067 10.3945 4.7647 10.7815L9.53613 15.4677L19.1074 5.89644C19.4979 5.50592 20.1311 5.50591 20.5216 5.89644L21.2287 6.60355Z'/%3E%3C/svg%3E")
    no-repeat center / contain;
}

body .ui-chkbox .ui-chkbox-box .ui-chkbox-icon {
  margin-left: unset;
  margin-top: unset;
  transform: translate(-50%, calc(-50% + 2px));
}

body .ui-selectcheckboxmenu-item .ui-chkbox .ui-chkbox-box .ui-chkbox-icon {
  transform: translate(-50%, calc(-50%));
}

body .ui-selectoneradio .ui-g .ui-g-12,
body .ui-selectmanycheckbox .ui-g .ui-g-12 {
  padding-left: 0;
  padding-bottom: 0;
}

.bgs-form-field .ui-selectonemenu .ui-selectonemenu-label {
  /* to make the width of the select menu not jump when selecting longer texts */
  width: 0;
  min-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* bgs:inputSelectMultiple --> p:selectCheckboxMenu */
body .ui-selectcheckboxmenu {
  min-height: 40px;
}

body .ui-selectcheckboxmenu .ui-selectcheckboxmenu-multiple-container.ui-inputfield {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

body .ui-selectcheckboxmenu .ui-selectcheckboxmenu-multiple-container .ui-selectcheckboxmenu-token {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.2rem 0.5rem;
  margin: 0;
}

body .ui-selectcheckboxmenu .ui-selectcheckboxmenu-multiple-container .ui-selectcheckboxmenu-token .ui-selectcheckboxmenu-token-label {
  padding: 0;
}

body .ui-selectcheckboxmenu .ui-selectcheckboxmenu-multiple-container .ui-selectcheckboxmenu-token .ui-selectcheckboxmenu-token-icon {
  position: unset;
  margin: unset;
  order: 1;
}

body .p-datepicker {
  display: flex;
}

body .ui-calendar.ui-trigger-calendar input.hasDatepicker {
  flex-grow: 1;
}

body .p-datepicker .ui-datepicker-trigger.ui-button {
  border: 1px solid #ced4da;
  border-left: none;
}

/* PrimeFaces inputNumber renders a wrapper element that needs explicit width handling. */
.bgs-form-field .ui-inputnumber {
  display: flex;
  width: 100%;
}

.bgs-form-field .ui-inputnumber .ui-inputfield {
  width: 100%;
}

.ui-autocomplete,
.ui-autocomplete input {
  width: 100%;
}

body .ui-fileupload .ui-button {
  display: flex;
  gap: 1rem;
  align-items: center;
  padding: 0.375rem 0.75rem;
}

body .ui-fileupload .ui-button .ui-button-text {
  padding: 0;
}

body .ui-fileupload.ui-button-secondary .ui-button:not(.ui-state-hover) {
  background-color: white;
  color: var(--primary-color);
}

body .ui-fileupload .ui-button .ui-icon {
  position: relative;
  top: unset;
  left: unset;
  margin: unset;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
body .ui-fileupload .ui-button .ui-icon::before {
  font-size: 1.5rem;
}

/* Button Only Multi-Fileupload */
body .bgs-fileupload-button-only .ui-fileupload-files {
	display: none;
}

body .bgs-fileupload-button-only .ui-fileupload-buttonbar {
	background: none;
	border: none;
	padding: 0 !important;
}

body .bgs-fileupload-button-only .ui-fileupload-buttonbar .ui-button {
	margin: 0 0;
  gap: 0;
  padding: 0.25rem 0.125rem 0.25rem 0.325rem
}

body .bgs-fileupload-button-only .ui-fileupload-content {
	display: table;
	max-width: 250px;
	border: none;
	padding: 0;
}
.ui-messages-detail, .ui-messages-summary, .ui-growl-message p {
    white-space: pre-line;
}
