/**
 * Heating Error Lookup Styles
 * Minimal, clean design with no external dependencies
 */

.hel-container {
	--hel-primary: #2563eb;
	--hel-primary-hover: #1d4ed8;
	--hel-bg: #ffffff;
	--hel-bg-secondary: #f8fafc;
	--hel-border: #e2e8f0;
	--hel-text: #1e293b;
	--hel-text-muted: #64748b;
	--hel-success: #059669;
	--hel-error: #dc2626;
	--hel-radius: 8px;
	--hel-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);

	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	font-size: 15px;
	line-height: 1.5;
	color: var(--hel-text);
	background: var(--hel-bg);
	border: 1px solid var(--hel-border);
	border-radius: var(--hel-radius);
	padding: 1.25rem;
	box-sizing: border-box;
	max-width: 100%;
}

/* Compact mode for sidebar */
.hel-container--compact {
	padding: 1rem;
	font-size: 14px;
	margin-bottom: 1.5rem;
}

.hel-container--compact .hel-title {
	font-size: 0.9375rem;
	margin-bottom: 0.75rem;
}

.hel-container--compact .hel-field {
	margin-bottom: 0.625rem;
}

.hel-container--compact .hel-tabs {
	margin-bottom: 0.75rem;
}

.hel-container--compact .hel-tab {
	padding: 0.5rem 0.75rem;
	font-size: 0.8125rem;
}

.hel-container--compact .hel-label {
	font-size: 0.75rem;
	margin-bottom: 0.25rem;
}

.hel-container--compact .hel-select,
.hel-container--compact .hel-input {
	padding: 0.5rem 0.625rem;
	font-size: 0.875rem;
}

.hel-container--compact .hel-select {
	padding-right: 2rem;
}

.hel-container--compact .hel-field--loading::after {
	right: 2.25rem;
	bottom: 0.55rem;
	width: 12px;
	height: 12px;
}

.hel-container *,
.hel-container *::before,
.hel-container *::after {
	box-sizing: inherit;
}

.hel-title {
	margin: 0 0 1rem;
	font-size: 1.125rem;
	font-weight: 600;
	color: var(--hel-text);
}

/* Tabs */
.hel-tabs {
	display: flex;
	gap: 0;
	margin-bottom: 1rem;
	border: 1px solid var(--hel-border);
	border-radius: var(--hel-radius);
	overflow: hidden;
}

.hel-tab {
	flex: 1;
	padding: 0.625rem 1rem;
	font-size: 0.875rem;
	font-weight: 500;
	color: var(--hel-text-muted);
	background: var(--hel-bg-secondary);
	border: none;
	cursor: pointer;
	transition: all 0.15s ease;
}

.hel-tab:not(:last-child) {
	border-right: 1px solid var(--hel-border);
}

.hel-tab:hover {
	color: var(--hel-text);
	background: var(--hel-bg);
}

.hel-tab--active {
	color: var(--hel-primary);
	background: var(--hel-bg);
	font-weight: 600;
}

/* Panels */
.hel-panel {
	display: none;
}

.hel-panel--active {
	display: block;
}

/* Fields */
.hel-field {
	margin-bottom: 0.875rem;
	position: relative;
}

.hel-field:last-child {
	margin-bottom: 0;
}

/* Field loading state - pulsing border */
.hel-field--loading .hel-select,
.hel-field--loading .hel-input {
	border-color: var(--hel-primary);
	animation: hel-pulse 1s ease-in-out infinite;
	pointer-events: none;
}

@keyframes hel-pulse {
	0%, 100% {
		border-color: var(--hel-primary);
		box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
	}
	50% {
		border-color: var(--hel-border);
		box-shadow: 0 0 0 0 rgba(37, 99, 235, 0);
	}
}

/* Inline spinner inside field */
.hel-field--loading::after {
	content: '';
	position: absolute;
	right: 2.75rem;
	bottom: 0.7rem;
	width: 14px;
	height: 14px;
	border: 2px solid var(--hel-border);
	border-top-color: var(--hel-primary);
	border-radius: 50%;
	animation: hel-spin 0.6s linear infinite;
}

.hel-label {
	display: block;
	margin-bottom: 0.375rem;
	font-size: 0.8125rem;
	font-weight: 500;
	color: var(--hel-text-muted);
}

.hel-select,
.hel-input {
	width: 100%;
	padding: 0.625rem 0.75rem;
	font-size: 0.9375rem;
	color: var(--hel-text);
	background: var(--hel-bg);
	border: 1px solid var(--hel-border);
	border-radius: var(--hel-radius);
	outline: none;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
	-webkit-appearance: none;
	appearance: none;
}

.hel-select {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 0.75rem center;
	padding-right: 2.5rem;
	cursor: pointer;
}

.hel-select:disabled,
.hel-input:disabled {
	background-color: var(--hel-bg-secondary);
	color: var(--hel-text-muted);
	cursor: not-allowed;
}

.hel-select:focus,
.hel-input:focus {
	border-color: var(--hel-primary);
	box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Search Results */
.hel-search-results {
	max-height: 280px;
	overflow-y: auto;
	margin-top: 0.75rem;
}

.hel-search-item {
	padding: 0.75rem;
	border: 1px solid var(--hel-border);
	border-radius: var(--hel-radius);
	margin-bottom: 0.5rem;
	cursor: pointer;
	transition: all 0.15s ease;
}

.hel-search-item:hover {
	border-color: var(--hel-primary);
	background: var(--hel-bg-secondary);
}

.hel-search-item:last-child {
	margin-bottom: 0;
}

.hel-search-item__header {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	margin-bottom: 0.25rem;
}

.hel-search-item__code {
	font-weight: 600;
	color: var(--hel-primary);
}

.hel-search-item__brand {
	font-size: 0.8125rem;
	color: var(--hel-text-muted);
}

.hel-search-item__model {
	font-size: 0.8125rem;
	color: var(--hel-text-muted);
}

.hel-search-item__preview {
	font-size: 0.8125rem;
	color: var(--hel-text-muted);
	margin-top: 0.25rem;
}

/* Result Panel */
.hel-result {
	animation: hel-fade-in 0.2s ease;
}

@keyframes hel-fade-in {
	from {
		opacity: 0;
		transform: translateY(-5px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.hel-result__header {
	margin-bottom: 1rem;
}

.hel-result__back {
	padding: 0.375rem 0;
	font-size: 0.875rem;
	font-weight: 500;
	color: var(--hel-primary);
	background: none;
	border: none;
	cursor: pointer;
	transition: color 0.15s ease;
}

.hel-result__back:hover {
	color: var(--hel-primary-hover);
}

.hel-result__content {
	padding: 1rem;
	background: var(--hel-bg-secondary);
	border-radius: var(--hel-radius);
}

.hel-result__meta {
	margin-bottom: 1rem;
	padding-bottom: 0.75rem;
	border-bottom: 1px solid var(--hel-border);
}

.hel-result__code {
	font-size: 1.25rem;
	font-weight: 700;
	color: var(--hel-primary);
	margin-bottom: 0.25rem;
}

.hel-result__brand-model {
	font-size: 0.875rem;
	color: var(--hel-text-muted);
}

.hel-result__section {
	margin-bottom: 1rem;
}

.hel-result__section:last-child {
	margin-bottom: 0;
}

.hel-result__section-title {
	font-size: 0.8125rem;
	font-weight: 600;
	color: var(--hel-text-muted);
	text-transform: uppercase;
	letter-spacing: 0.025em;
	margin-bottom: 0.375rem;
}

.hel-result__section-content {
	font-size: 0.9375rem;
	color: var(--hel-text);
	line-height: 1.6;
}

/* Global Loading - hidden by default, used only for initial load */
.hel-loading {
	display: none;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	padding: 1rem;
	color: var(--hel-text-muted);
	font-size: 0.875rem;
}

.hel-loading--visible {
	display: flex;
}

.hel-spinner {
	width: 16px;
	height: 16px;
	border: 2px solid var(--hel-border);
	border-top-color: var(--hel-primary);
	border-radius: 50%;
	animation: hel-spin 0.6s linear infinite;
}

@keyframes hel-spin {
	to {
		transform: rotate(360deg);
	}
}

/* Loading overlay for initial state only */
.hel-container--initializing .hel-panel {
	opacity: 0.5;
	pointer-events: none;
}

/* Result loading state */
.hel-result__loading {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	padding: 2rem 1rem;
	color: var(--hel-text-muted);
	font-size: 0.875rem;
}

/* Error */
.hel-error {
	padding: 0.75rem;
	font-size: 0.875rem;
	color: var(--hel-error);
	background: rgba(220, 38, 38, 0.05);
	border: 1px solid rgba(220, 38, 38, 0.2);
	border-radius: var(--hel-radius);
	text-align: center;
}

/* No Results */
.hel-no-results {
	padding: 1.5rem;
	text-align: center;
	color: var(--hel-text-muted);
	font-size: 0.875rem;
}

/* Search Loading */
.hel-search-loading {
	padding: 1rem;
	text-align: center;
	color: var(--hel-text-muted);
	font-size: 0.875rem;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
}

.hel-search-loading::before {
	content: '';
	width: 14px;
	height: 14px;
	border: 2px solid var(--hel-border);
	border-top-color: var(--hel-primary);
	border-radius: 50%;
	animation: hel-spin 0.6s linear infinite;
}

/* Responsive */
@media (max-width: 480px) {
	.hel-container {
		padding: 1rem;
		font-size: 14px;
	}

	.hel-title {
		font-size: 1rem;
	}

	.hel-select,
	.hel-input {
		padding: 0.5rem 0.625rem;
		font-size: 16px; /* Prevents iOS zoom */
	}

	.hel-select {
		padding-right: 2rem;
	}
	
	.hel-field--loading::after {
		right: 2.25rem;
		bottom: 0.55rem;
		width: 12px;
		height: 12px;
	}
}

/* Transitions for smooth state changes */
.hel-panel {
	animation: hel-fade-in 0.15s ease;
}

.hel-select,
.hel-input {
	transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, opacity 0.15s ease;
}

/* Disabled state improvements */
.hel-select:disabled {
	color: var(--hel-text-muted);
	cursor: default;
	opacity: 0.7;
}
