$mobile-tile-picture-width: 100px;
$mobile-tile-producer-circle-radius: 28px;
$tile-border: 1px solid #aaa;

$actions: (goto, more-info, call, login);

@mixin tile($tile-picture-width, $tile-min-height, $tile-producer-circle-radius) {
	box-shadow: 0 0 3px #888;
	border: $tile-border;
	padding-left: $tile-picture-width + $tile-producer-circle-radius + 15px;
	min-height: $tile-min-height;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	&.tile-notification {
		justify-content: start;
	}
	transition: opacity 0.3s linear;
	@media screen and (max-width: $desktop-limit) {
		padding-left: $mobile-tile-picture-width + $mobile-tile-producer-circle-radius + 15px;
		min-height: $mobile-tile-picture-width;
	}
	position: relative;
	.tile-picture {
		position: absolute;
		left: 0;
		height: 100%;
		background: #c3c3c3;
		background-size: cover;
		background-repeat: no-repeat;
		width: $tile-picture-width;
		@media screen and (max-width: $desktop-limit) {
			width: $mobile-tile-picture-width;
		}
	}
	.tile-title {
		h2 {
			background: transparent;
			text-align: left;
			padding: 2rem 0 0 0;
			@media screen and (max-width: $desktop-limit) {
				padding-top: 1rem;
				padding-right: 2rem;
			}
			color: black;
			a {
				color: black;
			}
			font-size: 110%;
		}
		h3 {
			font-family: Oswald;
			font-weight: 300;
			font-size: 110%;
			text-transform: uppercase;
			margin: 0;
			padding-top: 4px;
			color: #909090;
		}
	}
	.producer {
		box-sizing: content-box;
		display: block;
		text-indent: -10000px;
		border: 1px solid #c3c3c3;
		background: white center center no-repeat;
		position: absolute;
		background-size:  $tile-producer-circle-radius * 2;
		width: $tile-producer-circle-radius * 2;
		height: $tile-producer-circle-radius * 2;
		border-radius: $tile-producer-circle-radius;
		top: calc(50% - #{$tile-producer-circle-radius});
		left: $tile-picture-width - $tile-producer-circle-radius;
		@media screen and (max-width: $desktop-limit) {
			background-size:  $mobile-tile-producer-circle-radius * 2;
			width: $mobile-tile-producer-circle-radius * 2;
			height: $mobile-tile-producer-circle-radius * 2;
			border-radius: $mobile-tile-producer-circle-radius;
			top: calc(50% - #{$mobile-tile-producer-circle-radius});
			left: $mobile-tile-picture-width - $mobile-tile-producer-circle-radius;
		}
	}
	.tile-actions {
		text-align: right;
		padding-right: 0.5rem;
		a, span {
			@extend %action-link;
		}
	}
	.tile-content {
		p {
			margin: 0.5rem 0;
		}
		p.form-date {
			margin-top: 0;
		}
		p.form-digest {
			font-size: 90%;
			color: #666;
		}
		p.form-status {
			span.status-name {
				font-weight: bold;
				text-transform: uppercase;
			}
			&.open {
				color: $red;
			}
		}
	}
	&.placeholder {
		opacity: 0.6;
		.producer {
			background-image: url(img/loading.gif);
			background-size: 80%;
		}
	}
}

%action-link {
	text-transform: uppercase;
	font-family: Oswald;
	font-size: 90%;
	color: black;
	display: inline-block;
	height: 26px;
	line-height: 26px;
	background-position: left center;
	background-repeat: no-repeat;
	background-size: 18px;
	padding-left: 24px;
	margin-left: 10px;
	&:hover {
		color: $red;
	}
}

@each $action in $actions {
	.action-#{$action} {
		background-image: url(img/#{$action}.png);
		&:hover {
			background-image: url(img/#{$action}-hover.png);
		}
	}
}

a.tile-link {
	&:focus {
		outline: 2px solid $red;
		outline-offset: 1px;
	}
	&:hover {
		text-decoration: none;
	}
	.tile-head {
	}
	.tile-title {
		display: flex;
		flex-direction: column;
	}
	.description {
		max-height: 2.4em;
		overflow: hidden;
		p {
			margin: 0;
			color: black;
		}
	}
}

.dashboard-cell-icons {
	position: absolute;
	right: 0rem;
	top: 0rem;
	z-index: 100;
}

a.add-to-dashboard,
a.remove-from-dashboard {
	display: inline-block;
	width: 41px;
	height: 37px;
	background: none center center no-repeat;
	background-size: 1rem;
	&.remove-from-dashboard {
		background-image: url(img/coeur-rouge.png);
		&:hover {
			background-image: url(img/coeur-vide.png);
		}
	}
	&.add-to-dashboard {
		background-image: url(img/coeur-vide.png);
		&:hover {
			background-image: url(img/coeur-rouge.png);
		}
	}
	&.remove-from-dashboard.new, &.add-to-dashboard.new {
		&::after {
			content: "";
			display: block;
			background-image: url(img/coeur-rouge.png);
			width: 100%;
			height: 100%;
			animation-name: favorite_pulse_animation;
			animation-duration: 3000ms;
			animation-iteration-count: 1;
			animation-timing-function: linear;
			opacity: 0;
		}
	}
}

@keyframes favorite_pulse_animation {
	0% { transform: scale(0.5); opacity: 1;}
	20% { transform: scale(1); }
	40% { transform: scale(0.5); opacity: 1;}
	60% { transform: scale(1); }
	80% { transform: scale(0.5); }
	100% { opacity: 0; display: black; }
}

.tile.cell {
	border: none;  // cancel border as it will come from the inner .tile
}

.badge {
	&.open {
		color: $green;
	}
	&.closed {
		color: $red;
	}
	&.soon-to-be-closed {
		color: $orange;
	}
}

div.dashboard-content {
	span.move-up {
		box-sizing: content-box;
		display: inline-block;
		position: absolute;
		background: white;
		border: 1px solid #c3c3c3;
		top: calc(50% - #{$tile-producer-circle-radius});
		left: $tile-picture-width - $tile-producer-circle-radius;
		width: $tile-producer-circle-radius * 2;
		height: $tile-producer-circle-radius * 2;
		border-radius: $tile-producer-circle-radius;
		@media screen and (max-width: $desktop-limit) {
			top: calc(50% - #{$mobile-tile-producer-circle-radius});
			left: $mobile-tile-picture-width - $mobile-tile-producer-circle-radius;
			width: $mobile-tile-producer-circle-radius * 2;
			height: $mobile-tile-producer-circle-radius * 2;
			border-radius: $mobile-tile-producer-circle-radius;
		}
		text-align: center;
		opacity: 0;
		transition: opacity 0.1s linear;
		&::after {
			content: "\f062"; /* arrow-up */
			font-family: FontAwesome;
			position: relative;
			top: 7px;
			font-size: 3.75rem;
			@media screen and (max-width: $desktop-limit) {
				font-size: 2.5rem;
			}
		}
	}
	&.edit-mode span.move-up {
		opacity: 1;
		transition: opacity 0.05s linear;
	}
	> div.cell:first-child span.move-up {
		&::after {
			content: "\f063"; /* arrow-down */
		}
	}
}

.cell-added {
	background: white;
	padding: 0.2rem;
	position: relative;
	top: -0.8rem;
}

.silo-a-verre div.adresse {
	padding-bottom: 2rem;
}

div.ui-dialog.new-intertitle {
	input {
		width: 100%;
	}
}

button.add-section {
	position: relative;
	z-index: 100;
}

div#alert {
	h2 a {
		color: inherit;
		border-bottom: 1px dotted black;
	}
	img {
		float: left;
		margin: 0 1rem 1rem 0;
	}
	p.more-info {
		text-align: right;
		a {
			@extend %action-link;
		}
	}
}

div.parking {
	p.available::before {
		font-family: FontAwesome;
	}
	p.available {
		padding: 0.1rem 0;
	}
	p.available.bike-park::before {
		content: "\f206";
	}
	p.available.car-park::before {
		content: "\f1b9";
	}
	p.available.motorcycle-park::before {
		content: "\f21c"
	}
	p.available.pmr-park::before {
		content: "\f193"
	}
	p.available.autopartage::before {
		content: url(img/autopartage.png);
	}
}

div.pmr {
	.parking-type {
		position: relative;
	}
	img.parking-type.epi {
		transform: rotate(45deg);
		top: 6px;
		padding-right: 8px;
	}
	img.parking-type.long {
		transform: rotate(90deg);
		padding:  8px 6px 0 6px;
	}
	span.parking-type.long {
		top: -12px;
	}
	img.parking-type.talon {
		padding: 6px  6px 0 0;
	}
	span.parking-type.talon {
		top: -8px;
	}
}

div.evenement-routier {
	.tile-content p {
		margin-right : 0.5rem;
	}
}

div.toilette {
	span::before {
		font-family: FontAwesome;
	}
	span.handi-toilette::before {
		content: "\f193";
		color: blue;
	}
	span.payant-toilette::before {
		content: "\f153";
		color: #DAA520;
	}
	span.femmes-toilette::before {
		content: "\f182";
	}
	span.hommes-toilette::before {
		content: "\f183";
	}
	span.unisexe-toilette::before {
		content: "\f182 \f183";
	}
	span.enfants-toilette::before {
		content: "\f1ae";
	}
}

#content .pn-notifications div.tile.tile-notification {
	box-shadow: 0 0 3px #555;
	border: 1px solid $red;
}

#content .pn-notifications div.tile.notifications--no-notification {
	padding: 1em;
	min-height: 0;
}
