/**
* Universal Annotation Styling for Aletyx Documentation
* This file provides consistent styling for all annotation types:
* - Custom image annotations
* - Code annotations
* - Image maps
*/

/* ====================================
  SHARED ANIMATION KEYFRAMES
  ==================================== */

@keyframes pulse {
	0% {
		box-shadow: 0 0 0 0 rgba(252, 118, 76, 0.4);
	}

	70% {
		box-shadow: 0 0 0 10px rgba(252, 118, 76, 0);
	}

	100% {
		box-shadow: 0 0 0 0 rgba(252, 118, 76, 0);
	}
}

/* ====================================
	 CUSTOM IMAGE ANNOTATIONS
	 ==================================== */

/* Container for annotated images */
.annotated-image-container {
	position: relative;
	margin: 1.5em 0;
	width: 100%;
	height: auto;
	display: block;
}

.annotated-image {
	width: 100%;
	height: auto;

}

/**
   * Universal Annotation Styling for Aletyx Documentation
   * This file provides consistent styling for all annotation types:
   * - Custom image annotations
   * - Code annotations
   * - Image maps
   */

/* ====================================
	 SHARED ANIMATION KEYFRAMES
	 ==================================== */

@keyframes pulse {
	0% {
		box-shadow: 0 0 0 0 rgba(252, 118, 76, 0.4);
	}

	70% {
		box-shadow: 0 0 0 10px rgba(252, 118, 76, 0);
	}

	100% {
		box-shadow: 0 0 0 0 rgba(252, 118, 76, 0);
	}
}

/* ====================================
	 CUSTOM IMAGE ANNOTATIONS
	 ==================================== */

/* Container for annotated images */
.annotated-image-container {
	position: relative;
	margin: 1.5em 0;
	width: 100%;
	height: auto;
	display: block;
}

.annotated-image {
	width: 100%;
	height: auto;
	display: block;
}

/* Annotation markers */
.annotation-marker {
	position: absolute;
	width: 24px;
	height: 24px;
	border-radius: 50%;
	background-color: #16293F;
	color: white;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 14px;
	font-weight: bold;
	cursor: pointer;
	transition: all 0.2s ease;
	z-index: 5;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
	transform: translate(-50%, -50%);
	/* Pulsing animation */
	animation: pulse 2s infinite;
}

.annotation-marker:hover {
	transform: translate(-50%, -50%) scale(1.1);
	background-color: rgba(252, 118, 76, 0.9);
	animation: none;
}

.annotation-marker.active {
	background-color: #FC764C;
	transform: translate(-50%, -50%) scale(1.1);
	animation: none;
}

/* Special marker styles */
.annotation-marker.plus::after {
	content: "+";
}

.annotation-marker.x::before,
.annotation-marker.x::after {
	content: '';
	position: absolute;
	width: 14px;
	height: 2px;
	background-color: white;
	transition: transform 0.3s ease;
}

.annotation-marker.x::before {
	transform: rotate(45deg);
}

.annotation-marker.x::after {
	transform: rotate(-45deg);
}

/* Rotate X to plus when active */
.annotation-marker.x.rotate-plus::before {
	transform: rotate(0deg);
}

.annotation-marker.x.rotate-plus::after {
	transform: rotate(90deg);
}

/* Annotation tooltips */
.annotation-tooltip {
	position: absolute;
	background-color: white;
	border-left: 4px solid #FC764C;
	padding: 12px 15px;
	border-radius: 4px;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
	max-width: 300px;
	z-index: 100;
	display: none;
	font-size: 14px;
	pointer-events: auto;
}

.annotation-tooltip.visible {
	display: block;
}

.annotation-tooltip-title {
	font-weight: bold;
	margin-bottom: 5px;
	color: #16293F;
}

.annotation-tooltip-content {
	margin: 0;
	color: #444;
}

/* Dark mode support */
[data-md-color-scheme="slate"] .annotation-tooltip {
	background-color: #2e303e;
	border-left: 4px solid #FC764C;
}

[data-md-color-scheme="slate"] .annotation-tooltip-title {
	color: white;
}

[data-md-color-scheme="slate"] .annotation-tooltip-content {
	color: #ddd;
}

/* ====================================
	 CODE ANNOTATIONS
	 ==================================== */

/* Style the MkDocs Material code annotations */
.md-annotation {
	position: relative !important;
	display: inline-block !important;
	z-index: 2 !important;
}

/* Style the annotation marker to look like a pulsing plus */
.md-annotation__index {
	width: 20px !important;
	height: 20px !important;
	border-radius: 50% !important;
	background-color: rgba(252, 118, 76, 0.8) !important;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2) !important;
	display: flex !important;
	justify-content: center !important;
	align-items: center !important;
	cursor: pointer !important;
	transition: all 0.2s ease !important;
	position: relative !important;
	animation: pulse 2s infinite !important;
	margin-left: 3px !important;
	margin-right: 3px !important;
	transform: translate(0, 0) !important;
}

/* Remove the default number from MkDocs code annotations */
.md-annotation__index span {
	display: none !important;
}

/* Create plus sign using pseudo-elements */
.md-annotation__index::before,
.md-annotation__index::after {
	content: '' !important;
	position: absolute !important;
	background-color: white !important;
	transition: transform 0.3s ease !important;
}

/* Horizontal line of the plus */
.md-annotation__index::before {
	width: 10px !important;
	height: 2px !important;
	top: 50% !important;
	left: 50% !important;
	transform: translate(-50%, -50%) !important;
}

/* Vertical line of the plus */
.md-annotation__index::after {
	width: 2px !important;
	height: 10px !important;
	top: 50% !important;
	left: 50% !important;
	transform: translate(-50%, -50%) !important;
}

/* Hover state */
.md-annotation:hover .md-annotation__index {
	background-color: #FC764C !important;
	transform: scale(1.1) !important;
	animation: none !important;
	/* Stop pulsing on hover */
}

/* Active state - transforms plus to x */
.md-annotation--active .md-annotation__index {
	background-color: #FC764C !important;
	transform: scale(1.1) !important;
	animation: none !important;
}

.md-annotation--active .md-annotation__index::before {
	transform: translate(-50%, -50%) rotate(45deg) !important;
}

.md-annotation--active .md-annotation__index::after {
	transform: translate(-50%, -50%) rotate(45deg) !important;
}

/* Fix tooltip styling */
.md-tooltip {
	background-color: white !important;
	border-left: 4px solid #FC764C !important;
	border-radius: 4px !important;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
	padding: 12px 15px !important;
	max-width: 300px !important;
	z-index: 100 !important;
	color: #333 !important;
	opacity: 1 !important;
}

/* Dark mode tooltip */
[data-md-color-scheme="slate"] .md-tooltip {
	background-color: #2e303e !important;
	color: rgba(255, 255, 255, 0.9) !important;
}

/* Ensure tooltip inner content is properly styled */
.md-tooltip__inner {
	color: #333 !important;
	font-size: 14px !important;
	line-height: 1.5 !important;
}

[data-md-color-scheme="slate"] .md-tooltip__inner {
	color: #fff !important;
}

/* Fix positioning of code annotation icons */
.md-code .md-annotation {
	position: relative !important;
	top: 0 !important;
	right: 0 !important;
	bottom: 0 !important;
	left: 0 !important;
}

/* Fix hover behavior on desktop */
@media (hover: hover) {
	.md-annotation:hover .md-tooltip {
		opacity: 1 !important;
		transform: translate(-50%, 0) !important;
		pointer-events: auto !important;
		visibility: visible !important;
		display: block !important;
	}
}

/* ====================================
	 IMAGE MAP ANNOTATIONS
	 ==================================== */

/* Image map container */
.image-map-container {
	position: relative;
	display: inline-block;
	max-width: 100%;
}

.image-map {
	max-width: 100%;
	height: auto;
	display: block;
}

/* Area highlights */
.area-highlight {
	position: absolute;
	border: 3px solid transparent;
	opacity: 0.3;
	transition: opacity 0.3s ease, background-color 0.3s ease;
	pointer-events: none;
	z-index: 10;
}

.area-highlight.area-active {
	opacity: 1;
	background-color: rgba(255, 255, 255, 0.2);
}

/* Text section highlighting */
.section-creation,
.section-import,
.section-toolbar,
.section-projects,
[class^="section-"] {
	border-left: 4px solid transparent;
	padding-left: 10px;
	transition: background-color 0.3s ease;
}

.section-creation {
	border-color: #e63946;
}

.section-import {
	border-color: #457b9d;
}

.section-toolbar {
	border-color: #2a9d8f;
}

.section-projects {
	border-color: #8338ec;
}

.section-active {
	background-color: rgba(0, 0, 0, 0.05);
}

/* Image map tooltip */
.image-map-tooltip {
	position: absolute;
	background-color: rgba(50, 50, 50, 0.9);
	color: white;
	padding: 8px 12px;
	border-radius: 4px;
	font-size: 14px;
	z-index: 1000;
	max-width: 250px;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
	pointer-events: none;
	display: none;
}

/* Dark mode adjustments */
[data-md-color-scheme="slate"] .section-active {
	background-color: rgba(255, 255, 255, 0.1);
}

[data-md-color-scheme="slate"] .image-map-tooltip {
	background-color: rgba(0, 0, 0, 0.8);
}


.image-map-container {
	position: relative;
	display: inline-block;
	max-width: 100% margin: 1.5rem 0;
}

.image-map {
	max-width: 100%;
	height: auto;
	display: block;
	border: 1px solid #ddd;
	border-radius: 4px;
}

/* Area highlighting - make sure this is visible */
.area-highlight {
	position: absolute;
	border: 2px solid;
	border-radius: 3px;
	transition: all 0.25s ease-in-out;
	pointer-events: none;
	/* Make sure it doesn't interfere with clicking */
	z-index: 5;
	opacity: 0.3;
	/* Make it slightly visible even when not active */
	background-color: rgba(255, 255, 255, 0.1);
}

/* Highlight active areas with more opacity */
.area-highlight.area-active {
	opacity: 0.7 !important;
	background-color: rgba(255, 255, 255, 0.3) !important;
	box-shadow: 0 0 8px rgba(0, 0, 0, 0.2);
	z-index: 10 !important;
}

/* Make area highlights more visible in dark mode */
[data-md-color-scheme="slate"] .area-highlight {
	opacity: 0.4;
	background-color: rgba(255, 255, 255, 0.15);
}

[data-md-color-scheme="slate"] .area-highlight.area-active {
	opacity: 0.8 !important;
	background-color: rgba(255, 255, 255, 0.35) !important;
	box-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
}

/* Tooltip styling */
.image-map-tooltip {
	position: absolute;
	background-color: rgba(0, 0, 0, 0.8);
	color: white;
	padding: 8px 12px;
	border-radius: 4px;
	font-size: 14px;
	max-width: 250px;
	pointer-events: none;
	z-index: 100;
	box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
	display: none;
}

/* Style for active text sections */
[class^="section-"] {
	padding-left: 10px;
	transition: all 0.25s ease;
	position: relative;
}

[class^="section-"]:before {
	content: "";
	position: absolute;
	left: 0;
	top: 0;
	bottom: 0;
	width: 3px;
	background-color: transparent;
	transition: background-color 0.25s ease;
}

[class^="section-"].section-active:before {
	background-color: #e63946;
}

.section-creation.section-active:before {
	background-color: #e63946;
}

.section-import.section-active:before {
	background-color: #457b9d;
}

.section-toolbar.section-active:before {
	background-color: #2a9d8f;
}

.section-projects.section-active:before {
	background-color: #8338ec;
}

/* Section highlighting */
[class^="section-"].section-active {
	background-color: rgba(0, 0, 0, 0.05);
}

[data-md-color-scheme="slate"] [class^="section-"].section-active {
	background-color: rgba(255, 255, 255, 0.05);
}

/* Mobile/touch device specific adjustments */
@media (hover: none),
(pointer: coarse) {

	/* Make areas more touchable */
	area {
		cursor: pointer !important;
	}

	/* More prominent highlighting for touch devices */
	.area-highlight.area-active {
		opacity: 0.8 !important;
		background-color: rgba(255, 255, 255, 0.4) !important;
		border-width: 3px !important;
	}

	/* Allow touch on section highlighting */
	[class^="section-"] {
		cursor: pointer;
	}

	/* Make tooltips larger and more readable on mobile */
	.image-map-tooltip {
		font-size: 16px !important;
		padding: 10px 15px !important;
		max-width: 80vw !important;
	}

	/* Ensure sections are more visible when tapped */
	[class^="section-"].section-active {
		background-color: rgba(0, 0, 0, 0.1);
	}

	[data-md-color-scheme="slate"] [class^="section-"].section-active {
		background-color: rgba(255, 255, 255, 0.1);
	}

	/* Make sure the highlight bar is more visible */
	[class^="section-"].section-active:before {
		width: 5px !important;
	}
}

/* Force highlight areas to be visible */
.image-map-container .area-highlight {
	display: block !important;
	visibility: visible !important;
}

/* === Refined Mobile-Friendly Tooltip Fixes === */

.annotation-tooltip {
	max-width: 90vw;
	z-index: 999;
	word-break: break-word;
	box-sizing: border-box;
	overflow-wrap: break-word;
}

@media (max-width: 768px) {
	.annotation-tooltip {
		font-size: 0.85rem;
		padding: 0.75rem 1rem;
	}

	.annotated-image-container {
		overflow-x: auto;
	}
}
