/**
 * Homepage Styles for Item Exchange Platform
 */

/* Users Section */
.exchange-users {
	padding: 40px 0 60px;
}

.users-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 24px;
	width: 100%;
	margin: 0 auto;
	padding: 0 20px;
	box-sizing: border-box;
}

.user-card {
	background: #2a2a2a;
	border-radius: 12px;
	border: 2px solid #3a3a3a;
	padding: 0;
	transition: all 0.3s ease;
}

.user-card:hover {
	transform: translateY(-4px);
	border-color: #8b5cf6;
	box-shadow: 0 8px 24px rgba(139, 92, 246, 0.2);
}

.user-card-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 24px;
}

.user-info {
	display: flex;
	align-items: center;
	gap: 16px;
}

.user-avatar {
	width: 64px;
	height: 64px;
	border-radius: 50%;
	overflow: hidden;
	border: 3px solid #8b5cf6;
	flex-shrink: 0;
}

.user-avatar img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.user-name {
	font-size: 1.5rem;
	font-weight: 700;
	color: #ffffff;
	margin: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	flex: 1;
	min-width: 0;
}

.user-card-stats {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 16px;
	margin-bottom: 24px;
	padding: 24px 0;
	border-top: 1px solid #3a3a3a;
	border-bottom: 1px solid #3a3a3a;
}

.user-stat {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.user-stat .stat-number {
	font-size: 2rem;
	font-weight: 700;
	color: #ffffff;
	line-height: 1;
}

.user-stat .stat-label {
	font-size: 0.75rem;
	color: #b0b0b0;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	font-weight: 600;
}

.user-stat.stat-looking .stat-number {
	color: #FF9800;
}

.user-stat.stat-have .stat-number {
	color: #4CAF50;
}

.user-card-actions {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.user-card-actions .button {
	padding: 12px 24px;
	font-size: 1rem;
	font-weight: 600;
	border-radius: 8px;
	text-decoration: none;
	transition: all 0.3s ease;
	cursor: pointer;
	border: none;
	display: block;
	box-sizing: border-box;
	text-align: center;
	white-space: nowrap;
}

.user-card-actions .button-small {
	padding: 8px 16px;
	font-size: 0.875rem;
}

.button-primary {
	background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
	color: #ffffff !important;
}

.button-primary:hover {
	background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
	transform: translateY(-2px);
	box-shadow: 0 8px 16px rgba(139, 92, 246, 0.3);
	color: #ffffff !important;
}

.button-secondary {
	background: rgba(139, 92, 246, 0.2);
	color: #c4b5fd !important;
	border: 1px solid rgba(139, 92, 246, 0.4);
}

.button-secondary:hover {
	background: rgba(139, 92, 246, 0.3);
	border-color: rgba(139, 92, 246, 0.6);
	transform: translateY(-2px);
	color: #ffffff !important;
}

/* Featured User Section */
.featured-user-section {
	display: flex;
	flex-direction: column;
	gap: 32px;
	margin-bottom: 40px;
	padding: 20px;
	background: rgba(0, 0, 0, 0.2);
	border-radius: 12px;
	border: 1px solid rgba(139, 92, 246, 0.2);
	min-width: 0;
	max-width: 100%;
	box-sizing: border-box;
	overflow: visible;
}

.featured-user-card {
	height: fit-content;
}

.user-items-section {
	min-width: 0;
	width: 100%;
	max-width: 100%;
	overflow: visible;
	display: flex;
	flex-direction: column;
	gap: 40px;
	box-sizing: border-box;
}

.looking-for-items,
.have-extra-items {
	min-width: 0;
	width: 100%;
	max-width: 100%;
	overflow: visible;
	box-sizing: border-box;
}

.looking-for-heading {
	font-size: 1.5rem;
	font-weight: 700;
	background: linear-gradient(135deg, #FF9800 0%, #F57C00 100%);
	-webkit-background-clip: text;
	-webkit-text-fill-color: transparent;
	background-clip: text;
	margin: 0 0 20px 0;
}

.have-extra-heading {
	font-size: 1.5rem;
	font-weight: 700;
	background: linear-gradient(135deg, #4CAF50 0%, #388E3C 100%);
	-webkit-background-clip: text;
	-webkit-text-fill-color: transparent;
	background-clip: text;
	margin: 0 0 20px 0;
}

.looking-for-grid,
.have-extra-grid {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 16px;
	width: 100%;
	min-width: 0;
	overflow: visible;
	padding: 0;
}

.looking-for-grid .exchange-item-card,
.have-extra-grid .exchange-item-card {
	width: 100%;
	min-width: 0;
	max-width: 100%;
	box-sizing: border-box;
	overflow: visible;
}

/* Fix border corner gaps caused by overflow:visible */
.looking-for-grid .exchange-item-card .item-card-image,
.have-extra-grid .exchange-item-card .item-card-image {
	border-radius: 6px 6px 0 0;
}

.looking-for-grid .exchange-item-card .item-card-title,
.have-extra-grid .exchange-item-card .item-card-title {
	border-radius: 0 0 6px 6px;
}

.looking-for-grid .exchange-item-card:hover,
.have-extra-grid .exchange-item-card:hover {
	transform: translateY(-4px);
	z-index: 20;
}

@media (max-width: 1400px) {

	.looking-for-grid,
	.have-extra-grid {
		grid-template-columns: repeat(4, 1fr);
	}
}

@media (max-width: 1200px) {

	.looking-for-grid,
	.have-extra-grid {
		grid-template-columns: repeat(3, 1fr);
	}
}

@media (max-width: 1024px) {
	.users-grid {
		grid-template-columns: repeat(2, 1fr);
	}

	.looking-for-grid,
	.have-extra-grid {
		grid-template-columns: repeat(4, 1fr);
	}
}

@media (max-width: 768px) {

	.looking-for-grid,
	.have-extra-grid {
		grid-template-columns: repeat(3, 1fr);
	}
}

@media (max-width: 640px) {
	.users-grid {
		grid-template-columns: 1fr;
	}

	.user-card-stats {
		grid-template-columns: 1fr;
		gap: 12px;
	}

	.looking-for-grid,
	.have-extra-grid {
		grid-template-columns: repeat(4, 1fr);
	}
}

@media (max-width: 480px) {

	.looking-for-grid,
	.have-extra-grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

/* Quick Actions for Player Card Items */
.looking-for-grid .item-quick-actions,
.have-extra-grid .item-quick-actions {
	gap: 4px;
	z-index: 30;
}

.looking-for-grid .quick-action-group,
.have-extra-grid .quick-action-group {
	position: relative;
}

.looking-for-grid .quick-action-btn,
.have-extra-grid .quick-action-btn {
	padding: 4px 8px;
	font-size: 0.65rem;
}

.looking-for-grid .quick-action-btn .action-label,
.have-extra-grid .quick-action-btn .action-label {
	display: inline;
}

.looking-for-grid .quick-action-btn .action-icon,
.have-extra-grid .quick-action-btn .action-icon {
	display: none;
}

.looking-for-grid .inline-quantity-controls,
.have-extra-grid .inline-quantity-controls {
	position: absolute;
	top: 100%;
	left: 50%;
	transform: translateX(-50%) translateY(4px);
	padding: 6px;
	gap: 4px;
	z-index: 100;
	min-width: max-content;
	display: flex;
	align-items: center;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.2s ease, transform 0.2s ease;
	background: rgba(26, 26, 26, 0.98);
	border: 1px solid rgba(139, 92, 246, 0.3);
	border-radius: 8px;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

/* Show state for quantity controls in player card grids */
.looking-for-grid .inline-quantity-controls.show,
.have-extra-grid .inline-quantity-controls.show {
	opacity: 1;
	pointer-events: all;
	transform: translateX(-50%) translateY(0);
}

.looking-for-grid .inline-quantity-controls .quantity-btn,
.have-extra-grid .inline-quantity-controls .quantity-btn {
	width: 24px;
	height: 24px;
	min-width: 24px;
	font-size: 14px;
}

.looking-for-grid .inline-quantity-controls .quantity-input,
.have-extra-grid .inline-quantity-controls .quantity-input {
	width: 40px;
	height: 24px;
	font-size: 12px;
}

.looking-for-grid .inline-quantity-controls .quantity-confirm-btn,
.have-extra-grid .inline-quantity-controls .quantity-confirm-btn {
	width: 24px;
	height: 24px;
	min-width: 24px;
	font-size: 12px;
}

/* Stats Section */
.exchange-stats {
	padding: 40px 20px;
	margin-bottom: 60px;
}

.stats-container {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
	gap: 24px;
	max-width: 1200px;
	margin: 0 auto;
}

.stat-box {
	background: #2a2a2a;
	padding: 32px 24px;
	border-radius: 12px;
	text-align: center;
	border: 2px solid #3a3a3a;
	transition: all 0.3s ease;
}

.stat-box:hover {
	transform: translateY(-4px);
	border-color: #4a4a4a;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.stat-number {
	font-size: 3rem;
	font-weight: 700;
	color: #ffffff;
	line-height: 1;
	margin-bottom: 12px;
}

.stat-label {
	font-size: 1rem;
	color: #b0b0b0;
	text-transform: uppercase;
	letter-spacing: 1px;
	font-weight: 600;
}

.stat-looking .stat-number {
	color: #FF9800;
}

.stat-have .stat-number {
	color: #4CAF50;
}

/* Recent Items Section */
.exchange-recent-items {
	padding: 40px 20px;
	margin-bottom: 60px;
}

.section-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	max-width: 1600px;
	margin: 0 auto 32px;
}

.section-header h2 {
	font-size: 2rem;
	font-weight: 700;
	color: #ffffff;
	margin: 0;
}

.view-all-link {
	color: #2196F3;
	text-decoration: none;
	font-weight: 600;
	font-size: 1.125rem;
	transition: color 0.3s ease;
}

.view-all-link:hover {
	color: #1976D2;
	text-decoration: underline;
}

/* Items Grid - Matches archive template */
.exchange-items-grid {
	display: grid;
	gap: 24px;
	max-width: 1600px;
	margin: 0 auto;
	grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

@media (min-width: 1600px) {
	.exchange-items-grid {
		grid-template-columns: repeat(4, 1fr);
	}
}

@media (max-width: 767px) {
	.exchange-items-grid {
		grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
	}
}

/* Empty State */
.exchange-empty-state {
	text-align: center;
	padding: 80px 20px;
	max-width: 600px;
	margin: 0 auto;
}

.empty-icon {
	font-size: 4rem;
	margin-bottom: 24px;
	opacity: 0.5;
}

.exchange-empty-state h3 {
	font-size: 1.75rem;
	color: #ffffff;
	margin-bottom: 12px;
}

.exchange-empty-state p {
	font-size: 1.125rem;
	color: #b0b0b0;
	margin-bottom: 32px;
}

/* Categories Section */
.exchange-categories {
	padding: 40px 20px;
	margin-bottom: 60px;
	background: #2a2a2a;
	border-top: 2px solid #3a3a3a;
	border-bottom: 2px solid #3a3a3a;
}

.categories-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
	gap: 16px;
	max-width: 1200px;
	margin: 0 auto;
}

.category-card {
	background: #333333;
	padding: 24px;
	border-radius: 8px;
	text-align: center;
	text-decoration: none;
	border: 2px solid #3a3a3a;
	transition: all 0.3s ease;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.category-card:hover {
	background: #3a3a3a;
	border-color: #2196F3;
	transform: translateY(-2px);
	box-shadow: 0 4px 12px rgba(33, 150, 243, 0.2);
}

.category-name {
	font-size: 0.75rem;
	font-weight: 700;
	color: rgb(156, 163, 175);
	text-transform: uppercase;
	letter-spacing: 0.05em;
}

.category-count {
	font-size: 0.875rem;
	color: #b0b0b0;
}

/* How It Works Section */
.exchange-how-it-works {
	padding: 60px 20px;
	max-width: 1200px;
	margin: 0 auto;
}

.exchange-how-it-works h2 {
	font-size: 2rem;
	font-weight: 700;
	color: #ffffff;
	text-align: center;
	margin-bottom: 48px;
}

.steps-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
	gap: 32px;
}

.step-card {
	background: #2a2a2a;
	padding: 32px;
	border-radius: 12px;
	text-align: center;
	border: 2px solid #3a3a3a;
	transition: all 0.3s ease;
}

.step-card:hover {
	border-color: #2196F3;
	transform: translateY(-4px);
	box-shadow: 0 8px 24px rgba(33, 150, 243, 0.2);
}

.step-number {
	width: 60px;
	height: 60px;
	background: linear-gradient(135deg, #2196F3 0%, #1976D2 100%);
	color: #ffffff;
	font-size: 1.75rem;
	font-weight: 700;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	margin: 0 auto 24px;
}

.step-card h3 {
	font-size: 1.375rem;
	color: #ffffff;
	margin-bottom: 12px;
}

.step-card p {
	font-size: 1rem;
	color: #b0b0b0;
	line-height: 1.6;
	margin: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
	.exchange-hero {
		padding: 60px 20px;
		margin-bottom: 40px;
	}

	.hero-actions {
		flex-direction: column;
	}

	.hero-actions .button {
		width: 100%;
		max-width: 300px;
	}

	.section-header {
		flex-direction: column;
		align-items: flex-start;
		gap: 16px;
	}

	.stats-container {
		grid-template-columns: repeat(2, 1fr);
	}

	.categories-grid {
		grid-template-columns: repeat(2, 1fr);
	}

	.steps-grid {
		grid-template-columns: 1fr;
	}
}

@media (max-width: 480px) {
	.stats-container {
		grid-template-columns: 1fr;
	}

	.categories-grid {
		grid-template-columns: 1fr;
	}
}

/* Homepage Exchange Grid - 6 columns */
.home .exchange-grid,
.page-template-front-page .exchange-grid {
	grid-template-columns: repeat(6, 1fr);
	gap: 20px;
}

@media (max-width: 1400px) {

	.home .exchange-grid,
	.page-template-front-page .exchange-grid {
		grid-template-columns: repeat(5, 1fr);
	}
}

@media (max-width: 1200px) {

	.home .exchange-grid,
	.page-template-front-page .exchange-grid {
		grid-template-columns: repeat(4, 1fr);
	}
}

@media (max-width: 1024px) {

	.home .exchange-grid,
	.page-template-front-page .exchange-grid {
		grid-template-columns: repeat(3, 1fr);
	}
}

@media (max-width: 768px) {

	.home .exchange-grid,
	.page-template-front-page .exchange-grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (max-width: 480px) {

	.home .exchange-grid,
	.page-template-front-page .exchange-grid {
		grid-template-columns: 1fr;
	}
}

/* Quantity Badge for Player Card Items */
.item-quantity-badge {
	position: absolute;
	top: 6px;
	right: 6px;
	background: #3b82f6;
	color: #ffffff;
	font-size: 0.75rem;
	font-weight: 700;
	min-width: 20px;
	height: 20px;
	padding: 0 6px;
	border-radius: 10px;
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 10;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.looking-for-grid .item-card-image,
.have-extra-grid .item-card-image {
	position: relative;
}

/* Sortable Groups Container */
.sortable-groups-container {
	grid-column: 1 / -1;
	display: flex;
	flex-direction: column;
	gap: 24px;
}

.solo-users-container {
	grid-column: 1 / -1;
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 24px;
}

@media (max-width: 1024px) {
	.solo-users-container {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (max-width: 640px) {
	.solo-users-container {
		grid-template-columns: 1fr;
	}
}

/* Collapsible Group Container */
.group-container {
	display: flex;
	flex-direction: column;
	gap: 0;
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* Drag handle cursor on header */
.group-header-section.collapsible-header {
	cursor: grab;
}

.group-header-section.collapsible-header:active {
	cursor: grabbing;
}

/* Sortable drag states */
.group-container.is-dragging {
	z-index: 1000;
}

.group-sortable-ghost {
	opacity: 0.4;
	background: rgba(139, 92, 246, 0.1);
}

.group-sortable-chosen {
	box-shadow: 0 8px 32px rgba(139, 92, 246, 0.4);
	transform: scale(1.01);
}

.group-sortable-chosen .group-header-section {
	background: linear-gradient(135deg, rgba(139, 92, 246, 0.3) 0%, rgba(124, 58, 237, 0.2) 100%);
	border-color: rgba(139, 92, 246, 0.8);
}

.group-sortable-drag {
	opacity: 1 !important;
}

/* Body state while sorting */
body.is-sorting-groups {
	cursor: grabbing !important;
	user-select: none;
}

body.is-sorting-groups * {
	cursor: grabbing !important;
}

/* Drag indicator icon on header */
.group-header-section.collapsible-header::before {
	content: '⋮⋮';
	position: absolute;
	left: 8px;
	top: 50%;
	transform: translateY(-50%);
	color: rgba(196, 181, 253, 0.5);
	font-size: 14px;
	letter-spacing: 2px;
	transition: color 0.2s ease;
}

.group-header-section.collapsible-header:hover::before {
	color: rgba(196, 181, 253, 0.8);
}

.group-header-section.collapsible-header {
	position: relative;
	padding-left: 36px;
}

/* Group Header Section - spans full width */
.group-header-section {
	grid-column: 1 / -1;
	background: linear-gradient(135deg, rgba(139, 92, 246, 0.15) 0%, rgba(124, 58, 237, 0.1) 100%);
	border: 2px solid rgba(139, 92, 246, 0.4);
	border-radius: 12px;
	padding: 16px 24px;
	margin-bottom: -8px;
}

/* Collapsible Header - clickable */
.group-header-section.collapsible-header {
	cursor: pointer;
	display: flex;
	justify-content: space-between;
	align-items: center;
	user-select: none;
	transition: background 0.2s ease, border-color 0.2s ease;
}

.group-header-section.collapsible-header:hover {
	background: linear-gradient(135deg, rgba(139, 92, 246, 0.25) 0%, rgba(124, 58, 237, 0.15) 100%);
	border-color: rgba(139, 92, 246, 0.6);
}

.group-header-section.collapsible-header:focus {
	outline: 2px solid rgba(139, 92, 246, 0.6);
	outline-offset: 2px;
}

/* Collapse Toggle Button */
.group-collapse-toggle {
	background: rgba(139, 92, 246, 0.2);
	border: 1px solid rgba(139, 92, 246, 0.4);
	border-radius: 6px;
	padding: 8px 12px;
	cursor: pointer;
	transition: all 0.2s ease;
	display: flex;
	align-items: center;
	justify-content: center;
}

.group-collapse-toggle:hover {
	background: rgba(139, 92, 246, 0.3);
	border-color: rgba(139, 92, 246, 0.6);
}

.collapse-icon {
	color: #c4b5fd;
	font-size: 0.875rem;
	transition: transform 0.3s ease;
	display: inline-block;
}

/* Collapsed state - rotate icon */
.group-header-section.collapsible-header[aria-expanded="false"] .collapse-icon {
	transform: rotate(-90deg);
}

/* Group Members Content - collapsible */
.group-members-content {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 24px;
	padding-top: 16px;
	overflow: hidden;
	transition: max-height 0.4s ease, opacity 0.3s ease, padding 0.3s ease;
	max-height: 5000px; /* Large enough to fit content */
	opacity: 1;
}

.group-members-content.collapsed {
	max-height: 0;
	opacity: 0;
	padding-top: 0;
	margin-top: -8px;
}

/* Responsive adjustments for group members grid */
@media (max-width: 1024px) {
	.group-members-content {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (max-width: 640px) {
	.group-members-content {
		grid-template-columns: 1fr;
	}
}

.group-header-content {
	display: flex;
	align-items: center;
	gap: 16px;
	flex-wrap: wrap;
}

.group-header-name {
	font-size: 1.5rem;
	font-weight: 700;
	color: #ffffff;
	margin: 0;
	background: linear-gradient(135deg, #c4b5fd 0%, #a78bfa 100%);
	-webkit-background-clip: text;
	-webkit-text-fill-color: transparent;
	background-clip: text;
}

.group-type-badge {
	background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
	color: #ffffff;
	font-size: 0.7rem;
	font-weight: 700;
	padding: 4px 10px;
	border-radius: 12px;
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

/* Group Member Cards */
.group-member-section {
	border: 2px solid rgba(139, 92, 246, 0.3);
	background: rgba(139, 92, 246, 0.03);
}

.group-member-section .user-avatar.is-leader {
	border-color: #fbbf24;
	position: relative;
}

.group-member-section .user-avatar.is-leader .leader-crown,
.user-avatar.is-leader .leader-crown {
	position: absolute;
	top: -8px;
	left: 50%;
	transform: translateX(-50%);
	font-size: 16px;
	z-index: 3;
	filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
}

.user-avatar {
	position: relative;
}

/* Solo User Section */
.solo-user-section {
	border: 1px solid rgba(100, 100, 100, 0.3);
}

@media (max-width: 768px) {
	.group-header-section {
		padding: 12px 16px;
	}

	.group-header-name {
		font-size: 1.25rem;
	}
}