// ====================== Panels =======================

// Panel container
.panel {
  position: relative;
  margin-bottom: 45px;
  background-color: @panel-bg;
  border-radius: @panel-border-radius;

  &.panel-transparent {
    background: none;
    border: 0;
    margin: 0;
    padding: 0;
  }

  // Top Border Panel
  &.panel-border {
      border-style: solid;
      border-width: 0;
      &.top    { border-top-width: 5px; }
      &.right  { border-right-width: 5px; }
      &.bottom { border-bottom-width: 5px; }
      &.left   { border-left-width: 5px; }
      > .panel-heading {
          background-color: @panel-heading-bg;
          border-color: @panel-border-color;
          border-top: 1px solid transparent;
          > .panel-title {
            color: @panel-heading-font-color;
          }
      }
  }
  &.panel-border.panel-default {
      border-color: #DDD;
      > .panel-heading {
          border-top: 1px solid transparent;
      }
  }

}

// Panel Menu
.panel-menu {
  background-color: #fafafa;
  padding: 12px;
  border: 1px solid @panel-border-color;

  &.dark {
    background-color: #f8f8f8;
  }
}
.panel-body .panel-menu {
  border-left: 0;
  border-right: 0;
}
.panel-heading-bb + .panel-menu,
.panel-menu + .panel-body,
.panel-body + .panel-menu,
.panel-body + .panel-body {
  border-top: 0;
}


// Panel content
.panel-body {
  position: relative;
  padding: @panel-body-padding;
  border: 1px solid @panel-border-color;
  &:extend(.clearfix all);

  & + .panel-footer {
    border-top: 0;
  }
}


// Panel heading
.panel-heading {
  position: relative;
  height: 52px;
  line-height: 49px;
  letter-spacing: 0.2px;
  color: @panel-heading-font-color;
  font-size: @panel-heading-font-size;
  font-weight: @panel-heading-font-weight;
  padding: @panel-heading-padding;
  background: @panel-heading-bg;
  border: 1px solid @panel-border-color;
  .border-left-radius(@panel-border-radius);

  + .panel-body {
    border-top: 0;
  }

  > .dropdown .dropdown-toggle {
    color: inherit;
  }

  .widget-menu {

    // Button Group
    .btn-group {
      margin-top: -3px;
    }

    // Form control
    .form-control {
        margin-top: 6px;
        font-size: 11px;
        height: 27px;
        padding: 2px 10px;
        border-radius: 1px;
        &.input-sm {
          margin-top: 9px;
          height: 22px;
        }
    }
    // Progress Bar sizes
    .progress { margin-top: 11px; margin-bottom: 0; }
    .progress-bar-lg { margin-top: 10px; }
    .progress-bar-sm { margin-top: 15px; }
    .progress-bar-xs { margin-top: 17px; }

  }
}

.panel-icon {
  padding-left: 5px;
}

//Panel title
.panel-title {
  padding-left: 6px;
  margin-top: 0;
  margin-bottom: 0;

  > .fa,
  > .glyphicon,
  > .glyphicons,
  > .imoon {
      top: 2px;
      min-width: 22px;
      color: inherit;
      font-size: 14px;
  }

  > a {
    color: inherit;
  }
}

//Panel Footer
.panel-footer {
  padding: @panel-footer-padding;
  background-color: @panel-footer-bg;
  border: 1px solid @panel-border-color;
  .border-bottom-radius((@panel-border-radius - 1));
}


// Panels in "#content"

#content .panel {
  .box-shadow(1px 2px 0 @brand-light);
  padding: 25px;

  .panel-heading {
    background-color: transparent;
    border: 0;
    -webkit-border-radius: 0;
    border-radius: 0;
    height: auto;
    line-height: 24px;
    padding: 0;

    .panel-icon {
      color: @muted;
      font-size: 20px;
      line-height: 24px;
    }
    .panel-title {
      font: 700 20px/24px 'Lato';
      letter-spacing: 0;
      padding: 0;
    }

    &.panel-heading-bb {
      border-bottom: 1px solid @brand-light;
      padding-bottom: 23px;
    }
  }
  .panel-menu {margin-top: 30px;}
  .panel-heading + .panel-menu {margin-top: 0;}

  .panel-body {
    border: 0;
    margin-top: 30px;
  }
  .panel-heading + .panel-body {margin-top: 15px;}
  .panel-footer {
    background-color: transparent;
    border: 0;
  }
}

#content .panel-tile {
  padding: 0;

  .panel-body {margin-top: 0;}
}

// Panels with list groups
.panel {
  > .list-group {
    margin-bottom: 0;

    .list-group-item {
      border-radius: 0;
    }

    &:first-child {
      .list-group-item:first-child {
        .border-top-radius((@panel-border-radius - 1));
      }
    }
    &:last-child {
      .list-group-item:last-child {
        .border-bottom-radius((@panel-border-radius - 1));
      }
    }
  }
}
.panel-heading + .list-group {
  .list-group-item:first-child {
    border-top-width: 0;
  }
}
.panel-body + .list-group {
  .list-group-item:first-child {
    border-top-width: 0;
  }
}
.list-group + .panel-footer {
  border-top-width: 0;
}

// Panels with tables

.panel {
  > .table,
  > .table-responsive > .table,
  > .panel-collapse > .table {
    margin-bottom: 0;
  }
  > .table:first-child,
  > .table-responsive:first-child > .table:first-child {
    .border-top-radius((@panel-border-radius - 1));

    > thead:first-child,
    > tbody:first-child {
      > tr:first-child {
        td:first-child,
        th:first-child {
          border-top-left-radius: (@panel-border-radius - 1);
        }
        td:last-child,
        th:last-child {
          border-top-right-radius: (@panel-border-radius - 1);
        }
      }
    }
  }
  > .table:last-child,
  > .table-responsive:last-child > .table:last-child {
    .border-bottom-radius((@panel-border-radius - 1));

    > tbody:last-child,
    > tfoot:last-child {
      > tr:last-child {
        td:first-child,
        th:first-child {
          border-bottom-left-radius: (@panel-border-radius - 1);
        }
        td:last-child,
        th:last-child {
          border-bottom-right-radius: (@panel-border-radius - 1);
        }
      }
    }
  }
  > .panel-body + .table,
  > .panel-body + .table-responsive {
    border-top: 1px solid @table-border-color;
  }
  > .table > tbody:first-child > tr:first-child th,
  > .table > tbody:first-child > tr:first-child td {
    border-top: 0;
  }
  > .table-bordered,
  > .table-responsive > .table-bordered {
    border: 0;
    > thead,
    > tbody,
    > tfoot {
      > tr {
        > th:first-child,
        > td:first-child {
          border-left: 0;
        }
        > th:last-child,
        > td:last-child {
          border-right: 0;
        }
      }
    }
    > thead,
    > tbody {
      > tr:first-child {
        > td,
        > th {
          border-bottom: 0;
        }
      }
    }
    > tbody,
    > tfoot {
      > tr:last-child {
        > td,
        > th {
          border-bottom: 0;
        }
      }
    }
  }
  > .table-responsive {
    border: 0;
    margin-bottom: 0;
  }
}

// Panels with accordion

.panel-group {
  margin-bottom: @line-height-computed;

  .panel-title {
    padding-left: 0;
  }

  .panel-heading,
  .panel-heading a {
    position: relative;
    display: block;
    width: 100%;
  }

  &.accordion-lg {
    .panel + .panel {
      margin-top: 12px;
    }
    .panel-heading {
      font-size: 14px;
      height: 54px;
      line-height: 52px;
    }
  }

  .accordion-icon {
    padding-left: 35px;

    &:after {
      position: absolute;
      content: "\f068";
      font-family: "FontAwesome";
      font-size: 12px;
      font-style: normal;
      font-weight: normal;
      -webkit-font-smoothing: antialiased;
      color: #555;
      left: 10px;
      top: 0;
    }

    &.collapsed:after {
      content: "\f067";
    }

    &.icon-right {
      padding-left: 10px;
      padding-right: 30px;
      &:after {
        left: auto;
        right: 5px;
      }
    }

  }

  .panel {
    margin-bottom: 0;
    border-radius: @panel-border-radius;
    + .panel {
      margin-top: 5px;
    }
    padding: 8px 40px 9px 15px;
  }

  .panel-heading {
    + .panel-collapse > .panel-body {
      border-top: 0;
    }
  }
  .panel-footer {
    border-top: 0;
    + .panel-collapse .panel-body {
      border-bottom: 1px solid @panel-inner-border;
    }
  }

}

#content .panel-group {
  &.accordion {
    .panel {
      -webkit-box-shadow: none;
      -moz-box-shadow: none;
      box-shadow: none;
      background-color: transparent;
      margin-bottom: 20px;
      padding: 0;

      .panel-heading {
        background-color: transparent;
        color: @text-color;
        font: 700 12px/24px 'Open Sans';
        padding: 0;
        text-transform: uppercase;

        a {
          background-color: @light-gray;
          border-radius: @border-radius-base;
          color: @text-color;
          padding: 8px 40px 8px 14px;

          &:hover {color: @brand-primary;}

          &:not(.collapsed) {
            background-color: @brand-primary;
            color: @white;

            &:after {
              content: '';
              position: absolute;
              top: 100%;
              left: 30px;
              width: 0;
              height: 0;
              border-width: 7px 7px 0px 7px;
              border-style: solid;
              border-color: @brand-primary transparent transparent transparent;

            }
          }
        }

      }

      .panel-body {margin-top: 20px;}
    }

    .accordion-icon {
      padding-left: 0;

      &:after {
        font-size: 14px;
        left: auto;
        right: 15px;
        top: 8px;
      }
    }
  }
}


// Responsive styles

@media (max-width: 359px) {
  .panel-heading .panel-title + .panel-tabs {position: relative;}
  .panel-heading .panel-title + .widget-menu.pull-right {
    float: none !important;
  }
}