/**
 * Omni Icon Error Observer Styles
 * 
 * Styles for the error panel and error state interactions.
 */

/* Error state - the icon becomes the trigger */
omni-icon[data-oiwc-state="error"] {
	position: relative;
	cursor: pointer;
	transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	padding: 4px;
	background: linear-gradient(135deg, rgba(239, 68, 68, 0.1) 0%, rgba(220, 38, 38, 0.05) 100%);
	border: 2px dashed color-mix(in srgb, rgb(239, 68, 68) 25%, transparent);
	border-radius: 16px;
	box-shadow: 0 2px 4px rgba(239, 68, 68, 0.1);
}

/* Make the SVG smaller to fit within the error box */
omni-icon[data-oiwc-state="error"] > svg {
	width: calc(100% - 8px) !important;
	height: calc(100% - 8px) !important;
	color: #ef4444;
}

omni-icon[data-oiwc-state="error"]:focus {
	outline: 2px solid rgba(239, 68, 68, 0.5);
	border-radius: 16px;
	outline-offset: 2px;
}

omni-icon[data-oiwc-state="error"]:focus:not(:focus-visible) {
	outline: none;
}

omni-icon[data-oiwc-state="error"]:hover {
	background: linear-gradient(135deg, rgba(239, 68, 68, 0.15) 0%, rgba(220, 38, 38, 0.08) 100%);
	border-color: rgba(239, 68, 68, 0.4);
	box-shadow: 0 4px 8px rgba(239, 68, 68, 0.15);
	/* transform: scale(1.05); */
}

omni-icon[data-oiwc-state="error"]:hover > svg {
	animation: oiwc-shake 0.5s ease;
}

omni-icon[data-oiwc-expanded="true"] {
	background: linear-gradient(135deg, rgba(239, 68, 68, 0.2) 0%, rgba(220, 38, 38, 0.12) 100%);
	border-color: rgba(239, 68, 68, 0.5);
	animation: oiwc-pulse-glow 2s ease-in-out infinite;
}

/* Error panel - floating panel positioned by @floating-ui/dom */
.oiwc-error-panel {
	width: max-content;
	position: absolute;
	top: 0;
	left: 0;
	background: color-mix(in oklab, rgb(255 255 255) 70%, transparent);
	backdrop-filter: blur(12px);
	border: 1px solid rgba(239, 68, 68, 0.2);
	border-radius: 8px;
	padding: 16px;
	box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
	opacity: 0;
	transform: translateX(-10px);
	transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
	pointer-events: none;
	z-index: 9999;
}

.oiwc-error-panel--visible {
	opacity: 1;
	transform: translateX(0);
	pointer-events: auto;
}

.oiwc-error-panel--dismissed {
	opacity: 0;
	transform: scale(0.8);
}

/* Error panel header */
.oiwc-error-panel__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 10px;
}

.oiwc-error-panel__title {
	font-size: 14px;
	font-weight: 600;
	color: rgb(239, 68, 68);
	display: flex;
	align-items: center;
	gap: 6px;
}

.oiwc-error-panel__close {
	background: none;
	border: none;
	color: rgba(107, 114, 128, 0.8);
	font-size: 24px;
	line-height: 1;
	cursor: pointer;
	padding: 0;
	width: 24px;
	height: 24px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 4px;
	transition: all 0.2s ease;
}

.oiwc-error-panel__close:hover {
	background: rgba(107, 114, 128, 0.1);
	color: rgb(75, 85, 99);
}

/* Error panel message */
.oiwc-error-panel__message {
	font-size: 13px;
	color: rgb(75, 85, 99);
	/* margin: 0 0 12px 0; */
	margin-top: 12px;
	line-height: 1.5;
}

/* Error panel meta */
.oiwc-error-panel__meta {
	font-size: 12px;
	color: rgb(107, 114, 128);
	margin: 0 0 12px 0;
	padding: 10px;
	background: rgba(243, 244, 246, 0.5);
	border-radius: 6px;
	border-left: 3px solid rgba(239, 68, 68, 0.3);
}

.oiwc-error-panel__meta strong {
	color: rgb(55, 65, 81);
	font-weight: 600;
}

.oiwc-error-panel__meta code {
	background: rgba(255, 255, 255, 0.7);
	padding: 2px 6px;
	border-radius: 4px;
	font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', monospace;
	font-size: 11px;
	color: rgb(220, 38, 38);
	border: 1px solid rgba(239, 68, 68, 0.15);
}

/* Animations */
@keyframes oiwc-shake {
	0%, 100% { transform: rotate(0deg); }
	25% { transform: rotate(-10deg); }
	75% { transform: rotate(10deg); }
}

@keyframes oiwc-pulse-glow {
	0%, 100% {
		box-shadow: 0 2px 4px rgba(239, 68, 68, 0.1);
	}
	50% {
		box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25);
	}
}

/* Dark mode support */
[data-theme="dark"], 
.dark {
	.oiwc-error-panel {
		background: color-mix(in oklab, rgb(24 24 27) 30%, transparent);
		border-color: rgba(239, 68, 68, 0.2);
	}

	.oiwc-error-panel__title {
		color: rgb(252, 165, 165);
	}

	.oiwc-error-panel__close {
		color: rgba(156, 163, 175, 0.8);
	}

	.oiwc-error-panel__close:hover {
		background: rgba(156, 163, 175, 0.15);
		color: rgb(209, 213, 219);
	}

	.oiwc-error-panel__message {
		color: rgb(209, 213, 219);
	}

	.oiwc-error-panel__meta {
		background: rgba(17, 24, 39, 0.5);
		color: rgb(156, 163, 175);
	}

	.oiwc-error-panel__meta strong {
		color: rgb(229, 231, 235);
	}

	.oiwc-error-panel__meta code {
		background: rgba(55, 65, 81, 0.7);
		color: rgb(252, 165, 165);
		border-color: rgba(239, 68, 68, 0.2);
	}
}

/* Responsive adjustments */
@media (max-width: 640px) {
	.oiwc-error-panel {
		position: fixed !important;
		left: 50% !important;
		top: 50% !important;
		transform: translate(-50%, -50%) scale(0.95);
		min-width: calc(100vw - 32px);
		max-width: calc(100vw - 32px);
	}

	.oiwc-error-panel--visible {
		transform: translate(-50%, -50%) scale(1);
	}
}
