/**
 * Card Collection - echanges entre membres
 *
 * @copyright (c) 2024, Verturin
 * @license GNU General Public License, version 2 (GPL-2.0)
 */

/* =============================================================
 * BOURSE AUX ECHANGES
 * ============================================================= */

.cc-offers {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
	gap: 14px;
	margin: 0 0 28px;
	padding: 0;
	list-style: none;
}

.cc-offer {
	display: flex;
	gap: 14px;
	align-items: center;
	padding: 13px 15px;
	border: 1px solid rgba(0, 0, 0, .10);
	border-radius: 12px;
	background: rgba(255, 255, 255, .72);
}

/* Une carte de la mancoliste se remarque immediatement */
.cc-offer.is-wanted {
	border-color: rgba(245, 158, 11, .55);
	background: linear-gradient(135deg, rgba(245, 158, 11, .09), rgba(255, 255, 255, .6));
}

@media (prefers-color-scheme: dark) {
	.cc-offer {
		border-color: rgba(255, 255, 255, .12);
		background: rgba(255, 255, 255, .05);
	}

	.cc-offer.is-wanted {
		background: linear-gradient(135deg, rgba(245, 158, 11, .16), rgba(255, 255, 255, .04));
	}
}

.cc-offer-thumb {
	position: relative;
	flex: 0 0 auto;
	width: 58px;
	aspect-ratio: 64 / 89;
	border-radius: 7px;
	overflow: hidden;
	background: rgba(0, 0, 0, .08);
}

.cc-offer-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.cc-offer-thumb[data-rarity="rare"]       { box-shadow: inset 0 0 0 2px #3b82f6; }
.cc-offer-thumb[data-rarity="ultra_rare"] { box-shadow: inset 0 0 0 2px #a855f7; }
.cc-offer-thumb[data-rarity="legendary"]  { box-shadow: inset 0 0 0 2px #f59e0b; }

.cc-offer-body {
	flex: 1 1 auto;
	min-width: 0;
}

.cc-offer-name {
	display: block;
	font-weight: 600;
	text-decoration: none;
	color: inherit;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.cc-offer-owner {
	margin-top: 4px;
	font-size: .84em;
}

.cc-offer-tags {
	display: flex;
	flex-wrap: wrap;
	gap: 5px;
	margin-top: 6px;
}

.cc-tag {
	display: inline-block;
	padding: 2px 8px;
	border-radius: 999px;
	background: rgba(0, 0, 0, .07);
	font-size: .7em;
	font-weight: 600;
}

.cc-tag-wanted { background: rgba(245, 158, 11, .22); color: #92400e; }
.cc-tag-own    { background: rgba(16, 185, 129, .20); color: #065f46; }

.cc-offer-action {
	flex: 0 0 auto;
}

/* =============================================================
 * LISTE DES ECHANGES
 * ============================================================= */

.cc-trades {
	margin: 0 0 28px;
	padding: 0;
	list-style: none;
	border: 1px solid rgba(0, 0, 0, .10);
	border-radius: 12px;
	overflow: hidden;
}

.cc-trade + .cc-trade {
	border-top: 1px solid rgba(0, 0, 0, .08);
}

.cc-trade-link {
	display: grid;
	grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto auto;
	gap: 14px;
	align-items: center;
	padding: 13px 16px;
	text-decoration: none;
	color: inherit;
	transition: background .15s ease;
}

.cc-trade-link:hover {
	background: rgba(0, 0, 0, .03);
}

@media (max-width: 620px) {
	.cc-trade-link {
		grid-template-columns: minmax(0, 1fr) auto;
		gap: 6px 12px;
	}
}

.cc-trade-summary,
.cc-trade-date {
	font-size: .85em;
	color: #6b7280;
}

/* Pastille d'etat */
.cc-badge-status {
	display: inline-block;
	padding: 3px 11px;
	border-radius: 999px;
	font-size: .72em;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .04em;
	color: #fff;
	white-space: nowrap;
}

.cc-status-pending   .cc-badge-status,
.cc-badge-status.cc-status-pending   { background: #f59e0b; }
.cc-status-accepted  .cc-badge-status,
.cc-badge-status.cc-status-accepted  { background: #3b82f6; }
.cc-status-completed .cc-badge-status,
.cc-badge-status.cc-status-completed { background: #10b981; }
.cc-status-rejected  .cc-badge-status,
.cc-badge-status.cc-status-rejected  { background: #ef4444; }
.cc-status-cancelled .cc-badge-status,
.cc-badge-status.cc-status-cancelled { background: #94a3b8; }

/* Compteur de propositions en attente */
.cc-pill {
	display: inline-block;
	min-width: 20px;
	padding: 1px 7px;
	border-radius: 999px;
	background: #ef4444;
	color: #fff;
	font-size: .76em;
	font-weight: 700;
	line-height: 18px;
	text-align: center;
}

/* =============================================================
 * PROPOSITION : deux colonnes
 * ============================================================= */

.cc-trade-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 24px;
	margin: 0 0 20px;
}

@media (max-width: 760px) {
	.cc-trade-grid {
		grid-template-columns: minmax(0, 1fr);
	}
}

.cc-trade-col {
	padding: 16px 18px;
	border: 1px solid rgba(0, 0, 0, .10);
	border-radius: 12px;
	background: rgba(255, 255, 255, .7);
}

@media (prefers-color-scheme: dark) {
	.cc-trade-col {
		border-color: rgba(255, 255, 255, .12);
		background: rgba(255, 255, 255, .04);
	}
}

.cc-trade-col-title {
	margin: 0 0 14px;
	font-size: .92em;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .04em;
	color: #6b7280;
}

.cc-trade-empty {
	margin: 0;
	padding: 20px 0;
	text-align: center;
	font-size: .88em;
	color: #9ca3af;
}

/* Liste de selection */
.cc-picklist {
	margin: 0;
	padding: 0;
	list-style: none;
	max-height: 460px;
	overflow-y: auto;
}

.cc-pick {
	display: flex;
	gap: 11px;
	align-items: center;
	padding: 8px 10px;
	border: 1px solid transparent;
	border-radius: 9px;
	cursor: pointer;
	transition: background .15s ease, border-color .15s ease;
}

.cc-pick:hover {
	background: rgba(59, 130, 246, .06);
}

.cc-pick:has(input:checked) {
	border-color: #3b82f6;
	background: rgba(59, 130, 246, .10);
}

.cc-pick input[type="checkbox"] {
	flex: 0 0 auto;
	margin: 0;
}

.cc-pick-thumb {
	flex: 0 0 auto;
	width: 36px;
	aspect-ratio: 64 / 89;
	border-radius: 5px;
	overflow: hidden;
	background: rgba(0, 0, 0, .08);
}

.cc-pick-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.cc-pick-body {
	flex: 1 1 auto;
	min-width: 0;
}

.cc-pick-name {
	display: block;
	font-size: .9em;
	font-weight: 600;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.cc-pick-qty {
	flex: 0 0 auto;
	width: 58px;
	padding: 5px 7px;
	border: 1px solid rgba(0, 0, 0, .12);
	border-radius: 6px;
	font: inherit;
	font-size: .85em;
	text-align: center;
}

/* Grille reduite pour le detail d'un echange */
.cc-grid-small {
	grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
	gap: 10px;
}

.cc-trade-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	align-items: center;
	padding: 16px 18px;
	border: 1px solid rgba(0, 0, 0, .10);
	border-radius: 12px;
	background: rgba(255, 255, 255, .7);
}

.cc-trade-actions .cc-owned-help {
	flex: 1 1 100%;
	margin: 0;
}

@media (prefers-reduced-motion: reduce) {
	.cc-pick,
	.cc-trade-link {
		transition: none;
	}
}

/* =============================================================
 * MES PROPRES OFFRES
 *
 * La bourse ne liste que les objets des autres membres : sans ce
 * rappel, marquer une carte disponible donne l'impression que rien
 * ne s'est passe.
 * ============================================================= */

.cc-my-offers {
	margin: 0 0 24px;
	padding: 14px 16px;
	border: 1px solid rgba(16, 185, 129, .32);
	border-radius: 12px;
	background: rgba(16, 185, 129, .06);
}

.cc-my-offers-head {
	display: flex;
	flex-wrap: wrap;
	gap: 4px 12px;
	align-items: baseline;
	margin-bottom: 11px;
}

.cc-my-offers-head span {
	font-size: .84em;
	color: #6b7280;
}

.cc-my-offers-list {
	display: flex;
	flex-wrap: wrap;
	gap: 9px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.cc-my-offer {
	position: relative;
	display: block;
	width: 46px;
	aspect-ratio: var(--cc-ratio, 64 / 89);
	border-radius: 6px;
	overflow: hidden;
	background: rgba(0, 0, 0, .08);
}

.cc-my-offer img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.cc-my-offer .cc-qty {
	top: 3px;
	right: 3px;
	min-width: 18px;
	height: 18px;
	padding: 0 5px;
	font-size: .64em;
	line-height: 18px;
}

/* Choix du type a la creation */
.cc-choice-kinds {
	grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.cc-choice-kinds .cc-choice-item small {
	color: #6b7280;
	font-size: .82em;
}
