/* ========================================
   FILTER PANEL
   ======================================== */

.filter-panel {
	background: var(--bg-secondary);
	border: 2px solid var(--accent-danger); /* use admin red border for all users */
	box-shadow: 0 4px 14px rgba(255, 71, 87, 0.06);
	border-radius: var(--radius-lg);
	margin-bottom: 1.5rem;
	overflow: visible; /* allow custom option lists to overflow */
}

.filter-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 1.25rem 1.5rem; /* match volunteers panel spacing */
	font-size: 1rem; /* match volunteers panel */
	font-weight: 600;
	color: var(--text-primary);
	cursor: pointer;
	transition: all 0.2s ease;
}

.filter-header:hover {
	background: var(--bg-tertiary);
}

.filter-header span {
	display: flex;
	align-items: center;
	gap: 0.75rem; /* match volunteers title gap */
}

.filter-chevron {
	transition: transform 0.3s ease;
	opacity: 0.6;
	font-size: 0.9rem; /* match panel chevron size */
}

.filter-chevron.collapsed {
	transform: rotate(-90deg);
}

.filter-active-indicator {
	display: inline-block;
	width: 8px;
	height: 8px;
	background: var(--accent-primary);
	border-radius: 50%;
	margin-left: 0.25rem;
}

.filter-content {
	padding: 0 1.25rem 1.25rem;
	display: flex;
	flex-direction: column;
	gap: 1rem;
	transition:
		max-height 0.3s ease,
		opacity 0.3s ease,
		padding 0.3s ease;
	max-height: 1000px;
	opacity: 1;
}

.filter-content.collapsed {
	max-height: 0 !important;
	padding: 0 1.25rem !important;
	opacity: 0;
	pointer-events: none;
	overflow: hidden;
}

.filter-row {
	display: flex;
	gap: 1rem;
	flex-wrap: wrap;
	align-items: center;
}

.filter-search {
	flex: 1;
	min-width: 200px;
}

.filter-search input {
	padding-left: 1rem;
	background: var(--bg-tertiary);
	border: 1px solid var(--border-primary);
	color: var(--text-primary);
}

.filter-search input:focus {
	background: var(--bg-tertiary);
	border-color: var(--accent-primary);
	box-shadow: 0 0 0 2px rgba(0, 255, 136, 0.15);
	color: var(--text-primary);
}

.filter-search input::placeholder {
	color: var(--text-muted);
}

/* Filter row specific select sizing */
.filter-row .form-select {
	min-width: 150px;
	max-width: 200px;
}

/* Filter selects row - keep both dropdowns on one line */
.filter-selects-row {
	flex-wrap: nowrap;
}

.filter-selects-row .form-select {
	flex: 1;
	min-width: 0;
	max-width: none;
}

/* Make filter selects visually match the admin modal dropdowns */
.filter-panel .form-select,
.filter-row .form-select {
	padding: 0.6rem 0.875rem;
	background: var(--bg-primary);
	border: 1px solid var(--border-primary);
	border-radius: 8px;
	color: var(--text-primary);
	font-size: 0.9rem;
	transition: all 0.2s ease;
	appearance: none;
	-webkit-appearance: none;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3 6l5 5 5-5' stroke='%23a0a0a0' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 12px center;
	background-size: 12px;
}

.filter-panel .form-select:focus,
.filter-row .form-select:focus {
	outline: none;
	border-color: var(--accent-primary);
	box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.15);
}

@media (max-width: 1100px) {
	.filter-selects-row {
		flex-wrap: wrap;
	}
}

@media (max-width: 480px) {
	.filter-selects-row {
		flex-wrap: wrap;
	}
	.filter-selects-row .form-select {
		min-width: 100%;
	}
}

.filter-toggles {
	display: flex;
	gap: 0.75rem;
	flex-wrap: wrap;
}

/* Redesigned toggle buttons: clean card with left square indicator and centered check */
.filter-toggle {
	position: relative;
	display: inline-flex;
	align-items: center;
	gap: 0.75rem;
	padding: 0.6rem 0.875rem;
	padding-left: 48px; /* space for indicator */
	min-height: 44px;
	background: var(--bg-elevated);
	border: 1px solid var(--border-primary);
	border-radius: 10px;
	cursor: pointer;
	font-size: 0.95rem;
	color: var(--text-secondary);
	transition: all var(--transition-fast);
}

.filter-toggle:hover {
	transform: translateY(-1px);
	border-color: var(--border-secondary);
	color: var(--text-primary);
}

/* left square indicator */
.filter-toggle::before {
	content: "";
	position: absolute;
	left: 14px;
	top: 50%;
	transform: translateY(-50%);
	width: 20px;
	height: 20px;
	border: 2px solid var(--border-color);
	border-radius: 6px;
	background: transparent;
	box-sizing: border-box;
}

/* centered check mark inside the square when active */
.filter-toggle::after {
	content: "";
	position: absolute;
	left: 14px;
	top: 50%;
	transform: translateY(-50%);
	width: 20px;
	height: 20px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 12px;
	color: var(--bg-primary);
}

.filter-toggle.active {
	background: rgba(0, 255, 136, 0.08);
	border-color: var(--accent-primary);
	color: var(--accent-primary);
}

.filter-toggle.active::before {
	background: var(--accent-primary);
	border-color: var(--accent-primary);
}

.filter-toggle.active::after {
	content: "✓";
}

/* Different active colors for filter toggles (variants) */
.filter-toggle-green.active {
	background: rgba(0, 255, 136, 0.12);
	border-color: #00ff88;
	color: #00ff88;
}

.filter-toggle-cyan.active {
	background: rgba(0, 212, 255, 0.12);
	border-color: #00d4ff;
	color: #00d4ff;
}

.filter-toggle input {
	display: none;
}

.filter-toggle.disabled {
	opacity: 0.45;
	cursor: not-allowed;
	pointer-events: none;
	background: var(--bg-tertiary);
	border-color: var(--border-primary);
	color: var(--text-muted);
}

.filter-toggle.disabled:hover {
	transform: none;
	border-color: var(--border-primary);
	color: var(--text-muted);
}

.filter-role-tag {
	display: inline-flex;
	align-items: center;
	padding: 0.35rem 0.75rem;
	background: var(--bg-tertiary);
	border: 1px solid var(--border-primary);
	border-radius: 20px;
	cursor: pointer;
	font-size: 0.8rem;
	color: var(--text-secondary);
	transition: all 0.2s ease;
}

.filter-role-tag:hover {
	border-color: var(--border-secondary);
	color: var(--text-primary);
}

.filter-role-tag.active {
	background: rgba(0, 212, 255, 0.1);
	border-color: var(--accent-secondary);
	color: var(--accent-secondary);
}

.filter-role-tag input {
	display: none;
}

.filter-actions {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding-top: 0.5rem;
	border-top: 1px solid var(--border-primary);
}

.filter-count {
	font-size: 0.85rem;
	color: var(--text-muted);
}

/* ========================================
   TIME RANGE FILTER
   ======================================== */

.filter-datetime-row {
	gap: 1rem;
}

.filter-datetime-row .form-select {
	min-width: 150px;
	flex: 1;
}

.filter-time-row {
	display: flex;
	gap: 1rem;
	align-items: center;
	flex-wrap: wrap;
}

.time-range {
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.time-range label {
	color: var(--text-muted);
	font-size: 0.85rem;
	display: flex;
	align-items: center;
	gap: 0.35rem;
}

.filter-datetime {
	padding: 0.5rem 0.75rem;
	background: var(--bg-tertiary);
	color: var(--text-primary);
	border: 1px solid var(--border-primary);
	border-radius: 8px;
	font-size: 0.9rem;
	width: 110px;
	transition: all 0.2s ease;
}

.filter-datetime:focus {
	outline: none;
	border-color: var(--accent-primary);
	box-shadow: 0 0 0 2px rgba(0, 255, 136, 0.15);
}

.filter-datetime::-webkit-calendar-picker-indicator {
	filter: invert(1);
	cursor: pointer;
}

/* ========================================
   RESPONSIVE FILTER ADJUSTMENTS
   ======================================== */

@media (max-width: 768px) {
	.filter-row {
		flex-direction: column;
		align-items: stretch;
	}

	.filter-search {
		min-width: 100%;
	}

	.filter-row .form-select {
		max-width: 100%;
	}

	.filter-datetime-row {
		flex-direction: column;
	}

	.filter-datetime-row .form-select {
		flex: 1;
		min-width: 100%;
		max-width: 100%;
	}

	.filter-time-row {
		flex-direction: row;
		flex-wrap: wrap;
		justify-content: flex-start;
	}

	.time-range {
		flex: 0 0 auto;
	}

	.filter-datetime {
		width: 110px;
	}

	/* Keep the indicator aligned with the base styles but slightly smaller radius on narrow screens.
	   Preserve left padding so the square indicator doesn't overlap the icon/text. */
	.filter-toggle {
		padding: 0.35rem 0.6rem 0.35rem 48px;
		font-size: 0.8rem;
		padding-left: 48px;
	}

	.filter-toggle::before {
		content: "";
		width: 20px;
		height: 20px;
		border: 2px solid var(--border-color);
		border-radius: 4px;
		display: inline-block;
		flex-shrink: 0;
		background: transparent;
		position: absolute;
		left: 14px; /* keep same anchor as desktop */
		top: 50%;
		transform: translateY(-50%);
	}

	.filter-toggle.active::before {
		background: var(--accent-primary);
		border-color: var(--accent-primary);
	}

	/* Place the check mark exactly over the indicator using the same left/size
	   and flex centering so it remains visually centered on all breakpoints */
	.filter-toggle::after {
		content: "";
		position: absolute;
		left: 14px;
		top: 50%;
		width: 20px;
		height: 20px;
		display: flex;
		align-items: center;
		justify-content: center;
		transform: translateY(-50%);
		font-size: 12px;
		color: var(--bg-primary);
	}

	.filter-toggle.active::after {
		content: "✓";
	}
}

.filter-label {
	width: 100%;
	margin-bottom: 0.25rem;
}

@media (max-width: 480px) {
	.filter-toggle {
		min-width: 100%;
	}

	.filter-time-row {
		flex-direction: column;
	}

	.time-range {
		width: 100%;
		justify-content: flex-start;
	}

	.filter-datetime {
		flex: 1;
		width: auto;
	}

	.filter-role-tag {
		flex: 0 0 auto;
		min-width: auto;
	}
}
