/* ═══════════════════════════════════════════════════════════════════
   MEDALS.CSS — TopPopote Grade Medal System
   Extrait de grades_preview.html — ne pas modifier le preview
═══════════════════════════════════════════════════════════════════ */

/* ═══════════════════════════════════════
   MEDAL BASE
═══════════════════════════════════════ */
.medal {
  position: relative;
  transition: transform 0.4s cubic-bezier(0.34, 1.4, 0.64, 1);
  flex-shrink: 0;
  display: inline-block;
}

/* Sizes */
.medal.xs { width: 28px;  height: 28px; }
.medal.sm { width: 48px;  height: 48px; }
.medal.md { width: 90px;  height: 90px; }
.medal.lg { width: 160px; height: 160px; }
.medal.xl { width: 200px; height: 200px; }

/* ── Ribbon ── */
.medal-ribbon {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  display: flex;
  gap: 2px;
}
.medal.md .medal-ribbon { top: -14px; }
.medal.lg .medal-ribbon { top: -22px; }
.medal.xl .medal-ribbon { top: -28px; }

.medal-ribbon-left,
.medal-ribbon-right {
  width: 10px;
  height: 20px;
  border-radius: 0 0 6px 6px;
}
.medal.lg .medal-ribbon-left,
.medal.lg .medal-ribbon-right { width: 16px; height: 30px; border-radius: 0 0 9px 9px; }
.medal.xl .medal-ribbon-left,
.medal.xl .medal-ribbon-right { width: 20px; height: 38px; border-radius: 0 0 12px 12px; }

/* ── Circle body ── */
.medal-body {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* ── Inner ring ── */
.medal-inner-ring {
  position: absolute;
  border-radius: 50%;
  border: 1.5px solid;
  opacity: 0.35;
  pointer-events: none;
}
.medal.sm .medal-inner-ring  { inset: 5px; }
.medal.md .medal-inner-ring  { inset: 7px; }
.medal.lg .medal-inner-ring  { inset: 12px; }
.medal.xl .medal-inner-ring  { inset: 14px; }

/* ── Shine ── */
.medal-shine {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  filter: blur(4px);
  pointer-events: none;
}
.medal.sm .medal-shine  { width: 12px; height: 12px; top: 6px;  left: 8px; }
.medal.md .medal-shine  { width: 22px; height: 22px; top: 10px; left: 14px; }
.medal.lg .medal-shine  { width: 40px; height: 40px; top: 18px; left: 24px; }
.medal.xl .medal-shine  { width: 50px; height: 50px; top: 22px; left: 30px; }

/* ── Emoji ── */
.medal-emoji {
  position: relative;
  z-index: 1;
  line-height: 1;
  user-select: none;
}
.medal.xs .medal-emoji  { font-size: 13px; }
.medal.sm .medal-emoji  { font-size: 22px; }
.medal.md .medal-emoji  { font-size: 34px; }
.medal.lg .medal-emoji  { font-size: 62px; }
.medal.xl .medal-emoji  { font-size: 78px; }

/* ── Stars ── */
.medal-stars {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 2px;
  z-index: 3;
  filter: drop-shadow(0 1px 4px rgba(0, 0, 0, 0.6));
}
.medal.md .medal-stars  { bottom: -7px; }
.medal.lg .medal-stars  { bottom: -12px; gap: 3px; }
.medal.xl .medal-stars  { bottom: -14px; gap: 4px; }

.medal-star { line-height: 1; }
.medal.md .medal-star  { font-size: 10px; }
.medal.lg .medal-star  { font-size: 16px; }
.medal.xl .medal-star  { font-size: 20px; }

/* ═══════════════════════════════════════
   GRADE THEMES — Medal colors
═══════════════════════════════════════ */

/* ── 1. PLONGEUR — bleu ardoise ── */
.medal-plongeur .medal-body {
  background: radial-gradient(135deg at 30% 25%, #94a3b8, #64748b, #334155);
  border: 2.5px solid rgba(148, 163, 184, 0.4);
  box-shadow:
    0 0 0 1px rgba(100, 116, 139, 0.2),
    0 6px 28px rgba(51, 65, 85, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}
.medal-plongeur .medal-inner-ring { border-color: #cbd5e1; }
.medal-plongeur .medal-ribbon-left  { background: #64748b; }
.medal-plongeur .medal-ribbon-right { background: #475569; }

/* ── 2. APPRENTI — violet ── */
.medal-apprenti .medal-body {
  background: radial-gradient(135deg at 30% 25%, #a5b4fc, #6366f1, #3730a3);
  border: 2.5px solid rgba(165, 180, 252, 0.45);
  box-shadow:
    0 0 0 1px rgba(99, 102, 241, 0.25),
    0 6px 28px rgba(79, 70, 229, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}
.medal-apprenti .medal-inner-ring { border-color: #c7d2fe; }
.medal-apprenti .medal-ribbon-left  { background: #6366f1; }
.medal-apprenti .medal-ribbon-right { background: #4f46e5; }

/* ── 3. COMMIS — vert clair ── */
.medal-commis .medal-body {
  background: radial-gradient(135deg at 30% 25%, #6ee7b7, #34d399, #059669);
  border: 2.5px solid rgba(110, 231, 183, 0.45);
  box-shadow:
    0 0 0 1px rgba(52, 211, 153, 0.25),
    0 6px 28px rgba(16, 185, 129, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}
.medal-commis .medal-inner-ring { border-color: #a7f3d0; }
.medal-commis .medal-ribbon-left  { background: #10b981; }
.medal-commis .medal-ribbon-right { background: #059669; }

/* ── 4. CHEF DE PARTIE — émeraude + or ── */
.medal-partie .medal-body {
  background: radial-gradient(135deg at 30% 25%, #34d399, #059669, #064e3b);
  border: 2.5px solid rgba(52, 211, 153, 0.5);
  box-shadow:
    0 0 0 1px rgba(5, 150, 105, 0.3),
    0 8px 32px rgba(5, 150, 105, 0.6),
    0 0 60px rgba(52, 211, 153, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}
.medal-partie .medal-inner-ring { border-color: #6ee7b7; border-width: 2px; }
.medal-partie .medal-ribbon-left  { background: #f59e0b; }
.medal-partie .medal-ribbon-right { background: #d97706; }

/* ── 5. SOUS-CHEF — or ── */
.medal-souschef .medal-body {
  background: radial-gradient(135deg at 30% 25%, #fde68a, #f59e0b, #92400e);
  border: 2.5px solid rgba(252, 211, 77, 0.5);
  box-shadow:
    0 0 0 1px rgba(245, 158, 11, 0.35),
    0 8px 32px rgba(217, 119, 6, 0.55),
    0 0 60px rgba(245, 158, 11, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.medal-souschef .medal-inner-ring { border-color: #fef3c7; border-width: 2px; }
.medal-souschef .medal-ribbon-left  { background: #f59e0b; }
.medal-souschef .medal-ribbon-right { background: #d97706; }

/* ── 6. CHEF EXÉCUTIF — orange intense ── */
.medal-executif .medal-body {
  background: radial-gradient(135deg at 30% 25%, #fdba74, #f97316, #7c2d12);
  border: 2.5px solid rgba(251, 146, 60, 0.5);
  box-shadow:
    0 0 0 1px rgba(249, 115, 22, 0.35),
    0 8px 36px rgba(234, 88, 12, 0.6),
    0 0 70px rgba(249, 115, 22, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}
.medal-executif .medal-inner-ring { border-color: #fed7aa; border-width: 2px; }
.medal-executif .medal-ribbon-left  { background: #f97316; }
.medal-executif .medal-ribbon-right { background: #ea580c; }

/* ── 7. CHEF ÉTOILÉ — rose/fuchsia ── */
.medal-etoile .medal-body {
  background: radial-gradient(135deg at 30% 25%, #f9a8d4, #ec4899, #831843);
  border: 2.5px solid rgba(244, 114, 182, 0.5);
  box-shadow:
    0 0 0 1px rgba(236, 72, 153, 0.35),
    0 8px 36px rgba(219, 39, 119, 0.6),
    0 0 80px rgba(236, 72, 153, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}
.medal-etoile .medal-inner-ring { border-color: #fbcfe8; border-width: 2px; }
.medal-etoile .medal-ribbon-left  { background: #fbbf24; }
.medal-etoile .medal-ribbon-right { background: #f59e0b; }

/* ── 8. LÉGENDE — or impérial, pulse ── */
.medal-legende .medal-body {
  background: radial-gradient(135deg at 25% 20%, #fef9c3, #fde68a, #f59e0b, #b45309, #78350f);
  border: 3px solid rgba(252, 211, 77, 0.65);
  box-shadow:
    0 0 0 2px rgba(245, 158, 11, 0.4),
    0 0 0 5px rgba(245, 158, 11, 0.1),
    0 8px 40px rgba(180, 83, 9, 0.65),
    0 0 90px rgba(245, 158, 11, 0.22),
    inset 0 2px 0 rgba(255, 255, 255, 0.35);
  animation: legendePulse 2.5s ease-in-out infinite;
}
@keyframes legendePulse {
  0%, 100% {
    box-shadow:
      0 0 0 2px rgba(245, 158, 11, 0.4),
      0 0 0 5px rgba(245, 158, 11, 0.1),
      0 8px 40px rgba(180, 83, 9, 0.65),
      0 0 90px rgba(245, 158, 11, 0.22),
      inset 0 2px 0 rgba(255, 255, 255, 0.35);
  }
  50% {
    box-shadow:
      0 0 0 2px rgba(245, 158, 11, 0.7),
      0 0 0 9px rgba(245, 158, 11, 0.08),
      0 8px 40px rgba(180, 83, 9, 0.85),
      0 0 140px rgba(245, 158, 11, 0.38),
      inset 0 2px 0 rgba(255, 255, 255, 0.35);
  }
}
.medal-legende .medal-inner-ring { border-color: #fef3c7; border-width: 2px; opacity: 0.55; }
.medal-legende .medal-ribbon-left  { background: #b45309; }
.medal-legende .medal-ribbon-right { background: #92400e; }

/* ═══════════════════════════════════════
   CINEMATIC ANIMATION
═══════════════════════════════════════ */
#grade-cinematic {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}
#grade-cinematic.active { display: flex; }

.gc-backdrop {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, #071a0e 0%, #010804 100%);
  opacity: 0;
  animation: gcBdIn 0.45s ease forwards;
}
@keyframes gcBdIn { to { opacity: 1; } }

.gc-flash {
  position: absolute;
  inset: 0;
  background: #fff;
  opacity: 0;
  pointer-events: none;
  z-index: 10;
  animation: gcFlash 0.35s 0.85s ease forwards;
}
@keyframes gcFlash {
  0%   { opacity: 0; }
  25%  { opacity: 0.4; }
  100% { opacity: 0; }
}

canvas#gc-particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

.gc-rings {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 2;
}
.gc-ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid;
  opacity: 0;
  transform: scale(0.4);
}
.gc-ring:nth-child(1) { width: 240px;  height: 240px;  animation: gcRing 0.9s 0.55s cubic-bezier(0.2, 0, 0, 1) forwards; }
.gc-ring:nth-child(2) { width: 360px;  height: 360px;  animation: gcRing 0.9s 0.70s cubic-bezier(0.2, 0, 0, 1) forwards; }
.gc-ring:nth-child(3) { width: 500px;  height: 500px;  animation: gcRing 0.9s 0.85s cubic-bezier(0.2, 0, 0, 1) forwards; }
.gc-ring:nth-child(4) { width: 680px;  height: 680px;  animation: gcRing 0.9s 1.00s cubic-bezier(0.2, 0, 0, 1) forwards; }
.gc-ring:nth-child(5) { width: 900px;  height: 900px;  animation: gcRing 0.9s 1.15s cubic-bezier(0.2, 0, 0, 1) forwards; }
@keyframes gcRing { to { opacity: 0.2; transform: scale(1); } }

.gc-glow {
  position: absolute;
  width: 700px;
  height: 700px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 1;
  opacity: 0;
  animation: gcGlowIn 0.7s 0.3s ease forwards;
}
@keyframes gcGlowIn { to { opacity: 1; } }

.gc-content {
  position: relative;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.gc-eyebrow {
  font-family: 'Poppins', sans-serif;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 6px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
  opacity: 0;
  transform: translateY(8px);
  animation: gcUp 0.5s 0.65s ease forwards;
  margin-bottom: 28px;
}
@keyframes gcUp { to { opacity: 1; transform: translateY(0); } }

.gc-medal-wrap {
  position: relative;
  opacity: 0;
  transform: scale(0.2) rotate(-20deg);
  animation: gcMedalIn 0.8s 0.88s cubic-bezier(0.34, 1.5, 0.64, 1) forwards;
  margin-bottom: 40px;
}
@keyframes gcMedalIn { to { opacity: 1; transform: scale(1) rotate(0deg); } }

/* Rays */
.gc-rays {
  position: absolute;
  inset: -80px;
  opacity: 0;
  animation: gcRaysIn 0.4s 0.9s ease forwards;
  pointer-events: none;
}
@keyframes gcRaysIn { to { opacity: 1; } }
.gc-ray {
  position: absolute;
  top: 50%;
  left: 50%;
  height: 2px;
  border-radius: 999px;
  transform-origin: left center;
  opacity: 0.35;
}

.gc-grade-name {
  font-family: 'Poppins', sans-serif;
  font-size: clamp(40px, 8vw, 72px);
  font-weight: 900;
  letter-spacing: -2px;
  line-height: 1;
  opacity: 0;
  transform: translateY(22px);
  animation: gcNameIn 0.65s 1.25s cubic-bezier(0.34, 1.2, 0.64, 1) forwards;
  margin-bottom: 14px;
  text-shadow: 0 0 80px currentColor;
}
@keyframes gcNameIn { to { opacity: 1; transform: translateY(0); } }

.gc-sub {
  font-family: 'DM Sans', sans-serif;
  font-size: 16px;
  color: rgba(255, 255, 255, 0.45);
  font-style: italic;
  opacity: 0;
  animation: gcUp 0.5s 1.55s ease forwards;
  margin-bottom: 14px;
}

.gc-xp-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  padding: 6px 16px;
  font-family: 'Poppins', sans-serif;
  font-size: 11px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.5);
  opacity: 0;
  animation: gcUp 0.5s 1.7s ease forwards;
  margin-bottom: 48px;
}

.gc-close-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.7);
  font-family: 'Poppins', sans-serif;
  font-size: 12px;
  font-weight: 700;
  padding: 12px 32px;
  border-radius: 999px;
  cursor: pointer;
  letter-spacing: 0.5px;
  opacity: 0;
  animation: gcUp 0.5s 1.9s ease forwards;
  transition: all 0.2s;
}
.gc-close-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

/* Exit */
#grade-cinematic.exiting > * {
  animation: gcOut 0.4s ease forwards !important;
}
@keyframes gcOut { to { opacity: 0; } }

/* ═══════════════════════════════════════
   LIGHT THEME OVERRIDES
═══════════════════════════════════════ */

/* Medals — adoucir les ombres en mode clair (les couleurs de grade restent identiques) */
[data-theme="light"] .medal-plongeur .medal-body {
  box-shadow: 0 0 0 1px rgba(100,116,139,0.2), 0 4px 16px rgba(51,65,85,0.18), inset 0 1px 0 rgba(255,255,255,0.4);
}
[data-theme="light"] .medal-apprenti .medal-body {
  box-shadow: 0 0 0 1px rgba(99,102,241,0.25), 0 4px 16px rgba(79,70,229,0.2), inset 0 1px 0 rgba(255,255,255,0.3);
}
[data-theme="light"] .medal-commis .medal-body {
  box-shadow: 0 0 0 1px rgba(52,211,153,0.2), 0 4px 16px rgba(16,185,129,0.2), inset 0 1px 0 rgba(255,255,255,0.3);
}
[data-theme="light"] .medal-partie .medal-body {
  box-shadow: 0 0 0 1px rgba(5,150,105,0.25), 0 6px 20px rgba(5,150,105,0.2), 0 0 30px rgba(52,211,153,0.08), inset 0 1px 0 rgba(255,255,255,0.3);
}
[data-theme="light"] .medal-souschef .medal-body {
  box-shadow: 0 0 0 1px rgba(245,158,11,0.3), 0 6px 20px rgba(217,119,6,0.2), 0 0 30px rgba(245,158,11,0.1), inset 0 1px 0 rgba(255,255,255,0.3);
}
[data-theme="light"] .medal-executif .medal-body {
  box-shadow: 0 0 0 1px rgba(249,115,22,0.3), 0 6px 22px rgba(234,88,12,0.22), 0 0 35px rgba(249,115,22,0.1), inset 0 1px 0 rgba(255,255,255,0.25);
}
[data-theme="light"] .medal-etoile .medal-body {
  box-shadow: 0 0 0 1px rgba(236,72,153,0.3), 0 6px 22px rgba(219,39,119,0.22), 0 0 40px rgba(236,72,153,0.1), inset 0 1px 0 rgba(255,255,255,0.25);
}
[data-theme="light"] .medal-legende .medal-body {
  box-shadow: 0 0 0 2px rgba(245,158,11,0.35), 0 0 0 5px rgba(245,158,11,0.08), 0 6px 28px rgba(180,83,9,0.3), 0 0 50px rgba(245,158,11,0.12), inset 0 2px 0 rgba(255,255,255,0.4);
}
[data-theme="light"] .medal-legende .medal-body {
  animation: legendePulseLight 2.5s ease-in-out infinite;
}
@keyframes legendePulseLight {
  0%, 100% {
    box-shadow: 0 0 0 2px rgba(245,158,11,0.35), 0 0 0 5px rgba(245,158,11,0.08), 0 6px 28px rgba(180,83,9,0.3), 0 0 50px rgba(245,158,11,0.12), inset 0 2px 0 rgba(255,255,255,0.4);
  }
  50% {
    box-shadow: 0 0 0 2px rgba(245,158,11,0.6), 0 0 0 8px rgba(245,158,11,0.06), 0 6px 28px rgba(180,83,9,0.45), 0 0 80px rgba(245,158,11,0.2), inset 0 2px 0 rgba(255,255,255,0.4);
  }
}

/* Cinematic animation — fond clair en mode light */
[data-theme="light"] .gc-backdrop {
  background: radial-gradient(ellipse at center, #e8f5f0 0%, #f0f9f4 100%);
}
[data-theme="light"] .gc-eyebrow {
  color: rgba(0, 0, 0, 0.4);
}
[data-theme="light"] .gc-sub {
  color: rgba(0, 0, 0, 0.45);
}
[data-theme="light"] .gc-xp-badge {
  background: rgba(0, 0, 0, 0.06);
  border-color: rgba(0, 0, 0, 0.1);
  color: rgba(0, 0, 0, 0.45);
}
[data-theme="light"] .gc-close-btn {
  background: rgba(0, 0, 0, 0.06);
  border-color: rgba(0, 0, 0, 0.12);
  color: rgba(0, 0, 0, 0.6);
}
[data-theme="light"] .gc-close-btn:hover {
  background: rgba(0, 0, 0, 0.1);
  color: rgba(0, 0, 0, 0.85);
}
