@import "../../../themes/ionic.globals.wp";

// Windows Item
// --------------------------------------------------

/// @prop - Font size of the item text
$item-wp-body-text-font-size: 14px !default;

/// @prop - line height of the item text
$item-wp-body-text-line-height: 1.5 !default;

/// @prop - Background color of the item
$item-wp-body-background-color: $list-wp-background-color !default;

/// @prop - Color of the item text
$item-wp-body-text-color: $list-wp-text-color !default;

/// @prop - Color of the item paragraph
$item-wp-paragraph-text-color: #666 !default;

/// @prop - Font size of the item
$item-wp-font-size: 16px !default;

/// @prop - Size of the avatar in the item
$item-wp-avatar-size: 40px !default;

/// @prop - Border radius of the avatar in the item
$item-wp-avatar-border-radius: 50% !default;

/// @prop - Size of the thumbnail in the item
$item-wp-thumbnail-size: 80px !default;

/// @prop - Shows the detail arrow icon on an item
$item-wp-detail-push-show: false !default;

/// @prop - Color of the detail arrow icon
$item-wp-detail-push-color: $input-wp-border-color !default;

/// @prop - Icon for the detail arrow
$item-wp-detail-push-svg: "<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 20'><path d='M2,20l-2-2l8-8L0,2l2-2l10,10L2,20z' fill='#{$item-wp-detail-push-color}'/></svg>" !default;

/// @prop - Color for the divider
$item-wp-divider-color: $list-wp-text-color !default;

/// @prop - Background for the divider
$item-wp-divider-background: #fff !default;

/// @prop - Bodrer bottom for the divider
$item-wp-divider-border-bottom: 1px solid $list-wp-border-color !default;

/// @prop - Font size for the divider
$item-wp-divider-font-size: 20px !default;

/// @prop - Background for the sliding content
$item-wp-sliding-content-background: $list-wp-background-color !default;

.item-wp {
  position: relative;
  font-size: $item-wp-font-size;
  font-weight: normal;
  color: $item-wp-body-text-color;
  text-transform: none;
  background-color: $item-wp-body-background-color;
  box-shadow: none;

  @include padding-horizontal($item-wp-padding-start, 0);
}

.item-wp:active {
  background-color: $list-wp-activated-background-color;
}

.item-wp[no-lines] {
  border-width: 0;
}

.item-wp h1 {
  font-size: 24px;
  font-weight: normal;

  @include margin(0, 0, 2px);
}

.item-wp h2 {
  font-size: 16px;
  font-weight: normal;

  @include margin(2px, 0);
}

.item-wp h3,
.item-wp h4,
.item-wp h5,
.item-wp h6 {
  font-size: 14px;
  font-weight: normal;
  line-height: normal;

  @include margin(2px, 0);
}

.item-wp p {
  overflow: inherit;
  font-size: 14px;
  line-height: normal;
  color: $item-wp-paragraph-text-color;
  text-overflow: inherit;

  @include margin(0, 0, 2px);
}

.item-wp.item-block .item-inner {
  border-bottom: 1px solid $list-wp-border-color;

  @include padding-horizontal(null, ($item-wp-padding-end / 2));
}

// Windows Item Detail Push
// --------------------------------------------------

// Only show the forward arrow icon if true
@if $item-wp-detail-push-show == true {
  .item-wp[detail-push] .item-inner,
  button.item-wp:not([detail-none]) .item-inner,
  a.item-wp:not([detail-none]) .item-inner {
    background-repeat: no-repeat;
    background-size: 14px 14px;

    @include svg-background-image($item-wp-detail-push-svg, true);
    @include padding-horizontal(null, 32px);
    @include background-position(end, $item-wp-padding-end - 2, center);
  }
}

// Windows Item Media
// --------------------------------------------------

.item-wp [item-left], // deprecated
.item-wp [item-right], // deprecated
.item-wp [item-start],
.item-wp [item-end] {
  @include margin($item-wp-padding-media-top, ($item-wp-padding-end / 2), $item-wp-padding-media-bottom, 0);
}

.item-wp .ion-icon[item-left], // deprecated
.item-wp .ion-icon[item-right], // deprecated
.item-wp .ion-icon[item-start],
.item-wp .ion-icon[item-end] {
  @include margin($item-wp-padding-icon-top, null, $item-wp-padding-icon-bottom, 0);
}

.item-wp .item-button {
  height: 25px;
  font-size: 12px;

  @include padding(0, 0.6em);
}

.item-wp .item-button[icon-only] .ion-icon,
.item-wp .item-button[icon-only] {
  @include padding(0, 1px);
}

.item-wp[text-wrap] ion-label {
  font-size: $item-wp-body-text-font-size;
  line-height: $item-wp-body-text-line-height;
}

.item-wp .ion-icon[item-left] + .item-inner,
.item-wp .ion-icon[item-left] + .item-input,
.item-wp .ion-icon[item-start] + .item-inner,
.item-wp .ion-icon[item-start] + .item-input {
  @include margin-horizontal(($item-wp-padding-start / 2), null);
}

.item-wp .ion-avatar[item-left], // deprecated
.item-wp .ion-thumbnail[item-left], // deprecated
.item-wp .ion-avatar[item-start],
.item-wp .ion-thumbnail[item-start] {
  @include margin(($item-wp-padding-end / 2), $item-wp-padding-end, ($item-wp-padding-end / 2), 0);
}

.item-wp .ion-avatar[item-right], // deprecated
.item-wp .ion-thumbnail[item-right], // deprecated
.item-wp .ion-avatar[item-end],
.item-wp .ion-thumbnail[item-end] {
  @include margin($item-wp-padding-end / 2);
}

// Windows Item Avatar
// --------------------------------------------------

.item-wp .ion-avatar {
  min-width: $item-wp-avatar-size;
  min-height: $item-wp-avatar-size;
}

.item-wp .ion-avatar .ion-img,
.item-wp .ion-avatar img {
  width: $item-wp-avatar-size;
  height: $item-wp-avatar-size;
  overflow: hidden;

  @include border-radius($item-wp-avatar-border-radius);
}

// Windows Item Thumbnail
// --------------------------------------------------

.item-wp .ion-thumbnail {
  min-width: $item-wp-thumbnail-size;
  min-height: $item-wp-thumbnail-size;
}

.item-wp .ion-thumbnail .ion-img,
.item-wp .ion-thumbnail img {
  width: $item-wp-thumbnail-size;
  height: $item-wp-thumbnail-size;
}

// Windows Item Divider
// --------------------------------------------------

.item-divider-wp {
  font-size: $item-wp-divider-font-size;
  color: $item-wp-divider-color;
  background-color: $item-wp-divider-background;
  border-bottom: $item-wp-divider-border-bottom;

  @include padding-horizontal($item-wp-padding-start, null);
}

// Generate Windows Item and Item Divider Colors
// --------------------------------------------------

@each $color-name, $color-base, $color-contrast in get-colors($colors-wp) {
  // If there is text with a color it should use this color
  // and override whatever item sets it to
  .item-wp .text-wp-#{$color-name} {
    color: $color-base;
  }

  .item-wp-#{$color-name},
  .item-divider-wp-#{$color-name} {
    color: $color-contrast;
    background-color: $color-base;

    p {
      color: $color-contrast;
    }

    &:active {
      background-color: color-shade($color-base);
    }
  }
}

// Windows Item Sliding
// --------------------------------------------------

.list-wp .ion-item-sliding {
  background-color: $item-wp-sliding-content-background;
}
