//
// Panels
// --------------------------------------------------


// Base class
.ai1ec-panel {
  margin-bottom: @line-height-computed;
  background-color: @panel-bg;
  border: 1px solid transparent;
  border-radius: @panel-border-radius;
  .ai1ec-box-shadow(0 1px 1px rgba(0,0,0,.05));
}

// Panel contents
.ai1ec-panel-body {
  padding: 15px;
  .ai1ec-clearfix();
}


// List groups in panels
//
// By default, space out list group content from panel headings to account for
// any kind of custom content between the two.

.ai1ec-panel {
  > .ai1ec-list-group {
    margin-bottom: 0;

    .ai1ec-list-group-item {
      border-width: 1px 0;

      // Remove border radius for top one
      &:first-child {
        .ai1ec-border-top-radius(0);
      }
      // But keep it for the last one
      &:last-child {
        border-bottom: 0;
      }
    }
  }
}
// Collapse space between when there's no additional content.
.ai1ec-panel-heading + .ai1ec-list-group {
  .ai1ec-list-group-item:first-child {
    border-top-width: 0;
  }
}


// Tables in panels
//
// Place a non-bordered `.ai1ec-table` within a panel (not within a `.ai1ec-panel-body`) and
// watch it go full width.

.ai1ec-panel {
  > .ai1ec-table,
  > .ai1ec-table-responsive > .ai1ec-table {
    margin-bottom: 0;
  }
  > .ai1ec-panel-body + .ai1ec-table,
  > .ai1ec-panel-body + .ai1ec-table-responsive {
    border-top: 1px solid @table-border-color;
  }
  > .ai1ec-table > tbody:first-child th,
  > .ai1ec-table > tbody:first-child td {
    border-top: 0;
  }
  > .ai1ec-table-bordered,
  > .ai1ec-table-responsive > .ai1ec-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;
        }

        &:last-child > th,
        &:last-child > td {
          border-bottom: 0;
        }
      }
    }
  }
  > .ai1ec-table-responsive {
    border: 0;
    margin-bottom: 0;
  }
}


// Optional heading
.ai1ec-panel-heading {
  padding: 10px 15px;
  border-bottom: 1px solid transparent;
  .ai1ec-border-top-radius(@panel-border-radius - 1);

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

// Within heading, strip any `h*` tag of it's default margins for spacing.
.ai1ec-panel-title {
  margin-top: 0;
  margin-bottom: 0;
  font-size: ceil((@font-size-base * 1.125));
  color: inherit;

  > a {
    color: inherit;
  }
}

// Optional footer (stays gray in every modifier class)
.ai1ec-panel-footer {
  padding: 10px 15px;
  background-color: @panel-footer-bg;
  border-top: 1px solid @panel-inner-border;
  .ai1ec-border-bottom-radius(@panel-border-radius - 1);
}


// Collapsable panels (aka, accordion)
//
// Wrap a series of panels in `.ai1ec-panel-group` to turn them into an accordion with
// the help of our collapse JavaScript plugin.

.ai1ec-panel-group {
  // Tighten up margin so it's only between panels
  .ai1ec-panel {
    margin-bottom: 0;
    border-radius: @panel-border-radius;
    overflow: hidden; // crop contents when collapsed
    + .ai1ec-panel {
      margin-top: 5px;
    }
  }

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


// Contextual variations
.ai1ec-panel-default {
  .ai1ec-panel-variant(@panel-default-border; @panel-default-text; @panel-default-heading-bg; @panel-default-border);
}
.ai1ec-panel-primary {
  .ai1ec-panel-variant(@panel-primary-border; @panel-primary-text; @panel-primary-heading-bg; @panel-primary-border);
}
.ai1ec-panel-success {
  .ai1ec-panel-variant(@panel-success-border; @panel-success-text; @panel-success-heading-bg; @panel-success-border);
}
.ai1ec-panel-warning {
  .ai1ec-panel-variant(@panel-warning-border; @panel-warning-text; @panel-warning-heading-bg; @panel-warning-border);
}
.ai1ec-panel-danger {
  .ai1ec-panel-variant(@panel-danger-border; @panel-danger-text; @panel-danger-heading-bg; @panel-danger-border);
}
.ai1ec-panel-info {
  .ai1ec-panel-variant(@panel-info-border; @panel-info-text; @panel-info-heading-bg; @panel-info-border);
}
