@import (reference) '~dumi-theme-mobile/es/style/variables';

@s-device-width: 375px;

.@{prefix}-mobile-container {
}

.gen-device-style(@scale) {
  /*width: @s-device-width * @scale;
  min-width: @s-device-width * @scale;
  height: @s-device-width * @scale * @s-device-ratio;
  box-shadow: 0 0 0 @s-device-border-width * @scale #090a0d,
  0 0 0 @s-device-shell-width * @scale #9fa3a8,
  0 4px 20px @s-device-shell-width * @scale rgba(0, 0, 0, 0.1);*/

  width: @s-device-width * @scale !important;
  //height: 590px;
  background-image: url(https://gw.alipayobjects.com/zos/rmsportal/JAxcjwaQvIsAWvXUrjbY.png);
  background-size: 100%;
  background-repeat: no-repeat;
  overflow: hidden;

  .mobile-header {
    height: 64px;
    overflow: hidden;
  }

  .mobile-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    margin: 0 7px;
    cursor: url('https://gw.alipayobjects.com/mdn/rms_4f0ff1/afts/img/A*eRn5S6F8qVgAAAAAAAAAAABkARQnAQ')
        10 10,
      auto;
    position: relative;

    > iframe {
      flex: 1;
      border: 0;
      display: block;
      touch-action: pan-y;
      user-select: none;
      -webkit-user-drag: none;
      background: #f4f4f4;
      -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
    }
  }

  .wrapper-loading {
    display: flex;
    flex: 1;

    .@{prefix}-spin-container {
      display: flex;
      flex: 1;
    }
  }
}

.@{prefix}-device {
  position: sticky;
  top: @s-device-gap-top;
  //margin-left: @s-content-margin;

  &[data-device-type='iOS'] {
    display: flex;
    flex-direction: column;
    ////width: @s-device-width;
    //min-width: @s-device-width;
    //height: @s-device-width * @s-device-ratio - 20;
    min-height: calc(100vh - 140px);
    height: calc(100vh - 140px);
    //min-height: @s-device-width * @s-device-ratio - 20;
    //border-radius: 32px;
    overflow: hidden;
    .gen-device-style(1);

    &::after {
      content: '';
      position: absolute;
      border-left: 1px solid #dfdfdf87;
      border-right: 1px solid #dfdfdf87;
      left: 7px;
      right: 7px;
      top: 56px;
      bottom: 40px;
      z-index: -1;
    }

    @media only screen and (max-width: 1440px) {
      .gen-device-style(0.9);
    }

    @media only screen and (max-width: 1360px) {
      .gen-device-style(0.8);
    }

    @media only screen and (max-width: 960px) {
      display: none;
    }
  }

  &[data-mode='site'] {
    top: 80px;
  }

  &-status,
  &-action {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 22px;
  }

  &-status {
    height: 30px;
    color: #222;
    font-size: 12px;
    font-weight: 500;
    user-select: none;
    background-color: #fff;

    [data-prefers-color='dark'] & {
      color: rgba(255, 255, 255, 0.85);
    }

    span {
      display: inline-block;
      width: 60px;

      &:nth-child(2) {
        text-align: center;
      }
    }

    // battery
    &::after {
      content: '';
      display: inline-block;
      margin-left: 42px;
      width: 14px;
      height: 5px;
      border-radius: 1px;
      background: #50d664;
      box-shadow: 0 0 0 1px #fff, 0 0 0 2px #999;
    }
  }

  &-action {
    height: 40px;
    background: #ffffff;
    margin: 0 0px;
    border-radius: 0 0 10px 10px;
    box-shadow: inset 0 0 0 1px #eee;

    > a,
    > button {
      padding: 0;
      width: 16px;
      height: 16px;
      box-sizing: content-box;
      border: 2px solid transparent;
      transition: opacity 0.2s, background 0.2s;
      outline: none;
      cursor: pointer;

      &:hover {
        opacity: 0.8;
      }

      &:active {
        opacity: 0.9;
      }

      &[role='refresh'] {
        background-position-x: -144px;
      }

      &[role='open-demo'] {
        background-position-x: -126px;
      }

      &[role='qrcode'] {
        position: relative;
        z-index: 1;
        background-position-x: -218px;

        > canvas {
          position: absolute;
          bottom: 120%;
          left: 50%;
          border: 4px solid #fff;
          box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
          box-sizing: content-box;
          transition: all 0.2s ease-in-out;
          transform: translateX(-50%) scale(0);
          transform-origin: center bottom;
        }

        &:hover > canvas,
        &:focus > canvas {
          transform: translateX(-50%) scale(1);
        }
      }
    }
  }
}
