.p-calendar {
	&.p-invalid.p-component > .p-inputtext {
		@include invalid-input();
	}

	&:not(.p-calendar-disabled).p-focus > .p-inputtext {
		@include focused-input();
	}
}

.p-datepicker {
	padding: 0;
	background: $calendarInlineBg;
	color: $calendarTextColor;
	border: $calendarBorder;
	border-radius: $borderRadius;

	&:not(.p-datepicker-inline) {
		background: $calendarBg;
		border: $calendarOverlayBorder;
		box-shadow: $calendarShadow;

		.p-datepicker-header {
			background: $calendarHeaderBg;
		}
	}

	.p-datepicker-header {
		padding: $calendarHeaderPadding;
		color: $calendarHeaderTextColor;
		background: $calendarInlineHeaderBg;
		font-weight: $calendarHeaderFontWeight;
		margin: $inputListHeaderMargin;
		border-bottom: $calendarHeaderBorder;
		border-top-right-radius: $borderRadius;
		border-top-left-radius: $borderRadius;

		.p-datepicker-prev,
		.p-datepicker-next {
			@include action-icon();

			border-radius: $calendarCellDateBorderRadius;
			color: $calendarCellDateTextColor;

			&:enabled:hover {
				background: $calendarCellDateHoverBg;
				color: $calendarCellDateTextColor;
			}
		}

		.p-datepicker-prev {
			margin-left: 0.5rem;
		}

		.p-datepicker-next {
			margin-right: 0.5rem;
		}

		.p-datepicker-title {
			line-height: $actionIconHeight;
			margin: 0 0.5rem;
			display: flex;
			align-items: center;

			.p-datepicker-year,
			.p-datepicker-month {
				color: $calendarHeaderTextColor;
				transition: $actionIconTransition;
				font-weight: 400;
				padding: $calendarPadding;
				border: $calendarHeaderCellBorder;
				border-radius: $calendarHeaderCellBorderRadius;
				line-height: 1;
				min-width: 116px;

				&:enabled:hover {
					color: $calendarMonthYearHeaderHoverTextColor;
				}
			}

			select.p-datepicker-year {
				padding: $calendarPadding calc(0.5rem + 24px + 2px) $calendarPadding $calendarPadding;
				appearance: none;
				-webkit-appearance: none;
				-moz-appearance: none;
				background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2385888e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath stroke='none' d='M0 0h24v24H0z' fill='none'/%3E%3Cpath d='M6 9l6 6l6 -6'/%3E%3C/svg%3E");
				background-repeat: no-repeat;
				background-position: right 0.75rem center;
				background-size: 20px;
			}

			select.p-datepicker-month {
				padding: $calendarPadding calc(0.5rem + 24px + 2px) $calendarPadding $calendarPadding;
				line-height: 1;
				appearance: none;
				-webkit-appearance: none;
				-moz-appearance: none;
				background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2385888e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath stroke='none' d='M0 0h24v24H0z' fill='none'/%3E%3Cpath d='M6 9l6 6l6 -6'/%3E%3C/svg%3E");
				background-repeat: no-repeat;
				background-position: right 0.75rem center;
				background-size: 20px;
			}

			// для Firefox
			select.p-datepicker-year:-moz-focusring, select.p-datepicker-month:-moz-focusring {
				color: transparent;
				text-shadow: 0 0 0 #000;
			}

			.p-datepicker-month {
				margin-right: $inlineSpacing;
			}

			.p-datepicker-decade {
				padding: $calendarPadding;
				border: $calendarHeaderCellBorder;
				border-radius: $calendarHeaderCellBorderRadius;
				font-weight: 400;
				line-height: 1;
			}
		}
	}

	.p-datepicker-calendar-container {
		padding: $calendarContainerPadding;
		border-top: $calendarContainerBorderTop;
	}

	table {
		font-size: $fontSize;
		margin: $calendarTableMargin;

		th {
			padding: $calendarHeaderCellPadding;

			> span {
				width: $calendarCellDateWidth;
				height: $calendarCellDateHeight;
			}
		}

		td {
			padding: $calendarCellDatePadding;

			> span {
				width: $calendarCellDateWidth;
				height: $calendarCellDateHeight;
				border-radius: $calendarCellDateBorderRadius;
				transition: $listItemTransition;
				border: $calendarCellDateBorder;
				color: $calendarCellDateTextColor;

				&.p-highlight {
					color: $calendarCellDateHighlightTextColor;
					background: $calendarCellDateHighlightBg;

					&:hover {
						background: $calendarCellDateHighlightHoverBg;
					}
				}

				&:focus {
					@include focused();
				}
			}

			&.p-datepicker-today {
				> span {
					background: $calendarCellDateTodayBg;
					color: $calendarCellDateTodayTextColor;
					border: 1px solid;
					border-color: $calendarCellDateTodayBorderColor;

					&.p-highlight {
						color: $calendarCellDateTodayHighlightTextColor;
						background: $calendarCellDateTodayHighlightBg;

						&:hover {
							background: $calendarCellDateTodayHighlightHoverBg;
						}
					}
				}
			}
		}
	}

	.p-datepicker-buttonbar {
		padding: $calendarButtonBarPadding;
		border-top: $calendarButtonBarBorderTop;

		.p-button {
			width: auto;
		}
	}

	.p-timepicker {
		border-top: $calendarTimePickerBorderTop;
		padding: $calendarTimePickerPadding;

		button {
			@include action-icon();

			color: $calendarTimePickerButtonColor;
			border-radius: $calendarTimePickerButtonBorderRadius;

			&:last-child {
				margin-top: 0.2em;
			}
		}

		span {
			font-size: $calendarTimePickerTimeFontSize;
		}

		> div {
			padding: $calendarTimePickerElementPadding;
		}
	}

	&.p-datepicker-timeonly {
		.p-timepicker {
			border-top: 0 none;
		}
	}

	.p-monthpicker {
		margin: $calendarTableMargin;
		padding: $calendarContainerPadding;
		border-top: $calendarContainerBorderTop;

		.p-monthpicker-month {
			padding: $calendarCellDatePadding;
			transition: $listItemTransition;
			border-radius: $borderRadius;

			&.p-highlight {
				color: $calendarCellDateHighlightTextColor;
				background: $calendarCellDateHighlightBg;

				&:hover {
					background: $calendarCellDateHighlightHoverBg;
				}
			}
		}
	}

	.p-yearpicker {
		margin: $calendarTableMargin;
		padding: $calendarContainerPadding;
		border-top: $calendarContainerBorderTop;

		.p-yearpicker-year {
			padding: $calendarCellDatePadding;
			transition: $listItemTransition;
			border-radius: $borderRadius;

			&.p-highlight {
				color: $calendarCellDateHighlightTextColor;
				background: $calendarCellDateHighlightBg;

				&:hover {
					background: $calendarCellDateHighlightHoverBg;
				}
			}
		}
	}

	&.p-datepicker-multiple-month {
		.p-datepicker-group {
			border-left: $calendarContainerBorderTop;
			padding-right: 0;
			padding-left: 0;
			padding-top: 0;
			padding-bottom: 0;

			&:first-child {
				padding-left: 0;
				border-left: 0 none;
			}

			&:last-child {
				padding-right: 0;
			}
		}
	}

	&:not(.p-disabled) {
		table {
			td {
				span:not(.p-highlight):not(.p-disabled) {
					&:hover {
						background: $calendarCellDateHoverBg;
					}

					&:focus {
						@include focused();
					}
				}
			}
		}

		.p-monthpicker {
			.p-monthpicker-month {
				&:not(.p-disabled) {
					&:not(.p-highlight):hover {
						background: $calendarCellDateHoverBg;
					}

					&:focus {
						@include focused();
					}
				}
			}
		}

		.p-yearpicker {
			.p-yearpicker-year {
				&:not(.p-disabled) {
					&:not(.p-highlight):hover {
						background: $calendarCellDateHoverBg;
					}

					&:focus {
						@include focused();
					}
				}
			}
		}
	}
}

@media screen and (max-width: $calendarBreakpoint) {
	.p-datepicker {
		table {
			th,
			td {
				padding: $calendarCellDatePaddingSM;
			}
		}
	}
}
