/**
 * Agent Grid Styles
 * Responsive grid layout, filters, search, and pagination
 * @version 1.0.0
 */

/* ========================================
   Grid Wrapper
   ======================================== */

/* ========================================
   Grid Wrapper - Full width layout with filters on top
   ======================================== */

.bx-agent-grid-wrapper {
	display: flex;
	flex-direction: column;
	gap: 2.5rem;
	width: 100%;
	max-width: 1280px;
	margin: 0 auto;
	padding: 0 1.5rem;
}

@media (max-width: 767px) {
	.bx-agent-grid-wrapper {
		gap: 2rem;
		padding: 0 1rem;
	}
}

@media (min-width: 1440px) {
	.bx-agent-grid-wrapper {
		padding: 0 2rem;
	}
}

/* ========================================
   Grid Layout - Responsive columns for cards
   ======================================== */

.agent-grid-container,
.bx-agent-grid {
	display: grid;
	gap: 1.75rem;
	width: 100%;
	grid-template-columns: 1fr;
}

@media (min-width: 768px) {
	.agent-grid-container,
	.bx-agent-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (min-width: 1024px) {
	.agent-grid-container,
	.bx-agent-grid {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

@media (min-width: 1440px) {
	.agent-grid-container,
	.bx-agent-grid {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}
}

/* ========================================
   Empty State
   ======================================== */

.agent-grid-empty {
	grid-column: 1 / -1;
	text-align: center;
	padding: 4rem 2rem;
	background: white;
	border-radius: 12px;
	border: 2px dashed #e5e7eb;
}

.agent-grid-empty .empty-icon {
	font-size: 4rem;
	margin-bottom: 1rem;
	opacity: 0.5;
}

.agent-grid-empty h3 {
	font-size: 1.5rem;
	color: #111827;
	margin-bottom: 0.5rem;
}

.agent-grid-empty p {
	font-size: 1rem;
	color: #6b7280;
	margin-bottom: 1.5rem;
}

.btn-clear-filters {
	padding: 0.75rem 1.5rem;
	background: #3b82f6;
	color: white;
	border: none;
	border-radius: 8px;
	font-size: 1rem;
	font-weight: 500;
	cursor: pointer;
	transition: all 0.2s;
}

.btn-clear-filters:hover {
	background: #2563eb;
	transform: translateY(-2px);
}

.btn-clear-filters:active {
	transform: translateY(0);
}

/* ========================================
   Error State
   ======================================== */

.agent-grid-error {
	grid-column: 1 / -1;
	text-align: center;
	padding: 4rem 2rem;
	background: #fef2f2;
	border-radius: 12px;
	border: 2px solid #fca5a5;
}

.agent-grid-error .error-icon {
	font-size: 4rem;
	margin-bottom: 1rem;
}

.agent-grid-error h3 {
	font-size: 1.5rem;
	color: #991b1b;
	margin-bottom: 0.5rem;
}

.agent-grid-error p {
	font-size: 1rem;
	color: #dc2626;
	margin-bottom: 1.5rem;
}

.btn-retry {
	padding: 0.75rem 1.5rem;
	background: #dc2626;
	color: white;
	border: none;
	border-radius: 8px;
	font-size: 1rem;
	font-weight: 500;
	cursor: pointer;
	transition: all 0.2s;
}

.btn-retry:hover {
	background: #b91c1c;
	transform: translateY(-2px);
}

.btn-retry:active {
	transform: translateY(0);
}

/* ========================================
   Pagination
   ======================================== */

.agent-grid-pagination {
	grid-column: 1 / -1;
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 0.5rem;
	margin-top: 2rem;
	padding-top: 2rem;
	border-top: 1px solid #e5e7eb;
}

.pagination-btn,
.pagination-number {
	padding: 0.75rem 1rem;
	background: white;
	border: 1px solid #d1d5db;
	border-radius: 8px;
	font-size: 0.875rem;
	font-weight: 500;
	color: #374151;
	cursor: pointer;
	transition: all 0.2s;
}

.pagination-btn:hover:not(:disabled),
.pagination-number:hover:not(.active) {
	background: #f3f4f6;
	border-color: #9ca3af;
}

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

.pagination-number.active {
	background: #3b82f6;
	color: white;
	border-color: #3b82f6;
}

.pagination-numbers {
	display: flex;
	gap: 0.5rem;
}

/* Mobile pagination adjustments */
@media (max-width: 767px) {
	.pagination-btn,
	.pagination-number {
		padding: 0.5rem 0.75rem;
		font-size: 0.8rem;
	}

	.pagination-prev::before {
		content: "←";
		margin-right: 0.25rem;
	}

	.pagination-next::after {
		content: "→";
		margin-left: 0.25rem;
	}
}

/* ========================================
   Filter Controls Container
   ======================================== */

.filter-controls {
	background: white;
	border-radius: 12px;
	padding: 1.5rem;
	margin-bottom: 2rem;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.filter-controls-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 1.5rem;
}

.filter-controls-title {
	font-size: 1.25rem;
	font-weight: 600;
	color: #111827;
	margin: 0;
}

.filter-controls-clear {
	padding: 0.5rem 1rem;
	background: transparent;
	border: 1px solid #d1d5db;
	border-radius: 6px;
	font-size: 0.875rem;
	color: #6b7280;
	cursor: pointer;
	transition: all 0.2s;
}

.filter-controls-clear:hover {
	background: #f3f4f6;
	border-color: #9ca3af;
}

/* ========================================
   Search Box
   ======================================== */

.filter-search {
	position: relative;
	margin-bottom: 1.5rem;
}

.filter-search-input {
	width: 100%;
	padding: 0.875rem 1rem 0.875rem 3rem;
	border: 2px solid #e5e7eb;
	border-radius: 8px;
	font-size: 1rem;
	color: #111827;
	transition: all 0.2s;
}

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

.filter-search-icon {
	position: absolute;
	left: 1rem;
	top: 50%;
	transform: translateY(-50%);
	color: #9ca3af;
	font-size: 1.25rem;
	pointer-events: none;
}

/* ========================================
   Filter Groups
   ======================================== */

.filter-groups {
	display: grid;
	gap: 0.75rem;
}

@media (min-width: 768px) {
	.filter-groups {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (min-width: 1024px) {
	.filter-groups {
		grid-template-columns: repeat(4, 1fr);
	}
}

.filter-group {
	display: flex;
	flex-direction: column;
	border-bottom: none;
	padding-bottom: 0.5rem;
	margin-bottom: 0.5rem;
}

.filter-group:last-child {
	border-bottom: none;
	margin-bottom: 0;
}

.filter-group-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	cursor: pointer;
	user-select: none;
	gap: 0.5rem;
	min-height: auto;
}

.filter-group-label {
	font-size: 0.9375rem;
	font-weight: 600;
	color: #1f2937;
	margin: 0;
	line-height: 1.2;
}

.filter-group-toggle {
	background: none;
	border: none;
	padding: 0;
	cursor: pointer;
	color: #6b7280;
	font-size: 1.25rem;
	line-height: 1;
	transition: all 0.2s;
	border-radius: 4px;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 1.5rem;
	height: 1.5rem;
}

.filter-group-toggle:hover {
	background: #f3f4f6;
	color: #374151;
}

/* ========================================
   Filter Tag Buttons (shadcn/ui style)
   ======================================== */

.filter-group-options {
	display: flex;
	flex-wrap: nowrap;
	gap: 0.5rem;
	margin-top: 0.5rem;
	overflow-x: auto;
	overflow-y: hidden;
	transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
	padding-bottom: 0.25rem;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: thin;
	scrollbar-color: #d1d5db #f3f4f6;
}

.filter-group-options::-webkit-scrollbar {
	height: 6px;
}

.filter-group-options::-webkit-scrollbar-track {
	background: #f3f4f6;
	border-radius: 3px;
}

.filter-group-options::-webkit-scrollbar-thumb {
	background: #d1d5db;
	border-radius: 3px;
}

.filter-group-options::-webkit-scrollbar-thumb:hover {
	background: #9ca3af;
}

.filter-group-options[data-expanded="false"] {
	max-height: 0 !important;
	margin-top: 0 !important;
	opacity: 0;
}

.filter-tag-button {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.375rem 0.75rem;
	border: 1.5px solid #e5e7eb;
	border-radius: 8px;
	background: white;
	font-size: 0.875rem;
	font-weight: 500;
	color: #374151;
	cursor: pointer;
	transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
	user-select: none;
	outline: none;
	white-space: nowrap;
}

.filter-tag-button:hover {
	background: #f9fafb;
	border-color: #9ca3af;
	transform: translateY(-1px);
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.filter-tag-button:active {
	transform: translateY(0);
	box-shadow: none;
}

.filter-tag-button.active {
	background: white;
	border-color: #1f2937;
	color: #1f2937;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.filter-tag-button.active:hover {
	background: #f9fafb;
	border-color: #111827;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.filter-tag-label {
	line-height: 1.2;
	font-weight: 500;
}

.filter-tag-count {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 1.375rem;
	height: 1.375rem;
	padding: 0 0.4rem;
	background: #f3f4f6;
	color: #6b7280;
	border-radius: 12px;
	font-size: 0.6875rem;
	font-weight: 700;
	line-height: 1;
	letter-spacing: -0.01em;
}

.filter-tag-button.active .filter-tag-count {
	background: #1f2937;
	color: white;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.filter-option-hidden {
	display: none;
}

.filter-show-more {
	background: none;
	border: none;
	color: #3b82f6;
	font-size: 0.875rem;
	font-weight: 500;
	padding: 0.5rem 0.75rem;
	cursor: pointer;
	text-align: left;
	border-radius: 6px;
	transition: all 0.2s;
	margin-top: 0.25rem;
	width: 100%;
}

.filter-show-more:hover {
	background: #eff6ff;
	color: #2563eb;
}

/* ========================================
   Active Filters Display
   ======================================== */

.active-filters {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin-top: 1rem;
	padding-top: 1rem;
	border-top: 1px solid #e5e7eb;
}

.active-filter-tag {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.375rem 0.75rem;
	background: #eff6ff;
	border: 1px solid #bfdbfe;
	border-radius: 6px;
	font-size: 0.875rem;
	color: #1e40af;
}

.active-filter-tag-close {
	background: none;
	border: none;
	color: #3b82f6;
	cursor: pointer;
	padding: 0;
	font-size: 1rem;
	line-height: 1;
	transition: color 0.2s;
}

.active-filter-tag-close:hover {
	color: #1e40af;
}

/* ========================================
   Sort Controls
   ======================================== */

.sort-controls {
	display: flex;
	align-items: center;
	gap: 1rem;
	margin-bottom: 1.5rem;
}

.sort-label {
	font-size: 0.875rem;
	font-weight: 500;
	color: #374151;
}

.sort-select {
	padding: 0.625rem 1rem;
	border: 1px solid #d1d5db;
	border-radius: 6px;
	font-size: 0.875rem;
	color: #374151;
	background: white;
	cursor: pointer;
	transition: all 0.2s;
}

.sort-select:hover {
	border-color: #9ca3af;
}

.sort-select:focus {
	outline: none;
	border-color: #3b82f6;
	box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* ========================================
   Results Count
   ======================================== */

.results-count {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 1rem;
	padding: 1rem;
	background: #f9fafb;
	border-radius: 8px;
}

.results-count-text {
	font-size: 0.875rem;
	color: #6b7280;
}

.results-count-number {
	font-weight: 600;
	color: #111827;
}

/* ========================================
   Loading State
   ======================================== */

.agent-grid-loading {
	grid-column: 1 / -1;
	text-align: center;
	padding: 4rem 2rem;
}

.loading-spinner {
	width: 48px;
	height: 48px;
	border: 4px solid #e5e7eb;
	border-top-color: #3b82f6;
	border-radius: 50%;
	animation: spin 1s linear infinite;
	margin: 0 auto 1rem;
}

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

.loading-text {
	font-size: 1rem;
	color: #6b7280;
}

/* ========================================
   Accessibility
   ======================================== */

/* Focus visible styles */
.pagination-btn:focus-visible,
.pagination-number:focus-visible,
.filter-option-input:focus-visible,
.sort-select:focus-visible,
.filter-search-input:focus-visible {
	outline: 2px solid #3b82f6;
	outline-offset: 2px;
}

/* Screen reader only */
.sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border-width: 0;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
	.pagination-btn,
	.pagination-number,
	.filter-option,
	.sort-select,
	.filter-search-input,
	.btn-clear-filters,
	.btn-retry,
	.loading-spinner {
		transition: none;
		animation: none;
	}
}

/* ========================================
   Print Styles
   ======================================== */

@media print {
	.filter-controls,
	.sort-controls,
	.agent-grid-pagination {
		display: none;
	}

	.agent-grid-wrapper {
		grid-template-columns: repeat(2, 1fr);
		gap: 1rem;
	}
}
