@layer reset {
  * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
  }

  body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--color-water-blue-50);
    min-height: 100vh;
  }
}

@layer base {
  .app {
    min-height: 100vh;
    display: flex;
    align-items: start;
    justify-content: center;
  }
}

@layer core {
  .toast-container {
    position: fixed;
    top: 0;
    height: 0;
    right: 0;
    padding-inline: 0.5rem;
    max-width: 100svw;
    display: flex;
    flex-direction: column;
    align-items: end;
    z-index: 9999;
    filter: drop-shadow(0 0.125rem 0.25rem rgba(0, 0, 0, 0.2));
  }

  .toast {
    max-width: 320px;
    transform: translateY(-100%);
    opacity: 0;
    transition:
      transform 0.3s ease,
      opacity 0.3s ease,
      height 0.3s ease;
    overflow: clip;
    interpolate-size: allow-keywords;
    height: fit-content;
  }

  .toast--success {
    --toast-background: var(--color-spring-green-600);
  }

  .toast--info {
    --toast-background: var(--color-water-blue-600);
  }

  .toast--warning {
    --toast-background: var(--color-sun-yellow-500);
    --toast-text-color: var(--color-sun-yellow-950);
  }

  .toast--error {
    --toast-background: var(--color-error-bg);
  }

  .toast--visible {
    transform: translateY(0);
    opacity: 1;
  }
  .toast--exiting {
    height: 0;
    opacity: 0;
  }

  .toast__card {
    border-radius: 4px;
    background-color: var(--toast-background);
    cursor: pointer;
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem 0.75rem 1rem;
    color: var(--toast-text-color, var(--color-white));
    font-weight: 500;
    font-size: 0.9rem;
  }

  .toast__icon {
    font-size: 1.5rem;
  }

  @property --toast-progress {
    syntax: '<percentage>';
    initial-value: 0%;
    inherits: false;
  }

  @keyframes toast-progress {
    from {
      --toast-progress: 0%;
    }
    to {
      --toast-progress: 100%;
    }
  }

  .toast--auto-close .toast__card {
    background: linear-gradient(
      to right,
      color-mix(var(--toast-background), black 5%) var(--toast-progress),
      var(--toast-background) var(--toast-progress)
    );
    animation: toast-progress var(--toast-timeout) linear forwards;
  }
  .toast__card:hover {
    animation-play-state: paused;
  }

  .truncate {
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  [data-tooltip],
  .truncate {
    position: relative;
  }

  .tooltip {
    position: absolute;
    width: max-content;
    max-width: calc(100svw - 1rem);
    display: none;

    background: var(--color-ash-gray-800);
    color: var(--color-white);
    padding: 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.875rem;
    text-align: center;
  }
}

@layer components {
  .default-flex-column {
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }

  .badge {
    display: inline-block;
    line-height: 1.5rem;
    padding-inline: 0.75rem;
    border: 1px solid transparent;
    background: hsl(from currentColor h calc(s * 0.9) 95%);
    border-radius: calc(1px * infinity);
    font-size: 0.8rem;
    font-weight: 500;
  }

  .badge--outlined {
    border: 1px solid rgb(from currentColor r g b / 0.4);
  }

  .badge--disabled {
    opacity: 0.5;
    cursor: not-allowed;
  }

  .btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border: 1px solid var(--button-color);
    border-radius: 4px;
    font-size: 0.875rem;
    cursor: pointer;
    transition:
      background-color 0.2s,
      color 0.2s;
    font-weight: 500;
    --button-color: var(--color-pigeon-blue-700);
    background: var(--button-color);
    --button-contrast-color: var(--color-white);
    color: var(--button-contrast-color);
    text-decoration: none;
    text-align: center;

    &:hover:not(:disabled),
    &:focus:not(:disabled):not(.btn--outlined) {
      background: color-mix(in srgb, var(--button-color) 80%, black 20%);
    }

    &:focus:not(:disabled) {
      outline: 2px solid var(--button-color);
      outline-offset: 4px;
    }
  }

  .btn--disabled {
    opacity: 0.5;
    cursor: not-allowed;
  }

  .btn--outlined {
    border: 1px solid var(--button-color);
    background: transparent;
    color: var(--button-color);

    &:hover:not(:disabled) {
      background: color-mix(in srgb, transparent 90%, var(--button-color) 10%);
    }
  }

  .btn--text {
    background: transparent;
    color: var(--button-color);

    &:hover:not(:disabled) {
      background: color-mix(in srgb, transparent 90%, var(--button-color) 10%);
    }
  }

  .btn--primary {
    --button-color: var(--color-water-blue-600);
  }

  .btn--success {
    --button-color: var(--color-spring-green-600);
  }

  .btn--secondary {
    --button-color: var(--color-pigeon-blue-700);
  }

  .btn--destructive {
    --button-color: var(--color-error-bg);
  }

  .btn--icon-only {
    padding-inline: 0.5rem;
  }

  .inputfield {
    background: var(--color-white);
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--color-ash-gray-300);
    border-radius: 4px;
    font-size: 1rem;
  }

  .card {
    background-color: var(--color-white);
    border: 1px solid var(--color-ash-gray-200);
    border-bottom-color: var(--color-ash-gray-300);
    border-radius: 0.5rem;
    padding: 1.25rem;
    box-shadow: var(--shadow-elevation-s);
  }

  .card--elevation-m {
    box-shadow: var(--shadow-elevation-m);
  }
}
