/*!
 * This file is part of the Semantic MediaWiki Extension
 * @see https://semantic-mediawiki.org/
 *
 * @section LICENSE
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
 *
 * @see https://codepen.io/oknoblich/pen/tfjFl
 * @since 3.0
 *
 * @file
 * @ingroup SMW
 *
 * @licence GNU GPL v2+
 * @author mwjames
 */

@import 'tokens.less';

.smw-tabs {
	margin-top: 10px;
	clear: both;

	@media ( max-width: @max-width-breakpoint-mobile ) {
		display: flex;
		flex-direction: column;
	}

	section,
	.subtab-content {
		display: none;
		padding: 0;
		border-top: @border-base;
	}

	label.nav-label {
		display: inline-block;
		color: @color-base;
		padding: @spacing-25 @spacing-75;
		font-size: @font-size-medium;
		font-weight: @font-weight-bold;
		line-height: @line-height-small;
		white-space: nowrap;
		user-select: none;
		transition-property: @transition-property-base;
		transition-duration: @transition-duration-base;

		@media ( max-width: @max-width-breakpoint-mobile ) {
			box-shadow: inset 0 -1px 0 0 @border-color-subtle;
		}

		.smw-tab-icon {
			display: inline-block;
			min-width: @min-size-icon-small;
			min-height: @min-size-icon-small; 
			opacity: @opacity-icon-base;
			vertical-align: text-top;
			margin-right: @spacing-25;
		}

		&::before {
			margin-right: @spacing-25;
			font-weight: normal;
		}

		&[for*='1'],
		&[for*='2'],
		&[for*='3'],
		&[for*='4'] {
			&::before {
				content: '';
			}
		}

		&:hover {
			color: @color-progressive--hover;
			cursor: pointer;
			box-shadow: @box-shadow-inset-medium-vertical @box-shadow-color-progressive-selected--hover;

			.smw-tab-icon {
				opacity: @opacity-icon-base--hover;
			}
		}

		&:active {
			color: @color-progressive--active;
			box-shadow: @box-shadow-inset-medium-vertical @box-shadow-color-progressive-selected--active;

			.smw-tab-icon {
				opacity: @opacity-icon-base--selected;
			}
		}
	}

	input.nav-tab {
		display: none;

		&:checked + label.nav-label {
			color: @color-progressive;
			box-shadow: @box-shadow-inset-medium-vertical @box-shadow-color-progressive-selected;

			&.cached {
				box-shadow: @box-shadow-inset-medium-vertical orange;
			}

			.smw-tab-icon {
				opacity: @opacity-icon-base--selected;
			}
		}
	}
}

/**
 * Requires to be adjusted by each set that uses the rules
 * to assign a tab to a content section.
 */
#tab-setup:checked ~ #tab-content-setup,
#tab2:checked ~ #content2,
#tab3:checked ~ #content3,
#tab4:checked ~ #content4 {
	display: block;
}

/**
 * https://codepen.io/markcaron/pen/MvGRYV
 */
.smw-tabset > input[type="radio"] {
	position: absolute;
	left: -200vw;
}

.smw-tabset > input[type="checkbox"] {
	display: none;
}

.smw-tabset .tab-panel {
	display: none;
}

.smw-tabset > input:first-child:checked ~ .tab-panels > .tab-panel:first-child,
.smw-tabset > input:nth-child(3):checked ~ .tab-panels > .tab-panel:nth-child(2),
.smw-tabset > input:nth-child(5):checked ~ .tab-panels > .tab-panel:nth-child(3),
.smw-tabset > input:nth-child(7):checked ~ .tab-panels > .tab-panel:nth-child(4),
.smw-tabset > input:nth-child(9):checked ~ .tab-panels > .tab-panel:nth-child(5),
.smw-tabset > input:nth-child(11):checked ~ .tab-panels > .tab-panel:nth-child(6) {
	display: block;
}

.smw-tabset > label {
	position: relative;
	display: inline-block;
	padding: 15px 15px 25px;
	border: 1px solid transparent;
	border-bottom: 0;
	cursor: pointer;
	font-weight: 300;
	color: #8d8d8d;
	margin-bottom: 0px;
}

.smw-tabset > label::after {
	content: "";
	position: absolute;
	left: 15px;
	bottom: 10px;
	width: 22px;
	height: 4px;
	background: #8d8d8d;
}

.smw-tabset > input:focus + label,
.smw-tabset > input:checked + label {
	color: #06c;
}

.smw-tabset > input:focus + label::after,
.smw-tabset > input:checked + label::after {
	background: #06c;
}

.smw-tabset > input:focus + label.smw-indicator-severity-error::after,
.smw-tabset > input:checked + label.smw-indicator-severity-error::after {
	background: #d33;
}

.smw-tabset > input:focus + label.smw-indicator-severity-warning::after,
.smw-tabset > input:checked + label.smw-indicator-severity-warning::after {
	background: #ffa500;
}

.smw-tabset > label:hover {
	color: #444;
}

.smw-tabset > label:hover::after {
	background: #444;
}

.smw-tabset > input:checked + label {
	border-color: #ccc;
	border-bottom: 1px solid #fff;
	margin-bottom: -1px;
	border-top: 2px solid #06c;
}

.smw-tabset > input:checked + label.smw-indicator-severity-error {
	border-top: 2px solid #d33;
	color: #d33;
}

.smw-tabset > input:checked + label.smw-indicator-severity-warning {
	border-top: 2px solid #ffa500;
	color: #ffa500;
}

.tab-panel {
	padding: 30px 0;
	border-top: 1px solid #ccc;
}

.smw-issue-panel > label {
	padding: 2px 5px 5px;
}

.smw-issue-panel > input + label {
	margin-left: 5px;
}

.smw-issue-panel > label::after {
	left: 5px;
	bottom: 3px;
	width: 12px;
	height: 2px;
	background: #8d8d8d;
}

.smw-issue-panel .tab-panel {
	padding: 0 10px 10px 10px;
	overflow-y: auto;
	overflow-x: hidden;
	max-height: 280px;
}

.smw-issue-panel .tab-panel:after2 {
	content: "";
	display: block;
	height: 10px;
	width: 100%;
}
