/* RoleSelect - Role selection popup with categories support */

/* Overlay */
.rs-overlay {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.5);
	z-index: 9999;
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.3s ease, visibility 0.3s ease;
}

.rs-overlay.rs-visible {
	opacity: 1;
	visibility: visible;
}

/* Modal */
.rs-modal {
	background: #ffffff;
	width: 560px;
	max-width: 95%;
	height: 70vh;
	max-height: 600px;
	border-radius: 12px;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
	display: flex;
	flex-direction: column;
	transform: scale(0.95);
	transition: transform 0.3s ease;
	overflow: hidden;
}

.rs-overlay.rs-visible .rs-modal {
	transform: scale(1);
}

/* Header */
.rs-header {
	padding: 20px 24px 16px;
	border-bottom: 1px solid #e5e7eb;
	flex-shrink: 0;
}

.rs-header-top {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 16px;
}

.rs-header-info {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.rs-title {
	margin: 0;
	font-size: 18px;
	font-weight: 600;
	color: #111827;
}

.rs-counter {
	font-size: 13px;
	color: #6b7280;
}

.rs-counter .rs-count {
	font-weight: 600;
	color: #3b82f6;
}

.rs-close {
	background: none;
	border: none;
	font-size: 28px;
	color: #6b7280;
	cursor: pointer;
	padding: 0;
	width: 32px;
	height: 32px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 6px;
	transition: background 0.2s, color 0.2s;
	line-height: 1;
}

.rs-close:hover {
	background: #f3f4f6;
	color: #111827;
}

/* Search */
.rs-search-container {
	width: 100%;
}

.rs-search-input {
	width: 100%;
	padding: 10px 14px;
	border: 1px solid #d1d5db;
	border-radius: 8px;
	font-size: 14px;
	outline: none;
	transition: border-color 0.2s, box-shadow 0.2s;
	box-sizing: border-box;
}

.rs-search-input:focus {
	border-color: #3b82f6;
	box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.rs-search-input::placeholder {
	color: #9ca3af;
}

/* Body */
.rs-body {
	flex: 1;
	overflow-y: auto;
	padding: 16px 24px;
}

/* Categories section */
.rs-categories-section {
	margin-bottom: 20px;
}

.rs-section-title {
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: #6b7280;
	margin-bottom: 10px;
}

.rs-categories-list {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.rs-category-btn {
	padding: 8px 14px;
	border: 1px solid #e2e8f0;
	background: white;
	border-radius: 6px;
	cursor: pointer;
	font-size: 13px;
	color: #374151;
	transition: all 0.15s;
}

.rs-category-btn:hover {
	border-color: #3b82f6;
	background: #f8fafc;
}

.rs-category-btn.rs-active {
	background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
	border-color: transparent;
	color: white;
}

/* Breadcrumb / back */
.rs-breadcrumb {
	display: none;
	align-items: center;
	gap: 8px;
	padding: 10px 14px;
	margin-bottom: 12px;
	background: #f8fafc;
	border-radius: 8px;
	cursor: pointer;
	transition: background 0.15s;
}

.rs-breadcrumb:hover {
	background: #e0f2fe;
}

.rs-breadcrumb.rs-visible {
	display: flex;
}

.rs-breadcrumb-icon {
	color: #3b82f6;
	font-size: 12px;
}

.rs-breadcrumb-categories {
	font-weight: 500;
	color: #3b82f6;
}

.rs-breadcrumb-separator {
	color: #94a3b8;
}

.rs-breadcrumb-current {
	color: #1e293b;
}

/* Roles list */
.rs-roles-section {
	margin-bottom: 16px;
}

.rs-roles-list {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.rs-role-item {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px 14px;
	background: #f9fafb;
	border-radius: 8px;
	cursor: pointer;
	transition: background 0.15s;
}

.rs-role-item:hover {
	background: #e0e7ff;
}

.rs-role-item.rs-selected {
	background: #dbeafe;
}

.rs-role-item input[type="checkbox"],
.rs-role-item input[type="radio"] {
	margin: 0;
	cursor: pointer;
	width: 16px;
	height: 16px;
	accent-color: #3b82f6;
	flex-shrink: 0;
}

.rs-role-label {
	flex: 1;
	font-size: 14px;
	color: #1e293b;
	cursor: pointer;
}

.rs-role-label mark {
	background: #fef08a;
	color: inherit;
	padding: 0 2px;
	border-radius: 2px;
}

/* Loading state */
.rs-loading {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 40px;
	color: #6b7280;
	gap: 12px;
}

.rs-loading i {
	font-size: 24px;
	color: #3b82f6;
}

/* Empty state */
.rs-empty {
	text-align: center;
	padding: 40px 20px;
	color: #9ca3af;
}

.rs-empty-icon {
	font-size: 32px;
	margin-bottom: 12px;
}

/* Footer */
.rs-footer {
	padding: 16px 24px;
	border-top: 1px solid #e5e7eb;
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-shrink: 0;
	background: white;
}

.rs-footer-left {
	display: flex;
	align-items: center;
	gap: 8px;
}

.rs-selection-info {
	font-size: 13px;
	color: #6b7280;
}

.rs-selection-value {
	font-weight: 600;
	color: #3b82f6;
}

.rs-footer-right {
	display: flex;
	gap: 10px;
}

.rs-btn {
	padding: 10px 20px;
	border-radius: 6px;
	font-size: 14px;
	font-weight: 500;
	cursor: pointer;
	transition: all 0.15s;
	border: none;
	outline: none;
}

.rs-btn-reset {
	background: transparent;
	color: #6b7280;
	border: 1px solid #d1d5db;
}

.rs-btn-reset:hover {
	background: #f9fafb;
	color: #374151;
	border-color: #9ca3af;
}

.rs-btn-apply {
	background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
	color: white;
	box-shadow: 0 1px 3px rgba(99, 102, 241, 0.3);
}

.rs-btn-apply:hover {
	box-shadow: 0 2px 6px rgba(99, 102, 241, 0.4);
}

.rs-btn-apply:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

/* Scrollbar */
.rs-body::-webkit-scrollbar {
	width: 6px;
}

.rs-body::-webkit-scrollbar-track {
	background: #f3f4f6;
}

.rs-body::-webkit-scrollbar-thumb {
	background: #d1d5db;
	border-radius: 3px;
}

.rs-body::-webkit-scrollbar-thumb:hover {
	background: #9ca3af;
}

/* Responsive */
@media (max-width: 640px) {
	.rs-modal {
		height: 85vh;
		max-height: none;
		border-radius: 12px 12px 0 0;
	}

	.rs-categories-list {
		gap: 6px;
	}

	.rs-category-btn {
		padding: 6px 10px;
		font-size: 12px;
	}
}
