@import './../theme/vars.scss';

$cardpanePrefix: #{$vender-prefix}-cardpane;

.#{$cardpanePrefix} {
  position: relative;
  font-size: 12px;
  line-height: 1.5;
  background: white;
  border-radius: 5px;
  transition: all $animation-duration-slow;

  &:not(&-disabled-hover):hover,
  &-actived {
    border-color: rgba(0, 0, 0, 0.2);
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.2);
  }

  &-bordered {
    border: 1px solid #e9e9e9;
  }

  &-animate {
    animation-duration: $animation-duration-fast;
    animation-name: cardpane-fadedown;
  }

  &-head {
    height: 48px;
    padding: 0 14px;
    line-height: 48px;
    border-radius: 2px 2px 0 0;
    zoom: 1;
  }

  &-head + &-body {
    border-top: 1px solid #e9e9e9;
  }

  &-head-title {
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    font-size: 14px;
    font-weight: 500;
    color: rgba(0, 0, 0, 0.85);
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  &-extra {
    position: absolute;
    top: 0;
    right: 16px;
  }

  &-body {
    padding: 14px;
  }

  &-body + &-footer {
    border-top: 1px solid rgba(0, 0, 0, 0.05);
  }

  &-footer {
    padding: 8px 10px;

    a {
      color: rgba(0, 0, 0, 0.4);
    }
  }
}

.#{$cardpanePrefix}-loading .#{$cardpanePrefix}-body {
  user-select: none;
}

.#{$cardpanePrefix}-loading-content {
  p {
    margin: 0;
  }
}

.#{$cardpanePrefix}-loading-block {
  height: 14px;
  margin: 4px 0;
  background: linear-gradient(90deg, rgba(207, 216, 220, 0.2), rgba(207, 216, 220, 0.4), rgba(207, 216, 220, 0.2));
  background-size: 600% 600%;
  border-radius: $border-radius-sm;
  animation: card-loading 1.4s ease infinite;
}

// collapse card
.amos-collapsecard {
  &-header {
    position: relative;
    padding: 8px 32px;
    line-height: 22px;
    color: rgba(0, 0, 0, 0.85);
    cursor: pointer;
    transition: all 0.3s;

    &-arrow {
      > i[class*='icon'] {
        position: absolute;
        margin-right: 6px;
        transform: scale(0.75) rotate(0deg);
        transition: transform 0.24s;
      }
    }


    &.amos-collapsecard-header-arrow-left {
      .amos-collapsecard-header-arrow {
        > i {
          left: 10px;
        }
      }
    }

    &.amos-collapsecard-header-arrow-right {
      .amos-collapsecard-header-arrow {
        > i {
          right: 3px;
        }
      }
    }
  }

  &-opened &-header {
    .amos-collapsecard-header-arrow {
      > .aficon-right {
        transform: scale(0.75) rotate(90deg);
      }
    }
  }

  &-content {
    padding: 0 16px;
    overflow: hidden;
    color: rgba(0, 0, 0, 0.65);

    &-closed {
      display: none;
    }
  }
}

.amos-collapsecard-anim {
  overflow: hidden;

  &-active {
    transition: height 0.12s, opacity 0.12s;
  }
}

@keyframes cardpane-fadedown {
  0% {
    opacity: 0;
    transform: translate3d(0, -10px, 0);
  }

  100% {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes card-loading {
  0%,
  100% { background-position: 0 50%; }

  50% { background-position: 100% 50%; }
}
