/**
 * PCO Group Viewer – Styles
 *
 * All selectors scoped under #pco-group-viewer to avoid collisions
 * with WordPress / Divi theme styles.
 *
 * Design aligned with TRBC Event Finder module.
 *
 * @author Steven Floyd <stfloyd@pm.me>
 */

/* ================================================================== */
/*  Container                                                         */
/* ================================================================== */

#pco-group-viewer {
	max-width: 1200px;
	margin: 0 auto;
	padding: 20px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
		Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
	line-height: 1.5;
	color: #2c3e50;
	box-sizing: border-box;
}

#pco-group-viewer *,
#pco-group-viewer *::before,
#pco-group-viewer *::after {
	box-sizing: inherit;
}

/* ================================================================== */
/*  Top header: title + search                                        */
/* ================================================================== */

#pco-group-viewer .pco-top-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 1.5rem;
	gap: 1.5rem;
	flex-wrap: wrap;
}

#pco-group-viewer .pco-title {
	margin: 0;
	font-size: 2rem;
	color: #2c3e50;
	font-weight: 700;
	line-height: 1.3;
}

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

#pco-group-viewer .pco-search-wrapper {
	position: relative;
	flex: 0 1 320px;
	min-width: 200px;
}

#pco-group-viewer .pco-search-container {
	position: relative;
	width: 100%;
}

#pco-group-viewer .pco-search-icon-wrapper {
	position: absolute;
	left: 16px;
	top: 50%;
	transform: translateY(-50%);
	display: flex;
	align-items: center;
	justify-content: center;
	pointer-events: none;
}

#pco-group-viewer .pco-search-icon {
	color: #6c757d;
	width: 16px;
	height: 16px;
}

#pco-group-viewer .pco-search-input {
	width: 100%;
	border: 1px solid #e9ecef !important;
	border-radius: 24px !important;
	padding: 10px 16px 10px 42px !important;
	font-size: 0.95rem;
	color: #2c3e50;
	background: #f8f9fa;
	outline: none !important;
	transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
	-webkit-appearance: none;
	-moz-appearance: none;
	appearance: none;
	margin: 0;
	box-shadow: none !important;
	min-height: auto;
}

#pco-group-viewer .pco-search-input:focus {
	border-color: #4995d1 !important;
	box-shadow: 0 0 0 3px rgba(73, 149, 209, 0.15) !important;
	background: #fff;
}

#pco-group-viewer .pco-search-input::placeholder {
	color: #adb5bd;
}

/* ================================================================== */
/*  Body: sidebar + main layout                                       */
/* ================================================================== */

#pco-group-viewer .pco-body {
	display: flex;
	gap: 2rem;
}

/* Sidebar (desktop) */
#pco-group-viewer .pco-sidebar {
	flex: 0 0 220px;
	min-width: 0;
}

#pco-group-viewer .pco-sidebar-inner {
	position: sticky;
	top: 100px; /* accounts for Divi navbar */
}

/* Main content */
#pco-group-viewer .pco-main {
	flex: 1;
	min-width: 0;
}

/* ================================================================== */
/*  Filters (sidebar on desktop, inline on mobile)                    */
/* ================================================================== */

#pco-group-viewer .pco-filters-section {
	display: flex;
	flex-direction: column;
	gap: 1.25rem;
}

#pco-group-viewer .pco-filter-group {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

#pco-group-viewer .pco-filter-group h3 {
	margin: 0;
	font-size: 0.8rem;
	font-weight: 700;
	color: #6c757d;
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

#pco-group-viewer .pco-filter-options {
	display: flex;
	flex-wrap: wrap;
	gap: 0.375rem;
}

/* Remove horizontal scroll behavior on desktop */
#pco-group-viewer .pco-horizontal-scroll {
	overflow-x: visible;
	padding-bottom: 0;
	padding-top: 0;
	margin: 0;
}

/* ================================================================== */
/*  Filter chips / pills                                              */
/* ================================================================== */

#pco-group-viewer .pco-filter-chip {
	display: inline-block;
	padding: 6px 14px;
	border: 1px solid #e9ecef;
	border-radius: 20px;
	background: #fff;
	color: #6c757d;
	font-size: 0.8rem;
	font-weight: 500;
	cursor: pointer;
	transition: all 0.2s ease;
	white-space: nowrap;
	line-height: 1.4;
	user-select: none;
	position: relative;
	margin: 0;
	box-shadow: none;
}

/* Remove shimmer pseudo-element */
#pco-group-viewer .pco-filter-chip::before {
	display: none;
}

#pco-group-viewer .pco-filter-chip:hover {
	border-color: #4995d1;
	color: #4995d1;
	background: rgba(73, 149, 209, 0.05);
	transform: none;
	box-shadow: none;
}

#pco-group-viewer .pco-filter-chip.active {
	background: #4995d1;
	border-color: #4995d1;
	color: #fff;
	transform: none;
	box-shadow: none;
}

#pco-group-viewer .pco-filter-chip.active:hover {
	background: #3a7ab3;
	border-color: #3a7ab3;
	color: #fff;
	transform: none;
	box-shadow: none;
}

/* ================================================================== */
/*  Filter action buttons                                             */
/* ================================================================== */

#pco-group-viewer .pco-filters-header {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
}

#pco-group-viewer .pco-filters-header h2 {
	display: none; /* "Filter Groups" heading not needed with sidebar label pattern */
}

#pco-group-viewer .pco-header-buttons {
	display: flex;
	gap: 0.375rem;
	flex-wrap: wrap;
}

#pco-group-viewer .pco-more-filters-btn {
	display: inline-block;
	padding: 6px 14px;
	border: 1px solid #e9ecef;
	border-radius: 20px;
	background: #fff;
	color: #6c757d;
	font-size: 0.8rem;
	font-weight: 500;
	cursor: pointer;
	transition: all 0.2s ease;
	white-space: nowrap;
	line-height: 1.4;
	box-shadow: none;
	position: relative;
	overflow: visible;
}

#pco-group-viewer .pco-more-filters-btn:hover {
	border-color: #4995d1;
	color: #4995d1;
	background: rgba(73, 149, 209, 0.05);
	transform: none;
	box-shadow: none;
}

#pco-group-viewer .pco-clear-filters-btn {
	display: inline-block;
	padding: 6px 14px;
	border: 1px solid #e9ecef;
	border-radius: 20px;
	background: #fff;
	color: #6c757d;
	font-size: 0.8rem;
	font-weight: 500;
	cursor: pointer;
	transition: all 0.2s ease;
	white-space: nowrap;
	line-height: 1.4;
	box-shadow: none;
}

#pco-group-viewer .pco-clear-filters-btn:hover {
	border-color: #dc3545;
	color: #dc3545;
	background: rgba(220, 53, 69, 0.05);
	transform: none;
	box-shadow: none;
}

/* ================================================================== */
/*  Results bar                                                       */
/* ================================================================== */

#pco-group-viewer .pco-results-section {
	min-height: 200px;
}

#pco-group-viewer .pco-results-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 1.25rem;
	padding-bottom: 0.75rem;
	border-bottom: 1px solid #e9ecef;
}

#pco-group-viewer .pco-results-count {
	font-size: 0.9rem;
	color: #6c757d;
	font-weight: 400;
}

#pco-group-viewer .pco-active-filters {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

#pco-group-viewer .pco-active-filter-tag {
	background: #4995d1;
	color: white;
	padding: 2px 10px;
	border-radius: 12px;
	font-size: 0.75rem;
	font-weight: 500;
}

/* ================================================================== */
/*  Card grid                                                         */
/* ================================================================== */

#pco-group-viewer .pco-group-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
	gap: 1.5rem;
}

#pco-group-viewer .pco-group-card {
	background: white;
	border-radius: 12px;
	overflow: hidden;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
	transition: all 0.2s ease;
	text-decoration: none;
	color: inherit;
	display: block;
	border: 1px solid #e9ecef;
}

#pco-group-viewer .pco-group-card:hover {
	transform: translateY(-4px);
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
	text-decoration: none;
	color: inherit;
}

#pco-group-viewer .pco-group-card-image {
	width: 100%;
	height: 180px;
	background-size: cover;
	background-position: center;
	background-color: #f0f0f0;
}

#pco-group-viewer .pco-group-card-content {
	padding: 16px;
}

#pco-group-viewer .pco-group-card-title {
	margin: 0 0 8px 0;
	font-size: 1.1rem;
	font-weight: 600;
	color: #2c3e50;
	line-height: 1.4;
}

#pco-group-viewer .pco-group-card-tags {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
	margin-top: 8px;
}

#pco-group-viewer .pco-group-tag {
	background: #f8f9fa;
	color: #6c757d;
	padding: 2px 8px;
	border-radius: 10px;
	font-size: 0.75rem;
	font-weight: 500;
	border: 1px solid #e9ecef;
}

#pco-group-viewer .pco-hidden {
	display: none !important;
}

/* ================================================================== */
/*  No results state                                                  */
/* ================================================================== */

#pco-group-viewer .pco-no-results {
	display: none;
	text-align: center;
	padding: 3rem 2rem;
	background: #f8f9fa;
	border-radius: 12px;
	border: 1px solid #e9ecef;
}

#pco-group-viewer .pco-no-results.pco-show {
	display: block;
}

#pco-group-viewer .pco-no-results-icon {
	font-size: 3rem;
	color: #6c757d;
	margin-bottom: 1rem;
}

#pco-group-viewer .pco-no-results-title {
	color: #2c3e50;
	font-size: 1.25rem;
	font-weight: 600;
	margin: 0 0 0.5rem 0;
}

#pco-group-viewer .pco-no-results-text {
	color: #6c757d;
	font-size: 0.95rem;
	margin: 0 0 1.25rem 0;
}

#pco-group-viewer .pco-no-results-clear-btn {
	display: inline-block;
	padding: 10px 24px;
	background: #4995d1;
	color: #fff;
	border: none;
	border-radius: 6px;
	font-size: 0.9rem;
	font-weight: 600;
	cursor: pointer;
	transition: background 0.2s ease;
}

#pco-group-viewer .pco-no-results-clear-btn:hover {
	background: #3a7ab3;
}

/* ================================================================== */
/*  Modal                                                             */
/* ================================================================== */

#pco-group-viewer .pco-modal-overlay {
	display: none;
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.5);
	z-index: 999999;
	justify-content: center;
	align-items: center;
	opacity: 0;
	transition: opacity 0.3s ease;
}

#pco-group-viewer .pco-modal-overlay.pco-show {
	display: flex;
	animation: pco-modalFadeIn 0.3s ease forwards;
}

#pco-group-viewer .pco-modal-content {
	background: white;
	border-radius: 16px;
	width: 90%;
	max-width: 600px;
	max-height: 80vh;
	display: flex;
	flex-direction: column;
	box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
	transform: scale(0.95) translateY(10px);
	transition: all 0.3s ease;
	overflow: hidden;
}

#pco-group-viewer .pco-modal-overlay.pco-show .pco-modal-content {
	transform: scale(1) translateY(0);
}

#pco-group-viewer .pco-modal-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 20px 24px;
	border-bottom: 1px solid #e9ecef;
}

#pco-group-viewer .pco-modal-header h2 {
	margin: 0;
	font-size: 1.25rem;
	color: #2c3e50;
	font-weight: 600;
}

#pco-group-viewer .pco-close-btn {
	background: none;
	border: none;
	font-size: 24px;
	cursor: pointer;
	color: #6c757d;
	padding: 0;
	width: 32px;
	height: 32px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	transition: background-color 0.2s ease, color 0.2s ease;
	line-height: 1;
}

#pco-group-viewer .pco-close-btn:hover {
	background: #f8f9fa;
	color: #2c3e50;
}

#pco-group-viewer .pco-modal-body {
	padding: 24px;
	overflow-y: auto;
	flex: 1;
}

/* Modal filter groups use same pill styling */
#pco-group-viewer .pco-modal-body .pco-filter-group {
	margin-bottom: 1.25rem;
}

#pco-group-viewer .pco-modal-body .pco-filter-group:last-child {
	margin-bottom: 0;
}

#pco-group-viewer .pco-modal-footer {
	display: flex;
	justify-content: flex-end;
	gap: 0.75rem;
	padding: 16px 24px;
	border-top: 1px solid #e9ecef;
}

#pco-group-viewer .pco-reset-btn {
	background: #f8f9fa;
	color: #6c757d;
	border: 1px solid #e9ecef;
	padding: 8px 20px;
	border-radius: 6px;
	cursor: pointer;
	font-size: 0.9rem;
	font-weight: 500;
	transition: all 0.2s ease;
}

#pco-group-viewer .pco-reset-btn:hover {
	background: #e9ecef;
	color: #2c3e50;
}

#pco-group-viewer .pco-apply-btn {
	background: #4995d1;
	color: white;
	border: none;
	padding: 8px 20px;
	border-radius: 6px;
	cursor: pointer;
	font-size: 0.9rem;
	font-weight: 600;
	transition: background 0.2s ease;
}

#pco-group-viewer .pco-apply-btn:hover {
	background: #3a7ab3;
}

/* ================================================================== */
/*  Sticky filter bar (mobile/tablet only)                            */
/* ================================================================== */

#pco-group-viewer .pco-sticky-bar {
	display: none; /* hidden on desktop */
}

/* Dropdown trigger buttons */
#pco-group-viewer .pco-sticky-dropdown {
	position: relative;
	flex-shrink: 0;
}

#pco-group-viewer .pco-sticky-trigger {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 6px 14px;
	border: 1px solid #e9ecef;
	border-radius: 20px;
	background: #f8f9fa;
	color: #2c3e50;
	font-size: 0.85rem;
	font-weight: 500;
	cursor: pointer;
	transition: all 0.2s ease;
	white-space: nowrap;
}

#pco-group-viewer .pco-sticky-trigger:hover {
	border-color: #4995d1;
	color: #4995d1;
}

#pco-group-viewer .pco-sticky-trigger i {
	font-size: 0.65rem;
	transition: transform 0.2s ease;
}

#pco-group-viewer .pco-sticky-dropdown.is-open .pco-sticky-trigger {
	border-color: #4995d1;
	color: #4995d1;
}

#pco-group-viewer .pco-sticky-dropdown.is-open .pco-sticky-trigger i {
	transform: rotate(180deg);
}

/* Dropdown panels */
#pco-group-viewer .pco-sticky-panel {
	display: none;
	position: absolute;
	top: calc(100% + 6px);
	left: 0;
	background: #fff;
	border: 1px solid #e9ecef;
	border-radius: 12px;
	padding: 8px;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
	z-index: 10;
	min-width: 160px;
	max-width: 320px;
	flex-wrap: wrap;
	gap: 6px;
}

#pco-group-viewer .pco-sticky-dropdown.is-open .pco-sticky-panel {
	display: flex;
}

#pco-group-viewer .pco-sticky-panel .pco-filter-chip {
	font-size: 0.8rem;
	padding: 4px 12px;
}

/* Sticky search */
#pco-group-viewer .pco-sticky-search {
	position: relative;
	flex: 0 1 200px;
	min-width: 120px;
}

#pco-group-viewer .pco-sticky-search-icon {
	position: absolute;
	left: 12px;
	top: 50%;
	transform: translateY(-50%);
	color: #adb5bd;
	width: 14px;
	height: 14px;
	pointer-events: none;
}

#pco-group-viewer .pco-sticky-search-input {
	width: 100%;
	border: 1px solid #e9ecef;
	border-radius: 20px;
	padding: 6px 12px 6px 32px;
	font-size: 0.85rem;
	color: #2c3e50;
	background: #f8f9fa;
	outline: none;
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
	box-sizing: border-box;
}

#pco-group-viewer .pco-sticky-search-input:focus {
	border-color: #4995d1;
	box-shadow: 0 0 0 2px rgba(73, 149, 209, 0.15);
	background: #fff;
}

/* Sticky count */
#pco-group-viewer .pco-sticky-count {
	font-size: 0.8rem;
	color: #6c757d;
	white-space: nowrap;
	margin-left: auto;
	flex-shrink: 0;
}

/* ================================================================== */
/*  Animations (simplified)                                           */
/* ================================================================== */

@keyframes pco-modalFadeIn {
	to {
		opacity: 1;
	}
}

/* ================================================================== */
/*  Responsive                                                        */
/* ================================================================== */

/* Tablet and below: collapse sidebar to inline, enable sticky bar */
@media (max-width: 980px) {
	#pco-group-viewer .pco-body {
		flex-direction: column;
		gap: 0;
	}

	#pco-group-viewer .pco-sidebar {
		flex: none;
		width: 100%;
		margin-bottom: 1.5rem;
	}

	#pco-group-viewer .pco-sidebar-inner {
		position: static;
	}

	/* Horizontal pill layout on mobile */
	#pco-group-viewer .pco-filter-group {
		flex-direction: row;
		align-items: center;
		flex-wrap: wrap;
	}

	#pco-group-viewer .pco-filter-group h3 {
		margin-right: 0.25rem;
	}

	#pco-group-viewer .pco-filter-options {
		display: contents;
	}

	/* Enable sticky bar on mobile/tablet */
	#pco-group-viewer .pco-sticky-bar {
		display: block;
		position: fixed;
		top: 0;
		left: 0;
		right: 0;
		z-index: 9999;
		background: #fff;
		box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
		transform: translateY(-100%);
		transition: transform 0.3s ease;
		pointer-events: none;
	}

	#pco-group-viewer .pco-sticky-bar.is-visible {
		transform: translateY(0);
		pointer-events: auto;
	}

	#pco-group-viewer .pco-sticky-inner {
		display: flex;
		align-items: center;
		gap: 0.75rem;
		max-width: 1200px;
		margin: 0 auto;
		padding: 10px 20px;
		flex-wrap: nowrap;
	}
}

@media (max-width: 768px) {
	#pco-group-viewer .pco-top-header {
		flex-direction: column;
		align-items: flex-start;
		gap: 1rem;
	}

	#pco-group-viewer .pco-search-wrapper {
		flex: 1 1 100%;
		width: 100%;
	}

	#pco-group-viewer .pco-title {
		font-size: 1.5rem;
	}

	#pco-group-viewer .pco-group-grid {
		grid-template-columns: repeat(2, 1fr);
		gap: 1rem;
	}

	#pco-group-viewer .pco-no-results {
		padding: 2rem 1.5rem;
	}

	#pco-group-viewer .pco-sticky-inner {
		padding: 8px 12px;
		gap: 0.5rem;
	}

	#pco-group-viewer .pco-sticky-search {
		flex: 0 1 140px;
		min-width: 100px;
	}

	#pco-group-viewer .pco-modal-content {
		width: 95%;
		max-height: 90vh;
	}
}

@media (max-width: 480px) {
	#pco-group-viewer .pco-group-grid {
		grid-template-columns: 1fr;
		gap: 1rem;
	}

	#pco-group-viewer .pco-filter-group {
		gap: 0.375rem;
	}

	#pco-group-viewer .pco-filter-chip {
		padding: 5px 12px;
		font-size: 0.8rem;
	}
}
