//
// Panels
// --------------------------------------------------

.panel {
  margin-bottom: @line-height-computed;
  background-color: @panel-bg;
}

// Panel contents
// ----------------
.panel-body {
  padding: @panel-padding;
  border-left: 1px solid @panel-default-border;
  border-right: 1px solid @panel-default-border;
  &:extend(.clearfix all);
}
.panel-body:last-child {
  border-bottom: 1px solid @panel-default-border;
  .border-bottom-radius(@panel-border-radius);
}

// Panel Heading
// ----------------
.panel-heading {
	position: relative;
	padding: @panel-heading-padding-vertical @panel-padding;
	border: 1px solid transparent;
	.border-top-radius(@panel-border-radius);
	
	> .dropdown .dropdown-toggle {
		color: inherit;
	}
}

// Within heading, strip any `h*` tag of its default margins for spacing.
// Changes: Removed .panel-title class - by nienn
.panel-heading {
	h1, h2, h3, h4, h5, h6 {
		margin-top: 0;
		margin-bottom: 0;
		color: inherit;
		> a,
		> a:hover,
		> a:focus {
			color: inherit;
			text-decoration: none;
		}
	}
	h1 { font-size: @font-size-base + 10; }
	h2 { font-size: @font-size-base + 7; }
	h3 { font-size: @font-size-base + 4; }
	h4 { font-size: @font-size-base + 2; }
	h5 { font-size: @font-size-base; }
	h6 { font-size: @font-size-base - 1; }
	
	p, ul, ol {
		font-size: 85%;
		margin-top: 6px;
		margin-bottom: 0;
		> a,
		> a:hover,
		> a:focus {
			color: inherit;
			text-decoration: underline;
		}
	}
}

// Panel Options - by nienn
// ----------------
.panel-heading .panel-options {
	position: absolute;
	bottom: @panel-heading-padding-vertical + 1;
	right: @panel-padding;
}
h1, h2, h3, h4, h5, h6 {// give it the same line-height if there's a header before
	+ .panel-options {
		line-height: @headings-line-height;
	}
}
.panel-heading .panel-options .text,
.panel-heading .panel-options > a {
	display: inline-block;
	margin-left: 2px;
	color: fade(@panel-default-text, 60%);
}
.panel-heading .panel-options > a {
	cursor: pointer;
}
.panel-heading .panel-options > a.bg {
	padding: 1px;
	margin-top: -1px;
	margin-bottom: -1px;
	background-color: fade(@gray-darker, 8%);
	border-radius: @border-radius-small;
	.transition(background-color .1s);
	&:hover {
		background-color: transparent;
	}
}


// Panel Footer (stays gray in every modifier class)
// ----------------
.panel-footer {
  padding: @panel-footer-padding-vertical @panel-padding;
  background-color: @panel-footer-bg;
  border: 1px solid @panel-default-border;
  border-top-color: @panel-inner-border;
  .border-bottom-radius((@panel-border-radius - 1));
}

// Panel with Collapse
// ----------------
.panel-collapse > .panel-body,
.panel-collapse > .panel-footer {
  border-bottom-width: 0;
}
.panel-collapse.in,
.panel-collapse.collapsing {
  border-bottom: 1px solid @panel-default-border;
  .border-bottom-radius(@panel-border-radius);
}

// 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.
// ----------------

.panel {
  > .list-group,
  > .panel-collapse > .list-group {
    margin-bottom: 0;

    .list-group-item {
      border-radius: 0;
    }

    // Add border top radius for first one
    &:first-child {
      .list-group-item:first-child {
        border-top: 0;
        .border-top-radius((@panel-border-radius - 1));
      }
    }
    // Add border bottom radius for last one
    &:last-child {
      .list-group-item:last-child {
        .border-bottom-radius((@panel-border-radius - 1));
      }
    }
  }
}

> .panel-collapse > .list-group:last-child .list-group-item:last-child {
  border-bottom-width: 0;
}

// Collapse space between when there's no additional content.
.panel-heading + .list-group {
  .list-group-item:first-child {
    border-top-width: 0;
  }
}
.list-group + .panel-footer {
  border-top-width: 0;
}

// Tables in panels
// Place a non-bordered `.table` within a panel (not within a `.panel-body`) and
// watch it go full width.
// ----------------

.panel {
  > .table,
  > .table-responsive > .table,
  > .panel-collapse > .table {
    margin-bottom: 0;
	border: 1px solid @panel-default-border;

    caption {
      padding-left: @panel-padding;
      padding-right: @panel-padding;
    }
  }
  > .panel-collapse > .table {
	  border-bottom-width: 0;
  }
  .panel-heading + .table,
  .panel-collapse > .table:first-child {
	  border-top-width: 0;
  }
  > .table > tbody:first-child > tr:first-child th,
  > .table > tbody:first-child > tr:first-child td {
    border-top: 0;
  }
  // Add border top radius for first one
  > .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 {
        border-top-left-radius: (@panel-border-radius - 1);
        border-top-right-radius: (@panel-border-radius - 1);

        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);
        }
      }
    }
  }
  // Add border bottom radius for last one
  > .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 {
        border-bottom-left-radius: (@panel-border-radius - 1);
        border-bottom-right-radius: (@panel-border-radius - 1);

        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);
        }
      }
    }
  }
}


// Collapsable panels (aka, accordion)
// Wrap a series of panels in `.panel-group` to turn them into an accordion with
// the help of our collapse JavaScript plugin.
// ----------------

.panel-group {
	margin-bottom: @line-height-computed;
	
	.panel {
		margin-bottom: 0;
		border-radius: @panel-border-radius;// Pass border-radius here so we can hide corners from inner elements
		overflow: hidden;
	}
	.panel + .panel {
		margin-top: 2px;
	}
	
	.panel-heading,
	.panel-body,
	.panel-footer,
	.panel-collapse.in,
	.panel-collapse.collapsing {
		border-radius: 0;
	}
	.panel:first-child {
		.panel-heading {
			.border-top-radius(@panel-border-radius);
		}
	}
	.panel:last-child {
		.panel-heading,
		.panel-collapse.in,
		.panel-collapse.collapsing {
			.border-bottom-radius(@panel-border-radius);
		}
		.panel-body:last-child,
		.panel-footer, {
			.border-bottom-radius(@panel-border-radius - 1);
		}
	}
}


// Contextual variations
// ----------------
.panel-default {
	.panel-gradient-variant(@panel-default-border; @panel-default-text; @panel-default-heading-bg; @panel-default-border);
}

.panel-success {
	.panel-variant(@panel-success-border; @panel-success-text; @panel-success-heading-bg; @panel-success-border);
}
.panel-info {
	.panel-variant(@panel-info-border; @panel-info-text; @panel-info-heading-bg; @panel-info-border);
}
.panel-warning {
	.panel-variant(@panel-warning-border; @panel-warning-text; @panel-warning-heading-bg; @panel-warning-border);
}
.panel-danger {
	.panel-variant(@panel-danger-border; @panel-danger-text; @panel-danger-heading-bg; @panel-danger-border);
}
.panel-dark {
	.panel-variant(@panel-dark-border; @panel-dark-text; @panel-dark-heading-bg; @panel-dark-border);
}
.panel-light {
	.panel-variant(@panel-default-border; @panel-default-text; @panel-default-heading-bg; @panel-default-border);
}
.panel-white {
	.panel-variant(@panel-default-border; @panel-default-text; #fff; @panel-default-border);
}

.panel-silver {
	.panel-bg-variant(@panel-default-border; @panel-default-text; @panel-default-heading-bg; @panel-default-border);
}


// Size variations
// ----------------
.heading-lg {
	padding-top: @panel-heading-padding-vertical * 2;
	padding-bottom: @panel-heading-padding-vertical * 2;
}


// Group Style variations
// .panel-list displays clean looking list of panels
// -----------------------------------------
.panel-group.panel-list {
	border-top: 1px solid lighten(@gray-light, 7%);
	
	.panel {
		background-color: transparent;
	}
	.panel-heading {
		border-bottom: 2px solid lighten(@gray-light, 7%);
	}
	.panel-body {
		background-color: #fff;
		border-color: transparent;
	}
	.panel-body.in {
		border-bottom-color: lighten(@gray-light, 7%);
	}
	
	
	.panel-heading {
		h2 {
			color: darken(@text-color, 5%);
		}
		&:hover {
			border-bottom-color: @gray-light;
		}
		&:hover h2 {
			color: @text-darker;
		}
		&:hover .panel-options {
			color: @text-dark;
		}
	}

}