div#main-content-wrapper {
	z-index: 1;
	max-width: 100%;
}

#document #corps, #page {
	z-index: 0;

	#messages {
		padding: $block-padding;
		margin: $messages-block-margin;
		max-width: $width;
		font-weight: 600;
		letter-spacing: 0.025em;
	}

	// override .errornotice (includes/misc)
	%custom-error-notice {
		@extend .errornotice;
		&::before {
			font-size: 30px;
		}
	}

	// error warnings (WCS)
	div.widget div.content div.error {
		@extend %custom-error-notice;
		margin-top: 0;
	}

	#messages li,
	div.infonotice,
	div.successnotice,
	div.warningnotice,
	div.errornotice {
		@extend %custom-error-notice;
	}

	// override includes/_forms.scss
	.fargo-pick-popup button,
	button.ui-button,
	a#a2-continue,
	div#content button,
	input[type=submit],
	div.buttons input {
		@extend %button-style;
	}

	// override includes/_wcs.scss
	ul#evolutions {
		li span.item {
			/* left circle icon */
			background: $button-background !important;
			border-color: $button-background;
			color: $secondary-color !important;
		}

		div.evolution-metadata, li div.msg {
			background: $cell-background;
		}
	}

	// override fc.css
	div#fc-button a.button div {
		height: auto;
	}

	#main-content-wrapper {
		z-index: 1;
		max-width: 100%;
	}

	> nav {
		display: flex;
		align-items: center;
		justify-content: center;
		// flexbug https://github.com/philipwalton/flexbugs#flexbug-2
		max-width: 100%;
		background-color: $cell-background;
		font-size: 1.5rem;
		@media screen and ($max-mobile-viewport) {
			flex-direction: column;
		}

		> div {
			@media screen and ($max-mobile-viewport) {
				margin: $inner-nav-margin;
			}
		}

		div#nav {
			order: 0;
			flex-basis: 50%;
			background-color: transparent;
			height: unset;

			@media screen and ($max-mobile-viewport) {
				flex-basis: auto;
				width: 100%;

				> ul {
					display: flex;
					justify-content: space-around;
					align-items: center;
					// flexbug https://github.com/philipwalton/flexbugs#flexbug-2
					max-width: 100%;

					> li {
						flex-wrap: wrap;
						a {
							line-height: 1em;
						}
					}

					ul {
						display: none;
					}
				}
			}
			// first-level menu
			ul:first-child {
				display: flex;
				justify-content: center;
				flex-wrap: wrap;
				height: unset;
				li {
					flex-grow: 0;
				}
			}

			ul {
				li {
					font-weight: 700;
					a {
						color: $font-color;
						line-height: 2.7em;
						padding: 0 0.7em;
					}

					&.selected,
					&:hover {
						> a {
							color: $primary-color;
						}
					}
				}
			}
		}
		// User authentication block
		.user-nav {
			flex-basis: 50%;
			order: 1;

			@media screen and ($max-mobile-viewport) {
				flex-basis: $nav-height;
				margin: 0;
				width: 100%;

				a {
					height: auto;
					transition: background 0.5s, color 0.5s;
				}
				span.connected-user {
					padding: 0;
				}
			}

			span.login, span.logged-in {
				display: flex;
				flex-direction: row;
				align-items: center;
				justify-content: center;
				// flexbug https://github.com/philipwalton/flexbugs#flexbug-2
				max-width: 100%;
				padding: 0.5em;
				height: 100%;

				a {
					font-weight: 700;
					color: $font-color;
					height: auto;

					&.selected,
					&:hover {
						color: $primary-color;
						text-decoration: none;
					}
				}
				a.registration, span.sep, a.logout {
					padding-left: 1em;
				}
			}
			height: $nav-height;
			margin: $custom-nav-margin;
		}
	}
}

div#content {
	max-width: $width;
	margin: $content-block-margin;
	padding: $block-padding;

	#gauche,
	div#rub_service,
	div#services > ul > li,
	div.a2-block,
	div.a2-continue,
	div.block,
	div.cell {
		padding: $block-padding;
		background-color: $cell-background;
		margin: $inner-div-margin;
	}

	// override default _cells
	div#sidebar + div#columns > div.a2-block,
	div#login-page.methods2 > div.block {
		margin: $inner-div-margin;
	}

	div#sidebar + div#columns {
		#frontend-registration-email {
			float: left;
			max-width: calc(50% - 1em);
		}
		#frontend-registration-fc {
			float: right;
			max-width: calc(50% - 1em);
		}
	}

	div#gauche + div#rub_service {
		width: calc(79% - 1em);
	}

	#side {
		text-align: center;
	}

	form {
		margin: $form-margin;
		padding: $title-padding;
		background-color: $form-background;
		border: 0;

		.title label {
			display: block;
			margin-bottom: 0.3em;
			font-weight: 400;
			color: #B73720;
		}

		input#tracking-code,
		input[type="tel"],
		input[type="url"],
		input[type="date"],
		input[type="file"],
		input[type="text"],
		input[type="email"],
		input[type="number"],
		input[type="search"],
		input[type="password"],
		textarea,
		select {
			@include vendor-prefix(appearance, none);
			width: 100%;
			max-width: 70rem;
			background-color: #FFFFFF;
			font-family: $font-family;
			font-size: 1.5rem;
			padding: 0.8em 1em;
			line-height: normal;
			font-weight: 600;
			border: 1px solid transparent;
			border-radius: 5px;
			vertical-align: middle;

			&:focus {
				border-color: #AAA;
			}
		}

		h3, h4 {
			font-family: $font-family;
			font-weight: 400;

			&::before {
				color: $primary-color;
			}
		}

		h3 {
			font-size: 2.2rem;
		}

	}

	h1,
	h2,
	h3 {
		@extend %title-style;
	}

	h2 {
		font-size: 2.5rem;
	}

	h3 {
		font-size: 1.6rem;
	}

	div.buttons.submit {
		display: flex;
		justify-content: flex-start;
		flex-direction: row-reverse;
		flex-wrap: wrap;

		.cancel,
		[name="previous"] {
			background: $cell-background;
		}
	}

	button {
		@extend %button-style;
	}

	#tracking-code {
		h1,
		h2,
		h3 {
			padding: 0 5px;
			margin: $tracking-title-margin;
			line-height: normal;
		}
		a {
			padding: 0.5ex 0;
		}
	}

	input,
	textarea {
		@media screen and ($max-mobile-viewport) {
			max-width: 100%;
		}
	}

	div.cell.wcsformsofcategorycell {

		background-color: $category-title-background;
		border-color: $category-title-background;

		&.toggled {
			h2:first-child {
				color: $title-color;
				background-color: $category-title-background;
			}

			ul {
				background-color: $title-background;
				color: $title-color;
				padding: 0;

				li {
					a {
						padding: 1rem;
						color: $title-color;
					}
					a:hover {
						color: $title-color;
						background-color: $button-hover-background;
					}
				}
			}
		}

		h2:first-child {
			@extend %title-style;
			display: inline-block;
			padding-right: 1.5em;
			font-size: 1.6rem;
			color: $title-color;
			background-color: $category-title-background;
			text-transform: none;
			border: none;
			background-repeat: no-repeat;
			background-position: top left;
			padding-left: 140px;
			min-height: 95px;
			letter-spacing: 0.025em;
			line-height: 1.25;
			font-weight: 600;
			transition: all 0.3s;

			&:hover {
				background-color: $cell-entry-hover-background;
			}

			&::before {
				content: $minus-icon;
				font-family: FontAwesome;
				font-size: 0.9rem;
				position: relative;
				margin-bottom: 0.2em;
				-webkit-font-smoothing: antialiased;
				color: $primary-color;
			}

			&::after {
				content: $arrow-down-icon;
				font-family: FontAwesome;
				font-size: 10px;
				position: absolute;
				right: 1em;
				top: 1em;
				vertical-align: middle;
			}

			&.on {
				&::after {
					content: $arrow-up-icon;
				}
			}
		}

		@each $category in $category-slugs {
			@if $category-has-toggled-icons {
				&.#{$category} h2:first-child { background-image: url(img/icon-rouge/#{$category}.png), url(img/icon-rouge/#{$category}-on.png); }
				&.#{$category}.#{$_category_selector_class} h2:first-child { background-image: url(img/icon-rouge/#{$category}-on.png); }
				&.bleu {
					&.#{$category} h2:first-child { background-image: url(img/icon-bleu/#{$category}.png), url(img/icon-bleu/#{$category}-on.png); }
					&.#{$category}.#{$_category_selector_class} h2:first-child { background-image: url(img/icon-bleu/#{$category}-on.png); }
				 }
			} @else {
				&.#{$category} h2:first-child { background-image: url(img/icon-rouge/#{$category}.png); }
				&.bleu.#{$category} h2:first-child { background-image: url(img/icon-bleu/#{$category}.png); }
			}
		}
	}
}

div.ui-dialog {

	div.ui-dialog-titlebar span.ui-dialog-title {
		@extend %title-style;
		font-size: 2.5rem;
	}

	button {
		@extend %button-style;

		&.ui-button {
			height: 5.5em;
		}
	}
}

@media screen and ($max-mobile-viewport) {
	div#content {
		padding: $mobile-block-padding;

		div#columns {
			flex-direction: column;
			padding: $mobile-block-padding;

			> div {
				padding: 0.1em;
			}
			div#gauche, div#rub_service {
				width: calc(100% - 1em);
			}

			#frontend-registration-fc, #frontend-registration-email {
				float: none;
				max-width: 100%;
			}

		}
	}
}
