@import '_mixins';

$light-blue: #bbe2fb;

#nav-wrapper {
	padding: 1em;
	background-color: white;
	margin: 1em 0;
	border: 1px solid lightgray;
	display: flex;
	justify-content: space-between;

	.table-nav.top {
		display: flex;
		flex-direction: column;
		justify-content: space-between;
	}

	.search-box {
		margin-bottom: 1em;
	}
}

body.toplevel_page_nashaat-table {
	h1 {
		padding-bottom: 0.5em;
		margin-bottom: 0.5em;
		border-bottom: 1px dashed lightgray;
	}

	table.toplevel_page_nashaat-table {
		border-collapse: collapse;

		> thead {
			tr {
				background-color: $light-blue;
				color: white;
			}

			.column-name-wrapper {
				display: flex;
				white-space: nowrap;
				align-items: center;
				justify-content: center;
			}

			th {
				position: relative;
				padding: 8px 5px !important;

				.filter-box-wrapper {
					position: absolute;
					top: 115%;
					left: 50%;
					max-width: 350px;
					min-width: 120px;
					font-size: 12px;
					background-color: white;
					padding: 10px 15px;
					z-index: 5;
					transform: translateX(-50%);
					filter: drop-shadow(0 0 3px gray);
					pointer-events: none;
					opacity: 0;
					transition: all 0.2s;

					&[data-show='true'] {
						opacity: 1;
						pointer-events: initial;
						top: 105%;
					}

					&::before {
						content: '';
						height: 10px;
						width: 10px;
						position: absolute;
						top: 0;
						left: 50%;
						transform: translate(-50%, -40%) rotate(-45deg);
						background-color: white;
					}

					.filter-box-inner {
						overflow: auto;
						max-height: 150px;
						padding: 0px 10px;
						@include scrollbars(3px, darken($light-blue, 50%), $light-blue);

						> div {
							padding: 2px 0;
						}

						input[type='radio'] {
							display: none;

							+ span {
								border-radius: 50%;
								background-color: white;
								position: relative;
								height: 10px;
								width: 10px;
								display: inline-block;
								margin: 0 10px 0 0;
								box-shadow: 0 0 0 1px gray;

								&::before {
									content: '';
									height: 60%;
									width: 60%;
									background-color: #2980b9;
									position: absolute;
									top: 50%;
									left: 50%;
									border-radius: 50%;
									transform: translate(-50%, -50%);
									transition: all 0.1s;
								}
							}

							&:not(:checked) + span::before {
								opacity: 0;
							}
						}
					}

					.filter-box-apply {
						display: flex;
						justify-content: center;
						margin-top: 10px;

						.button {
							border-radius: 3px;
							background-color: #3498db;
							color: white;
							font-size: 12px;
							padding: 0 20px;
							min-height: auto;
						}
					}
				}

				&:nth-child(odd) {
					background-color: rgba(255, 255, 255, 0.1);
				}

				a.sorting-icon {
					padding: 0 5px;
					display: flex;
					justify-content: center;
					align-items: center;
					color: black;
					transition: all 0.2s;
					font-size: 15px;
					display: none;
					margin-right: 5px;
					border-radius: 2px;
					padding: 2px 7px;

					&:hover {
						background-color: rgba(0, 0, 0, 0.2);
					}
				}

				.column-name {
					color: black;
					padding: 3px 7px;
				}

				.filter-icon {
					font-size: 10px;
					display: none;
					color: black;
					padding: 3px 8px;
					margin: 0 5px 0 0;
					cursor: pointer;
					transition: all 0.2s;
					border-radius: 2px;

					&:hover {
						background-color: rgba(0, 0, 0, 0.2);
					}
				}

				&.filterable,
				&.sortable {
					&:hover {
						background-color: rgba(170, 170, 170, 0.2);

						span {
							display: none;
						}

						a {
							display: block;
						}

						.filter-icon {
							display: block;
						}
					}
				}

				&.column-date {
					width: 150px;
				}

				&.column-event {
					width: 90px;
				}

				&.column-context {
					width: 90px;
				}

				&.column-user_data {
					width: 100px;
				}

				&.column-ip {
					width: 100px;
				}

				&.column-level {
					width: 70px;
				}

				&.column-actions {
					width: 70px;
				}
			}
		}
	}
}

tbody tr {
	border-bottom: 1px solid #dddddd;

	&:nth-of-type(even) {
		background-color: #f3f3f3;
	}

	&:last-of-type {
		border-bottom: 2px solid darken($light-blue, 65%);
	}

	h4 {
		margin: 0;
		font-size: 15px;
		margin-left: -10px;
	}

	h5 {
		margin: 10px 0 0 0;
		font-size: 13px;
	}

	.log-info-wrapper {
		max-height: 450px;
		overflow: auto;
	}

	pre {
		max-width: 100%;
		overflow: auto;
	}

	&:hover {
		.actions-wrapper .single-action-wrapper span {
			opacity: 1;
		}
	}

	.actions-wrapper {
		display: flex;
		justify-content: center;

		.single-action-wrapper {
			padding: 0.2em;
			margin: 0 0.7em 0 0;
			position: relative;

			.action-spinner {
				display: none;
			}

			&[data-spinner='active'] {
				.action-spinner {
					display: inline-block;
				}

				span {
					display: none;
				}
			}

			span {
				cursor: pointer;
				transition: all 0.2s;
				font-size: 1.2em;
				position: relative;
				opacity: 0.3;

				&.delete-single-record {
					color: #e74c3c;
					&:hover {
						color: #c0392b;
					}
				}
			}
		}
	}

	.level-wrapper {
		font-size: 25px;
		display: flex;
		justify-content: center;

		&[data-level='level-0'] {
			color: #9e9e9e;
		}

		&[data-level='level-1'] {
			color: #155724;
		}

		&[data-level='level-2'] {
			color: #b19336;
		}

		&[data-level='level-3'] {
			color: #a93f48;
		}
	}

	.list-wrapper {
		list-style: disc;
		margin-left: 1.5em;
	}

	.changes-wrapper {
		margin-top: 10px;
		padding-left: 10px;
		border-top: 1px dashed rgba(180, 180, 180, 0.5);
		padding-top: 10px;

		.extra-data-row {
			margin-left: 15px;
			font-size: 12px;
		}
	}

	.inner-log-table {
		thead th {
			font-size: 0.8em;
		}

		td {
			font-size: 0.9em;
		}
	}
}

#current_filters {
	.filter-title {
		padding-bottom: 10px;
	}

	.filter-tags {
		.filter-span {
			border-radius: 50px;
			padding: 3px 0px 3px 15px;
			margin-right: 5px;
			background-color: $light-blue;
			font-size: 12px;

			a {
				padding: 2px 5px;
				transition: all 0.3s;
				border-radius: 2px;
				display: inline-block;
				text-decoration: none;
				color: black;
				margin: 0 10px 0 5px;
				line-height: 1;
				font-size: 12px;

				&:hover {
					background-color: rgba(0, 0, 0, 0.2);
				}
			}
		}
	}
}

#log-table-action {
	padding: 2em 0;
	display: flex;
	justify-content: flex-end;
	align-items: center;
}
