/**
 * so-rank.css (V15.7 - 07/07/2026)
 *
 * Styles du widget Rangs SO (Chantier B - phase B.1).
 *
 * Le widget affiche :
 *   - Un badge rond avec l'icone et la couleur du rang
 *   - Le label du rang + le total de SO Points
 *   - Une progress bar vers le prochain rang (sauf mode compact ou rang max)
 *
 * Variables CSS custom exposees :
 *   --rank-color    : couleur principale du rang courant (hex ou rgba)
 *   --rank-progress : pourcentage de progression 0-100 (pour animation)
 */

.so-rank-widget {
	background: #1e293b;
	border-radius: 12px;
	padding: 20px 24px;
	margin: 0 0 24px 0;
	color: #fff;
	box-shadow: 0 4px 14px rgba(0,0,0,0.2);
	border-left: 4px solid var(--rank-color, #6b7280);
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.so-rank-widget:hover {
	transform: translateY(-2px);
	box-shadow: 0 6px 20px rgba(0,0,0,0.25);
}

/* ========== En-tete : badge icone + label + points ========== */

.so-rank-widget-head {
	display: flex;
	align-items: center;
	gap: 16px;
}

.so-rank-widget-badge {
	flex-shrink: 0;
	width: 60px;
	height: 60px;
	border-radius: 50%;
	background: var(--rank-color, #6b7280);
	color: #0f172a;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 28px;
	box-shadow: 0 0 0 3px rgba(255,255,255,0.1), 0 4px 12px rgba(0,0,0,0.3);
	position: relative;
}

/* Effet glow selon le tier */
.so-rank-widget--or .so-rank-widget-badge {
	box-shadow: 0 0 0 3px rgba(255,215,0,0.3), 0 0 20px rgba(255,215,0,0.4);
}

.so-rank-widget--diamant .so-rank-widget-badge {
	background: linear-gradient(135deg, #b9f2ff 0%, #7dd3fc 50%, #38bdf8 100%);
	box-shadow: 0 0 0 3px rgba(185,242,255,0.3), 0 0 25px rgba(56,189,248,0.5);
	animation: so-rank-diamant-shine 3s ease-in-out infinite;
}

@keyframes so-rank-diamant-shine {
	0%, 100% { box-shadow: 0 0 0 3px rgba(185,242,255,0.3), 0 0 25px rgba(56,189,248,0.5); }
	50%      { box-shadow: 0 0 0 3px rgba(185,242,255,0.6), 0 0 35px rgba(56,189,248,0.8); }
}

.so-rank-widget-info {
	flex-grow: 1;
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.so-rank-widget-label {
	font-size: 18px;
	font-weight: 700;
	color: var(--rank-color, #fff);
	line-height: 1.2;
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

.so-rank-widget--novice .so-rank-widget-label {
	color: #94a3b8;
}

/* V15.8 fix : le parent theme force parfois `display:block` sur les strong/span
   dans certains contextes (page /badges/). On force explicitement le flex row
   pour aligner "17 / 32 badges (53%)" horizontalement. */
.so-rank-widget-points {
	display: flex !important;
	align-items: baseline !important;
	flex-wrap: wrap !important;
	gap: 6px !important;
	font-size: 14px;
	color: #cbd5e1;
	line-height: 1.4;
}

.so-rank-widget-points > strong,
.so-rank-widget-points > span {
	display: inline !important;
	white-space: nowrap !important;
	margin: 0 !important;
	padding: 0 !important;
}

.so-rank-widget-points strong {
	color: #fff !important;
	font-size: 16px !important;
	font-weight: 700 !important;
}

.so-rank-widget-total {
	color: #94a3b8 !important;
}

.so-rank-widget-pct {
	color: var(--rank-color, #fff) !important;
	font-weight: 600 !important;
}

/* ========== Progress bar vers next tier ========== */

.so-rank-widget-progress {
	margin-top: 16px;
}

.so-rank-widget-progress-bar {
	position: relative;
	height: 10px;
	background: rgba(255,255,255,0.08);
	border-radius: 5px;
	overflow: hidden;
	margin-bottom: 8px;
}

.so-rank-widget-progress-fill {
	position: absolute;
	top: 0;
	left: 0;
	height: 100%;
	border-radius: 5px;
	transition: width 0.6s cubic-bezier(0.4, 0.0, 0.2, 1);
	background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2) 50%, transparent);
	background-size: 200% 100%;
	animation: so-rank-shimmer 2s linear infinite;
}

@keyframes so-rank-shimmer {
	0%   { background-position: 200% 0; }
	100% { background-position: -200% 0; }
}

.so-rank-widget-progress-label {
	font-size: 13px;
	color: #94a3b8;
	text-align: right;
}

.so-rank-widget-progress-label strong {
	color: #fff;
	font-weight: 600;
}

/* ========== Rang max atteint ========== */

.so-rank-widget-max {
	margin-top: 16px;
	padding: 10px 14px;
	background: rgba(185,242,255,0.08);
	border-radius: 8px;
	font-size: 14px;
	color: #b9f2ff;
	text-align: center;
}

.so-rank-widget-max i.fa {
	margin-right: 6px;
	color: #ffd700;
}

/* ========== Mode compact ========== */

.so-rank-widget--compact {
	padding: 12px 16px;
	margin: 0 0 12px 0;
}

.so-rank-widget--compact .so-rank-widget-badge {
	width: 44px;
	height: 44px;
	font-size: 20px;
}

.so-rank-widget--compact .so-rank-widget-label {
	font-size: 14px;
}

.so-rank-widget--compact .so-rank-widget-points {
	font-size: 12px;
}

/* ========== Etat vide (user pas connecte) ========== */

.so-rank-widget--empty {
	background: #f1f5f9;
	color: #64748b;
	text-align: center;
	padding: 20px;
	border-radius: 12px;
	border-left: 4px solid #cbd5e1;
	font-style: italic;
}

/* ========== V15.8 - Shield rang (B.2 Option A) ========== */

/* Petit shield colore inline a cote du gamertag. Affiche partout ou l'user
   apparait (gamercard, notifs, listings). Le CSS est isole via .so-rank-shield
   pour ne rien casser des styles existants du theme. */

.so-rank-shield {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	background: var(--rank-color, #6b7280);
	color: #0f172a;
	vertical-align: middle;
	margin: 0 4px;
	flex-shrink: 0;
	cursor: help;
	box-shadow: 0 0 0 2px rgba(255,255,255,0.15), 0 2px 4px rgba(0,0,0,0.3);
	transition: transform 0.15s ease;
	line-height: 1;
	position: relative;
}

.so-rank-shield:hover {
	transform: scale(1.15);
}

.so-rank-shield i.fa {
	line-height: 1;
	margin: 0;
	color: #0f172a;
}

/* Tailles */
.so-rank-shield--sm { width: 20px; height: 20px; font-size: 11px; }
.so-rank-shield--md { width: 28px; height: 28px; font-size: 14px; }
.so-rank-shield--lg { width: 40px; height: 40px; font-size: 20px; }

/* Effet halo par tier - meme pattern que le widget */
.so-rank-shield--or {
	box-shadow: 0 0 0 2px rgba(255,215,0,0.4), 0 0 8px rgba(255,215,0,0.5);
}

.so-rank-shield--diamant {
	background: linear-gradient(135deg, #b9f2ff 0%, #7dd3fc 50%, #38bdf8 100%);
	box-shadow: 0 0 0 2px rgba(185,242,255,0.4), 0 0 12px rgba(56,189,248,0.6);
	animation: so-rank-shield-shine 3s ease-in-out infinite;
}

@keyframes so-rank-shield-shine {
	0%, 100% { box-shadow: 0 0 0 2px rgba(185,242,255,0.4), 0 0 12px rgba(56,189,248,0.6); }
	50%      { box-shadow: 0 0 0 2px rgba(185,242,255,0.7), 0 0 18px rgba(56,189,248,0.9); }
}

/* Novice : ne devrait pas etre rendu (fonction retourne '' pour Novice),
   mais fallback CSS au cas ou */
.so-rank-shield--novice {
	display: none !important;
}

/* V15.8 fix : dans la gamercard hero, le parent theme applique des regles
   tres strictes sur `.gamertag > span` (padding, font-size, display...) qui
   ecrasent le shield. On prefixe avec `article.gamercard-wrapper` (specificity
   0,4,3) + `!important` sur toutes les proprietes critiques pour battre les
   overrides parent (cf rule gamercard-bandeau.mdc). */
article.gamercard-wrapper .login-template .gamercard .gamertag .so-rank-shield {
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	width: 28px !important;
	height: 28px !important;
	min-width: 28px !important;
	max-width: 28px !important;
	padding: 0 !important;
	margin: 0 0 0 10px !important;
	border-radius: 50% !important;
	vertical-align: middle !important;
	line-height: 1 !important;
	font-size: 14px !important;
	background: var(--rank-color, #6b7280) !important;
	color: #0f172a !important;
	box-sizing: border-box !important;
	flex-shrink: 0 !important;
	overflow: hidden !important;
}

article.gamercard-wrapper .login-template .gamercard .gamertag .so-rank-shield i.fa {
	margin: 0 !important;
	padding: 0 !important;
	line-height: 1 !important;
	color: #0f172a !important;
	font-size: 14px !important;
	float: none !important;
	width: auto !important;
	height: auto !important;
}

/* Preserver les effets halo pour Or et Diamant dans la gamercard */
article.gamercard-wrapper .login-template .gamercard .gamertag .so-rank-shield--or {
	box-shadow: 0 0 0 2px rgba(255,215,0,0.4), 0 0 8px rgba(255,215,0,0.5) !important;
}

article.gamercard-wrapper .login-template .gamercard .gamertag .so-rank-shield--diamant {
	background: linear-gradient(135deg, #b9f2ff 0%, #7dd3fc 50%, #38bdf8 100%) !important;
	box-shadow: 0 0 0 2px rgba(185,242,255,0.4), 0 0 12px rgba(56,189,248,0.6) !important;
}

/* Ancien selecteur en fallback pour les usages hors gamercard hero */
.gamercard-wrapper .gamertag .so-rank-shield {
	margin-left: 8px;
	vertical-align: middle;
}

/* Positionnement dans le fil de notifs */
.so-notif-item .so-rank-shield {
	margin-left: 2px;
	margin-right: 2px;
}

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

@media (max-width: 768px) {
	.so-rank-widget {
		padding: 16px 18px;
	}

	.so-rank-widget-badge {
		width: 50px;
		height: 50px;
		font-size: 24px;
	}

	.so-rank-widget-label {
		font-size: 16px;
	}
}

@media (max-width: 480px) {
	.so-rank-widget-head {
		gap: 12px;
	}

	.so-rank-widget-badge {
		width: 42px;
		height: 42px;
		font-size: 18px;
	}

	.so-rank-widget-label {
		font-size: 15px;
	}
}
