/* ══════════════════════════════════════════════════════════════
   LUPALANDIA — GAMIFICACIÓN CSS  v1.0
   Módulo 15 · lupalandia.com
   Componentes: toast de badge, animación de nivel, widget racha,
   grilla de badges para perfil.
   ══════════════════════════════════════════════════════════════ */

:root {
    --lg-morado:   #7B2FFF;
    --lg-morado-c: #A96FFF;
    --lg-azul:     #00C2FF;
    --lg-verde:    #00FFB2;
    --lg-amarillo: #FFE040;
    --lg-gold:     #F5C842;
    --lg-blanco:   #F0EEFF;
    --lg-muted:    rgba(240,238,255,.55);
    --lg-gris:     #1E1A40;
    --lg-gris2:    #2A2450;
    --lg-bg:       #07051A;
}

/* ══════════════════════════════════════════════════════════════
   TOAST DE BADGE DESBLOQUEADO
   Aparece en cualquier página al detectar badges nuevos.
   ══════════════════════════════════════════════════════════════ */
#lg-toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: .75rem;
    pointer-events: none;
}

.lg-toast {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--lg-gris);
    border: 1px solid rgba(123,47,255,.4);
    border-left: 4px solid var(--lg-morado);
    border-radius: 16px;
    padding: 1rem 1.2rem;
    min-width: 280px;
    max-width: 340px;
    box-shadow: 0 8px 32px rgba(0,0,0,.5), 0 0 40px rgba(123,47,255,.15);
    font-family: 'Nunito', sans-serif;
    color: var(--lg-blanco);
    pointer-events: all;
    animation: lg-toast-in .4s cubic-bezier(.175,.885,.32,1.275) forwards;
}
.lg-toast.saliendo {
    animation: lg-toast-out .3s ease forwards;
}

@keyframes lg-toast-in {
    from { opacity:0; transform: translateX(60px) scale(.9); }
    to   { opacity:1; transform: translateX(0)    scale(1); }
}
@keyframes lg-toast-out {
    from { opacity:1; transform: translateX(0)    scale(1); }
    to   { opacity:0; transform: translateX(60px) scale(.9); }
}

.lg-toast-ico {
    font-size: 2rem;
    line-height: 1;
    flex-shrink: 0;
    filter: drop-shadow(0 0 8px rgba(245,200,66,.5));
}
.lg-toast-body { flex: 1; min-width: 0; }
.lg-toast-titulo {
    font-size: .65rem;
    font-family: 'Space Mono', monospace;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--lg-gold);
    margin-bottom: .2rem;
}
.lg-toast-nombre {
    font-weight: 900;
    font-size: .95rem;
    color: var(--lg-blanco);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.lg-toast-desc {
    font-size: .75rem;
    color: var(--lg-muted);
    margin-top: .1rem;
}

/* ══════════════════════════════════════════════════════════════
   OVERLAY DE SUBIDA DE NIVEL
   Ocupa toda la pantalla brevemente al subir de nivel.
   ══════════════════════════════════════════════════════════════ */
#lg-nivel-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(7,5,26,.92);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-family: 'Nunito', sans-serif;
    animation: lg-fade-in .3s ease;
    padding: 2rem;
}
@keyframes lg-fade-in { from{opacity:0} to{opacity:1} }

.lg-nivel-ico {
    font-size: 5rem;
    line-height: 1;
    margin-bottom: 1rem;
    animation: lg-bounce .6s cubic-bezier(.175,.885,.32,1.275);
    filter: drop-shadow(0 0 30px rgba(245,200,66,.6));
}
@keyframes lg-bounce {
    0%   { transform: scale(0); }
    60%  { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.lg-nivel-kicker {
    font-family: 'Space Mono', monospace;
    font-size: .7rem;
    letter-spacing: .2em;
    text-transform: uppercase;
    color: var(--lg-morado-c);
    margin-bottom: .5rem;
}
.lg-nivel-titulo {
    font-family: 'Fredoka One', cursive;
    font-size: clamp(2rem, 5vw, 3.5rem);
    color: var(--lg-amarillo);
    margin-bottom: .4rem;
    filter: drop-shadow(0 0 20px rgba(255,224,64,.4));
}
.lg-nivel-sub {
    font-size: 1rem;
    color: var(--lg-muted);
    margin-bottom: 2rem;
    max-width: 320px;
}
.lg-nivel-btn {
    background: linear-gradient(135deg, var(--lg-morado), #4B00D0);
    color: #fff;
    font-family: 'Nunito', sans-serif;
    font-weight: 900;
    font-size: .92rem;
    padding: .85rem 2.2rem;
    border-radius: 14px;
    border: none;
    cursor: pointer;
    box-shadow: 0 0 25px rgba(123,47,255,.5);
    transition: transform .2s;
}
.lg-nivel-btn:hover { transform: translateY(-2px); }

/* Partículas del overlay */
.lg-nivel-particulas {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}
.lg-particula {
    position: absolute;
    border-radius: 50%;
    animation: lg-flotar var(--dur) ease-in var(--dl) forwards;
}
@keyframes lg-flotar {
    0%   { transform: translateY(0) rotate(0deg); opacity:1; }
    100% { transform: translateY(-600px) rotate(720deg); opacity:0; }
}

/* ══════════════════════════════════════════════════════════════
   WIDGET DE RACHA [lupa_racha]
   ══════════════════════════════════════════════════════════════ */
.lg-racha-widget {
    display: inline-flex;
    align-items: center;
    gap: .75rem;
    background: var(--lg-gris);
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 12px;
    padding: .65rem 1rem;
}
.lg-racha-ico {
    font-size: 1.6rem;
    line-height: 1;
    filter: drop-shadow(0 0 6px rgba(255,165,0,.4));
}
.lg-racha-datos { line-height: 1.2; }
.lg-racha-num {
    font-family: 'Fredoka One', cursive;
    font-size: 1.1rem;
    color: var(--lg-amarillo);
    display: block;
}
.lg-racha-lbl {
    font-family: 'Space Mono', monospace;
    font-size: .58rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--lg-muted);
}

/* ══════════════════════════════════════════════════════════════
   GRILLA DE BADGES [lupa_badges]
   ══════════════════════════════════════════════════════════════ */
.lg-badges-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: .75rem;
}

.lg-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .35rem;
    background: var(--lg-gris);
    border-radius: 14px;
    padding: .9rem .5rem;
    text-align: center;
    transition: transform .2s, box-shadow .2s;
    border: 1px solid rgba(255,255,255,.07);
}
.lg-badge--on {
    border-color: rgba(123,47,255,.4);
    background: rgba(123,47,255,.1);
}
.lg-badge--on:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,.3), 0 0 20px rgba(123,47,255,.15);
}
.lg-badge--off {
    opacity: .3;
    filter: grayscale(1);
}
.lg-badge-ico {
    font-size: 1.8rem;
    line-height: 1;
}
.lg-badge--on .lg-badge-ico {
    filter: drop-shadow(0 0 6px rgba(245,200,66,.35));
}
.lg-badge-nombre {
    font-size: .62rem;
    font-family: 'Space Mono', monospace;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--lg-muted);
    line-height: 1.3;
}
.lg-badge--on .lg-badge-nombre {
    color: var(--lg-morado-c);
}

/* ══════════════════════════════════════════════════════════════
   BARRA DE PROGRESO DE NIVEL (para perfil)
   Clase lg-nivel-barra, usada por JS en el perfil
   ══════════════════════════════════════════════════════════════ */
.lg-nivel-barra-wrap {
    background: rgba(255,255,255,.07);
    border-radius: 20px;
    height: 8px;
    overflow: hidden;
    margin: .4rem 0;
}
.lg-nivel-barra-fill {
    height: 100%;
    border-radius: 20px;
    background: linear-gradient(90deg, var(--lg-morado), var(--lg-azul));
    transition: width .8s ease;
}

/* ══════════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 480px) {
    #lg-toast-container {
        left: 1rem;
        right: 1rem;
        bottom: 1rem;
    }
    .lg-toast { min-width: 0; max-width: 100%; }
    .lg-badges-grid { grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); }
}
