:host {
	// Container for the participant item
	.participant-container {
		position: relative;
		display: flex;
		align-items: center;
		padding: 12px 16px;
		border-radius: var(--ov-surface-radius, 8px);
		background-color: var(--ov-surface-color);
		border-bottom: 1px solid var(--ov-border-color);
		transition: all 0.2s ease-in-out;
		min-height: 64px;

		// &:hover {
		// 	background-color: var(--ov-surface-hover, #f5f5f5);
		// 	transform: translateY(-1px);
		// 	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
		// }

		&:last-child {
			border-bottom: none;
		}

		// Loading state
		&.loading {
			opacity: 0.7;
			pointer-events: none;

			&::after {
				content: '';
				position: absolute;
				top: 50%;
				right: 16px;
				width: 16px;
				height: 16px;
				border: 2px solid var(--ov-primary-color, #1976d2);
				border-radius: 50%;
				border-top-color: transparent;
				animation: spin 1s linear infinite;
			}
		}

		// Focus state for keyboard navigation
		&:focus-within {
			outline: 2px solid var(--ov-primary-color, #1976d2);
			outline-offset: 2px;
		}
	}

	// Avatar styling with improved design
	.participant-avatar {
		display: flex;
		align-items: center;
		justify-content: center;
		width: 40px;
		height: 40px;
		border-radius: var(--ov-surface-radius);
		margin-right: 12px;
		padding: 0;
		color: var(--ov-text-primary-color);
		font-weight: 500;
		flex-shrink: 0;
		position: relative;
		overflow: hidden;

		mat-icon {
			font-size: 20px;
			width: 20px;
			height: 20px;
			z-index: 1;
		}
	}

	// Main content area
	.participant-content {
		flex: 1;
		display: flex;
		flex-direction: column;
		min-width: 0; // Allows text truncation
		margin-right: 8px;
	}

	// Participant name row container
	.participant-name-row {
		display: flex;
		align-items: center;
		justify-content: space-between;
		width: 100%;
		margin: 0;
		gap: 4px;
		min-height: 20px;
	}

	// Participant name styling with overflow control
	.participant-name {
		display: flex;
		align-items: center;
		gap: 6px;
		flex: 1;
		min-width: 0;
		max-width: 100%;

		.participant-name-text {
			font-weight: 600 !important;
			font-size: 14px;
			line-height: 1.2;
			color: var(--ov-text-surface-color);
			white-space: nowrap;
			overflow: hidden;
			text-overflow: ellipsis;
			flex: 1;
			min-width: 0;
		}

		// Local participant indicator
		.local-indicator {
			font-size: 10px;
			font-weight: 600;
			color: var(--ov-text-surface-color);
			background-color: var(--ov-surface-color);
			padding: 4px 8px;
			border-radius: var(--ov-surface-radius);
			text-transform: uppercase;
			letter-spacing: 0.5px;
			flex-shrink: 0;
			border: 1px solid var(--ov-accent-action-color);
			white-space: nowrap;
		}
	}

	// Subtitle styling
	.participant-subtitle {
		font-style: normal;
		font-size: 12px !important;
		font-weight: 400;
		margin: 0;
		color: var(--ov-text-secondary-color);
		line-height: 1.3;
		display: flex;
		align-items: center;
		gap: 6px;
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;

		// Status indicators
		.status-indicator {
			display: inline-flex;
			align-items: center;
			gap: 3px;

			mat-icon {
				font-size: 12px;
				width: 12px;
				height: 12px;
			}

			// Different colors for different statuses
			&.camera-on {
				color: var(--ov-success-color, #4caf50);
			}

			&.camera-off {
				color: var(--ov-warning-color, #ff9800);
			}

			&.microphone-muted {
				color: var(--ov-error-color, #d32f2f);
			}
		}
	}

	// Action buttons container
	.participant-action-buttons {
		display: flex;
		align-items: center;
		gap: 4px;
		flex-shrink: 0;
		margin-left: auto;
	}

	// Mute button styling
	#mute-btn {
		width: 32px;
		height: 32px;
		border-radius: 50%;
		color: var(--ov-text-secondary, #757575);
		background-color: transparent;
		transition: all 0.2s ease-in-out;
		display: flex;
		align-items: center;
		justify-content: center;
		position: relative;

		&:hover {
			background-color: var(--ov-surface-hover, #f5f5f5);
			color: var(--ov-text-primary, #212121);
			transform: scale(1.1);
		}

		&:focus {
			outline: 2px solid var(--ov-primary-color, #1976d2);
			outline-offset: 2px;
		}

		&:disabled {
			opacity: 0.5;
			pointer-events: none;
		}

		&.warn-btn {
			color: var(--ov-error-color, #d32f2f);
			background-color: var(--ov-error-light, #ffebee);

			&:hover {
				background-color: var(--ov-error-color, #d32f2f);
				color: #ffffff;
			}

			// Pulsing animation for muted state
			animation: pulse 2s infinite;
		}

		mat-icon {
			font-size: 18px;
			width: 18px;
			height: 18px;
		}
	}

	// Participant badges container
	.participant-badges {
		display: flex;
		align-items: center;
		gap: 4px;
		flex-shrink: 0;
		max-width: 80px; // Limit badges width
		overflow: hidden;

		// Badge styling
		::ng-deep .badge {
			flex-shrink: 0;
			white-space: nowrap;
			overflow: hidden;
			text-overflow: ellipsis;
			max-width: 60px;

			// Badge variants
			&.moderator {
				color: var(--ov-warning-color, #f57c00);
			}

			&.speaker {
				color: var(--ov-primary-color, #1976d2);
			}

			&.host {
				color: var(--ov-success-color, #4caf50);
			}
		}
	}

	// After local participant content area
	.after-local-content {
		margin-top: 12px;
		padding-top: 12px;
		border-top: 1px solid var(--ov-surface-border, #e0e0e0);
		animation: fadeIn 0.3s ease-in-out;
		background-color: var(--ov-surface-alt, #fafafa);
		border-radius: var(--ov-surface-radius, 8px);
		padding: 12px;
	}

	// External item elements styling
	.external-elements {
		display: flex;
		align-items: center;
		gap: 4px;

		// Custom styling for external buttons
		::ng-deep button {
			transition: all 0.2s ease-in-out;

			&:hover {
				transform: scale(1.05);
			}
		}
	}

	// Material Design overrides for better integration
	mat-list {
		padding: 0;
	}

	::ng-deep .mat-mdc-list-item {
		height: auto !important;
		padding: 0 !important;
		min-height: auto !important;
		border-radius: var(--ov-surface-radius, 8px);
	}

	::ng-deep .mdc-list-item__content {
		padding: 0 !important;
		align-self: stretch !important;
		width: 100%;
	}

	::ng-deep .mat-mdc-list-base {
		--mat-list-list-item-hover-label-text-color: unset;
		--mat-list-list-item-hover-leading-icon-color: unset;
		padding: 0;
	}

	::ng-deep .mat-mdc-list-item:hover {
		background-color: transparent !important;
	}

	// Animations
	@keyframes fadeIn {
		from {
			opacity: 0;
			transform: translateY(-8px);
		}
		to {
			opacity: 1;
			transform: translateY(0);
		}
	}

	@keyframes spin {
		from {
			transform: rotate(0deg);
		}
		to {
			transform: rotate(360deg);
		}
	}

	@keyframes pulse {
		0%,
		100% {
			transform: scale(1);
		}
		50% {
			transform: scale(1.05);
		}
	}

	// Responsive design
	@media (max-width: 768px) {
		.participant-container {
			padding: 10px 12px;
			min-height: 56px;
		}

		.participant-avatar {
			width: 36px;
			height: 36px;
			margin-right: 10px;

			mat-icon {
				font-size: 18px;
				width: 18px;
				height: 18px;
			}

			&::after {
				width: 10px;
				height: 10px;
				bottom: 1px;
				right: 1px;
			}
		}

		.participant-name {
			max-width: calc(100% - 60px); // Less space on mobile

			.participant-name-text {
				font-size: 13px;
			}

			.local-indicator {
				font-size: 9px;
				padding: 2px 6px;
			}
		}

		.participant-badges {
			max-width: 60px;
		}

		.participant-subtitle {
			font-size: 11px !important;
		}

		#mute-btn {
			width: 28px;
			height: 28px;

			mat-icon {
				font-size: 16px;
				width: 16px;
				height: 16px;
			}
		}

		.after-local-content {
			margin-top: 10px;
			padding-top: 10px;
			padding: 10px;
		}
	}

	// High contrast mode support
	@media (prefers-contrast: high) {
		.participant-container {
			border: 2px solid var(--ov-text-primary, #212121);
		}

		.participant-avatar {
			border: 2px solid var(--ov-surface-background, #ffffff);
		}

		.local-indicator {
			border-width: 2px;
		}
	}

	// Reduced motion support
	@media (prefers-reduced-motion: reduce) {
		.participant-container,
		.participant-avatar,
		#mute-btn,
		.after-local-content,
		.external-elements ::ng-deep button {
			transition: none;
			animation: none;
		}

		.participant-container:hover {
			transform: none;
		}

		.participant-avatar:hover,
		#mute-btn:hover,
		.external-elements ::ng-deep button:hover {
			transform: none;
		}

		#mute-btn.warn-btn {
			animation: none;
		}
	}

	// Dark theme support
	@media (prefers-color-scheme: dark) {
		.participant-container {
			background-color: var(--ov-surface-background, #424242);
			border-bottom-color: var(--ov-surface-border, #616161);

			&:hover {
				background-color: var(--ov-surface-hover, #484848);
			}
		}

		.participant-name {
			color: var(--ov-text-primary, #ffffff);
		}

		.participant-subtitle {
			color: var(--ov-text-secondary, #cccccc);
		}

		.after-local-content {
			background-color: var(--ov-surface-alt, #373737);
		}
	}
}
