/* ===========================
   GAMIFICATION LEVEL SYSTEM
   =========================== */

/* Level Container */
.level-container {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    background: rgba(0, 212, 255, 0.05);
    border: 1px solid rgba(0, 212, 255, 0.2);
    border-radius: 8px;
    margin-top: 12px;
    margin-left: auto;
    position: relative;
}

.level-container::before {
    content: '|';
    position: absolute;
    left: -15px;
    color: var(--accent);
    font-size: 1.2rem;
    opacity: 0.5;
}

/* Level Badge */
.level-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #00d4ff, #0099cc);
    color: #000;
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    font-size: 0.85rem;
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.4);
    text-shadow: 0 0 8px rgba(0, 212, 255, 0.6);
    position: relative;
}

.level-badge::before {
    content: '';
    position: absolute;
    inset: -2px;
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: 50%;
    animation: pulse-ring 2s infinite;
}

@keyframes pulse-ring {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 212, 255, 0.4);
    }
    70% {
        box-shadow: 0 0 0 8px rgba(0, 212, 255, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(0, 212, 255, 0);
    }
}

/* XP Bar Container */
.xp-container {
    flex: 1;
    min-width: 120px;
}

.xp-label {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.7rem;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.xp-value {
    font-weight: 700;
    font-size: 0.75rem;
}

.xp-bar {
    width: 100%;
    height: 6px;
    background: rgba(0, 212, 255, 0.1);
    border: 1px solid rgba(0, 212, 255, 0.2);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}

.xp-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    animation: shine 2s infinite;
}

@keyframes shine {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

.xp-fill {
    height: 100%;
    background: linear-gradient(90deg, #00d4ff, #00ff88);
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.6), inset 0 0 5px rgba(255, 255, 255, 0.3);
    transition: width 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
}

.xp-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* Notification Styles */
.xp-notification {
    position: fixed;
    top: 100px;
    right: 20px;
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.95), rgba(0, 150, 255, 0.95));
    border: 2px solid #00d4ff;
    border-radius: 8px;
    padding: 16px 20px;
    font-family: 'Orbitron', sans-serif;
    color: #fff;
    box-shadow: 0 0 30px rgba(0, 212, 255, 0.5), inset 0 0 20px rgba(255, 255, 255, 0.1);
    z-index: 9999;
    animation: slideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), slideOut 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) 2.6s forwards;
    pointer-events: none;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

.notification-icon {
    font-size: 1.2rem;
    margin-right: 10px;
    display: inline-block;
    animation: popIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes popIn {
    0% {
        transform: scale(0.3);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}

.notification-text {
    display: inline-block;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 700;
}

.notification-xp {
    display: block;
    font-size: 0.8rem;
    opacity: 0.9;
    margin-top: 4px;
    text-align: right;
}

/* Level Up Notification */
.xp-notification.level-up {
    background: linear-gradient(135deg, rgba(0, 255, 136, 0.95), rgba(0, 200, 100, 0.95));
    border-color: #00ff88;
    box-shadow: 0 0 40px rgba(0, 255, 136, 0.6), inset 0 0 20px rgba(255, 255, 255, 0.1);
    animation: slideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), slideOut 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) 3.6s forwards;
}

.notification-icon.level-up-icon {
    animation: bounce 0.6s infinite;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-8px);
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .level-container {
        flex-direction: column;
        gap: 8px;
        width: 100%;
        margin-top: 12px;
    }

    .xp-container {
        width: 100%;
    }

    .xp-notification {
        top: auto;
        bottom: 20px;
        right: 10px;
        left: 10px;
        width: calc(100% - 20px);
    }

    @keyframes slideIn {
        from {
            transform: translateY(400px);
            opacity: 0;
        }
        to {
            transform: translateY(0);
            opacity: 1;
        }
    }

    @keyframes slideOut {
        from {
            transform: translateY(0);
            opacity: 1;
        }
        to {
            transform: translateY(400px);
            opacity: 0;
        }
    }
}

/* Navbar integration */
nav .nav-links {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

@media (min-width: 768px) {
    nav .nav-links {
        display: flex;
        flex-direction: row;
        gap: 20px;
        align-items: center;
    }

    .level-container {
        margin-top: 0;
        margin-left: auto;
        min-width: 220px;
    }
}
