// Painel do Sementes montado pelo Redux Framework (Painel, Relatórios,
// Análises e Configurações).
@use '../abstracts' as *;

#{$panel} {
	// Botões e barras do Redux que o Sementes não usa
	.redux-action_bar {
		#redux-defaults-section-top,
		#redux-defaults-top,
		#redux-defaults-section-bottom,
		#redux-defaults-bottom {
			display: none;
		}
	}

	.redux-main {
		#info_bar .expand_options,
		#redux-sticky {
			display: none;
		}

		.redux-container-switch .cb-disable.selected {
			background-image: linear-gradient(to bottom, #008bce, #0073aa) !important;
		}
	}

	.redux-group-tab {
		overflow-x: auto;
	}

	fieldset[id*=report] .select2-selection__placeholder {
		color: #444;
	}

	// A barra lateral mostra só o grupo aberto: Relatórios (seção 2) ou Análises (seção 10)
	.redux-sidebar .redux-group-menu {
		.redux-group-tab-link-li {
			display: none;
		}

		@each $group in ('\\32', '\\31 0') {
			##{$group}_section_group_li {
				&.active,
				&.activeChild,
				&.active li,
				&.activeChild li {
					display: block;
				}
			}
		}
	}
}

// Sem o rodapé "Salvar" nas seções que não têm o que salvar (Painel, relatórios e análises)
@each $section in ('\\31', '\\32', '\\33', '\\34', '\\35', '\\36', '\\37', '\\38', '\\39', '\\31 0', '\\31 1', '\\31 2', '\\31 3') {
	##{$section}_section_group[style="display: block;"] ~ #redux-footer-sticky #redux-footer {
		display: none;
	}
}

#redux-header {
	background: $sementes-green !important;
}

#\31_section_group > h2 {
	font-size: 2em;
}

fieldset.redux-field-container .select2 .select2-selection button span {
	display: none;
}

.hidden-redux-input {
	display: none;
}

#adminmenu .toplevel_page_eitagcr_panel .wp-menu-image img {
	opacity: 0.8;
}

#toplevel_page_eitagcr_panel img {
	width: 20px;
}

/*
 * Celular. Abaixo de 782px o próprio Redux mostra todas as seções empilhadas
 * (Painel, os 7 relatórios, análises e configurações numa página só) e,
 * abaixo de 600px, esconde o nome das abas. Aqui só a seção aberta aparece e a
 * barra lateral vira uma faixa de abas, como as abas de configurações do
 * WooCommerce (.nav-tab). Os !important vencem o esquema de cores do Redux.
 */
@include respond-below(tablet) {
	#{$panel} {
		// O Redux põe display:block inline na seção aberta
		.redux-container .redux-group-tab {
			display: none;
		}

		.redux-container #redux-header {
			padding: 12px 16px;

			.display_header,
			h2 {
				float: none;
				margin: 0;
				text-align: left;
			}

			h2 {
				font-size: 15px;
				line-height: 1.4;
			}
		}

		.redux-sidebar {
			float: none;
			width: 100% !important;
			height: auto !important;
			min-height: 0 !important;
			margin: 0 !important;
			background: $wp-bg !important;
			border-bottom: 1px solid $wp-border;
		}

		// .redux-container e li: especificidade para vencer o esquema de cores do Redux
		.redux-container .redux-sidebar .redux-group-menu {
			@include scroll-x;
			display: flex;
			height: auto !important;
			margin: 0;
			padding: 8px 8px 0;
			background: transparent !important;

			li.redux-group-tab-link-li {
				flex: 0 0 auto;
				margin: 0;
			}

			// O grupo (Relatórios/Análises) some e as subseções viram as abas
			li.hasSubSections,
			ul.subsection {
				display: contents !important;
			}

			li.hasSubSections > a {
				display: none !important;
			}

			li a.redux-group-tab-link-a {
				display: block;
				width: auto !important;
				margin-right: 4px;
				padding: 10px 12px;
				border: 1px solid $wp-border !important;
				border-bottom: 0 !important;
				background: $wp-tab-bg !important;
				color: $wp-text !important;
				font-size: 13px;
				font-weight: 600;
				line-height: 1.4;
				white-space: nowrap;
				box-shadow: none;

				i,
				&::after {
					display: none !important;
				}

				// O Redux esconde o nome e mostra só o ícone abaixo de 600px
				span.group_title {
					display: inline !important;
					position: static !important;
					width: auto !important;
					padding: 0 !important;
					background: none !important;
					border: 0 !important;
					box-shadow: none !important;
					color: inherit !important;
				}
			}

			li.active > a.redux-group-tab-link-a {
				position: relative;
				top: 1px;
				background: $wp-white !important;
				border-bottom: 1px solid $wp-white !important;

				&,
				span.group_title {
					color: $wp-text !important;
				}
			}
		}

		.redux-main {
			margin-left: 0 !important;
			padding: 12px !important;
			border-left: 0;

			// O Redux deixa th/td com width:100% e padding, sem border-box
			.form-table > tbody > tr > th,
			.form-table > tbody > tr > td {
				box-sizing: border-box;
			}

			.redux-field-container {
				max-width: 100%;
			}

			// O Redux põe style="width:40%" nos selects
			.select2-container {
				width: 100% !important;
				max-width: 100%;
			}

			// O WP transforma .form-table td em bloco no celular. As tabelas dos
			// relatórios e análises estão dentro de uma .form-table e precisam
			// continuar sendo tabelas.
			.redux-container-raw table {
				tr {
					display: table-row !important;
				}

				td,
				th {
					display: table-cell !important;
				}
			}

			.redux-group-tab > h2 {
				font-size: 1.3em;
				margin-top: 4px;
			}
		}
	}
}
