/* stylelint-disable scss/at-rule-no-unknown */
@tailwind base;
@tailwind components;
@tailwind utilities;

/* Video Editor Set up */

.tooltip {
	position: absolute;
	background: rgba(0, 0, 0, 0.75);
	color: #fff;
	padding: 5px 10px;
	border-radius: 5px;
	font-size: 12px;
	pointer-events: none; /* Prevents interfering with mouse events */
	opacity: 0; /* Initially hidden */
	transition: opacity 0.2s ease-in-out;
}

#root-video-analytics, #root-video-dashboard {

	&.free-user {
		height: calc(100vh - var(--wp-admin--admin-bar--height, 0));

		.api-key-overlay {
			background-size: 100% 100% !important;
			background-position: 0 0 !important;
			margin-left: -20px;
			width: -webkit-fill-available;
		}
	}

	background-color: #fff;

	#analytics-content {
		max-width: 1440px;
		margin: 0 auto;
		width: 100%;
	}

	// Video JS styles
	.video-analytics-container {

		@apply flex bg-white justify-between py-6 md:px-10 pt-8;

		.analytics-info-container {

			.analytics-info {

				width: calc(50% - 8px);

				@media screen and (min-width: 1024px) {
					width: 100%;
					max-width: 350px;
				}

				@media screen and (min-width: 1535px) {
					max-width: 350px;
				}

				@media screen and (max-width: 640px) {
					width: 100%;
				}
			}
		}
	}

	.country-heatmap-container {

		@apply bg-white overflow-auto h-[400px];
	}

	.media-frame-menu,
	.media-frame-router,
	.media-frame-content .upload-ui {
		display: none !important;
	}

	.analytics-info-container {
		display: flex;
		gap: 12px;

		.analytics-info {
			display: flex;
			align-items: center;
			padding: 9px 12px;
			border-radius: 12px;

			.analytics-single-info {
				display: flex;
				flex-direction: column;
				gap: 9px;
				width: 100%;
			}

			.analytics-info-heading {
				font-size: 16px;
				display: flex;
				align-items: center;
				font-weight: 400;
				gap: 5px;

				.tooltip-container {
					display: flex;
					align-items: center;
				}
			}

			.metric-change {
				font-size: 12px;
				padding: 2px 11px;
				border-radius: 12px;
			}

			.change-drop {
				background-color: #FFF0F0;
				color: #B91C1C;
			}

			.change-rise {
				background-color: #E5F6EA;
				color: #15803D;
			}

			p {
				margin-block-end: unset;
				margin-block-start: unset;
				font-size: 12px;
			}

			.single-metrics-value {
				font-weight: 600;
				font-size: 20px;
				line-height: 2rem;
				white-space: nowrap;
			}
		}
	}

	.godam-analytics-back-btn:hover {
		color: #AB3A6C;
	}

	.godam-analytics-back-btn:focus {
		box-shadow: none;
	}

	// Video Chart styles
	.video-container {
		position: relative;
		width: 100%;
		max-width: 830px;

		@media screen and (max-width: 1024px) {
			max-width: 100%;
		}
	}

	.video-chart-container {
		position: absolute;
		bottom: 0;
		left: 0;
		width: 100%;
		height: 75%;
		pointer-events: none;

		#chart-container {
			pointer-events: auto;
		}
	}

	.comparison-video-container {
		height: 300px;
	}

	.original-video-chart-container {
		position: absolute;
		top: 0;
		bottom: 0;
		height: 100%;
		width: 100%;
	}

	#chart-container, #original-chart-container, #comparison-chart-container {
		width: 100%;
		height: 100%;
		position: relative;
		display: flex;
		flex-direction: column;
		justify-content: flex-end;

		svg {
			width: 100%;
			height: 100%;
			display: block;
		}

		.line {
			fill: none;
			stroke: rgba(255, 246, 0, 1);
			stroke-width: 2px;
		}

		.area {
			fill: #ACAA3AB3;
			opacity: 0.7;
		}

		.line-chart-tooltip, .performance-line-chart-tooltip, .comparison-line-chart-tooltip {
			position: absolute;
			background-color: #fff;
			border: 1px solid #ccc;
			padding: 5px;
			border-radius: 4px;
			pointer-events: none;
			white-space: nowrap;
			font-size: 12px;
			box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
			text-align: center;
			opacity: 0;
			transform: translateX(-50%);
		}

		.line-chart-tooltip::after, .performance-line-chart-tooltip::after {
			content: "";
			position: absolute;
			border-width: 8px;
			border-style: solid;
			border-color: #fff transparent transparent transparent;
			left: 50%;
			bottom: -16px;
			transform: translateX(-50%);
		}

		.hover-line {
			stroke: #fff;
			stroke-width: 1.5px;
			stroke-dasharray: 4 2;
			opacity: 0;
		}

		.focus-circle {
			fill: rgba(255, 200, 0, 1);
			stroke: #fff;
			stroke-width: 2px;
			r: 3.5;
		}
	}

	#comparison-line-chart, #performance-line-chart {
		top: 0 !important;
	}

	#heatmap-container {
		max-width: 830px;
		margin-top: 2rem;

	.heatmap-tooltip {
		position: absolute;
		position: absolute;
		background-color: #fff;
		border: 1px solid #ccc;
		padding: 5px;
		border-radius: 4px;
		pointer-events: none;
		white-space: nowrap;
		font-size: 12px;
		box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
		text-align: center;
		opacity: 0;
		z-index: 999;

		&::after {
			content: "";
			position: absolute;
			border-width: 8px;
			border-style: solid;
			border-color: #fff transparent transparent transparent;
			left: 50%;
			bottom: -16px;
			transform: translateX(-50%);
		}

		&::before {
			content: "";
			position: absolute;
			border-width: 9px;
			border-style: solid;
			border-color: rgba(0, 0, 0, 0.2) transparent transparent transparent;
			left: 50%;
			bottom: -21px;
			transform: translateX(-50%);
			filter: blur(2px);
			z-index: -1;
		}
	}

	.heatmap-vertical-line {
		stroke: #000;
		stroke-dasharray: 4;
		stroke-width: 2px;
	}
	}
}

.not-safari {

	#root-video-analytics, #root-video-dashboard {

		&.free-user {

			.api-key-overlay {
				background-size: 100% calc(100% - 32px);
				background-position: center 32px;
			}
		}
	}
}

.metrics-chart {
	position: relative;
}

.mini-chart-tooltip {
	position: absolute;
	pointer-events: none;
	z-index: 100;
	left: 0;
}

.blurred {
	filter: blur(5px);
	pointer-events: none;
}

.api-key-overlay, .screen-size-overlay {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	display: flex;
	justify-content: center;
	align-items: center;
	background: rgba(0, 0, 0, 0.4);
	backdrop-filter: blur(5px);
	z-index: 99;
}

.api-key-overlay--upgrade {
	background-size: 100% calc(100% - 32px);
	background-repeat: no-repeat;
	background-position: center 32px;
}

.api-key-message, .screen-size-message {
	background: #fff;
	padding: 20px 40px;
	border-radius: 5px;
	box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
	text-align: center;
	font-size: 16px;
	font-weight: 700;
}

.api-key-message a {
	color: #ab3a6c;
	text-decoration: none;
	font-weight: 600;
}

.api-key-overlay-banner {
	display: flex;
	flex-direction: column;
	margin: 0 2rem;
	font-size: 1rem;
	font-weight: 400;

	&-header {
		font-size: 1.25rem;
		font-weight: 500;
		display: flex;
		flex-direction: column;
		gap: 1.5rem;
	}

	&-header a {
		margin: auto;
	}

	&-footer a {
		margin: auto;
	}

	&-footer {
		font-size: 0.975rem;
		font-weight: 400;
		margin-top: 0;
	}

	// Style the buy button to not take full width
	a.components-button.godam-button.is-primary {
		align-self: center;
		width: auto;
		display: inline-block;
	}
}

.api-key-message a:hover {
	text-decoration: underline;
}

.api-key-overlay-banner-header a:hover {
	text-decoration: none;
}

.hidden {
	display: none;
}

#root-video-analytics .hidden{
	display: none;
}

#tooltip-container {
	position: relative;
	display: inline-block;
	cursor: pointer;
}

#root-video-analytics #tooltip-container .tooltip-text,
#root-video-dashboard #tooltip-container .tooltip-text {
	position: absolute;
	top: 100%;
    left: -95%;
	visibility: hidden;
	background-color: rgba(0, 0, 0, 0.8);
	color: #fff;
	text-align: center;
	padding: 8px;
	border-radius: 5px;
	min-width: 110px;
	width: max-content;
	max-width: 200px;
	z-index: 100;
	pointer-events: none;
	font-size: 12px;
	line-height: 1.2;
	opacity: 0;
	transition: opacity 0.2s ease, visibility 0.2s ease;
	word-wrap: break-word;
	overflow-wrap: break-word;
}

#root-video-analytics #tooltip-container:hover .tooltip-text,
#root-video-dashboard #tooltip-container:hover .tooltip-text {
	visibility: visible;
	opacity: 1;
}

.bar-container {
            position: absolute;
            left: 0;
            bottom: 0;
            width: 100%;
            height: 4px; /* Adjust thickness */
            background-color: #d3d3d3;
        }

        .bar {
            height: 100%;
            background-color: #00f;
        }

.subheading-container {
	display: flex;
	align-items: center;
	position: relative;
	justify-content: start;
	border-bottom: 1px solid #ddd;
	margin: 0 40px;
	padding-bottom: 0;

	@media screen and (min-width: 768px) {
		justify-content: space-between;
	}
}

.subheading {
	margin-right: 20px;
	cursor: pointer;
	position: relative;
	font-weight: 500;
	border-bottom: 2px solid #AB3A6C;
	padding: 8px 0;
}

.ab-testing-table {
	width: 100%;
	border-collapse: collapse;
	margin-top: 2rem;
	font-family: Inter, sans-serif;
	font-size: 14px;
	color: #333;
	box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
	border-radius: 12px;

	th, td {
		border: 1px solid #e0e0e0;
		padding: 16px;
		text-align: center;
	}

	th {
		background-color: #f5f5f5;
		font-weight: 600;
		color: #555;
	}

	tr:nth-child(even) {
		background-color: #fafafa;
	}

	tr td:nth-child(2) {
		color: #000;
		background-color: #F9F8F2;
		font-weight: 600;
	}

	tr.left-greater td:first-child {
		background-color: #E5F6EA;
		color: #166534;
		font-weight: 600;
	}

	tr.right-greater td:last-child {
		background-color: #E5F6EA;
		color: #166534;
		font-weight: 600;
	}

}

.legend {
	// flex-direction: column;
	align-items: center;
	gap: 12px;
	flex-wrap: wrap;

	.legend-item {
		background-color: #F2F2F7;
		padding: 4px 8px;
		border-radius: 4px;
		display: flex;
		align-items: center;
		width: fit-content;
	}

	.pie-chart-legend {
		text-decoration: none;
		color: inherit;
		cursor: pointer;

		&:hover {
			text-decoration: underline;
		}
	}
}

.performance-status-container {
	border-radius: 12px 12px 0 0;
}

.posts-count-container {
      background-color: #fff;
      border-radius: 8px;
      padding: 16px;
	  height: 400px;
	  overflow: scroll;

    h2 {
      color: #1C1C1E;
	  font-weight: 700;
    }

    .legend {
      display: flex;
      flex-wrap: wrap;
      justify-content: center;
      margin-top: 20px;
    }

    .legend-color {
      width: 12px;
      height: 12px;
      margin-right: 5px;
      border-radius: 2px;
    }

    .total-views {
      font-size: 14px;
      margin-top: 10px;
      text-align: center;
      color: #555;
    }

    .donut-label {
      font-size: 14px;
      text-anchor: middle;
      fill: #333;
    }

    .donut-percent {
      font-size: 12px;
      text-anchor: middle;
      fill: #666;
    }

	.center-text-title {
		fill: #8E8E93;
		font-size: 14px;
		text-anchor: middle;
	}

	.center-text-views {
		font-size: 24px;
		font-weight: 600;
		text-anchor: middle;
	}
}

@media (max-width: 1024px) {

		#root-video-analytics, #root-video-dashboard {

			.video-analytics-container {
				padding: 40px;
			}

			.analytics-info-container {

				.analytics-info {
					min-width: 200px;
					gap: 20px;

					.analytics-single-info {
						width: 100%;
						align-items: center;
						gap: 7px;
					}

					.analytics-info-heading {
						width: 100%;
						justify-content: space-between;
					}
				}
			}

		.metrics-container {
			grid-template-columns: 1fr;
		}
	}
}
