@import "../../themes/ionic.globals.wp";

// Windows Item
// --------------------------------------------------

/// @prop - Font size of the item text
$item-wp-body-text-font-size:        1.4rem !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:                  1.6rem !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:          2rem !default;

/// @prop - Background for the sliding content
$item-wp-sliding-content-background: $list-wp-background-color !default;


.item-wp {
  @include padding-horizontal($item-wp-padding-start, 0);

  position: relative;

  font-size: $item-wp-font-size;
  font-weight: normal;
  text-transform: none;

  color: $item-wp-body-text-color;
  background-color: $item-wp-body-background-color;
  box-shadow: none;
}

.item-wp.activated {
  background-color: $list-wp-activated-background-color;
}

.item-wp[no-lines] {
  border-width: 0;
}

.item-wp h1 {
  @include margin(0, 0, 2px);

  font-size: 2.4rem;
  font-weight: normal;
}

.item-wp h2 {
  @include margin(2px, 0);

  font-size: 1.6rem;
  font-weight: normal;
}

.item-wp h3,
.item-wp h4,
.item-wp h5,
.item-wp h6 {
  @include margin(2px, 0);

  font-size: 1.4rem;
  font-weight: normal;
  line-height: normal;
}

.item-wp p {
  @include margin(0, 0, 2px);

  overflow: inherit;

  font-size: 1.4rem;
  line-height: normal;
  text-overflow: inherit;
  color: $item-wp-paragraph-text-color;
}

.item-wp.item-block .item-inner {
  @include padding-horizontal(null, ($item-wp-padding-end / 2));

  border-bottom: 1px solid $list-wp-border-color;
}


// 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 {
    @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);

    background-repeat: no-repeat;
    background-size: 14px 14px;
  }
}


// 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 {
  @include padding(0, .6em);

  height: 25px;

  font-size: 1.2rem;
}

.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, // deprecated
.item-wp ion-icon[item-left] + .item-input, // deprecated
 .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 {
  @include border-radius($item-wp-avatar-border-radius);

  overflow: hidden;

  width: $item-wp-avatar-size;
  height: $item-wp-avatar-size;
}


// 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 {
  @include padding-horizontal($item-wp-padding-start, null);

  border-bottom: $item-wp-divider-border-bottom;
  font-size: $item-wp-divider-font-size;

  color: $item-wp-divider-color;
  background-color: $item-wp-divider-background;
}


// 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;
    }

    &.activated {
      background-color: color-shade($color-base);
    }
  }
}


// Windows Item Sliding
// --------------------------------------------------

.list-wp ion-item-sliding {
  background-color: $item-wp-sliding-content-background;
}
