@import "../common/mixin.scss";

@include b(calendar) {
	box-shadow: $--box-shadow-concave;
	@include e(header) {
		display: flex;
		justify-content: space-between;
		padding: 12px 20px;
		border-bottom: $--table-border;
	}

	@include e(title) {
		color: $--color-text-primary;
		font-weight: bold;
		align-self: center;
	}

	@include e(body) {
		padding: 12px 20px 35px;
	}

	@include b(calendar-table) {
		table-layout: fixed;
		width: 100%;

		thead th {
			padding: 12px 0;
			color: $--color-text-primary;
			font-weight: normal;
			border: none;
		}

		&:not(.is-range) {
			td.prev,
			td.next {
				color: $--color-text-placeholder;
			}
		}

		td {
			padding: 0;
			border-bottom: $--calendar-border;
			border-right: $--calendar-border;
			vertical-align: top;
			color: $--color-text-primary;
			transition: background-color 0.2s ease;

			@include when(selected) {
				box-shadow: $--box-shadow-concave;
				border-bottom: 1px solid transparent;
				border-right: 1px solid transparent;
			}

			@include when(today) {
				color: $--color-primary;
				font-weight: bold;
			}
		}

		tr:first-child td {
			border-top: $--calendar-border;
		}

		tr td:first-child {
			border-left: $--calendar-border;
		}

		tr.tu-calendar-table__row--hide-border td {
			border-top: none;
		}

		@include b(calendar-day) {
			box-sizing: border-box;
			padding: 8px;
			height: $--calendar-cell-width;
			transition: background-color 0.3s;
			&:hover {
				cursor: pointer;
			}
		}
	}

	@include m(card) {
		.tu-calendar__body {
			padding: 16px;
		}
		@include b(calendar-table) {
			thead th {
				padding: 0;
			}
			tr {
				border-color: transparent;
			}
			td {
				border-color: transparent;
				box-shadow: none;
				@include when(selected) {
					box-shadow: none;
					span {
						box-shadow: $--box-shadow-border;
						border: 1px solid $--color-primary;
						color: $--color-primary;
					}
				}
			}
			tr:first-child td,
			tr td:first-child {
				border-color: transparent;
			}
			@include b(calendar-day) {
				height: 20px;
				padding: 0;
				margin: 12px 0;
				display: flex;
				align-items: center;
				justify-content: center;

				> span {
					display: inline-block;
					width: 24px;
					height: 24px;
					text-align: center;
					line-height: 24px;
					transition: color 0.3s;
					&:hover {
						color: $--color-primary;
					}
				}
			}
		}
	}
}
