:host {
	--wpconsent-z-index: 900000;
	--wpconsent-shadow: rgba(0, 0, 0, 0.19) 0px 10px 20px, rgba(0, 0, 0, 0.23) 0px 6px 6px;
	--wpconsent-border-radius: 10px;
	--wpconsent-padding: 15px 20px;
	--wpconsent-min-width: 526px;
	--wpconsent-mobile-breakpoint: 767px;
	--wpconsent-close-size: 12px;
	--wpconsent-close-color: #454545;
	--wpconsent-title-size: 20px;
	--wpconsent-line-height: 1.4;
	--wpconsent-focus-outline-color: #007cba;
	--wpconsent-focus-outline-width: 2px;
	--wpconsent-focus-outline-offset: 2px;
	--wpconsent-border: var(--wpconsent-text);
	all: initial;
	font-family: inherit;
}

/* Focus styles for better accessibility */
.wpconsent-banner-button:focus,
.wpconsent-banner-close:focus,
input[type="checkbox"]:focus,
#wpconsent-preferences-title:focus {
	outline: var(--wpconsent-focus-outline-width) solid var(--wpconsent-focus-outline-color);
	outline-offset: var(--wpconsent-focus-outline-offset);
}

/* Visual focus indicator when the banner or modal gets focus */
#wpconsent-banner-holder:focus,
#wpconsent-preferences-modal:focus {
	outline: none;
}

/* Hide screen reader only content */
.screen-reader-text {
	border: 0;
	clip: rect(1px, 1px, 1px, 1px);
	clip-path: inset(50%);
	height: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute;
	width: 1px;
	word-wrap: normal !important;
}

.wpconsent-banner-holder {
	position: fixed;
	bottom: 0;
	left: 0;
	right: 0;
	z-index: var(--wpconsent-z-index);
	display: none;

	&.wpconsent-banner-visible {
		display: block;
	}

	.wpconsent-banner {
		box-shadow: var(--wpconsent-shadow);
		max-height: calc(100vh - 20px);
		position: fixed;
		height: auto;
		grid-template-rows: minmax(0, 1fr);
		z-index: var(--wpconsent-z-index);
		border-style: solid;
		padding: var(--wpconsent-padding);
		background: var(--wpconsent-background);
		color: var(--wpconsent-text);
		display: grid;
		grid-gap: 10px;
		min-width: var(--wpconsent-min-width);
		max-width: 100%;
		grid-row-gap: 10px;
		border-width: 0;
		border-radius: var(--wpconsent-border-radius);
		top: initial;
		left: initial;
		right: 10px;
		bottom: 10px;
		transform: initial;
		box-sizing: border-box;

		@media (max-width: 767px) {
			width: 100%;
			min-width: 0;
		}
	}

	&.wpconsent-banner-long {
		.wpconsent-banner {
			left: 0;
			right: 0;
			border-radius: 0;
			box-shadow: none;
			bottom: 0;
			display: flex;
			align-items: center;
			justify-content: center;
			padding: 10px 24px;

			@media (max-width: 767px) {
				flex-direction: column;
				padding: 10px 15px;
			}

			.wpconsent-banner-body {
				margin: 0;
				width: auto;

				@media (max-width: 767px) {
					margin: 10px 0;
					width: 100%;
					max-height: 40vh;
				}
			}

			.wpconsent-banner-footer {
				@media (max-width: 767px) {
					width: 100%;
					flex-direction: column;
					gap: 5px;
				}
			}
		}

		&.wpconsent-banner-long-top {
			.wpconsent-banner {
				top: 0;
				bottom: auto;
			}
		}

		.wpconsent-banner-header {
			display: block;
			padding-right: 24px;
		}

		.wpconsent-powered-by-text {
			display: none;
		}
	}

	&.wpconsent-banner-floating {

		&.wpconsent-banner-floating-left-bottom {
			.wpconsent-banner {
				top: auto;
				left: 10px;
				right: auto;
				bottom: 10px;

				@media (max-width: 767px) {
					left: 0;
					bottom: 0;
				}
			}
		}

		&.wpconsent-banner-floating-right-bottom {
			.wpconsent-banner {
				top: auto;
				left: auto;
				right: 10px;
				bottom: 10px;

				@media (max-width: 767px) {
					right: 0;
					bottom: 0;
				}
			}
		}

		&.wpconsent-banner-floating-left-top {
			.wpconsent-banner {
				top: 10px;
				left: 10px;
				right: auto;
				bottom: auto;

				@media (max-width: 767px) {
					top: 0;
					left: 0;
				}
			}
		}

		&.wpconsent-banner-floating-right-top {
			.wpconsent-banner {
				top: 10px;
				left: auto;
				right: 10px;
				bottom: auto;

				@media (max-width: 767px) {
					top: 0;
					right: 0;
				}
			}
		}

		.wpconsent-banner-footer {
			@media (max-width: 767px) {
				width: 100%;
				flex-direction: column;
				gap: 5px;
			}
		}
	}


	.wpconsent-banner-header {
		grid-template-columns: 100px 1fr 100px;
		align-items: center;
		display: grid;
		grid-column: span 3;
	}

	.wpconsent-banner-close {
		line-height: var(--wpconsent-close-size);
		justify-self: end;
		grid-column-start: 3;
		font-size: var(--wpconsent-close-size);
		cursor: pointer;
		width: var(--wpconsent-close-size);
		height: var(--wpconsent-close-size);
		color: var(--wpconsent-close-color);
		background: none;
		border: none;
		padding: 0;
		position: absolute;
		top: 10px;
		right: 10px;

		svg path {
			stroke: var(--wpconsent-close-color);
		}
	}

	.wpconsent-banner-title {
		justify-self: center;
		grid-column-start: 2;
		font-size: var(--wpconsent-title-size);
		color: var(--wpconsent-text);
		font-weight: 500;
	}

	.wpconsent-banner-body {
		grid-column: span 3;
		overflow-y: hidden;
		overflow-x: hidden;
		max-height: 55vh;
		width: var(--wpconsent-min-width);
		margin-bottom: 5px;
		font-size: var(--wpconsent-font-size);
		line-height: var(--wpconsent-line-height);
		text-align: center;
		padding: 0 10px;

		/** On mobile let's make the width 100% */
		@media (max-width: 767px) {
			width: 100%;
			max-width: 100%;
			padding: 10px 0;
		}

		p {
			font-size: inherit;
			margin-top: 12px;
			margin-bottom: 0;
			color: inherit;
			line-height: var(--wpconsent-line-height);

			&:first-child {
				margin-top: 0;
			}
		}

		a {
			color: inherit;
		}
	}

	.wpconsent-banner-footer {
		display: flex;
		gap: 10px;
		grid-column: span 3;

		&.wpconsent-button-size-large {
			.wpconsent-banner-button {
				height: 60px;
				padding: 10px 20px;
				font-size: 18px;
			}
		}

		&.wpconsent-button-size-small {
			.wpconsent-banner-button {
				height: 30px;
				padding: 5px 10px;
				font-size: 14px;
			}
		}

		&.wpconsent-button-corner-square {
			.wpconsent-banner-button {
				border-radius: 0;
			}
		}

		&.wpconsent-button-corner-rounded {
			.wpconsent-banner-button {
				border-radius: 20px;
			}
		}

		&.wpconsent-button-type-outlined {
			.wpconsent-banner-button {
				background-color: transparent !important;

				&.wpconsent-accept-all {
					border: 2px solid var(--wpconsent-accept-bg);
					color: var(--wpconsent-accept-color);
				}

				&.wpconsent-cancel-all {
					border: 2px solid var(--wpconsent-cancel-bg);
					color: var(--wpconsent-cancel-color);
				}

				&.wpconsent-preferences-all {
					border: 2px solid var(--wpconsent-preferences-bg);
					color: var(--wpconsent-preferences-color);
				}
			}
		}
	}
}

.wpconsent-banner-button {
	height: 45px;
	padding: 10px;
	margin: initial;
	width: 100%;
	white-space: nowrap;
	border-radius: 4px;
	cursor: pointer;
	font-size: 15px;
	font-weight: 500;
	text-decoration: none;
	line-height: 1.2;
	text-align: center;
	flex: initial;
	border: none;
	text-transform: none;

	&.wpconsent-accept-cookies {
		background-color: #30363c;
		color: #fff;
	}

	&.wpconsent-accept-all {
		background-color: var(--wpconsent-accept-bg);
		color: var(--wpconsent-accept-color);
	}

	&.wpconsent-cancel-all {
		background-color: var(--wpconsent-cancel-bg);
		color: var(--wpconsent-cancel-color);
	}

	&.wpconsent-preferences-all {
		background-color: var(--wpconsent-preferences-bg);
		color: var(--wpconsent-preferences-color);
	}
}


.wpconsent-preferences-modal {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background-color: rgba(0, 0, 0, 0.5);
	display: none; /* Hidden by default */
	justify-content: center;
	align-items: center;
	z-index: 10202020;
}

.wpconsent-preferences-content {
	background-color: var(--wpconsent-background);
	padding-left: 26px;
	padding-right: 26px;
	padding-bottom: 26px;
	padding-top: 0;
	border-radius: 10px;
	max-width: 90%;
	width: 800px;
	max-height: 90vh;
	overflow-y: auto;
	box-shadow: var(--wpconsent-shadow);
	display: flex;
	flex-direction: column;
	color: var(--wpconsent-text);
	position: relative;
}

.wpconsent-preferences-content h2 {
	margin: 0;
}

.wpconsent-cookie-categories {
	flex-grow: 1;
	overflow-y: auto;
}


.wpconsent-cookie-item {
	margin-bottom: 10px;
}

.wpconsent-preferences-actions {
	margin-top: 20px;
	display: flex;
	align-items: flex-end;
	justify-content: space-between;

	@media (max-width: 767px) {
		flex-direction: column;
		gap: 10px;

		.wpconsent-powered-by {
			width: 100%;
			text-align: center;
		}
	}
}

.wpconsent-preferences-buttons {
	display: flex;
	justify-content: space-between;
	width: 100%;

	.wpconsent-preferences-buttons-left {
        display: flex;
        gap: 10px;
		padding-right: 10px;
	}

	.wpconsent-banner-button {
		width: auto;

		&.wpconsent-accept-all {
			background-color: var(--wpconsent-accept-bg);
			color: var(--wpconsent-accept-color);
		}

		&.wpconsent-close-preferences {
			background-color: var(--wpconsent-cancel-bg);
			color: var(--wpconsent-cancel-color);
		}

		&.wpconsent-save-preferences {
			background-color: var(--wpconsent-preferences-bg);
			color: var(--wpconsent-preferences-color);
		}
	}

	&.wpconsent-button-size-large {
		.wpconsent-banner-button {
			height: 60px;
			padding: 10px 20px;
			font-size: 18px;
		}
	}

	&.wpconsent-button-size-small {
		.wpconsent-banner-button {
			height: 30px;
			padding: 5px 10px;
			font-size: 14px;
		}
	}

	&.wpconsent-button-corner-square {
		.wpconsent-banner-button {
			border-radius: 0;
		}
	}

	&.wpconsent-button-corner-rounded {
		.wpconsent-banner-button {
			border-radius: 20px;
		}
	}

	&.wpconsent-button-type-outlined {
		.wpconsent-banner-button {
			background-color: transparent !important;

			&.wpconsent-accept-all {
				border: 2px solid var(--wpconsent-accept-bg);
				color: var(--wpconsent-accept-color);
			}

			&.wpconsent-close-preferences {
				border: 2px solid var(--wpconsent-cancel-bg);
				color: var(--wpconsent-cancel-color);
			}

			&.wpconsent-save-preferences {
				border: 2px solid var(--wpconsent-preferences-bg);
				color: var(--wpconsent-preferences-color);
			}
		}
	}
}

.wpconsent-cookie-category-text {
	padding-right: 20px;
	width: 100%;

	label {
		margin-top: 0;
		margin-bottom: 20px;
		font-size: 15px;
		font-weight: 600;
	}

	p {
		margin: 20px 0;
		font-size: 16px;

		a {
			font-size: inherit;
			color: var(--wpconsent-text);
		}
	}
}

.wpconsent-cookie-category {
	display: flex;
	border-bottom: 1px solid var(--wpconsent-outline-color);
	margin: 0 -26px;
	padding: 0 26px;
	cursor: pointer;

	&:first-child {
        border-top: 1px solid var(--wpconsent-outline-color);
    }
}

#wpconsent-preferences-title {
	font-size: 18px;
}

.wpconsent_preferences_panel_description {
	p {
		margin-top: .7em;
		margin-bottom: 20px;
		font-size: 14px;
		line-height: 2em;
		opacity: .8;
	}
}

.wpconsent-preferences-header {
	display: flex;
	justify-content: space-between;
    align-items: center;
	padding-top: 26px;

	.wpconsent-preferences-header-right {
        display: flex;
        gap: 10px;
	}

	.wpconsent-banner-logo {
		margin-right: 20px;
	}

	@media (max-width: 767px) {
		flex-direction: column;
		align-items: flex-start;
		gap: 10px;
		/** Reverse order */
		.wpconsent-preferences-header-right {
			order: 1;
			width: 100%;
			justify-content: space-between;
		}

		h2 {
			order: 2;
		}
	}
}

.wpconsent-preferences-header-close {
	background: none;
	border: none;
	cursor: pointer;
	padding: 0;
	align-items: center;
	height: 30px;
    width: 30px;
    font-size: 20px;
    line-height: 1;
    color: var(--wpconsent-text);
	position: absolute;
	top: 10px;
	right: 10px;
}

.wpconsent-cookie-category-checkbox {
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.wpconsent-always-active {
	color: var(--wpconsent-accept-bg);
	font-size: 15px;
    font-weight: 600;
	white-space: nowrap;
}

.wpconsent-preferences-checkbox-toggle {
	display: inline-block;
	height: 20px;
	position: relative;
	width: 36px;
	will-change: transform;
	transform-origin: left center;

	input {
		opacity: 0;
		height: 100%;
		width: 100%;
		position: absolute;

		&:checked {
			& + .wpconsent-preferences-checkbox-toggle-slider {
				background-color: var(--wpconsent-accept-bg);

				&:before {
					transform: translateX(16px);
					will-change: transform;
				}
			}
		}

		&:focus {
			& + .wpconsent-preferences-checkbox-toggle-slider {
				outline: 1px dotted #212121;
				outline: 1px auto -webkit-focus-ring-color;
			}

			&:not(:focus-visible) {
				& + .wpconsent-preferences-checkbox-toggle-slider {
					outline: none;
				}
			}
		}
	}

	.wpconsent-preferences-checkbox-toggle-slider {
		background-color: #ccc;
		border-radius: 20px;
		bottom: 0;
		cursor: pointer;
		left: 0;
		position: absolute;
		right: 0;
		top: 0;
		-webkit-transition: .4s;
		transition: .4s;
		will-change: background-color;

		&:before {
			background-color: white;
			border-radius: 50%;
			bottom: 3px;
			content: "";
			height: 14px;
			left: 3px;
			position: absolute;
			-webkit-transition: .4s;
			transition: .4s;
			width: 14px;
			will-change: transform;
		}
	}

	&.wpconsent-preferences-checkbox-toggle-disabled {

		.wpconsent-preferences-checkbox-toggle-slider {
			background-color: #ccc !important;
			cursor: not-allowed;
			opacity: 0.5;
		}

		input {
			cursor: not-allowed;
		}
	}
}

.wpconsent-preferences-accordion-item {
	display: flex;
	flex-direction: column;
}

.wpconsent-cookie-service {
	margin-left: 20px;
	position: relative;
}

.wpconsent-cookie-service .wpconsent-preferences-accordion-header {
	padding: 16px 0; /* Slightly smaller padding than category headers */
}

.wpconsent-preferences-accordion-header {
	width: 100%;
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 24px 0;
}

.wpconsent-preferences-accordion-content {
	max-height: 0;
	overflow: hidden;
	transition: max-height 0.3s ease-out;
	font-size: 14px;
	will-change: max-height;

	a {
		color: inherit;
	}
}

.wpconsent-preferences-accordion-toggle {
	background: none;
	border: none;
	cursor: pointer;
	padding: 0;
	margin-right: 15px;
	align-items: center;
}

.wpconsent-preferences-accordion-arrow {
	border: solid;
	border-color: var(--wpconsent-text);
	border-width: 0 2px 2px 0;
	display: inline-block;
	padding: 3.5px;
	position: relative;
	top: -3px;
	transform: rotate(45deg);
	-webkit-transform: rotate(45deg);
	transition: transform 0.3s ease-out;
}

.wpconsent-preferences-accordion-item.active > .wpconsent-preferences-accordion-header .wpconsent-preferences-accordion-arrow {
    transform: rotate(-135deg);
    -webkit-transform: rotate(-135deg);
    top: 2px;
}

/* Only show content for directly active accordion items */
.wpconsent-preferences-accordion-item.active > .wpconsent-preferences-accordion-content {
    max-height: 2000px;
    transition: max-height 0.3s ease-in;
}

/* cookies list */

.wpconsent-preference-cookies {
	.wpconsent-preferences-list-header,
	.wpconsent-preferences-list-item {
		display: grid;
		grid-template-columns: 1fr 4fr 1fr;
		gap: 15px;
		padding: 14px;
		align-items: center;
		border-bottom: 1px solid #ddd;
		margin-bottom: 0;
		font-size: 14px;
	}

	.wpconsent-service-url {
		margin: 10px 0;
		font-size: 14px;
	}

	.wpconsent-preferences-list-item:last-child {
        border-bottom: none;
    }
}

.wpconsent-preferences-list-header {
	font-weight: 600;
}

.wpconsent-preferences-powered-by {
	display: flex;
    padding-top: 20px;
    align-items: left;
}

.wpconsent-powered-by {
	font-size: 11px;
	opacity: 0.5;
	text-align: center;
	grid-column: span 3;

	a {
		text-decoration: none;
		display: inline-flex;
		align-items: center;

		svg {
			margin-left: 5px;
		}

		&:hover {
			text-decoration: underline;
		}
	}

	.wpconsent-preferences-content & {
		svg {
			width: 80px;
			height: 12px;
		}
	}
}
