/* ============================================================================
   BLACK DOG KUNG FU - Badge Tooltips CSS
   Version: 2.1 (Clean, responsive)
   Location: /css/badge-tooltips.css
   ============================================================================ */

:root {
	--bdkf-accent: #9B1B30;
	--bdkf-accent-hover: #7a1526;
	--bdkf-bg-dark: #0d0b09;
	--bdkf-bg-card: #1a1816;
	--bdkf-bg-elevated: #2a2725;
	--bdkf-border: #3d3a38;
	--bdkf-text-primary: #f5f3f0;
	--bdkf-text-secondary: #8a8583;
	--bdkf-success: #16A34A;
	--bdkf-warning: #EA580C;
	--bdkf-info: #3B82F6;
}

.light-mode {
	--bdkf-bg-dark: #f5f3f0;
	--bdkf-bg-card: #ffffff;
	--bdkf-bg-elevated: #e8e4e1;
	--bdkf-border: #d4d0cd;
	--bdkf-text-primary: #1a1816;
	--bdkf-text-secondary: #5c5856;
}

/* ============================================================================
   1. BADGE OCTAGON
   ============================================================================ */

.bdkf-badge-wrapper {
	display: flex;
	flex-direction: column;
	align-items: center;
	position: relative;
	cursor: pointer;
	user-select: none;
	transition: transform 0.2s ease;
}

.bdkf-badge-wrapper:hover {
	transform: scale(1.08);
}

.bdkf-badge-wrapper[data-earned="1"]:hover {
	transform: scale(1.12);
}

.bdkf-badge-octagon {
	position: relative;
	width: 60px;
	height: 60px;
	display: flex;
	align-items: center;
	justify-content: center;
	margin-bottom: 8px;
	transition: all 0.3s ease;
}

.bdkf-badge-octagon.earned {
	filter: drop-shadow(0 0 8px rgba(22, 163, 74, 0.4));
}

.bdkf-badge-octagon.locked {
	opacity: 0.6;
	filter: grayscale(100%);
}

.bdkf-badge-shape {
	position: absolute;
	width: 100%;
	height: 100%;
	top: 0;
	left: 0;
	fill: var(--bdkf-accent);
	transition: fill 0.3s ease;
}

.bdkf-badge-octagon.earned .bdkf-badge-shape {
	fill: var(--bdkf-success);
}

.bdkf-badge-octagon.locked .bdkf-badge-shape {
	fill: var(--bdkf-border);
}

.bdkf-badge-icon {
	position: relative;
	z-index: 2;
	font-size: 1.8rem;
	display: flex;
	align-items: center;
	justify-content: center;
}

/* ============================================================================
   2. TOOLTIP
   ============================================================================ */

.bdkf-badge-tooltip {
	position: absolute;
	bottom: 100%;
	left: 50%;
	transform: translateX(-50%) translateY(-12px);
	background: rgba(13, 11, 9, 0.92);
	border: 2px solid var(--bdkf-accent);
	border-radius: 8px;
	padding: 12px 16px;
	min-width: 220px;
	z-index: 1000;
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: all 0.2s ease;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.light-mode .bdkf-badge-tooltip {
	background: rgba(255, 255, 255, 0.95);
	border-color: var(--bdkf-accent);
	color: var(--bdkf-text-primary);
}

.bdkf-badge-wrapper:hover .bdkf-badge-tooltip,
.bdkf-badge-wrapper:focus-within .bdkf-badge-tooltip,
.bdkf-badge-octagon:focus-visible ~ .bdkf-badge-tooltip {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
	transform: translateX(-50%) translateY(-8px);
}

/* Flèche du tooltip */
.bdkf-badge-tooltip::after {
	content: '';
	position: absolute;
	top: 100%;
	left: 50%;
	transform: translateX(-50%);
	width: 8px;
	height: 8px;
	background: rgba(13, 11, 9, 0.92);
	border-right: 2px solid var(--bdkf-accent);
	border-bottom: 2px solid var(--bdkf-accent);
	transform: translateX(-50%) rotate(45deg);
}

.light-mode .bdkf-badge-tooltip::after {
	background: rgba(255, 255, 255, 0.95);
	border-color: var(--bdkf-accent);
}

/* ============================================================================
   3. CONTENU TOOLTIP
   ============================================================================ */

.bdkf-tooltip-header h4 {
	margin: 0;
	font-size: 0.95rem;
	font-weight: 600;
	color: var(--bdkf-text-primary);
	margin-bottom: 8px;
}

.bdkf-tooltip-content {
	font-size: 0.85rem;
}

.bdkf-condition {
	margin: 0 0 8px;
	color: var(--bdkf-text-secondary);
	line-height: 1.4;
}

.bdkf-earned {
	margin: 0;
	color: var(--bdkf-success);
	font-weight: 500;
	display: flex;
	align-items: center;
	gap: 6px;
}

/* ============================================================================
   4. BARRE DE PROGRESSION
   ============================================================================ */

.bdkf-progress-bar {
	width: 100%;
	height: 6px;
	background: var(--bdkf-border);
	border-radius: 3px;
	overflow: hidden;
	margin: 8px 0 4px;
}

.bdkf-progress-fill {
	height: 100%;
	background: linear-gradient(90deg, var(--bdkf-info) 0%, var(--bdkf-accent) 100%);
	border-radius: 3px;
	transition: width 0.5s ease;
}

.bdkf-progress-text {
	text-align: center;
	color: var(--bdkf-text-secondary);
	font-size: 0.75rem;
	margin-top: 4px;
}

/* ============================================================================
   5. LABEL BADGE
   ============================================================================ */

.bdkf-badge-label {
	display: block;
	text-align: center;
	font-size: 0.75rem;
	font-weight: 500;
	color: var(--bdkf-text-secondary);
	margin-top: 4px;
	max-width: 80px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* ============================================================================
   6. GRILLE DE BADGES (PAGE MES SUCCÈS)
   ============================================================================ */

.bdkf-badges-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
	gap: 24px;
	padding: 20px 0;
}

.bdkf-badges-section {
	margin-bottom: 40px;
}

.bdkf-badges-section h3 {
	font-size: 1.2rem;
	font-weight: 600;
	margin-bottom: 16px;
	color: var(--bdkf-text-primary);
	display: flex;
	align-items: center;
	gap: 8px;
}

.bdkf-badges-section h3::before {
	content: '';
	display: inline-block;
	width: 4px;
	height: 24px;
	background: var(--bdkf-accent);
	border-radius: 2px;
}

/* ============================================================================
   7. MOBILE - TOOLTIPS CENTRÉS
   ============================================================================ */

@media (max-width: 768px) {
	.bdkf-badge-wrapper {
		flex: 0 1 calc(50% - 12px);
	}

	.bdkf-badge-tooltip {
		position: fixed;
		bottom: auto;
		left: 50%;
		top: 50%;
		transform: translateX(-50%) translateY(-50%);
		z-index: 2000;
		min-width: 240px;
		max-width: 90vw;
	}

	.bdkf-badge-tooltip::after {
		display: none;
	}

	.bdkf-badge-wrapper:active .bdkf-badge-tooltip {
		opacity: 1;
		visibility: visible;
		pointer-events: auto;
	}

	.bdkf-badges-grid {
		grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
		gap: 16px;
	}
}

@media (max-width: 480px) {
	.bdkf-badge-octagon {
		width: 50px;
		height: 50px;
	}

	.bdkf-badge-icon {
		font-size: 1.4rem;
	}

	.bdkf-badge-label {
		font-size: 0.65rem;
		max-width: 70px;
	}

	.bdkf-badges-grid {
		grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
		gap: 12px;
	}
}

/* ============================================================================
   8. ANIMATIONS
   ============================================================================ */

@keyframes bdkf-badge-unlock {
	0% {
		opacity: 0;
		transform: scale(0.5);
	}
	50% {
		transform: scale(1.1);
	}
	100% {
		opacity: 1;
		transform: scale(1);
	}
}

@keyframes bdkf-progress-pulse {
	0%, 100% {
		opacity: 1;
	}
	50% {
		opacity: 0.7;
	}
}

.bdkf-badge-octagon.earned {
	animation: bdkf-badge-unlock 0.5s ease-out;
}

.bdkf-progress-bar {
	animation: bdkf-progress-pulse 2s ease-in-out infinite;
}

/* ============================================================================
   9. ACCESSIBILITÉ
   ============================================================================ */

.bdkf-badge-octagon {
	outline: none;
}

.bdkf-badge-octagon:focus-visible {
	outline: 2px solid var(--bdkf-accent);
	outline-offset: 4px;
}

/* Respecter les préférences d'animation */
@media (prefers-reduced-motion: reduce) {
	.bdkf-badge-wrapper,
	.bdkf-badge-octagon,
	.bdkf-progress-fill,
	.bdkf-badge-tooltip {
		animation: none !important;
		transition: none !important;
	}
}
