@import url('mixins.less');

:root {
  --f7-keypad-height: 260px;
  --f7-keypad-landscape-height: 200px;
  --f7-keypad-inline-height: 200px;
  --f7-keypad-inline-calc-height: 260px;
  --f7-keypad-popover-width: 300px;

  --f7-keypad-button-bg-color: #fcfcfd;
  --f7-keypad-button-text-color: #000;
  --f7-keypad-button-border-color: rgba(0,0,0,0.1);
  --f7-keypad-button-pressed-bg-color: #bcc0c5;
  --f7-keypad-button-dark-bg-color: #ddd;
  --f7-keypad-button-dark-pressed-bg-color: #fcfcfd;

  --f7-keypad-button-number-font-size: 28px;
  --f7-keypad-button-number-letters-size: 11px;

  --f7-keypad-calc-button-text-color: #fff;
  --f7-keypad-calc-button-bg-color: #ff9500;
  --f7-keypad-calc-button-pressed-bg-color: #e0750e;
  --f7-keypad-calc-button-active-border-color: rgba(0,0,0,0.4);
  --f7-keypad-calc-button-active-border-width: 1px;
}

.keypad-popover {
  width: var(--f7-keypad-popover-width);
  .keypad {
    height: var(--f7-keypad-height);
  }
  .ios & {
    .toolbar {
      background: none;
    }
  }
  .keypad-buttons {
    overflow: hidden;
    border-radius: var(--f7-popover-border-radius);
  }
  .toolbar ~ .keypad-buttons {
    border-radius: 0 0 var(--f7-popover-border-radius) var(--f7-popover-border-radius);
  }
}
.keypad-sheet {
  padding-bottom: var(--f7-safe-area-bottom);
  height: calc(var(--f7-safe-area-bottom) + var(--f7-keypad-height));
  @media (orientation: landscape) and (max-height: 415px) {
    height: var(--f7-keypad-landscape-height);
  }
}
.keypad-inline {
  height: var(--f7-keypad-inline-height);
  &.keypad-type-calculator {
    height: var(--f7-keypad-inline-calc-height);
  }
}
.keypad-inline, .keypad-popover .keypad {
  .keypad-buttons {
    height: 100%;
  }
  .toolbar ~ .keypad-buttons {
    height: calc(100% - var(--f7-toolbar-height));
  }
}
i.icon-keypad-delete {
  width: 22px;
  height: 16px;
  background-size: 22px 16px;
  background-image: url("data:image/svg+xml;charset=utf-8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 16'><path d='M18,0h-8C8.9,0,7.9,0.5,7.1,1.2c0,0,0,0,0,0L1,7.2C0.6,7.7,0.6,8.4,1,8.8l4.9,4.7L7,14.6c0,0,0,0,0,0c0.7,0.9,1.8,1.4,3,1.4 h8c2.2,0,4-1.8,4-4V4C22,1.8,20.2,0,18,0z M17.3,11.2l-0.7,0.7l-3.2-3.2l-3.2,3.2l-0.7-0.7L12.8,8L9.6,4.8l0.7-0.7l3.2,3.2l3.2-3.2 l0.7,0.7L14.2,8L17.3,11.2z' fill='%23000000'/></svg>");
}
.keypad-buttons {
  color: var(--f7-keypad-button-text-color);
  display: flex;
  flex-wrap: wrap;
}
.keypad-button {
  background: var(--f7-keypad-button-bg-color);
  position: relative;
  text-align: center;
  cursor: pointer;
  width: 100% / 3;
  width: calc(100% / 3);
  height: 25%;
  .hairline(right, var(--f7-keypad-button-border-color));
  .hairline(top, var(--f7-keypad-button-border-color));
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  box-sizing: border-box;
  user-select: none;
  &:not(.keypad-dummy-button) {
    &.active-state {
      background: var(--f7-keypad-button-pressed-bg-color);
    }
  }


  &.keypad-button-dark {
    background: var(--f7-keypad-button-dark-bg-color);
    &:not(.keypad-dummy-button) {
      &.active-state {
        background: var(--f7-keypad-button-dark-pressed-bg-color);
      }
    }
  }
  &.keypad-dummy-button {
    cursor: default;
  }

  .keypad-type-numpad & {
    &:nth-child(3n) {
      .hairline-remove(right);
    }
    &:nth-child(-n + 3) {
      .hairline-remove(top);
    }
    &.keypad-button-double {
      width: 100% / 3 * 2;
      width: calc(100% / 3 * 2);
    }
  }
  .keypad-type-calculator & {
    width: 25%;
    height: 20%;
    &:nth-child(4n) {
      .hairline-remove(right);
    }
    &:nth-child(-n + 4) {
      .hairline-remove(top);
    }
    &.keypad-button-double {
      width: 50%;
    }
  }
  &.calc-operator-button {
    color: var(--f7-keypad-calc-button-text-color);
    background: var(--f7-keypad-calc-button-bg-color);
    &.active-state {
      background: var(--f7-keypad-calc-button-pressed-bg-color);
    }
    &.calc-operator-active {
      border: var(--f7-keypad-calc-button-active-border-width) solid var(--f7-keypad-calc-button-active-border-color);
    }
  }
}

.keypad-button-number,
.keypad-button-letters {
  display: block;
}
.keypad-button-number {
  font-size: var(--f7-keypad-button-number-font-size);
  line-height: 1;
}
.keypad-button-letters {
  font-size: var(--f7-keypad-button-letters-font-size);
  line-height: 15px;
  height: 15px;
}

.list {
  input[type="numpad"],
  input[type="calculator"] {
    appearance: none;
    box-sizing: border-box;
    border: none;
    background: none;
    border-radius: 0 0 0 0;
    box-shadow: none;
    display: block;
    padding: 0;
    margin: 0;
    width: 100%;
    color: var(--f7-input-text-color);
    font-family: inherit;
    height: var(--f7-input-height);;
    font-size: var(--f7-input-font-size);;
  }
}