@font-face {
  font-family: Lato;
  font-style: normal;
  font-weight: 400;
  src: url(lato-v24-latin-regular.woff2) format(woff2);
}

body, html {
  display: flex;
  flex-direction: column;

  margin: 0;
  min-width: max(100vw, 300px);
  min-height: 100vh;

  font-family: Lato, system-ui;
  font-weight: 400;
  font-style: normal;

  font-size: 16px;

  --fg: #6f6f6f;
  color: var(--fg);

  --bg: #d7e3d7;
  background: linear-gradient(-45deg, #e7e7dd, #d7e3d7, #d6dfe5, #e9e9d8);

  @media (prefers-color-scheme: dark) {
    --fg: #b7b7b7;

    --bg: #1e1e1e;
    background: var(--bg);
  }

  user-select: none;
}

::selection {
  background: #296ca766;
}

.environment-ribbon {
  position: fixed;
  z-index: 9999;

  top: 0;
  right: 0;

  pointer-events: none;

  width: 100px;
  transform: translate(26px, 19px) rotate(45deg);

  text-align: center;
  text-transform: uppercase;
  font-weight: bold;
  font-size: 10px;

  background-color: var(--color);
  box-shadow: 0 0 8px #0006;

  /* Testo bianco se il colore dello sfondo è scuro; nero se è chiaro. */
  color: hsl(from var(--color) 0 0 calc(round(max(0, min(1, 1 - l / max(160 - s * 1.2, 145 - min(mod(h - 300, 360), mod(360 - h + 300, 360)) * 145 / 360)))) * 100));
}

.appbar {
  position: sticky;
  top: 0;
  z-index: 1;

  display: flex;
  flex: 0 0 56px;

  box-sizing: border-box;
  padding: 0 16px;

  align-items: center;

  border: 1px solid #d7d7d7;
  background: #ffffff;
  box-shadow: 0 0 4px #0008;

  font-size: 18px;

  @media (prefers-color-scheme: dark) {
    border-color: #1e1e1e;
    background: linear-gradient(#3c3c3c, #333333);
  }
}

.appbar-icon {
  width: 36px;
  height: 36px;

  margin-right: 8px;

  background: url(login-icon.svg);
  background-size: contain;
}

.appbar-title {
  font-size: unset; /* reset */
  margin: unset; /* reset */
  font-weight: unset; /* reset */
}

.content {
    display: flex;
    justify-content: center;
    align-items: center;
    flex: 1;
}

.footer {
  position: sticky;
  bottom: 0;
  z-index: 1;

  display: flex;
  align-items: center;
  justify-content: flex-end;

  flex: 0 0 32px;

  box-sizing: border-box;
  padding: 0 16px;

  border: 1px solid #d6d6de;
  background: #e8e8f1;

  @media (prefers-color-scheme: dark) {
    border-color: #1e1e1e;
    background: linear-gradient(#3c3c3c, #333333);
  }
}

.about {
  padding-bottom: 4px;
}

.about-poweredby {
  font-size: 9px;
}

.about-logo {
  display: inline-block;

  width: 14px;
  height: 14px;

  background: url(alad-logo-small.svg);
  background-size: contain;

  vertical-align: middle;
}

.about-aladcloud {
  font-size: 12px;
}

.card {
  flex: 1;
  max-width: 500px;

  margin: 16px;
  border-radius: 4px;
  box-shadow: 0 2px 2px #0003;

  --bg: #ffffff;
  background: var(--bg);

  @media (prefers-color-scheme: dark) {
    --bg: #272727;
  }

  @media (max-width: 550px) {
    max-width: calc(100% - 32px);
    align-self: flex-start;
  }
}
.card-editable {
  --bg: #f0f4f7;

  @media (prefers-color-scheme: dark) {
    --bg: #373737;
  }
}

.card-title {
  display: flex;
  align-items: center;

  position: relative;

  height: 48px;
  line-height: 47px;
  padding: 0 16px;

  border-bottom: 1px solid #2196f3;

  &::before {
    content: '';

    pointer-events: none;

    position: absolute;
    inset: 0;

    border-bottom: 1px solid #d3eafc;
  }

  @media (prefers-color-scheme: dark) {
    &::before {
      border-bottom-color: #263d4f;
    }
  }
}

.card-title-text {
  flex: 1;

  font-size: unset; /* reset */
  margin: unset; /* reset */
  font-weight: unset; /* reset */
}

.card-content {
  padding: 32px;
}

.content-block {
  display: flex;
  align-items: center;
  flex-wrap: wrap;

  gap: 8px;

  + & {
    margin-top: 16px;
  }
}

.dialog {
  position: relative;
  z-index: 2;

  box-sizing: border-box;
  width: 351px;
  max-width: calc(max(100vw, 300px) - 80px);

  padding: 21px;
  margin-bottom: 23px;

  &::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;

    background: #0008;
  }

  &::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;

    background: #ffffff;

    border-radius: 4px;
    border: 1px solid #d7d7d7;
  }

  @media (prefers-color-scheme: dark) {
    &::after {
      background: #272727;
      border-color: #202020;
    }
  }
}
.dialog-title {
  display: flex;
  align-items: center;
}
.dialog-title-text {
  user-select: text;

  font-size: unset; /* reset */
  margin: unset; /* reset */
  font-weight: unset; /* reset */

  color: #296ca7;

  @media (prefers-color-scheme: dark) {
    color: #ffc107;
  }
}
.dialog-content {
  font-size: 14px;
  margin-top: 16px;

  user-select: text;

  white-space: pre-wrap;
}

.dialog-icon-error {
  width: 50px;
  height: 50px;

  mask-image: url(error-icon.svg);
  background: #f44336;

  margin: 0 16px 0 4px;
}
.dialog-icon-question {
  width: 50px;
  height: 50px;

  mask-image: url(forum-icon.svg);
  background: #2196f3;

  margin: 0 16px 0 4px;
}

.list-icon {
  flex-shrink: 0;

  width: 32px;
  height: 32px;
  margin: -3px;

  mask-image: var(--icon);
  background: var(--fg);
}
.list-text {
  flex: 1;

  overflow: hidden;
  margin-left: 8px;
}
.list-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: pre;
}
.list-subtitle {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: pre;
  font-size: 14px;
  margin-top: 4px;
}

.center {
  justify-content: center;
}

.fill {
  flex: 1;
}

.flex {
  display: flex;
}

.button {
  display: inline-block;

  --color: #296ca7;

  /* Testo bianco se il colore dello sfondo è scuro; nero se è chiaro. */
  --fg: hsl(from var(--color) 0 0 calc(round(max(0, min(1, 1 - l / max(160 - s * 1.2, 145 - min(mod(h - 300, 360), mod(360 - h + 300, 360)) * 145 / 360)))) * 100));

  border-radius: 99px;
  padding: 8px 32px;

  font-size: 14px;

  border: 1px solid transparent;
  text-decoration: none; /* reset */

  cursor: pointer;

  @media (prefers-color-scheme: dark) {
    --color: #ffc107;
  }
}
.button:not(.button-primary) {
  color: var(--color);

  background: transparent;
  border-color: #d7d7d7;

  transition: 200ms ease background-color;

  @media (prefers-color-scheme: dark) {
    border-color: #3e3c37;
  }

  &:hover {
    background: color-mix(in srgb, var(--bg), var(--color) 2%);
  }

  &:active {
    background: color-mix(in srgb, var(--bg), var(--color) 20%);
  }

  &:disabled {
    pointer-events: none;

    color: inherit;
  }
}
.button-primary {
  color: var(--fg);
  background: var(--color);
  box-shadow: 0 .5px .5px #0002;

  transition: 200ms ease box-shadow;

  &:hover {
    box-shadow: 0 2px 3px #0002;
  }

  &:active {
    box-shadow: 0 .5px .5px #0002;
  }

  &:disabled {
    pointer-events: none;

    color: white;
    background: #6f6f6f;
    box-shadow: none;

    @media (prefers-color-scheme: dark) {
      background: #b7b7b7;
    }
  }
}

.text-field {
  display: flex;

  position: relative;

  margin: unset; /* reset */

  border-bottom: 2px solid #c3c5c6;
  background: #e9ecef;

  @media (prefers-color-scheme: dark) {
    border-color: #696969;
    background: #353535;
  }

  &:hover {
    background: #e1e4e7;

    @media (prefers-color-scheme: dark) {
      background: #3d3d3d;
    }
  }

  &:focus-within {
    border-color: #89accb;
    background: #e9ecef;

    @media (prefers-color-scheme: dark) {
      border-color: #9a7b1e;
      background: #353535;
    }
  }

  &.error {
    border-color: #d07a8b;

    @media (prefers-color-scheme: dark) {
      border-color: #cf6679;
    }
  }

  &:has(> input:disabled) {
    pointer-events: none;

    background: transparent;

    > span {
      color: inherit;
    }
  }

  /* label */
  > label {
    position: absolute;
    inset: 6px 12px;

    display: block;
    font-size: 12px;

    pointer-events: none;

    color: #296ca7;

    @media (prefers-color-scheme: dark) {
      color: #f4b90a;
    }
  }

  /* input */
  > input {
    flex: 1;

    border: 0;
    outline: 0;
    background: transparent;
    font-family: inherit;

    padding: 22px 12px 6px;

    color: inherit;
    font-size: inherit;

    /* HACK: alcuni browser mettono un fastidiosissimo colore di sfondo custom per l'autofill, questo hack lo toglie. */
    &:-webkit-autofill {
      -webkit-transition-delay: 9999s; /* reset */
    }
  }

  /* error */
  + div {
    line-height: 1em;
    min-height: 1em;
    padding: 6px 12px 8px;
    font-size: 12px;

    color: #f45d53;

    @media (prefers-color-scheme: dark) {
      color: #de9090;
    }
  }
}

/* Alad.AuthService.Integration.Profiles.UserInterface.TextFieldAndButton */
.profile-builtin-button {
  margin: 0 0 2em 1em;
}
