:root {
    --color-fw-bg: #111827;
    --color-fw-card: #1f2937;
    --color-fw-border: #374151;
    --color-fw-primary: #3b82f6;
}

/* --- UTILITÁRIOS GLOBAIS --- */
.bg-fw-bg {
    background-color: var(--color-fw-bg);
}

.bg-fw-card {
    background-color: var(--color-fw-card);
}

.border-fw-border {
    border-color: var(--color-fw-border);
}

.text-fw-primary {
    color: var(--color-fw-primary);
}

.bg-fw-primary {
    background-color: var(--color-fw-primary);
}

input:focus,
select:focus {
    box-shadow: 0 0 0 2px rgba(var(--fw-primary-rgb), 0.2);
}

.no-scrollbar::-webkit-scrollbar {
    display: none;
}

.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* --- ANIMAÇÕES GLOBAIS --- */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes flame-pulse {

    0%,
    100% {
        filter: drop-shadow(0 0 2px rgba(249, 115, 22, 0.4));
    }

    50% {
        filter: drop-shadow(0 0 12px rgba(249, 115, 22, 0.8));
    }
}

.animate-fade-in {
    animation: fadeIn 0.6s ease-out forwards;
}

.animate-slide-up {
    animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.lucide-flame {
    animation: flame-pulse 2s infinite ease-in-out;
}

.notification-popup.is-open {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
}

/* --- MENU LATERAL --- */
.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.625rem 0.75rem;
    border-radius: 0.5rem;
    margin-bottom: 0.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #94a3b8;
    transition: all 0.2s ease-in-out;
}

.nav-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: #f1f5f9;
}

.nav-item.active {
    background-color: rgba(59, 130, 246, 0.1);
    color: #60a5fa;
    font-weight: 600;
}

.nav-icon {
    flex-shrink: 0;
    width: 1.25rem;
    height: 1.25rem;
    transition: color 0.2s;
}

.nav-section-title {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
    margin-bottom: 0.5rem;
    margin-top: 1.5rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #475569;
}

/* --- TABS --- */
.tab-button.active-tab {
    color: theme('colors.white');
    border-bottom-color: theme('colors.fw-primary');
}

.tab-content article {
    background: linear-gradient(145deg, rgba(30, 41, 59, 0.4), rgba(15, 23, 42, 0.6));
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* =========================================
   RPG / GAMIFICATION - ESTILO FULL ART + BORDA ANIMADA
   ========================================= */

@keyframes shimmer-border {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

@keyframes border-rotate {
    0% {
        background-position: 0% 0%;
    }

    100% {
        background-position: 200% 200%;
    }
}

/* 1. Base do Card */
.badge-card-base {
    position: relative;
    height: 22rem;
    width: 100%;
    border-radius: 1rem;
    overflow: hidden;
    background-color: #020617;
    /* Borda padrão (será sobrescrita se desbloqueada) */
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94), box-shadow 0.4s ease;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
}

/* 2. Camada da Imagem */
.badge-bg-layer {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: 0;
    transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* 3. Efeitos de Hover (Card) */
.badge-item:hover .badge-card-base {
    transform: translateY(-8px);
    /* Glow externo suave na cor da raridade */
    box-shadow: 0 15px 30px -10px rgba(0, 0, 0, 0.7), 0 0 20px -5px var(--rarity-color);
}

.badge-item:hover .badge-bg-layer {
    transform: scale(1.1);
}

/* 4. Painel de Info (Reveal) */
.badge-info-panel {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1rem;
    background: linear-gradient(to top, rgba(2, 6, 23, 0.98), rgba(2, 6, 23, 0.8), transparent);
    z-index: 10;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-top: 1px solid transparent;
}

.badge-item:hover .badge-info-panel {
    opacity: 1;
    transform: translateY(0);
    border-top-color: var(--rarity-color);
}

/* 5. UI Elements (Tags/Icons) */
.floating-rarity-tag {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 20;
    font-size: 0.65rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 4px 8px;
    border-radius: 6px;
    backdrop-filter: blur(4px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.status-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
    backdrop-filter: blur(4px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}


/* --- ESTADOS & ANIMAÇÃO DE BORDA UNIFICADA --- */

/* BLOQUEADO: Cinza e Estático */
.badge-locked .badge-bg-layer {
    filter: grayscale(100%) contrast(0.8) brightness(0.4);
}

.badge-locked .status-badge {
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #64748b;
}

/* DESBLOQUEADO: Borda Animada em TODAS as raridades */
.badge-unlocked {
    /* Removemos a borda padrão para usar o pseudo-elemento animado */
    border-color: transparent;
}

.badge-unlocked .badge-bg-layer {
    filter: grayscale(0%) contrast(1.05) brightness(1);
}

/* A Mágica da Borda Animada para Todos */
.badge-unlocked::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 1rem;
    padding: 1.5px;
    /* Espessura da borda brilhante */

    /* Gradiente Animado usando a cor da raridade */
    background: linear-gradient(135deg,
            var(--rarity-color),
            rgba(255, 255, 255, 0.2) 25%,
            var(--rarity-color) 50%,
            transparent 75%,
            var(--rarity-color) 100%);

    /* Máscara para recortar apenas a borda */
    -webkit-mask:
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;

    background-size: 200% 200%;
    animation: shimmer-border 3s linear infinite;
    pointer-events: none;
    z-index: 50;
}

/* Status Icon colorido */
.badge-unlocked .status-badge {
    background: var(--rarity-color);
    color: #000;
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 0 15px var(--rarity-color);
}

/* Exceção Mítica (Extra Brilho no Ícone) */
.badge-unlocked[data-rarity="mythic"] .status-badge {
    color: white;
    background: black;
    border-color: var(--rarity-color);
}

/* Wrapper Mítico (Ainda mantemos este wrapper externo para o efeito "Magma" extra forte) */
.mythic-wrapper {
    position: relative;
    padding: 3px;
    border-radius: 1.2rem;
    background: linear-gradient(135deg, #450a0a, #ff0000, #ffae00, #ff0000, #450a0a);
    background-size: 300% 300%;
    animation: shimmer-border 4s linear infinite;
    box-shadow: 0 0 25px rgba(220, 38, 38, 0.5);
}

/* MODAL */
#achievement-modal.active {
    opacity: 1;
    pointer-events: auto;
}

#achievement-modal.active #achievement-card {
    transform: scale(1);
}

/* =========================================
   📚 BIBLIOTECA - EFEITOS NEON & GLASS
   ========================================= */

/* Sombra de Texto Suave (Usado no Autor) */
.text-shadow-sm {
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* Garante que o gradiente do botão brilhe */
a[href*="checkout"] {
    position: relative;
    overflow: hidden;
}

/* Efeito de "Scan" no botão de compra FW (Opcional - dá um toque muito premium) */
a[href*="checkout"]::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
            transparent,
            rgba(255, 255, 255, 0.2),
            transparent);
    transition: 0.5s;
}

a[href*="checkout"]:hover::after {
    left: 100%;
    transition: 0.5s;
}

/* Ajuste fino para a borda neon dos livros */
article.group:hover {
    box-shadow: 0 0 30px -5px rgba(var(--fw-primary-rgb), 0.15);
    border-color: rgba(var(--fw-primary-rgb), 0.5);
}

/* Fallback para garantir que o ícone de fallback do livro fique centralizado */
img[style*="display: none"]+i {
    display: block !important;
}

/* --- ESTADO DESATIVADO (PENDENTE) --- */
.nav-item.disabled {
    opacity: 0.5;
    cursor: not-allowed !important;
    position: relative;
    /* Necessário para o tooltip */
}

.nav-item.disabled:hover {
    background-color: rgba(255, 255, 255, 0.05);
    /* Feedback visual leve */
    color: #64748b;
    /* Mantém cor cinza */
}

/* --- TOOLTIP CUSTOMIZADO --- */
.nav-item.disabled::after {
    content: "Verifique seu e-mail";
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%) translateX(10px);
    background-color: #ef4444;
    /* Vermelho alerta */
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: bold;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    pointer-events: none;
}

/* Seta do Tooltip */
.nav-item.disabled::before {
    content: "";
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%) translateX(6px);
    border-width: 5px;
    border-style: solid;
    border-color: transparent #ef4444 transparent transparent;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 100;
}

.nav-item.disabled:hover::after,
.nav-item.disabled:hover::before {
    opacity: 1;
    visibility: visible;
    transform: translateY(-50%) translateX(15px);
    /* Pequeno movimento para direita */
}

.nav-item.disabled:hover::before {
    transform: translateY(-50%) translateX(5px);
}

/* Scrollbar Customizada */
.custom-scrollbar::-webkit-scrollbar {
    width: 4px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: transparent;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 10px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

/* Glass Effect */
.glass-effect {
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

/* Animação de Conteúdo */
@keyframes contentFadeUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-content {
    animation: contentFadeUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Animação da Chama */
@keyframes flame-pulse {

    0%,
    100% {
        transform: scale(1);
        filter: drop-shadow(0 0 2px rgba(249, 115, 22, 0.5));
    }

    50% {
        transform: scale(1.1);
        filter: drop-shadow(0 0 8px rgba(249, 115, 22, 0.8));
    }
}

.flame-active {
    animation: flame-pulse 2s infinite ease-in-out;
}

/* --- BLOQUEIO VISUAL E TOOLTIP (Menu Lateral + Dropdown) --- */
.nav-item.disabled,
.dropdown-link.disabled {
    opacity: 0.5;
    cursor: not-allowed !important;
    position: relative; /* Importante para o tooltip se posicionar */
}

/* Efeito Hover leve */
.nav-item.disabled:hover,
.dropdown-link.disabled:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: #64748b;
}

/* --- O TOOLTIP --- */
.nav-item.disabled::after,
.dropdown-link.disabled::after {
    content: "Verifique seu e-mail";
    position: absolute;
    /* Posicionamento à direita do item */
    right: 100%; /* No dropdown fica melhor se aparecer à esquerda */
    top: 50%;
    transform: translateY(-50%) translateX(-10px);
    background-color: #ef4444;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 9px;
    font-weight: bold;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 100;
    pointer-events: none;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
    margin-right: 10px; /* Espaço extra */
}

/* Ajuste específico para o menu lateral (tooltip à direita) */
.nav-item.disabled::after {
    left: 100%;
    right: auto;
    margin-right: 0;
    margin-left: 10px;
    transform: translateY(-50%) translateX(0);
}

.nav-item.disabled:hover::after,
.dropdown-link.disabled:hover::after {
    opacity: 1;
    visibility: visible;
}

/* Container de Notificações */
#toast-container {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    pointer-events: none;
}

/* Card do Toast */
.toast-card {
    position: relative;
    min-width: 320px;
    background: rgba(30, 41, 59, 0.95); /* slate-800 com glassmorphism */
    backdrop-blur: 8px;
    color: white;
    padding: 1rem 1.25rem;
    border-radius: 0.75rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 0.8rem;
    overflow: hidden; /* Importante para a barra não vazar */
    animation: toast-slide-in 0.4s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}

/* A Barra de Progresso */
.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    width: 100%;
    background: rgba(255, 255, 255, 0.2);
    transform-origin: left;
}

/* Cores por Tipo */
.toast-success .toast-progress { background: #10b981; } /* emerald-500 */
.toast-error .toast-progress { background: #ef4444; }   /* red-500 */

@keyframes toast-slide-in {
    from { transform: translateX(120%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes progress-drain {
    from { transform: scaleX(1); }
    to { transform: scaleX(0); }
}