/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

:root {
  /* Provide defaults for when this page is viewed in "toolkit". */
  background-color: var(--in-content-page-background, #fff);
  color: var(--in-content-page-color, #15141a);

  /* Provide backup values for some of the variables used in "browser" so that the styles
     look nice by default in "toolkit". */
  --AT-box-background: var(--background-color-box);
  --AT-box-border-color: var(--in-content-box-border-color, #9e9ea0);
  --AT-box-info-background: var(--in-content-box-info-background, #f0f0f4);

  /* Variables used in the page layout */
  --AT-page-margin: 20px;
  --AT-input-padding: 20px;
  /* This is somewhat arbitrary, but works well for the current design. If the computed
     header height changes, this will need to be adjusted. */
  --AT-header-height: 156px;
  --AT-input-height: calc(min(400px, calc(100vh - var(--AT-header-height))));
  --AT-select-arrow-inset: 5px;
}

body {
  display: flex;
  justify-content: center;
  align-items: center;
  inset: 0;
  position: absolute;
  visibility: hidden;
  flex-direction: column;
}

.about-translations-header {
  display: grid;
  grid-template-columns: 1fr max-content 1fr;
}

/* Increase the selector specificity to override the base `select` styles. */
select.about-translations-select {
  position: relative;
  padding-inline: 10px 20px;
  padding-block: 0;
  min-width: 50%;
  width: max-content;
  margin: 5px;
  background-position: right var(--AT-select-arrow-inset) center;
}

select#language-to {
  justify-self: end;
}

.language-swap-icon {
  width: 20px;
  height: 20px;
  background-image: url('chrome://global/content/translations/icons/swap-languages.svg');
  background-size: contain;
  margin: 0 auto;
  -moz-context-properties: fill;
  fill: currentColor;
  transform: rotateY(180deg) rotateZ(90deg);
}

select.about-translations-select:dir(rtl) {
  background-position-x: left var(--AT-select-arrow-inset);
}

.about-translations-contents {
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  width: calc(100% - var(--AT-page-margin) * 2);
  max-width: 1200px;
  background-color: var(--AT-box-background);
  border: 1px solid var(--AT-box-border-color);
  border-radius: 4px;
}

.about-translations-input {
  display: flex;
  width: 100%;
  border-top: 1px solid var(--AT-box-border-color);
}

.about-translations-input-start {
  border-inline-end: 1px solid var(--AT-box-border-color);
}

.about-translations-input > * {
  position: relative;
  width: 50%;
}

.about-translations-input-textarea {
  /* Override user's dragging of the textarea width. */
  width: 100% !important;
  height: var(--AT-input-height);
  box-sizing: border-box;
  margin: 0;
  padding: var(--AT-input-padding);
  border: 0;
}

.about-translations-input-results-blank {
  opacity: 0.7;
}

.about-translations-input-results {
  position: absolute;
  inset: 0;
  padding: var(--AT-input-padding);
  box-sizing: border-box;
  overflow-y: scroll;
}

.about-translations-info {
  display: none;
  padding: 10px;
  background-color: var(--AT-box-info-background);
  border-radius: 4px;
  margin-bottom: var(--AT-input-padding);
}

.about-translations-info-message {
  flex: 1;
  align-self: center;
}

.about-translations-info-icon {
  width: 16px;
  height: 16px;
  margin: 10px;
  background-image: url('chrome://global/skin/icons/info.svg');
  -moz-context-properties: fill;
  fill: currentColor;
}

@media (max-width: 700px) {
  :root {
    --AT-page-margin: 10px;
  }
  h1 {
    margin-top: 15px;
  }
  body {
    padding-bottom: var(--AT-page-margin);
  }
  .about-translations-input {
    flex-direction: column;
    flex: 1;
  }
  .about-translations-input-textarea,
  .about-translations-input {
    font-size: 16px;
  }
  .about-translations-input > * {
    width: 100%;
    flex: 1;
  }
  .about-translations-input-end {
    border-top: 1px solid var(--AT-box-border-color);
  }
  .about-translations-input-textarea {
    height: 100%;
  }
  .about-translations-contents {
    flex: 1;
  }
}
