/* 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/. */

html {
  /* Prevent unnecessary horizontal scroll bar from showing */
  overflow-x: hidden;
}

div {
  display: flex;
}

button {
  padding-inline: 10px;
}

fieldset {
  margin: 0 4px;
  padding: 0;
  border: none;

  > legend {
    box-sizing: border-box;
    width: 100%;
    padding: 0.4em 0.7em;
    background-color: var(--background-color-box);
    border: 1px solid var(--in-content-box-border-color);
    border-radius: 2px 2px 0 0;
    user-select: none;
  }
}

option:nth-child(even) {
  background-color: var(--in-content-box-background-odd);
}

#addresses,
#credit-cards {
  width: 100%;
  height: 16.6em;
  margin: 0;
  padding-inline: 0;
  border-top: none;
  border-radius: 0 0 2px 2px;

  > option {
    display: flex;
    align-items: center;
    height: 1.6em;
    padding-inline-start: 0.6em;
  }
}

#controls-container {
  margin-top: 1em;
}

#remove {
  margin-inline-end: auto;
}

#credit-cards {
  > option::before {
    content: "";
    background: url("icon-credit-card-generic.svg") no-repeat;
    background-size: contain;
    float: inline-start;
    width: 16px;
    height: 16px;
    padding-inline-end: 10px;
    -moz-context-properties: fill;
    fill: currentColor;
  }

  /*
    We use .png / @2x.png images where we don't yet have a vector version of a logo
  */
  &.branded > option {
    &[cc-type="amex"]::before {
      background-image: url("third-party/cc-logo-amex.png");
    }

    &[cc-type="cartebancaire"]::before {
      background-image: url("third-party/cc-logo-cartebancaire.png");
    }

    &[cc-type="diners"]::before {
      background-image: url("third-party/cc-logo-diners.svg");
    }

    &[cc-type="discover"]::before {
      background-image: url("third-party/cc-logo-discover.png");
    }

    &[cc-type="jcb"]::before {
      background-image: url("third-party/cc-logo-jcb.svg");
    }

    &[cc-type="mastercard"]::before {
      background-image: url("third-party/cc-logo-mastercard.svg");
    }

    &[cc-type="mir"]::before {
      background-image: url("third-party/cc-logo-mir.svg");
    }

    &[cc-type="unionpay"]::before {
      background-image: url("third-party/cc-logo-unionpay.svg");
    }

    &[cc-type="visa"]::before {
      background-image: url("third-party/cc-logo-visa.svg");
    }

    @media (min-resolution: 1.1dppx) {
      &[cc-type="amex"]::before {
        background-image: url("third-party/cc-logo-amex@2x.png");
      }

      &[cc-type="cartebancaire"]::before {
        background-image: url("third-party/cc-logo-cartebancaire@2x.png");
      }

      &[cc-type="discover"]::before {
        background-image: url("third-party/cc-logo-discover@2x.png");
      }
    }
  }
}
