/**
 * Custom styling for the snippets table
 */

$active-color: #2196f3;
$inactive-color: #ccc;

@import 'type-badges';

.column-name,
.column-type {
	.dashicons {
		font-size: 16px;
		width: 16px;
		height: 16px;
		vertical-align: middle;
	}

	.dashicons-clock {
		vertical-align: middle;
	}
}

.active-snippet .column-name > a {
	font-weight: 600;
}

.column-priority input {
	appearance: none;
	background: none;
	border: none;
	box-shadow: none;
	width: 4em;
	color: #666;
	text-align: center;

	&:hover, &:focus, &:active {
		color: #000;
		background-color: #f5f5f5;
		background-color: rgba(0, 0, 0, 0.1);
		border-radius: 6px;
	}

	&:disabled {
		color: inherit;
	}
}

.snippet-execution-button,
.snippet-activation-switch {
	display: block;
	position: relative;
}

.snippet-activation-switch {
	margin-top: 5px;
	width: 30px;
	height: 17px;
	border-radius: 34px;
	background-color: #ccc;

	&::before {
		transition: all .4s;
		content: "";
		height: 13px;
		width: 13px;
		display: inline-block;
		margin: 2px;
		background-color: white;
		border-radius: 50%;
	}

	&:hover::before {
		transform: translateX(40%);
	}

	.snippets .active-snippet & {
		background-color: $active-color;

		&::before {
			transform: translateX(100%);
		}

		&:hover::before {
			transform: translateX(60%);
		}
	}

	.snippets .erroneous-snippet &::before {
		content: '!';
		transform: translateX(50%);
		text-align: center;
		font-weight: bold;
		line-height: 1;
		color: #bbb;
	}
}

.snippet-execution-button {
	margin-left: 10px;
	margin-top: 9px;
	width: 0;
	height: 0;
	border-top: 9px solid transparent;
	border-bottom: 9px solid transparent;
	border-left: 10px solid $inactive-color;
	transition: all 0.3s;

	&::before {
		content: '';
		position: absolute;
		top: -14px;
		left: -21px;
		bottom: -14px;
		right: -8px;
		border-radius: 50%;
		border: 1.8px solid $inactive-color;
		z-index: 2;
		transition: all .3s;
	}

	&:hover, &:focus {
		border-left-color: #579;

		&::before {
			transform: scale(1.1);
			border-color: #579;
		}
	}
}

.clear-filters {
	vertical-align: baseline !important;
}

.snippets {

	tr {
		background: #fff;
	}

	ol, ul {
		margin: 0 0 1.5em 1.5em;
	}

	ul {
		list-style: disc;
	}

	th.sortable a, th.sorted a {
		display: flex;
		flex-direction: row;
	}

	.row-actions {
		color: #ddd;
		position: relative;
		left: 0;
	}

	.column-activate {
		padding-right: 0 !important;
	}

	.clear-filters {
		vertical-align: middle;
	}

	tfoot th.check-column {
		padding: 13px 0 0 3px;
	}

	thead th.check-column,
	tfoot th.check-column,
	.inactive-snippet th.check-column {
		padding-left: 5px;
	}

	td.column-description {
		max-width: 700px;
	}

	.active-snippet, .inactive-snippet {
		td, th {
			padding: 10px 9px;
			border: none;
			box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.1);
		}
	}

	.badge {
		margin-left: 4px;
		padding: 3px 6px;
		text-decoration: none;
		border: medium none;
		border-radius: 2px;
		background-color: #e0e0e0;
		background-color: rgba(0, 0, 0, 0.08);
		font-size: smaller;
		line-height: 1.2;

		/* rtl:ignore */
		.rtl & {
			float: left;
		}
	}

	tr.active-snippet + tr.inactive-snippet th,
	tr.active-snippet + tr.inactive-snippet td {
		border-top: 1px solid rgba(0, 0, 0, 0.03);
		box-shadow: inset 0 1px 0 rgba(0, 0, 0, 0.02), inset 0 -1px 0 #e1e1e1;
	}

	&, #all-snippets-table, #search-snippets-table {
		a.delete:hover {
			border-bottom: 1px solid #f00;
			color: #f00;
		}
	}

	#wpbody-content & .column-name {
		white-space: nowrap; /* prevents wrapping of snippet title */
	}
}

.inactive-snippet {
	@include link-colors($php-inactive);
}

.active-snippet {

	td, th {
		background-color: rgba($php-background, 0.06);
	}

	th.check-column {
		border-left: 2px solid #2ea2cc;
	}

	.snippet-activation-switch {
		background-color: $active-color;
	}
}

@mixin snippet-type-colors($type, $active, $inactive, $background, $highlight) {
	.#{$type}-snippet {
		@include link-colors($inactive);
	}

	.#{$type}-snippet.active-snippet {
		@include link-colors($active);

		td, th {
			background-color: rgba($background, 0.06);
		}

		.snippet-activation-switch {
			background-color: $highlight;
		}

		th.check-column {
			border-left-color: $highlight;
		}
	}
}

@include snippet-type-colors(css, $css-active, $css-inactive, $css-background, $css-highlight);
@include snippet-type-colors(html, $html-active, $html-active, $html-background, $html-highlight);
@include snippet-type-colors(js, $js-active, $js-inactive, $js-background, $js-highlight);

@media screen and (max-width: 782px) {
	p.search-box {
		float: left;
		position: initial;
		margin: 1em 0 0 0;
		height: auto;
	}
}

.wp-list-table .is-expanded td.column-activate.activate {
	/* fix for mobile layout */
	display: table-cell !important;
}

.nav-tab-wrapper + .subsubsub, p.search-box {
	margin: 10px 0 0 0;
}

.snippet-type-description {
	border-bottom: 1px solid #ccc;
	margin: 0;
	padding: 1em 0;
}

.code-snippets-notice a.notice-dismiss {
	text-decoration: none;
}

.thickbox-code-viewer{
	min-height: 250px;
	background-color: hsl(0,0%,96.5%);
	padding: 20px;
	border-radius: 10px;
}

#snippet-code-thickbox{
	display: block;
	width: 100%;
}

.cloud-icon{
    margin-right: 3px;
    margin-bottom: 2px;
}

.nav-tab-inactive[data-snippet-type=cloud]:hover .cloud-badge {
    color: #00bcd4;
}

.cloud-synced-legend {
    color: #00bcd4;
}

.go-pro-badge{
	border-color: #ce0000;
    color: #ce0000;
    margin-left: 3px;
	border: 1px solid;
    border-radius: 5px;
    font-size: 10px;
    padding: 1px 2px;
    text-transform: uppercase;
}

.cloud-downloaded{
	color: #e91e63;
}

.cloud-not-downloaded{
	color: #9e9e9e;
}

.cloud-update{
	color: #ff9800 !important; 
}

.cloud_update a{
	color: #ff9800 !important; 
	text-decoration: underline;
}
.cloud-table > tbody > tr  {
	height: 80px;
	box-shadow: inset 0 -1px 0 rgb(0 0 0 / 10%);
}
.cloud-table tbody .active-snippet .column-name {
	font-weight: 400;
	max-width: 400px;
	white-space: normal !important;
}

.cloud-table td .no-results{
	margin-top: 15px;
    color: #e32121;
    text-align: center;
}

.updated.column-updated span {
	text-decoration: dotted underline;
}

.column-download a, .action-button-link {
    border: 1px solid;
    border-radius: 5px;
    padding: 5px;
    margin-bottom: 5px;
    display: block;
    text-align: center;
	background: transparent;
}

.cloud-snippet-download{
	color: #2271b1 !important;
}

.cloud-snippet-downloaded, .cloud-snippet-preview-style {
    color: #616161 !important;
}

.cloud-snippet-update{
	color: #ff9800 !important;
}

.snippet-type-badge {
    white-space: nowrap;
}

.cloud-badge{
	margin-left: 10px;
	border: 1px solid;
    border-radius: 5px;
    font-size: 15px;
    line-height: 19px;
}

#cloud-search-form{
	margin-top: 30px;
	margin-bottom: 30px;
	text-align: center;
}

.input-group{
	position: relative;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -ms-flex-wrap: wrap;
    flex-wrap: wrap;
    -webkit-box-align: stretch;
    -ms-flex-align: stretch;
    align-items: stretch;
    max-width: 900px;
	margin: 0 auto;
}

#cloud_search{
	display: block;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    color: #495057;
    background-clip: padding-box;
    border-radius: 0;
    transition: border-color .15s ease-in-out,box-shadow .15s ease-in-out;
	position: relative;
    -webkit-box-flex: 1;
    -ms-flex: 1 1 auto;
    flex: 1 1 auto;
    width: 1%;
    margin-bottom: 0;

	&:focus{
		outline: 0;
		border: 1px solid #8c8f94;
		box-shadow: none;
	}
}

#cloud-select-prepend{
	margin-right: -3px;
	border-top-right-radius: 0;
    border-bottom-right-radius: 0;
	position: relative;
    z-index: 2;
	color: #2271b1;
	border-color: #2271b1;
	background-color: #f6f7f7;

	&:hover{
		background-color: #f0f0f1;
		border-color: #0a4b78;
		color: #0a4b78;
	}
}

#cloud-search-submit{
	padding: 0 15px;
    margin-left: -3px;
	display: flex;
    justify-content: center;
    align-items: center;
}

.cloud-search{
	margin-left: 5px;
}

.bundle-group{
	margin-top: 10px;
    justify-content: space-between;
	display: flex;
	gap: 5px;
	flex-wrap: nowrap;
}

#cloud-bundles{
	color: #495057;
    display: flex;
    flex: 1 1 auto;
    font-size: 1rem;
    padding: 0.375rem 0.75rem;
    position: relative;
    width: 50%;
}

#cloud-bundle-show{
	width: 10%;
}

#cloud-bundle-run{
	width: 15%;
}

#bundle_share_name{
	color: #495057;
    font-size: 1rem;
	width: 25%;
}

.heading-box{
	max-width: 900px;
	margin: auto;
	padding-bottom: 1rem;
}

.cloud-search-heading{
	font-size: 23px;
    font-weight: 400;
    padding: 9px 0 4px;
    line-height: 1.3;
    text-align: center;
	margin-bottom: 0;
}

.cloud-badge.ai-icon {
    font-size: 12px;
    padding: 3px;
    margin-left: 5px;
    color: #b22222;
}

.text-justify{
	text-align: justify;
}

.ai-verified-snippet .badge, .snippet-type-badge[data-type=ai-verified]{
	background-color: #ccfbf1;
	color: #0f766e;
}

.private-snippet .badge, .snippet-type-badge[data-type=private]{
	background-color: #eff6ff;
	color: #1d4ed8;
}

.public-snippet .badge, .snippet-type-badge[data-type=public]{
	background-color: #fefce8;
	color: #a16207;
}


.unverified-snippet .badge, .snippet-type-badge[data-type=unverified]{
	background-color: #fff1f2;
	color: #be123c;
	&:hover{
		background-color: #fde2e4;
		color: #be123c;
	}
}

.no-results {
    font-size: 15px;
}

.cloud-search-card-bottom{
	min-height: 40px;
}

#cloud-search-results .cloud-snippets #the-list{
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
}

.cloud-snippets .plugin-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.voted-info{
	display: inline-flex;
    gap: 3px;
    align-items: center;
	margin-bottom: 6px !important;
	&:hover{
		.thumbs-up{
			stroke: #059669;
			fill: #6ee7b7;
			animation: thumb 1s ease-in-out infinite;
		}
	}
}

.thumbs-up{
	width: 1.25rem; /* 20px */
	height: 1.25rem; /* 20px */
	transform-origin: bottom left;
	&:hover{
		stroke: #059669;
		fill: #6ee7b7;
	}
}

.css-badge{
	color: #8000ff !important;
}

.js-badge{
	color: #cd6600 !important;
}

.php-badge{
	color: #0073aa !important;
}

.html-badge{
	color: #548b54 !important;
}

.tooltip-box {
	position: relative;
	display: inline-block;
}

.tooltip-box .tooltip-text {
	visibility: hidden;
	width: 400px;
	background-color: rgba(0,0,0,0.7);
	backdrop-filter: blur(3px);
	padding: 6px;
	position: absolute;
	z-index: 5;
	border-radius: 5px;
}

.tooltip-box:hover .tooltip-text {
	visibility: visible;
}

.tooltip-text-item, .tooltip-text-link{
	color: #fff !important;
	text-align: center;
}

.tooltip-text-title{
	font-weight: bold;
	text-decoration: underline;
	color: #fff !important;
	text-align: center;
}

.tooltip-text-link{
	text-decoration: underline;
}

.plugin-card-bottom{
	overflow: visible !important;
}

.beta-test-notice{
	margin-top: 20px;
}

.highlight-yellow{
	background: #FFEE58;
    padding: 3px;
    border-radius: 3px;
}

@keyframes thumb{
	0%{transform:rotate(0)}
	33%{transform:rotate(7deg)}
	66%{transform:rotate(-15deg)}
	90%{transform:rotate(5deg)}
	to{transform:rotate(0)}
}