/**
 * Copyright (c) Microblink Ltd. All rights reserved.
 */

@import "../styles/_globals-sass";

:host {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;

  background-color: rgba(
    map-get(
      map-get(map-get($base-colors, text-secondary), onlight),
      foreground
    ),
    0.7
  );
  -webkit-backdrop-filter: blur(var(--mb-blur-filter));
  backdrop-filter: blur(var(--mb-blur-filter));

  header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    height: 44px;
    align-items: center;
  }

  .camera-selection-wrapper {
    min-width: 0;
    position: relative;
  }
}

// TODO: see if breakpoints are actually required in the toolbar
@media only screen and (min-width: $breakpoint-width-laptop-1280) {
  :host {
    header {
      max-width: 1024px;
      margin: 0 auto;
      padding-left: 0;
      padding-right: 0;
    }
  }
}

/**
 * Toolbar buttons
 */
$button-size: 40px;

:host {
  .toolbar-button {
    all: unset;
    flex-shrink: 0;
    appearance: none;
    cursor: pointer;
    width: $button-size;
    height: $button-size;
    box-sizing: border-box;
    border-radius: var(--mb-toolbar-border-radius);
    display: grid;
    place-content: center;

    &.close-button {
      justify-self: end;
    }

    svg {
      filter: drop-shadow(0px 1px 4px rgba(0, 0, 0, 0.4));
    }

    &:hover {
      background-color: rgba(
        map-get(
          map-get(map-get($base-colors, text-secondary), onlight),
          foreground
        ),
        0.3
      );
      box-shadow: 0px 1px 4px rgba(0, 0, 0, 0.1);
    }

    &:focus,
    &:active {
      box-shadow: 0 0 0 1px var(--mb-toolbar-border-color);
    }
  }

  .flip-button {
    transform-style: preserve-3d;
    perspective: 600px;
    z-index: 1;

    justify-self: flex-start;

    svg {
      transition: transform 300ms;
      backface-visibility: visible;
      will-change: transform;
    }

    &.flipped {
      svg {
        transform: rotateY(180deg);
      }
    }
  }
}
