/**
 * Encountrix - Frontend Styles
 * Version: 5.1.5
 */

/* Container */
.encountrix-container {
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
	border-radius: 8px;
	padding: 20px;
	color: #fff;
	max-width: 100%;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
	box-sizing: border-box;
	margin: 20px 0;
}

.encountrix-container * {
	box-sizing: border-box;
}

/* Section */
.encountrix-section {
	margin-bottom: 20px;
}

.encountrix-section:last-child {
	margin-bottom: 0;
}

/* Header */
.encountrix-header {
	border-bottom: 2px solid rgba(255, 255, 255, 0.1);
	padding-bottom: 15px;
	margin-bottom: 20px;
}

.encountrix-title .encountrix-icon {
	width: 28px;
	height: 28px;
	border-radius: 4px;
	margin-right: 8px;
	vertical-align: middle;
}

/* Difficulty Badges */
.encountrix-difficulty-badge {
	font-size: 12px;
	padding: 4px 12px;
	border-radius: 3px;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	font-weight: 600;
	color: #fff;
}

.encountrix-difficulty-badge.normal {
	background: #1eff00;
	color: #000;
}

.encountrix-difficulty-badge.heroic {
	background: #0070ff;
}

.encountrix-difficulty-badge.mythic {
	background: #a335ee;
}

/* Meta Information */
.encountrix-meta {
	display: flex;
	gap: 15px;
	font-size: 14px;
	color: rgba(255, 255, 255, 0.7);
	margin-bottom: 8px;
}

.encountrix-meta span {
	background: transparent;
	padding: 0;
	border-radius: 0;
}

/* Ranks */
.encountrix-ranks {
	display: flex;
	gap: 10px;
	font-size: 12px;
	color: rgba(255, 255, 255, 0.95);
}

.encountrix-rank {
	background: rgba(255, 255, 255, 0.1);
	padding: 3px 8px;
	border-radius: 4px;
	border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Progress Bar */
.encountrix-progress-bar {
	background: rgba(0, 0, 0, 0.3);
	border-radius: 12px;
	height: 28px;
	position: relative;
	overflow: hidden;
	margin-bottom: 20px;
	border: 1px solid rgba(255, 255, 255, 0.1);
}

.encountrix-progress-fill {
	height: 100%;
	border-radius: 11px;
	position: relative;
}

.encountrix-progress-fill.normal {
	background: linear-gradient(90deg, #4caf50, #66bb6a);
}

.encountrix-progress-fill.heroic {
	background: linear-gradient(90deg, #2196f3, #42a5f5);
}

.encountrix-progress-fill.mythic {
	background: linear-gradient(90deg, #9c27b0, #ba68c8);
}

.encountrix-progress-fill::after {
	content: '';
	position: absolute;
	inset: 0;
	background: linear-gradient(90deg,
			transparent,
			rgba(255, 255, 255, 0.2) 50%,
			transparent);
}

.encountrix-progress-text {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	font-weight: 600;
	font-size: 13px;
	text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
	color: #fff;
	z-index: 1;
}

/* Boss List */
.encountrix-boss-list {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.encountrix-boss-item {
	background: rgba(255, 255, 255, 0.05);
	border-radius: 6px;
	padding: 10px 12px;
	display: flex;
	align-items: center;
	gap: 12px;
	border: 1px solid rgba(255, 255, 255, 0.1);
	transition: all 0.2s ease;
	position: relative;
}

.encountrix-boss-item:hover {
	background: rgba(255, 255, 255, 0.08);
	transform: translateX(2px);
}

/* Boss Status Classes */
.encountrix-boss-item.defeated {
	opacity: 0.9;
	background: rgba(76, 175, 80, 0.15);
	border-color: rgba(76, 175, 80, 0.3);
}

.encountrix-boss-item.defeated .encountrix-boss-name {
	text-decoration: line-through;
	color: rgba(255, 255, 255, 0.6);
}

.encountrix-boss-item.in-progress {
	background: rgba(255, 152, 0, 0.12);
	border-color: rgba(255, 152, 0, 0.35);
}

.encountrix-boss-item.not-started {
	opacity: 0.85;
	background: rgba(100, 100, 100, 0.08);
	border-color: rgba(100, 100, 100, 0.2);
}

/* Boss Icon */
.encountrix-boss-icon {
	width: 28px;
	height: 28px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 14px;
	font-weight: 700;
	flex-shrink: 0;
	background: none;
}

.encountrix-boss-icon.encountrix-boss-portrait {
	width: 42px;
	height: 42px;
	border-radius: 6px;
	overflow: hidden;
	border: 2px solid rgba(255, 255, 255, 0.2);
	position: relative;
	background: rgba(0, 0, 0, 0.3);
}

.encountrix-boss-icon.encountrix-boss-portrait img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.encountrix-boss-icon.encountrix-boss-portrait span {
	color: rgba(255, 255, 255, 0.5);
}

/* Defeated Boss Check Mark */
.encountrix-boss-item.defeated .encountrix-boss-icon.encountrix-boss-portrait::after {
	content: '✓';
	position: absolute;
	bottom: -2px;
	right: -2px;
	width: 20px;
	height: 20px;
	background-color: #28a745;
	color: #fff;
	font-size: 12px;
	font-weight: 700;
	line-height: 20px;
	text-align: center;
	border-radius: 50%;
	border: 2px solid #1a1a2e;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

/* Boss Info */
.encountrix-boss-info {
	flex: 1;
	min-width: 0;
}

.encountrix-boss-name {
	font-weight: 500;
	margin-bottom: 4px;
	font-size: 14px;
	color: #fff;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.encountrix-boss-stats {
	font-size: 12px;
	color: rgba(255, 255, 255, 0.7);
	display: flex;
	gap: 12px;
	align-items: center;
}

.encountrix-defeated-label {
	color: #66bb6a;
	font-weight: 500;
}

.encountrix-pulls {
	color: #ffa726;
}

.encountrix-percent {
	color: #ff7043;
	font-weight: 500;
}

.encountrix-not-started {
	color: #9e9e9e;
	font-style: italic;
}

/* Rankings Table */
.encountrix-rankings-table {
	overflow-x: auto;
}

.encountrix-rankings-table table {
	width: 100%;
	border-collapse: collapse;
}

.encountrix-rankings-table th,
.encountrix-rankings-table td {
	padding: 10px 12px;
	text-align: left;
	border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.encountrix-rankings-table th {
	background: rgba(255, 255, 255, 0.08);
	font-weight: 600;
	font-size: 13px;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	color: rgba(255, 255, 255, 0.9);
}

.encountrix-rankings-table tbody tr {
	transition: background-color 0.2s ease;
}

.encountrix-rankings-table tbody tr:hover {
	background: rgba(255, 255, 255, 0.05);
}

.encountrix-rankings-table .rank {
	font-weight: 600;
	color: #ffa726;
}

.encountrix-rankings-table .guild-name {
	font-weight: 500;
}

.encountrix-rankings-table .realm {
	color: rgba(255, 255, 255, 0.7);
	font-size: 13px;
}

.encountrix-rankings-table .progress {
	font-weight: 500;
	color: #66bb6a;
}

/* Attribution */
.encountrix-attribution {
	margin-top: 16px;
	padding-top: 16px;
	border-top: 1px solid rgba(255, 255, 255, 0.1);
	text-align: center;
	color: rgba(255, 255, 255, 0.5);
	font-size: 11px;
}

/* Error Messages */
.encountrix-error,
.encountrix-error-inline {
	background: rgba(244, 67, 54, 0.1);
	border: 1px solid rgba(244, 67, 54, 0.3);
	color: #fff;
	padding: 16px;
	border-radius: 6px;
	text-align: center;
	font-weight: 500;
	font-size: 14px;
	margin: 16px 0;
}

.encountrix-error-inline {
	margin: 8px 0;
	padding: 12px;
	font-size: 13px;
}

.encountrix-header h3.encountrix-title {
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 0 0 12px;
	font-size: 18px;
	font-weight: 600;
}

.encountrix-header .encountrix-icon {
	width: 32px;
	height: 32px;
	border-radius: 6px;
	border: 2px solid rgba(255, 255, 255, 0.2);
	flex-shrink: 0;
}

.encountrix-header .encountrix-name {
	flex: 1;
	line-height: 1.2;
}

.encountrix-title {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin: 0 0 10px;
	font-size: 20px;
	font-weight: 600;
	color: #fff;
}

/* Realm selector enhancement */
input[list="realm-list"] {
	position: relative;
}

input[list="realm-list"]:focus {
	border-color: #5b9dd9;
	box-shadow: 0 0 0 1px #5b9dd9;
}

/* Raid Header with Journal Background */
.encountrix-header-container {
	margin-bottom: 20px;
}

/* Raid Header with Journal Background - Full Width */
.encountrix-header-hero {
	position: relative;
	height: 140px;
	background-size: cover;
	background-position: center;
	background-repeat: no-repeat;
	margin: -20px -20px 20px;

	/* Negative margins to break out of container padding */
	border-radius: 8px 8px 0 0;
	overflow: hidden;

	/* Establish containment context for cqi-based fluid title sizing */
	container-type: inline-size;
}

.encountrix-header-overlay {
	position: absolute;

	/* Cover the full hero area so the gradient renders correctly */
	inset: 0;
	padding: 20px;
	background: linear-gradient(to bottom,
			rgba(0, 0, 0, 0.92) 0%,
			rgba(0, 0, 0, 0.7) 45%,
			rgba(0, 0, 0, 0.15) 100%);
	display: flex;

	/* Pin the title to the top of the hero */
	align-items: flex-start;
}

.encountrix-header-title {
	margin: 0;
	color: #fff;
	text-shadow: 2px 2px 6px rgba(0, 0, 0, 0.9);
	letter-spacing: 0.5px;
	line-height: 1.2;
	overflow-wrap: break-word;
	hyphens: manual;
	width: 100%;

	/* Balance line lengths for short headings (≤ 6 lines) */
	text-wrap: balance;
}

.encountrix-header-title-text {
	display: block;

	/*
	 * Fluid font size relative to the hero container's inline (horizontal) size.
	 * Uses px boundaries — independent of theme root font-size overrides.
	 *
	 * At 1000px container: 3% × 1000 = 30px → clamped to 28px
	 * At  800px container: 3% ×  800 = 24px
	 * At  600px container: 3% ×  600 = 18px → clamped to 20px
	 * At  400px container: 3% ×  400 = 12px → clamped to 20px
	 *
	 * Minimum 20px keeps the title always larger than the guild name (18px).
	 * Falls back to vw in browsers without container query support.
	 */
	font-size: clamp(20px, 3vw, 28px);
	font-size: clamp(20px, 3cqi, 28px);
	font-weight: 700;
}

/* Simple header without background */
.encountrix-header-simple {
	padding: 15px 0;
	border-bottom: 2px solid rgba(255, 255, 255, 0.1);
	margin-bottom: 20px;

	/* Containment context for the simple header variant */
	container-type: inline-size;
}

.encountrix-header-simple .encountrix-header-title {
	margin: 0;
	font-size: clamp(20px, 3vw, 28px);
	font-size: clamp(20px, 3cqi, 28px);
	font-weight: 600;
	color: #fff;
	overflow-wrap: break-word;
	text-wrap: balance;
}

/* Responsive Design */
@media (max-width: 768px) {
	.encountrix-container {
		padding: 16px;
	}

	.encountrix-title {
		font-size: 16px;
		flex-direction: column;
		align-items: flex-start;
		gap: 8px;
	}

	.encountrix-difficulty-badge {
		margin-left: 0;
	}

	.encountrix-meta {
		flex-wrap: wrap;
	}

	.encountrix-boss-icon.encountrix-boss-portrait {
		width: 36px;
		height: 36px;
	}

	.encountrix-boss-name {
		font-size: 13px;
	}

	.encountrix-boss-stats {
		font-size: 11px;
		flex-wrap: wrap;
	}

	.encountrix-rankings-table {
		font-size: 12px;
	}

	.encountrix-rankings-table th,
	.encountrix-rankings-table td {
		padding: 8px;
	}
}

/* Dark Mode Compatibility */
@media (prefers-color-scheme: light) {
	.encountrix-container {
		background: linear-gradient(135deg, #f5f5f5 0%, #e0e0e0 100%);
		color: #333;
		box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
	}

	.encountrix-title,
	.encountrix-boss-name {
		color: #333;
	}

	.encountrix-meta,
	.encountrix-boss-stats {
		color: #666;
	}

	.encountrix-header {
		border-bottom-color: rgba(0, 0, 0, 0.1);
	}

	.encountrix-progress-bar {
		background: rgba(0, 0, 0, 0.1);
		border-color: rgba(0, 0, 0, 0.2);
	}
}

/* Print Styles */
@media print {
	.encountrix-container {
		background: none;
		color: #000;
		box-shadow: none;
		border: 1px solid #ccc;
	}

	.encountrix-difficulty-badge {
		color: #000;
		border: 1px solid #000;
		background: none !important;
	}

	.encountrix-progress-bar {
		border: 1px solid #000;
	}

	.encountrix-progress-fill::after {
		display: none;
	}
}