@font-face {
	font-family: Klarna;
	font-weight: 300;
	src: url("../fonts/KlarnaText-Regular.otf") format("opentype");
}

@font-face {
	font-family: KlarnaHeadline;
	font-weight: bold;
	src: url("../fonts/KlarnaText-Bold.otf") format("opentype");
}

/** New Settings page styling */

/** Start kp_settings__section */
.kp_settings__section {
	display: grid;
	align-items: start;
	grid-template-columns: 1fr;
	grid-template-rows: min-content auto;
	gap: 40px;
}

.woocommerce .kp_settings__section {
	font-family: Klarna;
	margin-top: 40px;
}

.woocommerce .kp_settings__section table.form-table tr {
	display: flex;
	flex-direction: column;
	padding-left: 20px;
	padding-right: 20px;
	padding-top: 20px;
}

div.kp_settings__section_content {
	background: white;
	border: 1px solid #e5e5e5;
	padding: 20px;
	width: calc( 100% - 40px );
	position: relative;
}

span.kp_settings__section_toggle {
	cursor: pointer;
}

.kp_settings__section_info, .kp_settings__section_preview {
	align-self: start;
	grid-row: 1;
}

.kp_settings__section_preview {
	width: 400px;
}

.woocommerce .kp_settings__section table.form-table tr th, .woocommerce .kp_settings__section table.form-table tr td {
	width: 100%;
	padding: 0;
	font-size: 14px;
	font-weight: normal;
}

.woocommerce .kp_settings__section table.form-table tr th {
	padding-bottom: 10px;
	font-weight: 600;
}

.woocommerce .kp_settings__section table.form-table input:not([type="checkbox"]):not(.select2-search__field), .woocommerce .kp_settings__section table.form-table select {
	max-width: 100%;
	width: 100%;
	height: 40px;
	margin: 5px;
	padding: 0 10px;
	border: 1px solid #ccc;
}

.woocommerce .kp_settings__section table.form-table input[type="checkbox"] {
	margin-right: 15px;
}

.woocommerce .kp_settings__section table.form-table tr:has(input[type="hidden"]) {
	display: none;
}

.woocommerce .kp_settings__section table.form-table .select2-container {
	width: 100% !important;
	max-width: 100% !important;
	min-width: 100% !important;
}

.kp_settings__section_previews {
	display: none;
}

/** Adapt the layout for bigger screens than mobile. */
@media (min-width: 960px) and (max-width: 1300px) {
	.kp_settings__section {
		grid-template-columns: 1fr 3fr;
	}

	.kp_settings__section_info {
		grid-column: 1;
	}

	div.kp_settings__section_content {
		grid-column: 2;
		margin: auto;
		grid-row: 1 / 3;
	}
}

@media (min-width: 1300px) {
	.kp_settings__section {
		max-width: 1700px;
		grid-template-columns: 1fr 3fr 400px;
	}

	div.kp_settings__section_content {
		grid-column: 2;
		margin: 0 auto;
		grid-row: 1 / 3;
	}

	.kp_settings__section_previews {
		display: block;
		grid-column: 3;
		width: 400px;
	}
}

div.kp_settings__section_content .kp_settings__section_toggle {
	position: absolute;
	top: 20px;
	right: 20px;
	z-index: 999;
}


div.kp_settings__section_content table {
	display: block;
	height: auto;
	max-height: 100%;
	overflow: hidden;
	transition: all 0.15s ease-in-out;
}

.kp_settings__section_previews {
	max-height: 100vh;
}

div.kp_settings__section_content table.kp_settings__section_content_hidden {
	max-height: 50px;
	pointer-events: none; /* Prevent interaction with the gradient */
}

.kp_settings__section_previews.kp_settings__section_content_hidden {
	max-height: 0;
	display: none;
	pointer-events: none; /* Prevent interaction with the gradient */
}

div.kp_settings__section_content .kp_settings__content_gradient {
	display: none;
	position: absolute;
	top: 0;
	left: 0;
	height: 100%;
	width: 100%;
	background: linear-gradient(
		to bottom,
		rgba(255, 255, 255, 0) 0%,
		rgba(255, 255, 255, 1) 75%
	);
	pointer-events: none; /* Prevent interaction with the gradient */
	z-index: 999;
}


.kp_settings__section_title.kp_settings__section_title_hidden {
	display: none;
}

.kp_settings__section_previews .kp_settings_section_preview {
	display: flex;
	flex-direction: column;
	align-items: center;
	background-color: white;
	padding: 0 1em 1em 1em;
}

.kp_settings__section_previews .kp_settings_section_preview:not(:first-child) {
	margin-top: 20px;
}

.kp_settings_section_preview .kp_settings__preview_title {
	font-family: KlarnaHeadline;
	font-size: 14px;
}

/** End kp_settings__section */

/** Start kp_settings__text_info */
.woocommerce .kp_settings__text_info h4 {
	font-family: KlarnaHeadline;
	margin: 0;
}

/** End kp_settings__text_info */

/** Start WooCommerce settings overrides */
.kp_settings__field input:not(.select2-search__field),
.kp_settings__field select {
	max-width: 100%;
	width: 100%;
	height: 40px;
	padding: 0 10px;
	border: 1px solid #ccc;
}

.kp_settings__field p.kp_settings__field_description,
.kp_settings__field label {
	font-family: KlarnaHeadline;
	margin: 0;
	font-size: 14px;
}

.kp_settings__header {
	font-family: Klarna;
	display: flex;
	gap: 20px;
	margin-bottom: 20px;
}

.kp_settings__header h1.kp_settings__header_title {
	font-family: KlarnaHeadline;
	margin: 0;
	padding: 0;
}

.kp_settings__header_logo {
	width: 75px;
	height: 75px;
	border: 1px solid transparent;
	border-radius: 10px;
}

.kp_settings__header_description {
	margin: 5px 0 0 0;
}

.kp_settings__header_links {
	display: flex;
	flex-direction: row;
	gap: 5px;
	margin: 0;
}

.woocommerce .kp_settings__section table.form-table tr:has(td fieldset input.kp_settings__credentials_field) {
	padding-top: 0;
}

.woocommerce .kp_settings__section table.form-table tr:has(td fieldset input.kp_settings__credentials_field[type="text"]:not(.kp_settings__credentials_field_client_id)) {
	float: left;
	/** Calculate the width so there is always a 10px gap between the two rows */
	width: calc(50% - 25px);
	padding-right: 0;
}

.woocommerce .kp_settings__section table.form-table tr:has(td fieldset input.kp_settings__credentials_field[type="password"]) {
	float: right;
	/** Calculate the width so there is always a 10px gap between the two rows */
	width: calc(50% - 25px);
	padding-left: 0;
}

.woocommerce .kp_settings__section table.form-table tr:has(td fieldset input.kp_settings__credentials_field[type="password"])::after {
	clear: both;
	content: ".";
	visibility: hidden;
	height: 0;
	display: block;
}

.kp_settings__credentials {
	clear:both
}

.woocommerce table.form-table .kp_settings__credentials td fieldset {
	margin-top: 0;
}

.woocommerce div.kp_settings__section_content tbody:last-child tr:last-child td {
	margin-bottom: 20px;
}

/** Label for credentials fields start */
.kp_settings__credentials fieldset {
	position: relative;
}

.woocommerce table.form-table tr th label {
	display: inline-block;
}
.woocommerce table.form-table tr th label .woocommerce-help-tip, .wc-wp-version-gte-53 .woocommerce table.form-table tr th label .woocommerce-help-tip {
	margin: -2px 0 0 0;
	position: relative;
}

.woocommerce div.kp_settings__section_content tr:has(td fieldset input.kp_settings__credentials_field) th label {
	font-family: Klarna;
	font-weight: 300;
	position: absolute;
	top: 0;
	left: 10px;
	color: grey;
    transition: all 0.2s;
    opacity: 0.6;
	cursor: text;
	user-select: none;
	display: inline-block;
}

.woocommerce table.form-table tr:has(td fieldset input.kp_settings__credentials_field:placeholder-shown) th label {
	top: 21px;
	font-size: 14px;
}

.woocommerce table.form-table tr:has(td fieldset input.kp_settings__credentials_field:not(:placeholder-shown)) th label,
.woocommerce table.form-table tr:has(td fieldset input.kp_settings__credentials_field:focus) th label {
	top: 5px;
	background: white;
	font-size: 10px;
	padding: 0 4px;
	opacity: 1;
}

/** Label for credentials fields end */

/** Toggle button start */
.woocommerce table.form-table .kp_settings__credentials th label {
	display: flex;
	justify-content: space-between;
	align-items: center;
	cursor: pointer;
}

.woocommerce .kp_settings__section table.form-table tr.kp_settings__credentials td.kp_settings__credentials_field_hidden {
	/*display: none;*/
	max-height: 0;
	transition: max-height 0.15s ease-out;
	overflow: hidden;
}

.woocommerce .kp_settings__section table.form-table tr.kp_settings__credentials td:not(.kp_settings__credentials_field_hidden) {
	max-height: 150px;
	transition: max-height 0.15s ease-in;
	overflow: hidden;
}

.kp_settings__credentials {
	display: grid;
	grid-template-columns: 1fr;
}
.kp_settings__credentials .kp_settings__fields_credentials {
	display: grid;
	grid-template-columns: 1fr 1fr;
}

.kp_settings__credentials .kp_settings__field {
	margin: 0 5px;
	position: relative;
}

.kp_settings__credentials .kp_settings__field label {
	font-family: Klarna;
	font-weight: 300;
	position: absolute;
	top: 0;
	left: 15px;
	color: grey;
    transition: all 0.2s;
    opacity: 0.6;
	cursor: text;
	user-select: none;
	display: inline-block;
}

.kp_settings__credentials .kp_settings__field:has(input:placeholder-shown) label {
	top: 17px;
	font-size: 14px;
}

.kp_settings__credentials .kp_settings__field:has(input:not(:placeholder-shown)) label,
.kp_settings__credentials .kp_settings__field:has(input:focus) label {
	top: 0;
	background: white;
	font-size: 10px;
	padding: 0 4px;
	opacity: 1;
}

.kp_settings__section.unavailable {
	display: none;
}

.kp_settings__mode_badge {
	background-color: #e3e5e9;
	border: solid 1px #1d2327;
	color: #1d2327;
	border-radius: 20px;
	padding: 5px 10px;
	font-size: 12px;
	font-weight: 700;
	white-space: nowrap;
}

.kp_settings__mode_badge.active {
	background-color: #92ffaf;
	border-color: #92ffaf;
}

#klarna_payments_select_all_countries {
	cursor: pointer;
	display: flex;
	justify-content: center;
	margin-bottom: 10px;
	padding: 0 10px;
}

#klarna_payments_select_all_countries.active, #klarna_payments_select_all_countries:hover {
	background-color: #007cba;
	color: #fff;
}

#klarna_payments_select_all_countries span {
	width: calc(100% - 2px);
	height: 100%;
	border-bottom: solid 1px #dcdcde;
	display: block;
	padding: 10px 0;
}

#klarna_payments_select_all_countries.active span, #klarna_payments_select_all_countries:hover span {
	border-color: #007cba;
}

.kp_settings__section_title {
	display: flex;
	flex-wrap: nowrap;
	align-items: center;
	gap: 5px;
}

.woocommerce .kp_settings__section table.form-table tr.kp_settings__send_shopping_data + tr {
	padding-top: 0;
}

.kp_settings__send_shopping_data + tr .titledesc {
	display: none;
}
