/**
 * Modern Groups Display Styles
 * Uses Reign theme CSS variables for consistency
 */

.reign-modern-groups-container {
	position: relative;
	margin: 20px 0;
}

/* Controls Section */
.reign-groups-controls {
	margin-bottom: 30px;
}

.reign-groups-controls .reign-controls-top {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 12px 20px;
	background: var(--reign-site-sections-bg-color);
	border: 1px solid var(--reign-site-border-color);
	border-radius: var(--reign-global-border-radius);
	box-shadow: var(--reign-more-options-box-shadow);
	gap: 20px;
	flex-wrap: wrap;
}

.reign-groups-controls .controls-left {
	display: flex;
	align-items: center;
	gap: 20px;
}

.reign-groups-controls .controls-right {
	display: flex;
	align-items: center;
	gap: 15px;
	flex: 1;
	justify-content: flex-end;
	flex-wrap: wrap;
}

/* View Switcher */
.reign-view-switcher {
	display: flex;
	gap: 2px;
	background: var(--reign-site-secondary-bg-color);
	padding: 3px;
	border-radius: var(--reign-global-button-radius);
}

.reign-view-switcher .view-btn {
	padding: 6px 10px;
	background: transparent;
	border: none;
	border-radius: calc(var(--reign-global-button-radius) - 2px);
	cursor: pointer;
	transition: all 0.3s;
	display: flex;
	align-items: center;
	gap: 6px;
	color: var(--reign-site-alternate-text-color);
}

.reign-view-switcher .view-btn:hover {
	background: var(--reign-site-sections-bg-color);
}

.reign-view-switcher .view-btn.active {
	background: var(--reign-site-sections-bg-color);
	color: var(--reign-colors-theme);
	box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Group Count */
.reign-group-count {
	font-size: 14px;
	color: var(--reign-site-alternate-text-color);
}

.reign-group-count span {
	font-weight: 700;
	color: var(--reign-colors-theme);
	font-size: 16px;
}

/* Search Box */
.reign-group-search-box {
	display: flex;
	position: relative;
	min-width: 200px;
}

.reign-group-search {
	width: 100%;
	padding: 8px 35px 8px 12px;
	border: 1px solid var(--reign-form-border-color);
	border-radius: var(--reign-global-form-radius);
	outline: none;
	font-size: 14px;
	transition: all 0.3s;
	background: var(--reign-form-background-color);
	color: var(--reign-form-text-color);
}

.reign-group-search:focus {
	border-color: var(--reign-form-focus-border-color);
	background: var(--reign-form-focus-background-color);
	color: var(--reign-form-focus-text-color);
	box-shadow: 0 0 0 3px rgba(var(--reign-colors-theme-rgb), 0.1);
}

.reign-group-search-box .search-btn {
	position: absolute;
	right: 5px;
	top: 50%;
	transform: translateY(-50%);
	background: transparent;
	border: none;
	padding: 5px 8px;
	cursor: pointer;
	color: var(--reign-site-alternate-text-color);
}

/* Sorting Dropdown */
.reign-group-sorting select {
	padding: 8px 12px;
	border: 1px solid var(--reign-form-border-color);
	border-radius: var(--reign-global-form-radius);
	background-color: var(--reign-form-background-color);
	color: var(--reign-form-text-color);
	cursor: pointer;
	font-size: 14px;
	min-width: 150px;
	transition: all 0.3s;
}

.reign-group-sorting select:focus {
	outline: none;
	border-color: var(--reign-form-focus-border-color);
	background-color: var(--reign-form-focus-background-color);
	color: var(--reign-form-focus-text-color);
}

/* Advanced Filters Button */
.toggle-advanced-filters-btn {
	display: flex;
	align-items: center;
	gap: 6px;
	font-weight: 600;
	font-size: 14px;
}

/* Advanced Filters Panel */
.reign-advanced-filters {
	margin-top: 15px;
	padding: 0;
	background: var(--reign-site-sections-bg-color);
	border: 1px solid var(--reign-site-border-color);
	border-radius: var(--reign-global-border-radius);
	box-shadow: var(--reign-more-options-box-shadow);
	animation: slideDown 0.3s ease;
}

@keyframes slideDown {
	from {
		opacity: 0;
		transform: translateY(-10px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.advanced-filters-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 15px 20px;
	border-bottom: 1px solid var(--reign-site-border-color);
}

.advanced-filters-header h4 {
	margin: 0;
	font-size: 16px;
	color: var(--reign-site-headings-color);
}

.close-filters-btn {
	background: none;
	border: none;
	font-size: 24px;
	color: var(--reign-site-alternate-text-color);
	cursor: pointer;
	padding: 0;
	width: 30px;
	height: 30px;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: color 0.3s;
}

.close-filters-btn:hover {
	color: var(--reign-site-headings-color);
}

.filters-content {
	padding: 20px;
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
	gap: 20px;
}

.filter-section label {
	display: block;
	margin-bottom: 10px;
	font-weight: 600;
	color: var(--reign-site-headings-color);
	font-size: 14px;
}

.filter-checkboxes {
	display: flex;
	flex-direction: column;
	gap: 8px;
	max-height: 200px;
	overflow-y: auto;
	padding-right: 10px;
}

.filter-checkbox {
	display: flex;
	align-items: center;
	gap: 8px;
	cursor: pointer;
	font-size: 14px;
	color: var(--reign-site-body-text-color);
}

.filter-checkbox input[type="checkbox"] {
	width: 18px;
	height: 18px;
	cursor: pointer;
}

.filter-checkbox:hover {
	color: var(--reign-colors-theme);
}

.filter-section select {
	width: 100%;
	padding: 8px 12px;
	border: 1px solid var(--reign-form-border-color);
	border-radius: var(--reign-global-form-radius);
	background-color: var(--reign-form-background-color);
	color: var(--reign-form-text-color);
	font-size: 14px;
	transition: all 0.3s;
}

.filter-section select:focus {
	outline: none;
	border-color: var(--reign-form-focus-border-color);
	background-color: var(--reign-form-focus-background-color);
	color: var(--reign-form-focus-text-color);
}

.filter-actions {
	grid-column: 1 / -1;
	display: flex;
	gap: 10px;
	margin-top: 20px;
	padding-top: 20px;
	border-top: 1px solid var(--reign-site-border-color);
}

.apply-filters-btn,
.clear-filters-btn {
	border-radius: var(--reign-global-button-radius);
	cursor: pointer;
	font-weight: 600;
	font-size: 14px;
	transition: all 0.3s;
}

.clear-filters-btn {
	background: var(--reign-site-secondary-bg-color);
	color: var(--reign-site-body-text-color);
	border-color: var(--reign-site-secondary-bg-color);
}

.clear-filters-btn:hover {
	background: var(--reign-site-button-bg-hover-color);
	color: var(--reign-site-button-text-hover-color);
	border-color: var(--reign-site-button-bg-hover-color);
}

/* Groups Grid Layout */
.reign-groups-wrapper {
	display: grid;
	gap: 30px;
	margin-bottom: 30px;
}

.reign-groups-wrapper.reign-view-grid {
	grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}

.reign-groups-wrapper.reign-view-grid.reign-cols-2 {
	grid-template-columns: repeat(2, 1fr);
}

.reign-groups-wrapper.reign-view-grid.reign-cols-3 {
	grid-template-columns: repeat(3, 1fr);
}

.reign-groups-wrapper.reign-view-grid.reign-cols-4 {
	grid-template-columns: repeat(4, 1fr);
}

.reign-groups-wrapper.reign-view-list {
	grid-template-columns: 1fr;
}

/* Group Card - Minimal Template */
.reign-group-card {
	background: var(--reign-site-sections-bg-color);
	border-radius: var(--reign-global-border-radius);
	overflow: hidden;
	box-shadow: 0 2px 8px rgba(0,0,0,0.08);
	transition: all 0.3s ease;
	display: flex;
	flex-direction: column;
	position: relative;
}

.reign-group-card:hover {
	transform: translateY(-5px);
	box-shadow: var(--reign-more-options-box-shadow);
}

.reign-group-card .group-thumb {
	position: relative;
	overflow: hidden;
	background: var(--reign-site-secondary-bg-color);
	height: 200px;
}

.reign-group-card .group-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.reign-group-card .default-group-image {
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	background: linear-gradient(135deg, var(--reign-colors-theme) 0%, var(--reign-accent-hover-color) 100%);
	color: var(--reign-color-white);
}

.reign-group-card .default-group-image i {
	font-size: 60px;
	opacity: 0.8;
}

/* Group Badge */
.reign-group-card .group-badge {
	position: absolute;
	top: 12px;
	right: 12px;
	padding: 6px 14px;
	border-radius: 20px;
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	color: var(--reign-color-white);
	z-index: 2;
	box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.reign-group-card .group-badge.free {
	background: var(--reign-color-success);
}

.reign-group-card .group-badge.enrolled {
	background: var(--reign-color-info);
}

.reign-group-card .group-badge.closed {
	background: var(--reign-color-error);
}

/* Group Content */
.reign-group-card .group-content {
	padding: 25px;
	flex: 1;
	display: flex;
	flex-direction: column;
}

.reign-group-card .group-categories {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-bottom: 12px;
}

.reign-group-card .category-badge {
	display: inline-block;
	background: var(--reign-site-secondary-bg-color);
	color: var(--reign-colors-theme);
	padding: 4px 10px;
	border-radius: 15px;
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
}

.reign-group-card .group-title {
	margin: 0 0 12px;
	font-size: 20px;
	line-height: 1.4;
	font-weight: 600;
}

.reign-group-card .group-title a {
	color: var(--reign-site-headings-color);
	text-decoration: none;
	transition: color 0.3s;
}

.reign-group-card .group-title a:hover {
	color: var(--reign-colors-theme);
}

.reign-group-card .group-excerpt {
	color: var(--reign-site-body-text-color);
	font-size: 14px;
	line-height: 1.6;
	margin-bottom: 20px;
	flex: 1;
}

/* Group Meta */
.reign-group-card .group-meta {
	display: flex;
	flex-wrap: wrap;
	gap: 15px;
	margin-bottom: 20px;
	padding-bottom: 20px;
	border-bottom: 1px solid var(--reign-site-border-color);
}

.reign-group-card .meta-item {
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 13px;
	color: var(--reign-site-alternate-text-color);
}

.reign-group-card .meta-item i {
	color: var(--reign-colors-theme);
	font-size: 16px;
}

/* Group Leader */
.reign-group-card .group-leader {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 20px;
	padding: 12px;
	background: var(--reign-site-secondary-bg-color);
	border-radius: calc(var(--reign-global-border-radius) / 2);
}

.reign-group-card .group-leader img {
	width: 36px;
	height: 36px;
	border-radius: 50%;
	object-fit: cover;
}

.reign-group-card .group-leader span {
	font-size: 14px;
	color: var(--reign-site-body-text-color);
	font-weight: 500;
}

/* Group Footer */
.reign-group-card .group-footer {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-top: auto;
}

.reign-group-card .price-tag {
	font-size: 20px;
	font-weight: 700;
	color: var(--reign-site-headings-color);
}

.reign-group-card .price-tag.free,
.reign-group-card .price-tag.open {
	color: var(--reign-color-success);
}

.reign-group-card .price-tag.closed {
	color: var(--reign-color-danger);
}

.reign-group-card .price-tag.paynow,
.reign-group-card .price-tag.subscribe {
	color: var(--reign-site-link-hover-color);
}

.reign-group-card .group-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 10px 20px;
	background: var(--reign-site-button-bg-color);
	color: var(--reign-site-button-text-color);
	border-radius: var(--reign-global-button-radius);
	text-decoration: none;
	font-weight: 600;
	font-size: 14px;
	transition: all 0.3s;
}

.reign-group-card .group-btn:hover {
	background: var(--reign-site-button-bg-hover-color);
	color: var(--reign-site-button-text-hover-color);
	transform: translateX(3px);
}

/* List View Adjustments */
.reign-view-list .reign-group-card {
	flex-direction: row;
	min-height: 220px;
	height: auto;
}

.reign-view-list .reign-group-card .group-thumb {
	width: 300px;
	height: auto;
	min-height: 220px;
	flex-shrink: 0;
}

.reign-view-list .reign-group-card .group-content {
	padding: 20px 25px;
}

.reign-view-list .reign-group-card .group-meta {
	padding-bottom: 15px;
	margin-bottom: 15px;
}

/* Pagination */
.reign-groups-pagination {
	margin-top: 40px;
	text-align: center;
	position: relative;
	z-index: 10;
	clear: both;
}

.reign-groups-pagination ul {
	display: inline-flex;
	list-style: none;
	padding: 0;
	margin: 0;
	gap: 8px;
	align-items: center;
}

.reign-groups-pagination li {
	display: inline-block;
}

.reign-groups-pagination a,
.reign-groups-pagination span {
	display: inline-block;
	padding: 10px 15px;
	background: var(--reign-site-sections-bg-color, #fff);
	border: 1px solid var(--reign-site-border-color, #ddd);
	border-radius: var(--reign-global-button-radius, 4px);
	color: var(--reign-site-body-text-color, #333);
	text-decoration: none !important;
	transition: all 0.3s;
	min-width: 40px;
	text-align: center;
	font-weight: 500;
	cursor: pointer;
	position: relative;
	z-index: 10;
}

.reign-groups-pagination a {
	pointer-events: auto !important;
}

.reign-groups-pagination a:hover {
	background: var(--reign-colors-theme, #2c5aa0) !important;
    border-color: var(--reign-colors-theme, #2c5aa0) !important;
    color: white !important;
}

.reign-groups-pagination .current {
	background: var(--reign-colors-theme, #2c5aa0) !important;
    border-color: var(--reign-colors-theme, #2c5aa0) !important;
    color: white !important;
	font-weight: 600;
}

/* Load More Button */
.reign-load-more-wrapper {
	text-align: center;
	margin-top: 40px;
	padding: 20px 0;
}

.reign-load-more-btn {
	display: inline-block;
	padding: 14px 40px;
	background: var(--reign-colors-theme);
	color: var(--reign-color-white);
	border: none;
	border-radius: 30px;
	font-size: 16px;
	font-weight: 600;
	cursor: pointer;
	transition: all 0.3s;
	box-shadow: 0 4px 15px rgba(var(--reign-colors-theme-rgb), 0.3);
}

.reign-load-more-btn:hover {
	transform: translateY(-2px);
	box-shadow: 0 6px 20px rgba(var(--reign-colors-theme-rgb), 0.4);
	background: var(--reign-accent-hover-color);
}

.reign-load-more-btn:disabled {
	opacity: 0.6;
	cursor: not-allowed;
	transform: none;
}

/* Infinite Scroll Loader */
.infinite-scroll-loader {
	text-align: center;
	padding: 30px;
	display: none;
}

.infinite-scroll-loader.active {
	display: block;
}

.infinite-scroll-loader .spinner {
	width: 40px;
	height: 40px;
	border: 4px solid var(--reign-site-secondary-bg-color);
	border-top: 4px solid var(--reign-colors-theme);
	border-radius: 50%;
	animation: spin 1s linear infinite;
	margin: 0 auto;
}

@keyframes spin {
	0% { transform: rotate(0deg); }
	100% { transform: rotate(360deg); }
}

/* No Groups Found */
.no-groups-found {
	grid-column: 1 / -1;
	text-align: center;
	padding: 60px 20px;
	background: var(--reign-site-secondary-bg-color);
	border-radius: var(--reign-global-border-radius);
}

.no-groups-found i {
	color: var(--reign-site-alternate-text-color);
	margin-bottom: 20px;
}

.no-groups-found h3 {
	color: var(--reign-site-headings-color);
	margin-bottom: 10px;
}

.no-groups-found p {
	color: var(--reign-site-body-text-color);
}

/* Responsive Design */
@media (max-width: 991px) {
	.reign-groups-controls .reign-controls-top {
		flex-direction: column;
		align-items: stretch;
	}
	
	.reign-groups-controls .controls-left,
	.reign-groups-controls .controls-right {
		width: 100%;
		justify-content: space-between;
	}
	
	.reign-group-search-box {
		flex: 1;
		min-width: auto;
	}
	
	.reign-groups-wrapper.reign-view-grid.reign-view-grid {
		grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
	}
	
	.filters-content {
		grid-template-columns: 1fr;
	}
}

@media (max-width: 576px) {
	.reign-groups-wrapper.reign-view-grid.reign-view-grid {
		grid-template-columns: 1fr;
	}
	
	.reign-view-list .reign-group-card {
		flex-direction: column;
	}
	
	.reign-view-list .reign-group-card .group-thumb {
		width: 100%;
		height: 200px;
	}
	
	.reign-groups-controls .controls-left,
	.reign-groups-controls .controls-right {
		flex-direction: column;
		gap: 10px;
	}
	
	.reign-groups-controls .controls-right > * {
		width: 100%;
	}
	
	.reign-group-sorting select {
		width: 100%;
	}
}

/* Dark Mode Support */
body.dark-mode .reign-group-card,
body.dark-scheme .reign-group-card {
	background: var(--reign-site-sections-bg-color);
	box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

body.dark-mode .reign-group-card:hover,
body.dark-scheme .reign-group-card:hover {
	box-shadow: 0 8px 20px rgba(0,0,0,0.3);
}

body.dark-mode .reign-groups-controls .reign-controls-top,
body.dark-scheme .reign-groups-controls .reign-controls-top,
body.dark-mode .reign-advanced-filters,
body.dark-scheme .reign-advanced-filters {
	background: var(--reign-site-sections-bg-color);
	border-color: var(--reign-site-border-color);
}

/* Groups Archive Page Specific Styles */
/* .reign-groups-archive-wrapper {
	padding: 40px 0;
} */

.reign-groups-archive-header {
	/* text-align: center; */
	margin-bottom: 40px;
}

.reign-groups-archive-header .page-title {
	font-size: 36px;
	color: var(--reign-site-headings-color);
	margin-bottom: 15px;
	font-weight: 700;
}

.reign-groups-archive-header .archive-description {
	font-size: 16px;
	color: var(--reign-site-body-text-color);
	max-width: 600px;
	margin: 0 auto;
	line-height: 1.6;
}

/* Override default LearnDash group list styles */
body.reign-groups-archive .ld-item-list-items,
body.reign-groups-archive .ld-item-list {
	display: none !important;
}

/* Ensure proper container width */
body.reign-groups-archive .container {
	max-width: 1200px;
	margin: 0 auto;
	padding: 0 15px;
}

/* Remove default LearnDash archive styles */
body.post-type-archive-groups .ld-course-list-items {
	display: none !important;
}

/* Fix any conflicts with theme styles */
body.reign-modern-groups .entry-content {
	max-width: none;
	padding: 0;
}

body.reign-modern-groups .content-wrapper {
	padding-top: 0;
}