/**
 * Reference Advanced Filters Widget Styles
 * 
 * Mobile-first responsive design for price, date, and tag filters
 * Beautiful UI with smooth transitions
 * 
 * @package GRPCMedia
 * @since 1.0.0
 */

/* ===== CONTAINER ===== */
.reference-advanced-filters {
	background: #ffffff;
	border-radius: 8px;
	padding: 30px;
	box-shadow: 0 2px 15px rgba(0, 0, 0, 0.08);
	margin-bottom: 30px;
}

/* ===== TITLE ===== */
.reference-advanced-filters .filter-title {
	margin: 0 0 25px 0;
	font-size: 20px;
	font-weight: 700;
	color: #333333;
	padding-bottom: 15px;
	border-bottom: 2px solid #f0f0f0;
	display: flex;
	align-items: center;
	gap: 10px;
}

.reference-advanced-filters .filter-title::before {
	content: '';
	display: inline-block;
	width: 4px;
	height: 24px;
	background: linear-gradient(to bottom, #2F2483, #005a8a);
	border-radius: 2px;
}

/* ===== FILTER GROUPS ===== */
.reference-advanced-filters .filter-groups {
	display: flex;
	flex-direction: column;
	gap: 25px;
	margin-bottom: 25px;
}

.filter-group {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.filter-group-label {
	font-size: 14px;
	font-weight: 600;
	color: #666666;
	display: flex;
	align-items: center;
	gap: 6px;
}

.filter-group-label::before {
	content: '•';
	color: #2F2483;
	font-size: 18px;
	line-height: 1;
}

/* ===== PRICE FILTER ===== */
.price-range-slider {
	position: relative;
	height: 6px;
	background: #e0e0e0;
	border-radius: 3px;
	margin: 10px 0;
}

.price-range-slider input[type="range"] {
	position: absolute;
	width: 100%;
	height: 6px;
	top: 0;
	left: 0;
	pointer-events: none;
	-webkit-appearance: none;
	appearance: none;
	background: transparent;
	outline: none;
}

.price-range-slider input[type="range"]::-webkit-slider-thumb {
	-webkit-appearance: none;
	appearance: none;
	width: 20px;
	height: 20px;
	background: #2F2483;
	border: 3px solid #ffffff;
	border-radius: 50%;
	cursor: pointer;
	pointer-events: all;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
	transition: all 0.2s ease;
}

.price-range-slider input[type="range"]::-webkit-slider-thumb:hover {
	background: #005a8a;
	transform: scale(1.15);
	box-shadow: 0 4px 12px rgba(47, 36, 131, 0.4);
}

.price-range-slider input[type="range"]::-moz-range-thumb {
	width: 20px;
	height: 20px;
	background: #2F2483;
	border: 3px solid #ffffff;
	border-radius: 50%;
	cursor: pointer;
	pointer-events: all;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
	transition: all 0.2s ease;
}

.price-range-slider input[type="range"]::-moz-range-thumb:hover {
	background: #005a8a;
	transform: scale(1.15);
	box-shadow: 0 4px 12px rgba(47, 36, 131, 0.4);
}

/* Price values display */
.price-range-values {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	font-size: 14px;
	font-weight: 600;
	color: #333333;
	margin-top: 5px;
}

.price-separator {
	color: #999999;
}

/* ===== DATE FILTER ===== */
.date-range-inputs,
.date-year,
.date-month {
	display: flex;
	gap: 10px;
	align-items: center;
}

.date-range-inputs input[type="date"],
.date-year,
.date-month {
	flex: 1;
	padding: 10px 14px;
	border: 1px solid #ddd;
	border-radius: 4px;
	font-size: 14px;
	color: #333333;
	transition: all 0.3s ease;
	background: #ffffff;
}

.date-range-inputs input[type="date"]:focus,
.date-year:focus,
.date-month:focus {
	border-color: #2F2483;
	outline: none;
	box-shadow: 0 0 0 3px rgba(47, 36, 131, 0.1);
}

.date-separator {
	color: #999999;
	font-weight: 600;
	flex-shrink: 0;
}

/* ===== TAG FILTER ===== */
.tag-list {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}

/* Checkbox Style */
.tag-list-checkbox .tag-item {
	display: flex;
	align-items: center;
	gap: 8px;
	cursor: pointer;
	transition: all 0.2s ease;
}

.tag-list-checkbox .tag-checkbox {
	width: 18px;
	height: 18px;
	cursor: pointer;
	accent-color: #2F2483;
}

.tag-list-checkbox .tag-label {
	font-size: 14px;
	color: #666666;
	transition: color 0.2s ease;
}

.tag-list-checkbox .tag-count {
	font-size: 12px;
	color: #999999;
}

.tag-list-checkbox .tag-item:hover .tag-label {
	color: #2F2483;
}

/* Button Style */
.tag-list-button .tag-item {
	position: relative;
}

.tag-list-button .tag-checkbox {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}

.tag-list-button .tag-label {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 8px 16px;
	background: #f5f5f5;
	color: #666666;
	font-size: 13px;
	font-weight: 500;
	border-radius: 20px;
	cursor: pointer;
	transition: all 0.3s ease;
	border: 2px solid transparent;
}

.tag-list-button .tag-count {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 20px;
	height: 20px;
	padding: 0 6px;
	background: #e0e0e0;
	color: #666666;
	font-size: 11px;
	font-weight: 600;
	border-radius: 10px;
	transition: all 0.3s ease;
}

.tag-list-button .tag-item:hover .tag-label {
	background: rgba(47, 36, 131, 0.1);
	color: #2F2483;
	border-color: rgba(47, 36, 131, 0.3);
}

.tag-list-button .tag-checkbox:checked + .tag-label {
	background: #2F2483;
	color: #ffffff;
	border-color: #2F2483;
	box-shadow: 0 4px 12px rgba(47, 36, 131, 0.3);
}

.tag-list-button .tag-checkbox:checked + .tag-label .tag-count {
	background: rgba(255, 255, 255, 0.3);
	color: #ffffff;
}

/* Select/Dropdown Style */
.tag-select {
	width: 100%;
	padding: 10px 14px;
	border: 1px solid #ddd;
	border-radius: 4px;
	font-size: 14px;
	color: #333333;
	background: #ffffff;
	transition: all 0.3s ease;
}

.tag-select:focus {
	border-color: #2F2483;
	outline: none;
	box-shadow: 0 0 0 3px rgba(47, 36, 131, 0.1);
}

/* ===== FILTER ACTIONS (Buttons) ===== */
.filter-actions {
	display: flex;
	gap: 10px;
	padding-top: 20px;
	border-top: 1px solid #f0f0f0;
}

.filter-button {
	flex: 1;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 12px 20px;
	background: #2F2483;
	color: #ffffff;
	font-size: 14px;
	font-weight: 600;
	border: none;
	border-radius: 4px;
	cursor: pointer;
	transition: all 0.3s ease;
}

.filter-button:hover {
	background: #005a8a;
	transform: translateY(-2px);
	box-shadow: 0 6px 16px rgba(47, 36, 131, 0.3);
}

.filter-button:active {
	transform: translateY(0);
}

.filter-button.filter-reset {
	background: #f5f5f5;
	color: #666666;
}

.filter-button.filter-reset:hover {
	background: #e0e0e0;
	color: #333333;
	box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
}

.filter-button i {
	font-size: 13px;
}

/* ===== LOADING STATE ===== */
.reference-advanced-filters.loading {
	position: relative;
	pointer-events: none;
	opacity: 0.6;
}

.reference-advanced-filters.loading::after {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	width: 40px;
	height: 40px;
	margin: -20px 0 0 -20px;
	border: 4px solid #f3f3f3;
	border-top: 4px solid #2F2483;
	border-radius: 50%;
	animation: filter-spin 1s linear infinite;
	z-index: 10;
}

@keyframes filter-spin {
	0% {
		transform: rotate(0deg);
	}
	100% {
		transform: rotate(360deg);
	}
}

/* ===== RESPONSIVE: MOBILE (< 768px) ===== */
@media (max-width: 768px) {
	.reference-advanced-filters {
		padding: 20px;
		margin-bottom: 20px;
	}

	.reference-advanced-filters .filter-title {
		font-size: 18px;
		margin-bottom: 20px;
		padding-bottom: 12px;
	}

	.reference-advanced-filters .filter-groups {
		gap: 20px;
		margin-bottom: 20px;
	}

	/* Price Range - Stack on mobile */
	.price-range-slider {
		height: 8px; /* Larger touch target */
	}

	.price-range-slider input[type="range"]::-webkit-slider-thumb {
		width: 24px;
		height: 24px;
	}

	.price-range-slider input[type="range"]::-moz-range-thumb {
		width: 24px;
		height: 24px;
	}

	.price-range-values {
		font-size: 13px;
	}

	/* Date inputs - Stack on mobile */
	.date-range-inputs {
		flex-direction: column;
		gap: 8px;
	}

	.date-range-inputs input[type="date"] {
		width: 100%;
		padding: 12px; /* Larger touch target */
	}

	.date-separator {
		display: none;
	}

	/* Tags - Smaller on mobile */
	.tag-list {
		gap: 8px;
	}

	.tag-list-button .tag-label {
		padding: 6px 12px;
		font-size: 12px;
	}

	.tag-list-button .tag-count {
		min-width: 18px;
		height: 18px;
		font-size: 10px;
	}

	.tag-list-checkbox .tag-label {
		font-size: 13px;
	}

	/* Action buttons - Stack on mobile */
	.filter-actions {
		flex-direction: column;
		gap: 8px;
	}

	.filter-button {
		width: 100%;
		padding: 14px 20px; /* Larger touch target */
	}
}

/* ===== RESPONSIVE: TABLET (768px - 1024px) ===== */
@media (min-width: 769px) and (max-width: 1024px) {
	.reference-advanced-filters {
		padding: 25px;
	}

	.reference-advanced-filters .filter-title {
		font-size: 19px;
	}

	.filter-groups {
		gap: 22px;
	}

	.filter-button {
		padding: 11px 18px;
		font-size: 13px;
	}
}

/* ===== RESPONSIVE: DESKTOP (> 1024px) ===== */
@media (min-width: 1025px) {
	/* Price slider - Full width on desktop */
	.price-range-slider input[type="range"]::-webkit-slider-thumb:active {
		transform: scale(1.25);
	}

	.price-range-slider input[type="range"]::-moz-range-thumb:active {
		transform: scale(1.25);
	}

	/* Tags - More columns on desktop */
	.tag-list-button,
	.tag-list-checkbox {
		display: grid;
		grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
		gap: 10px;
	}
}

/* ===== LARGE DESKTOP (> 1440px) ===== */
@media (min-width: 1441px) {
	.reference-advanced-filters {
		padding: 35px;
	}

	.reference-advanced-filters .filter-title {
		font-size: 22px;
	}

	.filter-groups {
		gap: 30px;
	}

	/* Tags - Even more columns on large screens */
	.tag-list-button,
	.tag-list-checkbox {
		grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
	}
}

/* ===== ACCESSIBILITY ===== */
.filter-button:focus,
.tag-select:focus,
.date-range-inputs input:focus,
.tag-checkbox:focus + .tag-label {
	outline: 2px solid #2F2483;
	outline-offset: 2px;
}

.filter-button:focus:not(:focus-visible),
.tag-select:focus:not(:focus-visible),
.date-range-inputs input:focus:not(:focus-visible),
.tag-checkbox:focus:not(:focus-visible) + .tag-label {
	outline: none;
}

/* ===== HIGH CONTRAST MODE ===== */
@media (prefers-contrast: high) {
	.reference-advanced-filters {
		border: 2px solid #333333;
	}

	.filter-button {
		border: 2px solid #2F2483;
	}

	.filter-button.filter-reset {
		border-color: #666666;
	}

	.price-range-slider {
		background: #999999;
	}

	.tag-list-button .tag-label {
		border: 2px solid #999999;
	}

	.tag-checkbox:checked + .tag-label {
		border-color: #2F2483;
	}
}

/* ===== DARK MODE SUPPORT ===== */
@media (prefers-color-scheme: dark) {
	.reference-advanced-filters {
		background: #1a1a1a;
		box-shadow: 0 2px 15px rgba(0, 0, 0, 0.4);
	}

	.reference-advanced-filters .filter-title {
		color: #ffffff;
		border-bottom-color: #333333;
	}

	.filter-group-label {
		color: #cccccc;
	}

	.price-range-slider {
		background: #333333;
	}

	.price-range-values {
		color: #cccccc;
	}

	.date-range-inputs input[type="date"],
	.date-year,
	.date-month,
	.tag-select {
		background: #2a2a2a;
		border-color: #444444;
		color: #cccccc;
	}

	.tag-list-button .tag-label {
		background: #2a2a2a;
		color: #cccccc;
		border-color: #444444;
	}

	.tag-list-button .tag-count {
		background: #333333;
		color: #999999;
	}

	.tag-list-checkbox .tag-label {
		color: #cccccc;
	}

	.tag-list-checkbox .tag-count {
		color: #999999;
	}

	.filter-button.filter-reset {
		background: #2a2a2a;
		color: #cccccc;
	}

	.filter-button.filter-reset:hover {
		background: #333333;
		color: #ffffff;
	}
}

/* ===== PRINT STYLES ===== */
@media print {
	.reference-advanced-filters {
		display: none;
	}
}

/* ===== ANIMATION: Slide In ===== */
.reference-advanced-filters {
	animation: slideInDown 0.5s ease forwards;
}

@keyframes slideInDown {
	from {
		opacity: 0;
		transform: translateY(-20px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

/* Disable animation in Elementor editor */
.elementor-editor-active .reference-advanced-filters {
	animation: none;
}

/* ===== COLLAPSIBLE MOBILE (Optional Enhancement) ===== */
@media (max-width: 768px) {
	.reference-advanced-filters.collapsible .filter-groups {
		max-height: 0;
		overflow: hidden;
		transition: max-height 0.4s ease;
	}

	.reference-advanced-filters.collapsible.expanded .filter-groups {
		max-height: 2000px;
	}

	.reference-advanced-filters.collapsible .filter-title {
		cursor: pointer;
		user-select: none;
	}

	.reference-advanced-filters.collapsible .filter-title::after {
		content: '\f078'; /* FontAwesome down arrow */
		font-family: 'Font Awesome 6 Free';
		font-weight: 900;
		margin-left: auto;
		transition: transform 0.3s ease;
	}

	.reference-advanced-filters.collapsible.expanded .filter-title::after {
		transform: rotate(180deg);
	}
}

/* ===== TOUCH DEVICE OPTIMIZATIONS ===== */
@media (hover: none) and (pointer: coarse) {
	/* Larger touch targets */
	.filter-button {
		min-height: 48px;
		padding: 14px 20px;
	}

	.tag-list-button .tag-label {
		min-height: 40px;
		padding: 10px 16px;
	}

	.tag-checkbox {
		min-width: 24px;
		min-height: 24px;
	}

	/* Disable hover animations on touch devices */
	.filter-button:hover {
		transform: none;
	}

	.tag-list-button .tag-item:hover .tag-label {
		transform: none;
	}
}

/* ===== LANDSCAPE MODE (Mobile) ===== */
@media (max-width: 768px) and (orientation: landscape) {
	.reference-advanced-filters {
		padding: 15px 20px;
	}

	.reference-advanced-filters .filter-title {
		font-size: 16px;
		margin-bottom: 15px;
		padding-bottom: 10px;
	}

	.filter-groups {
		gap: 15px;
		margin-bottom: 15px;
	}

	.filter-actions {
		flex-direction: row;
	}

	.filter-button {
		padding: 10px 16px;
		font-size: 13px;
	}
}


