/*** MyTE global and SUP fixes ***/

:root {
  /* SUP enhancement or option: output all styles as variables? */
  /* --bg-brand: #f9f9ed; lighter option than what's currently in figma, #f4f2dc; */
  --brand-secondary: #bebd7e;
  --scaled-neutral-10: #f1f1f4;
  --scaled-neutral-20: #d5d7dd;
  --scaled-neutral-30: #b9bec6;
  --scaled-neutral-40: #9ea6b0;
  --scaled-neutral-50: #848e9a;
  --scaled-neutral-60: #6c7785;
  --scaled-neutral-70: #54606f;
  --scaled-neutral-80: #3e4b5b;
  --scaled-neutral-90: #283646;
  --scaled-danger-10: #f8eeee;
  --scaled-danger-20: #ecd0d0;
  --scaled-danger-30: #e1b3b3;
  --scaled-danger-40: #d59494;
  --scaled-danger-50: #c87676;
  --scaled-danger-60: #bb5555;
  --scaled-danger-70: #ad3232;
  --scaled-danger-80: #8d1e1e;
  --scaled-danger-90: #681616;
  --scaled-success-10: #e6f3e9;
  --scaled-success-20: #bbdfc2;
  --scaled-success-30: #90cb9b;
  --scaled-success-40: #64b673;
  --scaled-success-50: #34a049;
  --scaled-success-60: #108727;
  --scaled-success-70: #0d6f1f;
  --scaled-success-80: #0a5518;
  --scaled-success-90: #073e12;
  --bg-success: var(--scaled-success-10);
  --fg-success: var(--scaled-success-70);
  --border-success: var(--scaled-success-60);
  --bg-subtle: var(--scaled-neutral-10);
  --border-default: var(--scaled-neutral-30);
  --border-muted: var(--scaled-neutral-20);
  --bg-danger: var(--scaled-danger-10);
  --fg-danger: var(--scaled-danger-80);
  --border-danger: var(--scaled-danger-60);
  --scaled-action-80: #244c75;
  --fg-action-hover: var(--scaled-action-80);

  /* link-hover doesn't exist in SUP */
  --bg-link-hover: var(--focus); /* rgba(164, 227, 235, 0.5); */
}

/* SUP enhancement or option: output all typography styles? */
.sui-typography--heading-md {
  font-size: 23px;
  font-style: normal;
  font-weight: 600;
  line-height: 130%;
  letter-spacing: -0.4px;
}

html {
  background-color: var(--bg-subtle);
}

body {
  /* SUP enhancement or user option: apply default foreground and background colours to the body */
  color: var(--fg-default);
  background-color: var(--bg-default);
  max-width: 600px;
  margin: auto;
  padding: 4%;
  min-height: 100vh;
  line-height: 1.4;
  box-shadow: 0px 6px 10px 0px rgba(0, 0, 0, 0.1);
}

footer {
  margin-top: 48px;
  padding-top: 16px;
  border-top: 1px solid var(--border-muted);
}

a:not(.sui-Button) {
  /* SUP issue: link colour missing */
  color: var(--fg-action);
  font-weight: 500;
}

a:not(.sui-Button):hover {
  color: var(--fg-action-hover);
  background-color: var(--bg-link-hover);
  outline: 3px solid var(--bg-link-hover);
}

i,
em {
  /* inconsistent/buggy behaviour in webkit, not sure which one or combo of these is best */
  /* font-style: oblique; */
  font-variation-settings: "slnt" -10;
  font-synthesis: none; /* prevents faux italic */
}

::selection {
  /* potential SUP enhancement */
  background: var(--focus);
}

/*** SUP TextField fixes from prototype ***/

/* SUP issue: TextField layout/flex gap not parsed but might not need/prefer it -- might depend on component size
.sui-TextField {
  gap: 2px;
}
*/

/* SUP issue: TextField label is missing */
.sui-TextField__label {
  padding-bottom: 6px;
  /* color: var(--fg-default); */
}

/* SUP issues:
    input width hardcoded
    colour not applied
    TextField molecule should render input with its own classes, e.g., .suiInput instead of .sui-TextField__input
    */
.sui-TextField__input,
.sui-Input {
  width: auto;
  color: inherit;
}

/* .sui-TextField__help {
  color: var(--fg-muted);
} */

/* SUP issue: button cursor missing */
button:not(:disabled) {
  cursor: pointer;
}

/* SUP issue: hover overrides active */
.sui-Button--primary:active:hover {
  background-color: var(--bg-action-emphasis-pressed);
}
/* above fixes the issue, but in SUP, it should be more like this:
.sui-Button--primary:not(:disabled,:active):hover {
  background-color: var(--bg-action-emphasis-hover);
}
*/
.sui-Button--secondary:active:hover {
  background-color: var(--bg-action-pressed);
}

/* SUP issue: incorrect/missing tertiary button styles */
.sui-Button--tertiary {
  border: 0;
  justify-content: flex-start;
}

.sui-Button--tertiary.sui-Button--large svg {
  height: 36px;
  width: 36px;
  fill: var(--fg-action);
}

.sui-Button--tertiary:focus-visible {
  text-decoration-line: underline;
  color: var(--fg-default);
}

.sui-Button--tertiary:hover {
  color: var(--fg-default);
  background-color: var(--bg-action-hover);
}

.sui-Button--tertiary:hover svg {
  fill: var(--fg-action-hover);
}

.sui-Button--tertiary:active {
  background-color: var(--bg-action-pressed);
  box-shadow: inset 1px 2px 4px var(--inner-dark);
}

/* SUP enhancement: support button classes on links */
a.sui-Button {
  text-decoration: none;
  white-space: nowrap;
}
a.sui-Button:hover {
  outline: 0;
}
a.sui-Button--primary:hover {
  color: var(--fg-on-emphasis);
}
a.sui-Button--secondary:hover {
  color: var(--fg-action);
}

/*** Radio buttons not yet in SUP ***/

.sui-RadioButton {
  display: flex;
  gap: 12px;
}

.sui-RadioButton__input {
  appearance: none;
  margin: 0;
  border: 2px solid var(--border-action);
  border-radius: 50%;
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-default);
  vertical-align: middle; /* not sure if this is needed in SUP generally or just because the input is in a table cell */
}

.sui-RadioButton__input::after {
  content: "";
  display: inline-block;
  width: 0;
  height: 0;
  border-radius: 50%;
  background-color: var(--bg-action-emphasis);
  transition: 0.2s all linear;
}

.sui-RadioButton__input:checked::after {
  width: 8px;
  height: 8px;
}

.sui-RadioButton__input:not(:disabled, :checked):hover {
  border-color: var(--border-action-hover);
  outline: 5px solid var(--focus);
}

/*** SUP issue: Checkbox missing some styles ***/

.sui-Checkbox__input:not(:disabled):hover {
  /* SUP issue: box-shadow generated instead of outline */
  box-shadow: none;
  outline: 5px solid var(--focus);
}

/*** misc global ***/

h1,
h2 {
  text-align: center;
  color: var(--fg-subtle);
}

h3,
h4 {
  color: var(--fg-subtle);
  margin-bottom: 8px;
}

h1 i {
  margin-right: -0.1em; /* a bit of kerning */
}

a.logo:hover {
  outline: 0;
}

img.logo {
  display: block;
  margin: auto;
}

a.icon-link:hover {
  outline: 0;
}

.icon-link svg {
  fill: var(--scaled-neutral-50);
  display: block;
}

.icon-link:hover svg {
  fill: var(--fg-action);
}

form {
  display: flex;
  flex-direction: column;
  gap: 20px;
  /* padding-bottom: 24px; */
}

.error:not(:empty) {
  color: var(--scaled-danger-70);
  font-weight: 500;
  padding: 16px;
  background-color: var(--bg-danger);
  border: 1px solid var(--scaled-danger-70);
  margin-bottom: 24px;
}

.error:not(:empty)::before {
  content: "🙁 ";
}

.warning:not(:empty) {
  color: var(--scaled-danger-50);
  font-weight: 500;
  padding: 16px;
  background-color: var(--bg-danger);
  border: 1px solid var(--scaled-danger-50);
  margin-bottom: 24px;
}

.warning:not(:empty)::before {
  content: "⚠️ ";
}

p.error,
p.warning,
p.success {
  margin: 0;
}

.success:not(:empty) {
  color: var(--fg-success);
  font-weight: 500;
  padding: 16px;
  background-color: var(--bg-success);
  border: 1px solid var(--border-success);
  margin-bottom: 24px;
}

.success:not(:empty)::before {
  content: "🙂 ";
}

p.success {
  transition-property: margin, padding, background-color;
  transition-duration: 1s;
}

.fineprint,
small {
  line-height: 1.2;
}

/*** Dropdown, not yet in SUP ***/

.sui-Dropdown {
  position: relative;
  display: inline-block;
}

.sui-Dropdown::after {
  /* caret */
  content: "";
  border: 6px solid transparent;
  border-top-color: inherit;
  position: absolute;
  right: 14px;
  top: 14px;
  pointer-events: none;
}

.sui-Dropdown--medium::after {
  top: 17px; /* (40 - 6) / 2 */
  right: 17px;
}

.sui-Dropdown--secondary::after {
  border-top-color: var(--fg-action);
}

.sui-Dropdown--primary::after {
  border-top-color: var(--fg-on-emphasis);
}

.sui-Dropdown select {
  appearance: none;
  width: 100%;
  padding-right: 32px;
}

/* SUP enhancement: placeholder colour */
.sui-Input::placeholder {
  color: var(--fg-subtle);
  opacity: 1;
}

/*** Date Input, not yet in SUP ***/
.sui-Input::-webkit-calendar-picker-indicator {
  /* filter: invert(0.7); */
  cursor: pointer;
  opacity: 0.7;
}
.sui-Input::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
}

/*** utility classes (copied from Tailwind) ***/

.flex {
  display: flex;
}
.justify-between {
  justify-content: space-between;
}
.flex-col {
  flex-direction: column;
}
.flex-wrap {
  flex-wrap: wrap;
}
.m-auto {
  margin: auto;
}
.m-0 {
  margin: 0;
}
.mb-0 {
  margin-bottom: 0;
}
.mt-0 {
  margin-top: 0;
}
.mb-1 {
  margin-bottom: 4px;
}
.mb-2 {
  margin-bottom: 8px;
}
.mb-4 {
  margin-bottom: 16px;
}
.mt-1 {
  margin-top: 4px;
}
.mt-6 {
  margin-top: 24px;
}
.gap-6 {
  gap: 24px;
}
.gap-5 {
  gap: 20px;
}
.gap-4 {
  gap: 16px;
}
.w-full {
  width: 100%;
}
.text-center {
  text-align: center;
}

/* spinner gpt generated?, probably delete */

.spinner {
  display: none; /* Initially hidden */
  margin-left: 5px;
  border: 3px solid #f3f3f3; /* Light grey */
  border-top: 3px solid #3498db; /* Blue */
  border-radius: 50%;
  width: 12px;
  height: 12px;
  animation: spin 1s linear infinite; /* Spin animation */
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/*** Page-Specific Styles ***/

.faq,
.about,
.evaluate,
.privacy {
  max-width: 760px;
  padding-top: 20px;
}

.reset-password {
  padding-top: 20px;
}

.flex .sui-TextField {
  min-width: 0;
  width: 100%;
}

.faq main,
.about main {
  max-width: 600px;
  margin: auto;
}

.about li {
  overflow-wrap: break-word;
  margin-bottom: 8px;
}

.faq dt {
  font-weight: 700;
  margin: 28px 0 4px;
}
.faq dd {
  margin: 0;
}
.faq dd p {
  margin-top: 0;
}

/* Sign In */

html:has(body.signin) {
  background-color: #f1f1f4; 
}

body.signin {
  background-color: #f1f1f4;
  box-shadow: none;
  padding: 24px 16px;
}

.signin h1 {
  font-size: 18px;
  color: var(--fg-muted);
  letter-spacing: -0.36px;
}

.signin #forgotPasswordLink,
.signin #backToLoginLink {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: -0.12px;
  text-decoration: none;
}

.login-card {
  background: white;
  border-radius: 12px;
  box-shadow: 0px 4px 10px #e2e6ef;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  box-sizing: border-box;
}


.signin footer {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-top: 24px;
  padding-top: 0;
  border-top: none;
}

.signin footer a {
  color: #2567A0;
  font-weight: 400;
  text-decoration: none;
}

#loginResult:empty {
  /* avoid gap */
  display: none;
}

#pwaHelpText:empty {
  display: none;
}

/* Edit User */

/* SUP issue: no danger style */
.delete-btn {
  background-color: var(--bg-danger);
  color: var(--fg-danger);
  border: 1px solid var(--border-danger);
}
.delete-btn:not(:disabled):hover,
.delete-btn:not(:disabled):active {
  background-color: var(--scaled-danger-20);
}

/* Admin */
body.admin,
body.encounter-details {
  max-width: 90%;
}

.modal {
  position: fixed;
  z-index: 10;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.6);
}

.modal form {
  background-color: white;
  padding: 32px;
  border-radius: 5px;
  max-width: 100%;
}

.flex .sui-Button {
  min-width: 100px;
}

.admin table {
  width: 100%;
  border-collapse: collapse;
}

.admin th {
  text-align: left;
  /* min-width: 72px; */
}

.admin td,
.admin th {
  padding: 8px 12px;
}

.admin td {
  border-top: 1px solid var(--border-muted);
}

.admin tbody tr:hover {
  cursor: pointer;
  background-color: var(--bg-action-hover);
}

.pagination {
  display: flex;
  gap: 12px;
  justify-content: end;
  margin: 12px 0;
}
/*
.pagination .sui-Button {
  display: inline-flex;
   SUP issue: buttons should be inline by default
   not needed in this case because I made the container flex
}
*/
.pagination .sui-Button svg {
  /* stroke: currentColor; SUP issue: differentiate between stroke and fill */
  fill: none;
}

/* Encounter Details and Results */

.encounter-details .qr-code {
  margin-bottom: 24px;
}

@media screen and (min-width: 700px) {
  .encounter-details .qr-code {
    float: right;
    margin: 4px 4px 24px 24px;
  }
}
.encounter-details table {
  margin-bottom: 24px;
}

.encounter-details td {
  padding: 8px 0;
  vertical-align: top;
}

.encounter-details td:first-child {
  font-weight: 600;
  padding-right: 20px;
}

.comments li {
  margin-bottom: 12px;
}

.results section {
  clear: both;
}

.results section > div {
  min-width: 216px;
  padding-right: 20px;
  border-right: 1px solid var(--border-muted);
}

.results section h3 {
  margin-top: 0;
}

.results h3 small {
  font-weight: 400;
  color: var(--fg-subtle);
  white-space: nowrap;
}

.results section > div:last-child {
  border: 0;
  padding-right: 0;
}

.encounter-details main > .flex {
  align-items: flex-start;
}

@media screen and (max-width: 800px) {
  .results section {
    display: block;
  }

  .encounter-details main > .flex {
    flex-direction: column-reverse;
    gap: 0;
  }
}

.portfolio .flex-wrap .sui-TextField {
  min-width: 172px;
  max-width: 32%;
}

.dashboard .flex-wrap .sui-TextField {
  min-width: 172px;
  max-width: 49%;
}

.dashboard .sui-Dropdown {
  max-width: 800px;
}
@media screen and (max-width: 640px) {
  body {
    max-width: 100% !important;
  }

  body.signin {
    max-width: 600px !important;
    padding: 4%;
  }

  .admin td,
  .admin th {
    padding: 4px;
    font-size: 14px;
  }

  .admin th {
    white-space: wrap !important;
  }

  #dataTable {
    overflow: scroll;
  }

  #dataTable th:last-child {
    width: 66px;
  }
}
