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

// Material Design List
// --------------------------------------------------

$list-md-margin-top:             16px !default;
$list-md-margin-right:           0 !default;
$list-md-margin-bottom:          16px !default;
$list-md-margin-left:            0 !default;

$list-inset-md-margin-top:       16px !default;
$list-inset-md-margin-right:     16px !default;
$list-inset-md-margin-bottom:    16px !default;
$list-inset-md-margin-left:      16px !default;
$list-inset-md-border-radius:    2px !default;

$list-md-header-padding:         16px $item-md-padding-right 16px $item-md-padding-left !default;
$list-md-header-font-size:       1.4rem !default;
$list-md-header-color:           #858585 !default;


//
// DEFAULT LIST
//

ion-list-header,
ion-item-divider {
  margin-left: 0;
  padding: $list-md-header-padding;

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

ion-list {
  margin: 0 $list-md-margin-right $list-md-margin-bottom $list-md-margin-left;

  .item-inner {
    border-bottom: 1px solid $list-md-border-color;
  }

  > .item:first-child,
  > ion-item-sliding:first-child .item {
    border-top: 1px solid $list-md-border-color;
  }

  > .item:last-child,
  > ion-item-sliding:last-child .item {
    border-bottom: 1px solid $list-md-border-color;
  }

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

  > ion-input:last-child::after {
    left: 0;
  }

  ion-item-options button,
  ion-item-options [button] {
    display: inline-flex;

    align-items: center;

    margin: 1px 0;

    height: calc(100% - 2px);

    border: 0;
    border-radius: 0;
    box-shadow: none;

    box-sizing: border-box;

    &::before {
      margin: 0 auto;
    }
  }

  // If the item has the no-lines attribute remove the bottom border from:
  // the item itself (for last-child items)
  // the item-inner class (if it is not last)
  .item[no-lines],
  .item[no-lines] .item-inner {
    border-width: 0;
  }

  + ion-list {
    margin-top: $list-md-margin-top + $list-md-margin-bottom;

    ion-list-header {
      margin-top: -$list-md-margin-top;
      padding-top: 0;
    }
  }
}


//
// INSET LIST
//

ion-list[inset] {
  margin: $list-inset-md-margin-top $list-inset-md-margin-right $list-inset-md-margin-bottom $list-inset-md-margin-left;

  border-radius: $list-inset-md-border-radius;

  .item:first-child {
    border-top-width: 0;
    border-top-left-radius: $list-inset-md-border-radius;
    border-top-right-radius: $list-inset-md-border-radius;
  }

  .item:last-child {
    border-bottom-width: 0;
    border-bottom-left-radius: $list-inset-md-border-radius;
    border-bottom-right-radius: $list-inset-md-border-radius;
  }

  .item-input {
    padding-right: 0;
    padding-left: 0;
  }

  + ion-list[inset] {
    margin-top: 0;
  }

  ion-list-header {
    background-color: $list-md-background-color;
  }
}


//
// NO LINES LIST
//

ion-list[no-lines] {
  .item,
  .item .item-inner {
    border-width: 0;
  }
}
