@import 'mediawiki.skin.variables.less';
@import 'mediawiki.widgets.datetime.definitions';

/* stylelint-disable no-duplicate-selectors */
.mw-widgets-datetime-calendarWidget {
	background-color: @background-color-base;
	display: inline-block;
	position: relative;
	border: @border-base;
	border-radius: @border-radius-base;
	padding: 0.5em;
	box-shadow: @box-shadow-drop-medium;
	vertical-align: middle;

	&:focus {
		border-color: @border-color-progressive--focus;
		outline: @outline-base--focus;
		box-shadow: @box-shadow-inset-small @box-shadow-color-progressive--focus, @box-shadow-drop-medium;
	}

	&.mw-widgets-datetime-calendarWidget-dependent {
		display: block;
		position: absolute;
		z-index: 4;
	}

	&-grid {
		table-layout: fixed;

		.mw-widgets-datetime-calendarWidget-cell {
			display: table-cell;
			white-space: nowrap;
		}
	}

	&.mw-widgets-datetime-calendarWidget-dependent {
		margin-top: -1px;
	}

	&-heading {
		font-weight: bold;
		text-align: center;
		vertical-align: middle;
		white-space: nowrap;

		.mw-widgets-datetime-calendarWidget-previous {
			float: left;

			// Overwrite OOUI's `.oo-ui-buttonElement-frameless.oo-ui-iconElement:first-child`
			&:first-child {
				margin-left: 0;
			}
		}

		.mw-widgets-datetime-calendarWidget-next {
			float: right;
		}
	}

	&-grid {
		margin: 0 auto;

		.mw-widgets-datetime-calendarWidget-cell {
			text-align: center;

			.oo-ui-buttonElement-button {
				width: 100%;
				border: 1px solid rgba( 255, 255, 255, 0 );
				transition-property: @transition-property-base;
				transition-duration: @transition-duration-base;
			}

			&.mw-widgets-datetime-calendarWidget-extra .oo-ui-buttonElement-button {
				.oo-ui-labelElement-label {
					color: @color-subtle;
				}

				&:hover .oo-ui-labelElement-label {
					color: @color-inverted;
				}
			}

			&.mw-widgets-datetime-calendarWidget-selected .oo-ui-buttonElement-button {
				background-color: @background-color-progressive--active;

				.oo-ui-labelElement-label {
					color: @color-inverted;
				}
			}

			&.oo-ui-widget-enabled .oo-ui-buttonElement-button:hover {
				background-color: #36c;
				color: @color-inverted;
				border-color: #36c;
			}
		}
	}

	&:focus &-grid &-cell&-focused .oo-ui-buttonElement-button {
		border-color: rgba( 0, 0, 0, 0.3 );
	}
}
