@import "../../globals.md";
@import "./item";

// Material Design Item
// --------------------------------------------------

$item-md-body-text-font-size:        1.4rem !default;
$item-md-body-text-line-height:      1.5 !default;
$item-md-paragraph-text-color:       #666 !default;

$item-md-font-size:                  1.6rem !default;
$item-md-avatar-size:                4rem !default;
$item-md-thumbnail-size:             8rem !default;
$item-md-note-color:                 darken($list-md-border-color, 10%) !default;

$item-md-divider-background:         #fff !default;
$item-md-divider-color:              #222 !default;
$item-md-divider-padding:            5px 15px !default;

$item-md-sliding-content-background: $list-md-background-color !default;


.item {
  position: relative;

  padding-right: 0;
  padding-left: ($item-md-padding-left);

  font-size: $item-md-font-size;
  font-weight: normal;
  text-transform: none;

  color: $list-md-text-color;
  background-color: $list-md-background-color;
  box-shadow: none;
  transition: background-color 300ms cubic-bezier(.4, 0, .2, 1), transform 300ms;

  h1 {
    margin: 0 0 2px;

    font-size: 2.4rem;
    font-weight: normal;
  }

  h2 {
    margin: 2px 0;

    font-size: 1.6rem;
    font-weight: normal;
  }

  h3,
  h4,
  h5,
  h6 {
    margin: 2px 0;

    font-size: 1.4rem;
    font-weight: normal;
    line-height: normal;
  }

  p {
    margin: 0 0 2px;

    font-size: 1.4rem;
    line-height: normal;
    color: $item-md-paragraph-text-color;
  }
}

.item.activated {
  background-color: $list-md-activated-background-color;
}

.item[no-lines] {
  border-width: 0;
}

.item-inner {
  padding-right: ($item-md-padding-right / 2);

  border-bottom: 1px solid $list-md-border-color;
}


// Material Design Item Media
// --------------------------------------------------

[item-left],
[item-right] {
  margin: $item-md-padding-media-top ($item-md-padding-right / 2) $item-md-padding-media-bottom 0;
}

ion-icon[item-left],
ion-icon[item-right] {
  margin-top: $item-md-padding-icon-top;
  margin-bottom: $item-md-padding-icon-bottom;
  margin-left: 0;
}

.item-button {
  padding: 0 .6em;

  height: 25px;

  font-size: 1.2rem;
}

.item-button.button-icon-only ion-icon,
.item-button.button-icon-only {
  padding: 0 1px;
}

ion-icon[item-left] + .item-inner,
ion-icon[item-left] + .item-input {
  margin-left: $item-md-padding-left + ($item-md-padding-left / 2);
}

ion-avatar[item-left],
ion-thumbnail[item-left] {
  margin: ($item-md-padding-right / 2) $item-md-padding-right ($item-md-padding-right / 2) 0;
}

ion-avatar[item-right],
ion-thumbnail[item-right] {
  margin: ($item-md-padding-right / 2);
}

ion-avatar {
  min-width: $item-md-avatar-size;
  min-height: $item-md-avatar-size;

  img {
    max-width: $item-md-avatar-size;
    max-height: $item-md-avatar-size;

    border-radius: $item-md-avatar-size / 2;
  }
}

ion-thumbnail {
  min-width: $item-md-thumbnail-size;
  min-height: $item-md-thumbnail-size;

  img {
    max-width: $item-md-thumbnail-size;
    max-height: $item-md-thumbnail-size;
  }
}

ion-note {
  color: $item-md-note-color;
}


// Material Design Item Group
// --------------------------------------------------

ion-item-group {
  .item:first-child {
    .item-inner {
      border-top-width: 0;
    }
  }

  .item:last-child .item-inner,
  ion-item-sliding:last-child .item-inner {
    border: 0;
  }
}


// Material Design Item Divider
// --------------------------------------------------

ion-item-divider {
  padding: $item-md-padding-top $item-md-padding-right $item-md-padding-bottom $item-md-padding-left;

  color: $item-md-divider-color;
  background-color: $item-md-divider-background;
}


// Generate Material Design Item Divider Colors
// --------------------------------------------------

@each $color-name, $color-base, $color-contrast in get-colors($colors-md) {
  ion-item-divider[#{$color-name}] {
    color: $color-contrast;
    background-color: $color-base;
  }
}


// Material Design Item Sliding
// --------------------------------------------------

ion-item-sliding {
  background-color: $item-md-sliding-content-background;
}
